Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ColladaPlugin/include/OgreColladaEntity.h @ 21

Last change on this file since 21 was 21, checked in by nicolasc, 16 years ago

added ogreode and Colladaplugin

File size: 2.8 KB
Line 
1/**
2 * This source file is part of OgreColladaPlugin
3 * an addon for OGRE (Object-oriented Graphics Rendering Engine)
4 * For the latest info, see http://www.ogre3d.org/
5 *
6 * This program is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Lesser General Public License as published by the Free Software
8 * Foundation; either version 2 of the License, or (at your option) any later
9 * version.
10
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14
15 * You should have received a copy of the GNU Lesser General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17 * Place - Suite 330, Boston, MA 02111-1307, USA, or go to
18 * http://www.gnu.org/copyleft/lesser.txt.
19 *
20 * @author      Philipp Hartl
21 * @see         README
22 */
23
24#ifndef __COLLADA_ENTITY_H__
25#define __COLLADA_ENTITY_H__
26
27#include "OgreColladaPrerequisites.h"
28#include "OgreString.h"
29
30namespace Ogre
31{
32        /**
33         * base class for collada entities
34         *
35         * @see inheritance (sub-classes) for more details
36         */
37        class ColladaEntity
38        {
39        public:
40                enum EntityTypes { CAMERA, GEOMETRY, IMAGE, LIGHT, MATERIAL, NODE, TEXTURE};
41
42                ColladaEntity(ColladaDocument *doc, xmlNode *node) : mDoc(doc), mNode(node), mLoaded(false), mStatus(false) { }
43                virtual ~ColladaEntity(void) { mNode = NULL; mDoc = NULL; }
44
45                /**
46                 * abstract method to import the xml element node (mNode, which was given by constructor)
47                 * and all child data of current node
48                 * must be implemented in derived structures
49                 *
50                 * @param       none
51                 * @return      true if import was successful, false otherwise
52                 */
53                virtual bool doImport(void) = 0;
54
55                const String &getId(void) const { return mId; }
56                const String &getName(void) const { return mName; }
57
58                virtual EntityTypes getEntityType(void) const = 0;
59
60                /**
61                 * create an ogre specific instance of imported entity (data)
62                 * should be attached at a SceneNode
63                 *
64                 * @param       none
65                 * @return      the instance of the created object as MovableObject, NULL otherwise
66                 */
67                virtual MovableObject *getOgreInstance(void) const = 0;
68
69                /**
70                 * import the identification attributes id and name of mNode
71                 *
72                 * @param       none
73                 * @return      void
74                 */
75                void initialise(void);
76
77                bool isImported(void) const { return mStatus; }
78                bool isLoaded(void) const { return mLoaded; }
79
80        protected:
81                ColladaDocument *mDoc;          // pointer back to the document this element belongs to
82                xmlNode                 *mNode;         // the node structure to import
83                String                  mId;            // unique identifier
84                String                  mName;
85
86                bool                    mLoaded;        // a simple check, if doImport() has been already called
87                bool                    mStatus;        // the return value of doImport(), if doImport was successful
88        };
89}
90
91#endif // __COLLADA_ENTITY_H__
Note: See TracBrowser for help on using the repository browser.