|
IrrlichtEngine
|
00001 // Copyright (C) 2002-2011 Nikolaus Gebhardt 00002 // This file is part of the "Irrlicht Engine". 00003 // For conditions of distribution and use, see copyright notice in irrlicht.h 00004 00005 #ifndef __I_SCENE_MANAGER_H_INCLUDED__ 00006 #define __I_SCENE_MANAGER_H_INCLUDED__ 00007 00008 #include "IReferenceCounted.h" 00009 #include "irrArray.h" 00010 #include "irrString.h" 00011 #include "path.h" 00012 #include "vector3d.h" 00013 #include "dimension2d.h" 00014 #include "SColor.h" 00015 #include "ETerrainElements.h" 00016 #include "ESceneNodeTypes.h" 00017 #include "ESceneNodeAnimatorTypes.h" 00018 #include "EMeshWriterEnums.h" 00019 #include "SceneParameters.h" 00020 #include "IGeometryCreator.h" 00021 #include "ISkinnedMesh.h" 00022 00023 namespace irr 00024 { 00025 struct SKeyMap; 00026 struct SEvent; 00027 00028 namespace io 00029 { 00030 class IReadFile; 00031 class IAttributes; 00032 class IWriteFile; 00033 class IFileSystem; 00034 } // end namespace io 00035 00036 namespace gui 00037 { 00038 class IGUIFont; 00039 class IGUIEnvironment; 00040 } // end namespace gui 00041 00042 namespace video 00043 { 00044 class IVideoDriver; 00045 class SMaterial; 00046 class IImage; 00047 class ITexture; 00048 } // end namespace video 00049 00050 namespace scene 00051 { 00053 00055 enum E_SCENE_NODE_RENDER_PASS 00056 { 00058 ESNRP_NONE =0, 00059 00061 ESNRP_CAMERA =1, 00062 00064 ESNRP_LIGHT =2, 00065 00067 ESNRP_SKY_BOX =4, 00068 00070 00082 ESNRP_AUTOMATIC =24, 00083 00085 ESNRP_SOLID =8, 00086 00088 ESNRP_TRANSPARENT =16, 00089 00091 ESNRP_TRANSPARENT_EFFECT =32, 00092 00094 ESNRP_SHADOW =64 00095 }; 00096 00097 class IAnimatedMesh; 00098 class IAnimatedMeshSceneNode; 00099 class IBillboardSceneNode; 00100 class IBillboardTextSceneNode; 00101 class ICameraSceneNode; 00102 class IDummyTransformationSceneNode; 00103 class ILightManager; 00104 class ILightSceneNode; 00105 class IMesh; 00106 class IMeshBuffer; 00107 class IMeshCache; 00108 class IMeshLoader; 00109 class IMeshManipulator; 00110 class IMeshSceneNode; 00111 class IMeshWriter; 00112 class IMetaTriangleSelector; 00113 class IParticleSystemSceneNode; 00114 class ISceneCollisionManager; 00115 class ISceneLoader; 00116 class ISceneNode; 00117 class ISceneNodeAnimator; 00118 class ISceneNodeAnimatorCollisionResponse; 00119 class ISceneNodeAnimatorFactory; 00120 class ISceneNodeFactory; 00121 class ISceneUserDataSerializer; 00122 class ITerrainSceneNode; 00123 class ITextSceneNode; 00124 class ITriangleSelector; 00125 class IVolumeLightSceneNode; 00126 00127 namespace quake3 00128 { 00129 struct IShader; 00130 } // end namespace quake3 00131 00133 00150 class ISceneManager : public virtual IReferenceCounted 00151 { 00152 public: 00153 00155 00399 virtual IAnimatedMesh* getMesh(const io::path& filename) = 0; 00400 00402 00408 virtual IAnimatedMesh* getMesh(io::IReadFile* file) = 0; 00409 00411 00414 virtual IMeshCache* getMeshCache() = 0; 00415 00417 00419 virtual video::IVideoDriver* getVideoDriver() = 0; 00420 00422 00424 virtual gui::IGUIEnvironment* getGUIEnvironment() = 0; 00425 00427 00429 virtual io::IFileSystem* getFileSystem() = 0; 00430 00432 00445 virtual IVolumeLightSceneNode* addVolumeLightSceneNode(ISceneNode* parent=0, s32 id=-1, 00446 const u32 subdivU = 32, const u32 subdivV = 32, 00447 const video::SColor foot = video::SColor(51, 0, 230, 180), 00448 const video::SColor tail = video::SColor(0, 0, 0, 0), 00449 const core::vector3df& position = core::vector3df(0,0,0), 00450 const core::vector3df& rotation = core::vector3df(0,0,0), 00451 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0; 00452 00454 00464 virtual IMeshSceneNode* addCubeSceneNode(f32 size=10.0f, ISceneNode* parent=0, s32 id=-1, 00465 const core::vector3df& position = core::vector3df(0,0,0), 00466 const core::vector3df& rotation = core::vector3df(0,0,0), 00467 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0; 00468 00470 00484 virtual IMeshSceneNode* addSphereSceneNode(f32 radius=5.0f, s32 polyCount=16, 00485 ISceneNode* parent=0, s32 id=-1, 00486 const core::vector3df& position = core::vector3df(0,0,0), 00487 const core::vector3df& rotation = core::vector3df(0,0,0), 00488 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0; 00489 00491 00501 virtual IAnimatedMeshSceneNode* addAnimatedMeshSceneNode(IAnimatedMesh* mesh, 00502 ISceneNode* parent=0, s32 id=-1, 00503 const core::vector3df& position = core::vector3df(0,0,0), 00504 const core::vector3df& rotation = core::vector3df(0,0,0), 00505 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f), 00506 bool alsoAddIfMeshPointerZero=false) = 0; 00507 00509 00519 virtual IMeshSceneNode* addMeshSceneNode(IMesh* mesh, ISceneNode* parent=0, s32 id=-1, 00520 const core::vector3df& position = core::vector3df(0,0,0), 00521 const core::vector3df& rotation = core::vector3df(0,0,0), 00522 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f), 00523 bool alsoAddIfMeshPointerZero=false) = 0; 00524 00526 00540 virtual ISceneNode* addWaterSurfaceSceneNode(IMesh* mesh, 00541 f32 waveHeight=2.0f, f32 waveSpeed=300.0f, f32 waveLength=10.0f, 00542 ISceneNode* parent=0, s32 id=-1, 00543 const core::vector3df& position = core::vector3df(0,0,0), 00544 const core::vector3df& rotation = core::vector3df(0,0,0), 00545 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0; 00546 00547 00549 00561 virtual IMeshSceneNode* addOctreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0, 00562 s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false) = 0; 00563 00565 00566 _IRR_DEPRECATED_ IMeshSceneNode* addOctTreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0, 00567 s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false) 00568 { 00569 return addOctreeSceneNode(mesh, parent, id, minimalPolysPerNode, alsoAddIfMeshPointerZero); 00570 } 00571 00573 00585 virtual IMeshSceneNode* addOctreeSceneNode(IMesh* mesh, ISceneNode* parent=0, 00586 s32 id=-1, s32 minimalPolysPerNode=256, bool alsoAddIfMeshPointerZero=false) = 0; 00587 00589 00590 _IRR_DEPRECATED_ IMeshSceneNode* addOctTreeSceneNode(IMesh* mesh, ISceneNode* parent=0, 00591 s32 id=-1, s32 minimalPolysPerNode=256, bool alsoAddIfMeshPointerZero=false) 00592 { 00593 return addOctreeSceneNode(mesh, parent, id, minimalPolysPerNode, alsoAddIfMeshPointerZero); 00594 } 00595 00597 00613 virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0, 00614 const core::vector3df& position = core::vector3df(0,0,0), 00615 const core::vector3df& lookat = core::vector3df(0,0,100), 00616 s32 id=-1, bool makeActive=true) = 0; 00617 00619 00630 virtual ICameraSceneNode* addCameraSceneNodeMaya(ISceneNode* parent = 0, 00631 f32 rotateSpeed = -1500.0f, f32 zoomSpeed = 200.0f, 00632 f32 translationSpeed = 1500.0f, s32 id=-1, 00633 bool makeActive=true) = 0; 00634 00636 00699 virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0, 00700 f32 rotateSpeed = 100.0f, f32 moveSpeed = 0.5f, s32 id=-1, 00701 SKeyMap* keyMapArray=0, s32 keyMapSize=0, bool noVerticalMovement=false, 00702 f32 jumpSpeed = 0.f, bool invertMouse=false, 00703 bool makeActive=true) = 0; 00704 00706 00718 virtual ILightSceneNode* addLightSceneNode(ISceneNode* parent = 0, 00719 const core::vector3df& position = core::vector3df(0,0,0), 00720 video::SColorf color = video::SColorf(1.0f, 1.0f, 1.0f), 00721 f32 radius=100.0f, s32 id=-1) = 0; 00722 00724 00742 virtual IBillboardSceneNode* addBillboardSceneNode(ISceneNode* parent = 0, 00743 const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f), 00744 const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1, 00745 video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF) = 0; 00746 00748 00762 virtual ISceneNode* addSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom, 00763 video::ITexture* left, video::ITexture* right, video::ITexture* front, 00764 video::ITexture* back, ISceneNode* parent = 0, s32 id=-1) = 0; 00765 00767 00784 virtual ISceneNode* addSkyDomeSceneNode(video::ITexture* texture, 00785 u32 horiRes=16, u32 vertRes=8, 00786 f32 texturePercentage=0.9, f32 spherePercentage=2.0,f32 radius = 1000.f, 00787 ISceneNode* parent=0, s32 id=-1) = 0; 00788 00790 00802 virtual IParticleSystemSceneNode* addParticleSystemSceneNode( 00803 bool withDefaultEmitter=true, ISceneNode* parent=0, s32 id=-1, 00804 const core::vector3df& position = core::vector3df(0,0,0), 00805 const core::vector3df& rotation = core::vector3df(0,0,0), 00806 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0; 00807 00809 00864 virtual ITerrainSceneNode* addTerrainSceneNode( 00865 const io::path& heightMapFileName, 00866 ISceneNode* parent=0, s32 id=-1, 00867 const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f), 00868 const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f), 00869 const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f), 00870 video::SColor vertexColor = video::SColor(255,255,255,255), 00871 s32 maxLOD=5, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17, s32 smoothFactor=0, 00872 bool addAlsoIfHeightmapEmpty = false) = 0; 00873 00875 00902 virtual ITerrainSceneNode* addTerrainSceneNode( 00903 io::IReadFile* heightMapFile, 00904 ISceneNode* parent=0, s32 id=-1, 00905 const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f), 00906 const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f), 00907 const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f), 00908 video::SColor vertexColor = video::SColor(255,255,255,255), 00909 s32 maxLOD=5, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17, s32 smoothFactor=0, 00910 bool addAlsoIfHeightmapEmpty = false) = 0; 00911 00913 00916 virtual IMeshSceneNode* addQuake3SceneNode(const IMeshBuffer* meshBuffer, const quake3::IShader * shader, 00917 ISceneNode* parent=0, s32 id=-1 00918 ) = 0; 00919 00920 00922 00926 virtual ISceneNode* addEmptySceneNode(ISceneNode* parent=0, s32 id=-1) = 0; 00927 00929 00935 virtual IDummyTransformationSceneNode* addDummyTransformationSceneNode( 00936 ISceneNode* parent=0, s32 id=-1) = 0; 00937 00939 virtual ITextSceneNode* addTextSceneNode(gui::IGUIFont* font, const wchar_t* text, 00940 video::SColor color=video::SColor(100,255,255,255), 00941 ISceneNode* parent = 0, const core::vector3df& position = core::vector3df(0,0,0), 00942 s32 id=-1) = 0; 00943 00945 00956 virtual IBillboardTextSceneNode* addBillboardTextSceneNode( gui::IGUIFont* font, const wchar_t* text, 00957 ISceneNode* parent = 0, 00958 const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f), 00959 const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1, 00960 video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF) = 0; 00961 00963 00989 virtual IAnimatedMesh* addHillPlaneMesh(const io::path& name, 00990 const core::dimension2d<f32>& tileSize, const core::dimension2d<u32>& tileCount, 00991 video::SMaterial* material = 0, f32 hillHeight = 0.0f, 00992 const core::dimension2d<f32>& countHills = core::dimension2d<f32>(0.0f, 0.0f), 00993 const core::dimension2d<f32>& textureRepeatCount = core::dimension2d<f32>(1.0f, 1.0f)) = 0; 00994 00996 01018 virtual IAnimatedMesh* addTerrainMesh(const io::path& meshname, 01019 video::IImage* texture, video::IImage* heightmap, 01020 const core::dimension2d<f32>& stretchSize = core::dimension2d<f32>(10.0f,10.0f), 01021 f32 maxHeight=200.0f, 01022 const core::dimension2d<u32>& defaultVertexBlockSize = core::dimension2d<u32>(64,64)) = 0; 01023 01025 01036 virtual IAnimatedMesh* addArrowMesh(const io::path& name, 01037 video::SColor vtxColorCylinder=0xFFFFFFFF, 01038 video::SColor vtxColorCone=0xFFFFFFFF, 01039 u32 tesselationCylinder=4, u32 tesselationCone=8, 01040 f32 height=1.f, f32 cylinderHeight=0.6f, 01041 f32 widthCylinder=0.05f, f32 widthCone=0.3f) = 0; 01042 01044 01050 virtual IAnimatedMesh* addSphereMesh(const io::path& name, 01051 f32 radius=5.f, u32 polyCountX = 16, 01052 u32 polyCountY = 16) = 0; 01053 01055 01063 virtual IAnimatedMesh* addVolumeLightMesh(const io::path& name, 01064 const u32 SubdivideU = 32, const u32 SubdivideV = 32, 01065 const video::SColor FootColor = video::SColor(51, 0, 230, 180), 01066 const video::SColor TailColor = video::SColor(0, 0, 0, 0)) = 0; 01067 01069 01075 virtual ISceneNode* getRootSceneNode() = 0; 01076 01078 01085 virtual ISceneNode* getSceneNodeFromId(s32 id, ISceneNode* start=0) = 0; 01086 01088 01095 virtual ISceneNode* getSceneNodeFromName(const c8* name, ISceneNode* start=0) = 0; 01096 01098 01105 virtual ISceneNode* getSceneNodeFromType(scene::ESCENE_NODE_TYPE type, ISceneNode* start=0) = 0; 01106 01108 01113 virtual void getSceneNodesFromType(ESCENE_NODE_TYPE type, 01114 core::array<scene::ISceneNode*>& outNodes, 01115 ISceneNode* start=0) = 0; 01116 01118 01121 virtual ICameraSceneNode* getActiveCamera() const =0; 01122 01124 01126 virtual void setActiveCamera(ICameraSceneNode* camera) = 0; 01127 01129 virtual void setShadowColor(video::SColor color = video::SColor(150,0,0,0)) = 0; 01130 01132 virtual video::SColor getShadowColor() const = 0; 01133 01135 01143 virtual u32 registerNodeForRendering(ISceneNode* node, 01144 E_SCENE_NODE_RENDER_PASS pass = ESNRP_AUTOMATIC) = 0; 01145 01147 01151 virtual void drawAll() = 0; 01152 01154 01159 virtual ISceneNodeAnimator* createRotationAnimator(const core::vector3df& rotationSpeed) = 0; 01160 01162 01174 virtual ISceneNodeAnimator* createFlyCircleAnimator( 01175 const core::vector3df& center=core::vector3df(0.f,0.f,0.f), 01176 f32 radius=100.f, f32 speed=0.001f, 01177 const core::vector3df& direction=core::vector3df(0.f, 1.f, 0.f), 01178 f32 startPosition = 0.f, 01179 f32 radiusEllipsoid = 0.f) = 0; 01180 01182 01194 virtual ISceneNodeAnimator* createFlyStraightAnimator(const core::vector3df& startPoint, 01195 const core::vector3df& endPoint, u32 timeForWay, bool loop=false, bool pingpong = false) = 0; 01196 01198 01207 virtual ISceneNodeAnimator* createTextureAnimator(const core::array<video::ITexture*>& textures, 01208 s32 timePerFrame, bool loop=true) = 0; 01209 01211 01216 virtual ISceneNodeAnimator* createDeleteAnimator(u32 timeMs) = 0; 01217 01219 01249 virtual ISceneNodeAnimatorCollisionResponse* createCollisionResponseAnimator( 01250 ITriangleSelector* world, ISceneNode* sceneNode, 01251 const core::vector3df& ellipsoidRadius = core::vector3df(30,60,30), 01252 const core::vector3df& gravityPerSecond = core::vector3df(0,-10.0f,0), 01253 const core::vector3df& ellipsoidTranslation = core::vector3df(0,0,0), 01254 f32 slidingValue = 0.0005f) = 0; 01255 01257 01265 virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime, 01266 const core::array< core::vector3df >& points, 01267 f32 speed = 1.0f, f32 tightness = 0.5f, bool loop=true, bool pingpong=false) = 0; 01268 01270 01288 virtual ITriangleSelector* createTriangleSelector(IMesh* mesh, ISceneNode* node) = 0; 01289 01291 01296 virtual ITriangleSelector* createTriangleSelector(IAnimatedMeshSceneNode* node) = 0; 01297 01298 01300 01308 virtual ITriangleSelector* createTriangleSelectorFromBoundingBox(ISceneNode* node) = 0; 01309 01311 01333 virtual ITriangleSelector* createOctreeTriangleSelector(IMesh* mesh, 01334 ISceneNode* node, s32 minimalPolysPerNode=32) = 0; 01335 01337 01338 _IRR_DEPRECATED_ ITriangleSelector* createOctTreeTriangleSelector(IMesh* mesh, 01339 ISceneNode* node, s32 minimalPolysPerNode=32) 01340 { 01341 return createOctreeTriangleSelector(mesh, node, minimalPolysPerNode); 01342 } 01343 01345 01352 virtual IMetaTriangleSelector* createMetaTriangleSelector() = 0; 01353 01355 01360 virtual ITriangleSelector* createTerrainTriangleSelector( 01361 ITerrainSceneNode* node, s32 LOD=0) = 0; 01362 01364 01370 virtual void addExternalMeshLoader(IMeshLoader* externalLoader) = 0; 01371 01373 virtual u32 getMeshLoaderCount() const = 0; 01374 01376 01379 virtual IMeshLoader* getMeshLoader(u32 index) const = 0; 01380 01382 01388 virtual void addExternalSceneLoader(ISceneLoader* externalLoader) = 0; 01389 01391 virtual u32 getSceneLoaderCount() const = 0; 01392 01394 01397 virtual ISceneLoader* getSceneLoader(u32 index) const = 0; 01398 01400 01402 virtual ISceneCollisionManager* getSceneCollisionManager() = 0; 01403 01405 01407 virtual IMeshManipulator* getMeshManipulator() = 0; 01408 01410 01418 virtual void addToDeletionQueue(ISceneNode* node) = 0; 01419 01421 01423 virtual bool postEventFromUser(const SEvent& event) = 0; 01424 01426 01427 virtual void clear() = 0; 01428 01430 01435 virtual io::IAttributes* getParameters() = 0; 01436 01438 01444 virtual E_SCENE_NODE_RENDER_PASS getSceneNodeRenderPass() const = 0; 01445 01447 01449 virtual ISceneNodeFactory* getDefaultSceneNodeFactory() = 0; 01450 01452 01454 virtual void registerSceneNodeFactory(ISceneNodeFactory* factoryToAdd) = 0; 01455 01457 virtual u32 getRegisteredSceneNodeFactoryCount() const = 0; 01458 01460 01462 virtual ISceneNodeFactory* getSceneNodeFactory(u32 index) = 0; 01463 01465 01467 virtual ISceneNodeAnimatorFactory* getDefaultSceneNodeAnimatorFactory() = 0; 01468 01470 01472 virtual void registerSceneNodeAnimatorFactory(ISceneNodeAnimatorFactory* factoryToAdd) = 0; 01473 01475 virtual u32 getRegisteredSceneNodeAnimatorFactoryCount() const = 0; 01476 01478 01480 virtual ISceneNodeAnimatorFactory* getSceneNodeAnimatorFactory(u32 index) = 0; 01481 01483 virtual const c8* getSceneNodeTypeName(ESCENE_NODE_TYPE type) = 0; 01484 01486 virtual const c8* getAnimatorTypeName(ESCENE_NODE_ANIMATOR_TYPE type) = 0; 01487 01489 01491 virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0) = 0; 01492 01494 01498 virtual ISceneNodeAnimator* createSceneNodeAnimator(const char* typeName, ISceneNode* target=0) = 0; 01499 01501 01519 virtual ISceneManager* createNewSceneManager(bool cloneContent=false) = 0; 01520 01522 01534 virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0; 01535 01537 01549 virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0; 01550 01552 01565 virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) = 0; 01566 01568 01581 virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) = 0; 01582 01584 01586 virtual IMeshWriter* createMeshWriter(EMESH_WRITER_TYPE type) = 0; 01587 01589 01591 virtual ISkinnedMesh* createSkinnedMesh() = 0; 01592 01594 virtual void setAmbientLight(const video::SColorf &ambientColor) = 0; 01595 01597 virtual const video::SColorf& getAmbientLight() const = 0; 01598 01600 01602 virtual void setLightManager(ILightManager* lightManager) = 0; 01603 01605 01607 virtual const IGeometryCreator* getGeometryCreator(void) const = 0; 01608 01610 01618 virtual bool isCulled(const ISceneNode* node) const =0; 01619 }; 01620 01621 01622 } // end namespace scene 01623 } // end namespace irr 01624 01625 #endif 01626