/** * This source file is part of OgreColladaPlugin * an addon for OGRE (Object-oriented Graphics Rendering Engine) * For the latest info, see http://www.ogre3d.org/ * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307, USA, or go to * http://www.gnu.org/copyleft/lesser.txt. * * @author Philipp Hartl * @see README */ #ifndef __COLLADA_ENTITY_H__ #define __COLLADA_ENTITY_H__ #include "OgreColladaPrerequisites.h" #include "OgreString.h" namespace Ogre { /** * base class for collada entities * * @see inheritance (sub-classes) for more details */ class ColladaEntity { public: enum EntityTypes { CAMERA, GEOMETRY, IMAGE, LIGHT, MATERIAL, NODE, TEXTURE}; ColladaEntity(ColladaDocument *doc, xmlNode *node) : mDoc(doc), mNode(node), mLoaded(false), mStatus(false) { } virtual ~ColladaEntity(void) { mNode = NULL; mDoc = NULL; } /** * abstract method to import the xml element node (mNode, which was given by constructor) * and all child data of current node * must be implemented in derived structures * * @param none * @return true if import was successful, false otherwise */ virtual bool doImport(void) = 0; const String &getId(void) const { return mId; } const String &getName(void) const { return mName; } virtual EntityTypes getEntityType(void) const = 0; /** * create an ogre specific instance of imported entity (data) * should be attached at a SceneNode * * @param none * @return the instance of the created object as MovableObject, NULL otherwise */ virtual MovableObject *getOgreInstance(void) const = 0; /** * import the identification attributes id and name of mNode * * @param none * @return void */ void initialise(void); bool isImported(void) const { return mStatus; } bool isLoaded(void) const { return mLoaded; } protected: ColladaDocument *mDoc; // pointer back to the document this element belongs to xmlNode *mNode; // the node structure to import String mId; // unique identifier String mName; bool mLoaded; // a simple check, if doImport() has been already called bool mStatus; // the return value of doImport(), if doImport was successful }; } #endif // __COLLADA_ENTITY_H__