00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00035 #ifndef __SO3SCENE_H__
00036 #define __SO3SCENE_H__
00037
00038 #include "../SCOLBasic/SO3Prerequisites.h"
00039 #include "../SCOLBasic/SO3DataScol.h"
00040 #include "../SO3SceneGraph/SO3Entity.h"
00041 #include "../SO3SceneGraph/SO3EntityFap.h"
00042 #include "../SO3SceneGraph/SO3Physics.h"
00043 #include <Ogre.h>
00044
00045 namespace SO3
00046 {
00047
00048
00049 class MMOUSE
00050 {
00051 public:
00052 int x;
00053 int y;
00054 int scroll;
00055 int index;
00056 int state;
00057 int flags;
00058 protected:
00059 private:
00060 public:
00064 MMOUSE()
00065 {
00066 x = 0;
00067 y = 0;
00068 scroll = 0;
00069 index = 0;
00070 state = 0;
00071 flags = 0;
00072 }
00073
00077 MMOUSE(int cx, int cy, int cindex, int cscroll = 0, int cstate = 0, int cflags = 0)
00078 {
00079 x = cx;
00080 y = cy;
00081 scroll = cscroll;
00082 index = cindex;
00083 state = cstate;
00084 flags = cflags;
00085 }
00089 MMOUSE(const MMOUSE& mmouse)
00090 {
00091 x = mmouse.x;
00092 y = mmouse.y;
00093 scroll = mmouse.scroll;
00094 index = mmouse.index;
00095 state = mmouse.state;
00096 flags = mmouse.flags;
00097 }
00098
00102 ~MMOUSE()
00103 {
00104 }
00105 protected:
00106 private:
00107 };
00108
00109 class SO3MainFrameListener : public Ogre::FrameListener
00110 {
00111 public:
00112 protected:
00113 SScene* m_scene;
00114 private:
00115
00116 public:
00119 SO3MainFrameListener(SScene* scene);
00120
00123 ~SO3MainFrameListener(void);
00124
00127 bool frameStarted(const Ogre::FrameEvent& evt);
00128
00131 bool frameEnded(const Ogre::FrameEvent& evt);
00132 protected:
00133 private:
00134 };
00135
00136 class SO3ParticleFrameListener : public Ogre::FrameListener
00137 {
00138 public:
00139 protected:
00140 SScene* m_scene;
00141 private:
00142
00143 public:
00146 SO3ParticleFrameListener(SScene* scene);
00147
00150 ~SO3ParticleFrameListener(void);
00151
00154 bool frameStarted(const Ogre::FrameEvent& evt);
00155
00158 bool frameEnded(const Ogre::FrameEvent& evt);
00159 protected:
00160 private:
00161 };
00162
00163 class _SO3_Export SScene : public SData
00164 {
00165 public:
00166
00167 const int channel;
00168 Ogre::SceneManager* O3SceneManager;
00169 Ogre::MeshManager* O3MeshManager;
00170 Ogre::MaterialManager* O3MaterialManager;
00171 Ogre::SkeletonManager* O3SkeletonManager;
00172 Ogre::TextureManager* O3TextureManager;
00173 Ogre::GpuProgramManager* O3GpuProgramManager;
00174 Ogre::HighLevelGpuProgramManager* O3HighLevelGpuProgramManager;
00175 Ogre::ParticleSystemManager* O3ParticleSystemManager;
00176 SO3ParticleFrameListener* particleListener;
00177 SO3MainFrameListener* mainListener;
00178 bool hasSkyBox;
00179 bool skyBoxDrawFirst;
00180 bool hasSkyDome;
00181 bool skyDomeDrawFirst;
00182 bool hasSkyPlane;
00183 bool skyPlaneDrawFirst;
00184 Ogre::MaterialPtr skyBoxMat;
00185 Ogre::MaterialPtr skyDomeMat;
00186 Ogre::MaterialPtr skyPlaneMat;
00187 Ogre::MaterialPtr materialCaster;
00188 Ogre::MaterialPtr materialReceiver;
00189 Ogre::Plane skyPlane;
00190 Ogre::String curMessage;
00191 int shadowCameraSetup;
00192 Ogre::ShadowCameraSetupPtr mCurrentShadowCameraSetup;
00193 SGroupMaterialMap listOfMaterial;
00194 SGroupTextureMap listOfTexture;
00195 SEnvironment* environment;
00196
00197 protected:
00198 private:
00199 SRoot* scolRoot;
00200 SNodeMap nodeList;
00201 SNode* rootNode;
00202 SPhysicWorld* physicWorld;
00203 SAnimMap animationList;
00204 int animationCounter;
00205
00206 public:
00210 SScene(SRoot* parent, std::string sceneName, int scolChannel);
00211
00215 ~SScene();
00216
00219 void clearOgreScene();
00220
00223 Ogre::SceneManager* GetOgreScenePointer();
00224
00228 SNode* GetRootNode();
00229
00233 SNode* GetNode(std::string nodeName);
00234
00238 const SNodeMap& GetNodeList() const;
00239
00243 SNode* CreateNode(std::string newNodeName);
00244
00248 void DeleteNode(SNode* existingNode);
00249
00253 SCamera* CreateCamera(std::string newCameraName);
00254
00258 void DeleteCamera(SCamera* existingCamera);
00259
00263 SEntity* CreateEntity(std::string groupName, std::string newEntityName, std::string meshName);
00264
00268 SEntityFap* CreateEntityFap(std::string newEntityFapName, std::string meshName, std::string pathStdFDP, std::string pathStdIndices);
00269
00273 SEntity* CreateEntity(std::string newEntityName, SEntity::EntityPrefabType prefabType);
00274
00278 SEntity* CreatePlane(std::string groupName, std::string newEntityName, SPointFloat sizev, SPointInt seg, SPointFloat uv);
00279
00283 void DeleteEntity(SEntity* existingEntity);
00284
00288 void ReloadEntities();
00289
00293 SSkeleton* CreateSkeleton(std::string newSkeletonName, SEntity* entity);
00294
00298 void DeleteSkeleton(SSkeleton* existingSkeleton);
00299
00303 SBone* CreateBone(std::string newBoneName, SSkeleton* skeleton, unsigned short id);
00304
00308 void DeleteBone(SBone* existingBone);
00309
00313 SParticleSystem* CreateParticleSystem(std::string newParticleSystemName, std::string particleSystemTemplate);
00314
00318 void DeleteParticleSystem(SParticleSystem* existingParticleSystem);
00319
00323 SLight* CreateLight(std::string newLightName);
00324
00328 void DeleteLight(SLight* existingLight);
00329
00333 SDynamicCubeMap* CreateDynamicCubeMap(std::string newDynamicCubeMapName);
00334
00338 void DeleteDynamicCubeMap(SDynamicCubeMap* existingDynamicCubeMap);
00339
00343 SDynamicReflectionMap* CreateDynamicReflectionMap(SViewPort* viewport, std::string newDynamicReflectionMapName);
00344
00348 void DeleteDynamicReflectionMap(SDynamicReflectionMap* existingDynamicReflectionMap);
00349
00353 SMaterial* CreateMaterial(std::string groupname, std::string matname);
00354
00358 void DeleteMaterial(SMaterial* material);
00359
00363 SMaterial* GetMaterial(std::string groupName, std::string materialName);
00364
00368 STexture* CreateTexture(std::string groupname, std::string texname, std::string path, int w=0, int h=0);
00369
00373 void DeleteTexture(STexture* texture);
00374
00378 STexture* GetTexture(std::string groupName, std::string texName);
00379
00382 SRoot* GetParent();
00383
00386 SPhysicWorld* GetPhysicsWorld();
00387
00390 SSequenceAnimation* CreateAnimationSequence(std::string animationName);
00391
00395 void AddAnimation(SAnim* existingAnimation);
00396
00400 void RemoveAnimation(SAnim* existingAnimation);
00401
00405 void RemoveAnimation(std::string animationName);
00406
00410 void DeleteAnimation(SAnim* existingAnimation);
00411
00414 unsigned short GetNumAnimations();
00415
00418 SAnim* GetAnimation(std::string animationName);
00419
00422 SAnimMap GetAnimations() const;
00423
00426 SEnvironment* GetEnvironment() const;
00427 protected:
00431 void AddNode(SNode* existingNode);
00432
00436 void RemoveNode(SNode* existingNode);
00437
00441 void RemoveNode(std::string nodeName);
00442 private:
00446 SScene();
00447
00448 };
00449
00450 }
00451
00452 #endif