00001
00002
00003
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 }
00035
00036 namespace gui
00037 {
00038 class IGUIFont;
00039 class IGUIEnvironment;
00040 }
00041
00042 namespace video
00043 {
00044 class IVideoDriver;
00045 class SMaterial;
00046 class IImage;
00047 class ITexture;
00048 }
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 }
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
00635 virtual ICameraSceneNode* addCameraSceneNodeMaya(ISceneNode* parent=0,
00636 f32 rotateSpeed=-1500.f, f32 zoomSpeed=200.f,
00637 f32 translationSpeed=1500.f, s32 id=-1, f32 distance=70.f,
00638 bool makeActive=true) =0;
00639
00641
00704 virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0,
00705 f32 rotateSpeed = 100.0f, f32 moveSpeed = 0.5f, s32 id=-1,
00706 SKeyMap* keyMapArray=0, s32 keyMapSize=0, bool noVerticalMovement=false,
00707 f32 jumpSpeed = 0.f, bool invertMouse=false,
00708 bool makeActive=true) = 0;
00709
00711
00723 virtual ILightSceneNode* addLightSceneNode(ISceneNode* parent = 0,
00724 const core::vector3df& position = core::vector3df(0,0,0),
00725 video::SColorf color = video::SColorf(1.0f, 1.0f, 1.0f),
00726 f32 radius=100.0f, s32 id=-1) = 0;
00727
00729
00747 virtual IBillboardSceneNode* addBillboardSceneNode(ISceneNode* parent = 0,
00748 const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f),
00749 const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1,
00750 video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF) = 0;
00751
00753
00767 virtual ISceneNode* addSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom,
00768 video::ITexture* left, video::ITexture* right, video::ITexture* front,
00769 video::ITexture* back, ISceneNode* parent = 0, s32 id=-1) = 0;
00770
00772
00789 virtual ISceneNode* addSkyDomeSceneNode(video::ITexture* texture,
00790 u32 horiRes=16, u32 vertRes=8,
00791 f32 texturePercentage=0.9, f32 spherePercentage=2.0,f32 radius = 1000.f,
00792 ISceneNode* parent=0, s32 id=-1) = 0;
00793
00795
00807 virtual IParticleSystemSceneNode* addParticleSystemSceneNode(
00808 bool withDefaultEmitter=true, ISceneNode* parent=0, s32 id=-1,
00809 const core::vector3df& position = core::vector3df(0,0,0),
00810 const core::vector3df& rotation = core::vector3df(0,0,0),
00811 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
00812
00814
00869 virtual ITerrainSceneNode* addTerrainSceneNode(
00870 const io::path& heightMapFileName,
00871 ISceneNode* parent=0, s32 id=-1,
00872 const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f),
00873 const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f),
00874 const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f),
00875 video::SColor vertexColor = video::SColor(255,255,255,255),
00876 s32 maxLOD=5, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17, s32 smoothFactor=0,
00877 bool addAlsoIfHeightmapEmpty = false) = 0;
00878
00880
00907 virtual ITerrainSceneNode* addTerrainSceneNode(
00908 io::IReadFile* heightMapFile,
00909 ISceneNode* parent=0, s32 id=-1,
00910 const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f),
00911 const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f),
00912 const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f),
00913 video::SColor vertexColor = video::SColor(255,255,255,255),
00914 s32 maxLOD=5, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17, s32 smoothFactor=0,
00915 bool addAlsoIfHeightmapEmpty = false) = 0;
00916
00918
00921 virtual IMeshSceneNode* addQuake3SceneNode(const IMeshBuffer* meshBuffer, const quake3::IShader * shader,
00922 ISceneNode* parent=0, s32 id=-1
00923 ) = 0;
00924
00925
00927
00931 virtual ISceneNode* addEmptySceneNode(ISceneNode* parent=0, s32 id=-1) = 0;
00932
00934
00940 virtual IDummyTransformationSceneNode* addDummyTransformationSceneNode(
00941 ISceneNode* parent=0, s32 id=-1) = 0;
00942
00944 virtual ITextSceneNode* addTextSceneNode(gui::IGUIFont* font, const wchar_t* text,
00945 video::SColor color=video::SColor(100,255,255,255),
00946 ISceneNode* parent = 0, const core::vector3df& position = core::vector3df(0,0,0),
00947 s32 id=-1) = 0;
00948
00950
00961 virtual IBillboardTextSceneNode* addBillboardTextSceneNode( gui::IGUIFont* font, const wchar_t* text,
00962 ISceneNode* parent = 0,
00963 const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f),
00964 const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1,
00965 video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF) = 0;
00966
00968
00994 virtual IAnimatedMesh* addHillPlaneMesh(const io::path& name,
00995 const core::dimension2d<f32>& tileSize, const core::dimension2d<u32>& tileCount,
00996 video::SMaterial* material = 0, f32 hillHeight = 0.0f,
00997 const core::dimension2d<f32>& countHills = core::dimension2d<f32>(0.0f, 0.0f),
00998 const core::dimension2d<f32>& textureRepeatCount = core::dimension2d<f32>(1.0f, 1.0f)) = 0;
00999
01001
01023 virtual IAnimatedMesh* addTerrainMesh(const io::path& meshname,
01024 video::IImage* texture, video::IImage* heightmap,
01025 const core::dimension2d<f32>& stretchSize = core::dimension2d<f32>(10.0f,10.0f),
01026 f32 maxHeight=200.0f,
01027 const core::dimension2d<u32>& defaultVertexBlockSize = core::dimension2d<u32>(64,64)) = 0;
01028
01030
01041 virtual IAnimatedMesh* addArrowMesh(const io::path& name,
01042 video::SColor vtxColorCylinder=0xFFFFFFFF,
01043 video::SColor vtxColorCone=0xFFFFFFFF,
01044 u32 tesselationCylinder=4, u32 tesselationCone=8,
01045 f32 height=1.f, f32 cylinderHeight=0.6f,
01046 f32 widthCylinder=0.05f, f32 widthCone=0.3f) = 0;
01047
01049
01055 virtual IAnimatedMesh* addSphereMesh(const io::path& name,
01056 f32 radius=5.f, u32 polyCountX = 16,
01057 u32 polyCountY = 16) = 0;
01058
01060
01068 virtual IAnimatedMesh* addVolumeLightMesh(const io::path& name,
01069 const u32 SubdivideU = 32, const u32 SubdivideV = 32,
01070 const video::SColor FootColor = video::SColor(51, 0, 230, 180),
01071 const video::SColor TailColor = video::SColor(0, 0, 0, 0)) = 0;
01072
01074
01080 virtual ISceneNode* getRootSceneNode() = 0;
01081
01083
01090 virtual ISceneNode* getSceneNodeFromId(s32 id, ISceneNode* start=0) = 0;
01091
01093
01100 virtual ISceneNode* getSceneNodeFromName(const c8* name, ISceneNode* start=0) = 0;
01101
01103
01110 virtual ISceneNode* getSceneNodeFromType(scene::ESCENE_NODE_TYPE type, ISceneNode* start=0) = 0;
01111
01113
01118 virtual void getSceneNodesFromType(ESCENE_NODE_TYPE type,
01119 core::array<scene::ISceneNode*>& outNodes,
01120 ISceneNode* start=0) = 0;
01121
01123
01126 virtual ICameraSceneNode* getActiveCamera() const =0;
01127
01129
01131 virtual void setActiveCamera(ICameraSceneNode* camera) = 0;
01132
01134 virtual void setShadowColor(video::SColor color = video::SColor(150,0,0,0)) = 0;
01135
01137 virtual video::SColor getShadowColor() const = 0;
01138
01140
01148 virtual u32 registerNodeForRendering(ISceneNode* node,
01149 E_SCENE_NODE_RENDER_PASS pass = ESNRP_AUTOMATIC) = 0;
01150
01152
01156 virtual void drawAll() = 0;
01157
01159
01164 virtual ISceneNodeAnimator* createRotationAnimator(const core::vector3df& rotationSpeed) = 0;
01165
01167
01179 virtual ISceneNodeAnimator* createFlyCircleAnimator(
01180 const core::vector3df& center=core::vector3df(0.f,0.f,0.f),
01181 f32 radius=100.f, f32 speed=0.001f,
01182 const core::vector3df& direction=core::vector3df(0.f, 1.f, 0.f),
01183 f32 startPosition = 0.f,
01184 f32 radiusEllipsoid = 0.f) = 0;
01185
01187
01199 virtual ISceneNodeAnimator* createFlyStraightAnimator(const core::vector3df& startPoint,
01200 const core::vector3df& endPoint, u32 timeForWay, bool loop=false, bool pingpong = false) = 0;
01201
01203
01212 virtual ISceneNodeAnimator* createTextureAnimator(const core::array<video::ITexture*>& textures,
01213 s32 timePerFrame, bool loop=true) = 0;
01214
01216
01221 virtual ISceneNodeAnimator* createDeleteAnimator(u32 timeMs) = 0;
01222
01224
01254 virtual ISceneNodeAnimatorCollisionResponse* createCollisionResponseAnimator(
01255 ITriangleSelector* world, ISceneNode* sceneNode,
01256 const core::vector3df& ellipsoidRadius = core::vector3df(30,60,30),
01257 const core::vector3df& gravityPerSecond = core::vector3df(0,-10.0f,0),
01258 const core::vector3df& ellipsoidTranslation = core::vector3df(0,0,0),
01259 f32 slidingValue = 0.0005f) = 0;
01260
01262
01270 virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime,
01271 const core::array< core::vector3df >& points,
01272 f32 speed = 1.0f, f32 tightness = 0.5f, bool loop=true, bool pingpong=false) = 0;
01273
01275
01293 virtual ITriangleSelector* createTriangleSelector(IMesh* mesh, ISceneNode* node) = 0;
01294
01296
01301 virtual ITriangleSelector* createTriangleSelector(IAnimatedMeshSceneNode* node) = 0;
01302
01303
01305
01313 virtual ITriangleSelector* createTriangleSelectorFromBoundingBox(ISceneNode* node) = 0;
01314
01316
01338 virtual ITriangleSelector* createOctreeTriangleSelector(IMesh* mesh,
01339 ISceneNode* node, s32 minimalPolysPerNode=32) = 0;
01340
01342
01343 _IRR_DEPRECATED_ ITriangleSelector* createOctTreeTriangleSelector(IMesh* mesh,
01344 ISceneNode* node, s32 minimalPolysPerNode=32)
01345 {
01346 return createOctreeTriangleSelector(mesh, node, minimalPolysPerNode);
01347 }
01348
01350
01357 virtual IMetaTriangleSelector* createMetaTriangleSelector() = 0;
01358
01360
01365 virtual ITriangleSelector* createTerrainTriangleSelector(
01366 ITerrainSceneNode* node, s32 LOD=0) = 0;
01367
01369
01375 virtual void addExternalMeshLoader(IMeshLoader* externalLoader) = 0;
01376
01378 virtual u32 getMeshLoaderCount() const = 0;
01379
01381
01384 virtual IMeshLoader* getMeshLoader(u32 index) const = 0;
01385
01387
01393 virtual void addExternalSceneLoader(ISceneLoader* externalLoader) = 0;
01394
01396 virtual u32 getSceneLoaderCount() const = 0;
01397
01399
01402 virtual ISceneLoader* getSceneLoader(u32 index) const = 0;
01403
01405
01407 virtual ISceneCollisionManager* getSceneCollisionManager() = 0;
01408
01410
01412 virtual IMeshManipulator* getMeshManipulator() = 0;
01413
01415
01423 virtual void addToDeletionQueue(ISceneNode* node) = 0;
01424
01426
01428 virtual bool postEventFromUser(const SEvent& event) = 0;
01429
01431
01432 virtual void clear() = 0;
01433
01435
01440 virtual io::IAttributes* getParameters() = 0;
01441
01443
01449 virtual E_SCENE_NODE_RENDER_PASS getSceneNodeRenderPass() const = 0;
01450
01452
01454 virtual ISceneNodeFactory* getDefaultSceneNodeFactory() = 0;
01455
01457
01459 virtual void registerSceneNodeFactory(ISceneNodeFactory* factoryToAdd) = 0;
01460
01462 virtual u32 getRegisteredSceneNodeFactoryCount() const = 0;
01463
01465
01467 virtual ISceneNodeFactory* getSceneNodeFactory(u32 index) = 0;
01468
01470
01472 virtual ISceneNodeAnimatorFactory* getDefaultSceneNodeAnimatorFactory() = 0;
01473
01475
01477 virtual void registerSceneNodeAnimatorFactory(ISceneNodeAnimatorFactory* factoryToAdd) = 0;
01478
01480 virtual u32 getRegisteredSceneNodeAnimatorFactoryCount() const = 0;
01481
01483
01485 virtual ISceneNodeAnimatorFactory* getSceneNodeAnimatorFactory(u32 index) = 0;
01486
01488 virtual const c8* getSceneNodeTypeName(ESCENE_NODE_TYPE type) = 0;
01489
01491 virtual const c8* getAnimatorTypeName(ESCENE_NODE_ANIMATOR_TYPE type) = 0;
01492
01494
01496 virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0) = 0;
01497
01499
01503 virtual ISceneNodeAnimator* createSceneNodeAnimator(const char* typeName, ISceneNode* target=0) = 0;
01504
01506
01524 virtual ISceneManager* createNewSceneManager(bool cloneContent=false) = 0;
01525
01527
01542 virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0;
01543
01545
01560 virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0;
01561
01563
01580 virtual bool saveScene(io::IXMLWriter* writer, const io::path& currentPath, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0;
01581
01583
01599 virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) = 0;
01600
01602
01618 virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) = 0;
01619
01621
01623 virtual IMeshWriter* createMeshWriter(EMESH_WRITER_TYPE type) = 0;
01624
01626
01628 virtual ISkinnedMesh* createSkinnedMesh() = 0;
01629
01631 virtual void setAmbientLight(const video::SColorf &ambientColor) = 0;
01632
01634 virtual const video::SColorf& getAmbientLight() const = 0;
01635
01637
01639 virtual void setLightManager(ILightManager* lightManager) = 0;
01640
01642
01644 virtual const IGeometryCreator* getGeometryCreator(void) const = 0;
01645
01647
01655 virtual bool isCulled(const ISceneNode* node) const =0;
01656 };
01657
01658
01659 }
01660 }
01661
01662 #endif
01663