CScene.h Source File

Chapitre 2

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

CScene.h

00001 
00008 #ifndef __CSCENE_H__
00009 #define __CSCENE_H__
00010 
00011 #include "CCamera.h"
00012 #include "CObject.h"
00013 #include "CNode.h"
00014 #include "assert.h"
00015 #include "CLight.h"
00016 #include <vector>
00017 
00018 using namespace std;
00019 
00020 class CScene
00021 {
00022         private:
00023                 int                                             mNumNodes;
00024                 vector<CNode*>                  mNodes;
00025                 vector<CCamera*>                mCameras;
00026                 vector<CLight*>                 mLights;
00027                 vector<CMaterial*>              mMaterials;
00028                 CCamera                                 *mActiveCamera;
00029                                   
00030         public:
00031                 // constructeurs et destructeurs
00032                 CScene() : mNumNodes(0), mActiveCamera(NULL) {}
00033                 virtual ~CScene() 
00034                 { }
00035 
00036                 // get
00037                 __forceinline int                       GetNumNodes() const { return mNumNodes; }
00038                 __forceinline CNode*            GetNode(const unsigned int i) const { assert(i<mNodes.size()); return mNodes[i]; }
00039                 __forceinline CLight*           GetLight(const unsigned int i) const { assert(i<mLights.size()); return mLights[i]; }
00040                 __forceinline int                       GetNumLights() const { return mLights.size(); }
00041                 __forceinline CCamera*          GetActiveCamera() const { return mActiveCamera; }
00042                 __forceinline CMaterial*        GetMaterial(const unsigned int i) const { assert(i<mMaterials.size()); return mMaterials[i]; }
00043 
00044                 // set
00045                 __forceinline void              SetActiveCamera(const unsigned int i) { assert(i<mCameras.size()); mActiveCamera = mCameras[i]; }
00046                 __forceinline void              SetActiveCamera(CCamera* cam) { assert(cam); mActiveCamera = cam; }
00047 
00048                 // methodes
00049                 __forceinline   bool    AddObject(CObject* object) { assert( object ); AddNode(object); return true; }
00050                 __forceinline   bool    AddCamera(CCamera* camera) { assert( camera ); mCameras.push_back(camera); AddNode(camera); SetActiveCamera(camera); return true; }
00051                 __forceinline   bool    AddNode(CNode* node) { assert( node ); mNodes.push_back(node); mNumNodes++; return true; }
00052                 __forceinline   bool    AddLight(CLight* light) { assert( light ); mLights.push_back(light); AddNode(light); return true; }
00053                 __forceinline   bool    AddMaterial(CMaterial* material) { assert(material); mMaterials.push_back(material); return true; }
00054 };
00055 
00056 #endif /* #ifndef __CSCENE_H__ */

Generated on Fri Apr 19 16:19:34 2002 by doxygen1.2.15