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 "vector3d.h"
00011 #include "dimension2d.h"
00012 #include "SColor.h"
00013 #include "ETerrainElements.h"
00014 #include "ESceneNodeTypes.h"
00015 #include "EMeshWriterEnums.h"
00016 #include "SceneParameters.h"
00017
00018 namespace irr
00019 {
00020 struct SKeyMap;
00021 struct SEvent;
00022
00023 namespace io
00024 {
00025 class IReadFile;
00026 class IAttributes;
00027 class IWriteFile;
00028 }
00029
00030 namespace gui
00031 {
00032 class IGUIFont;
00033 class IGUIEnvironment;
00034 }
00035
00036 namespace video
00037 {
00038 class IVideoDriver;
00039 class SMaterial;
00040 class IImage;
00041 class ITexture;
00042 }
00043
00044 namespace scene
00045 {
00046 class IMeshWriter;
00047
00049
00051 enum E_SCENE_NODE_RENDER_PASS
00052 {
00054 ESNRP_CAMERA,
00055
00057 ESNRP_LIGHT,
00058
00060 ESNRP_SKY_BOX,
00061
00063
00075 ESNRP_AUTOMATIC,
00076
00078 ESNRP_SOLID,
00079
00081 ESNRP_SHADOW,
00082
00084 ESNRP_TRANSPARENT,
00085
00087 ESNRP_SHADER_0,
00088 ESNRP_SHADER_1,
00089 ESNRP_SHADER_2,
00090 ESNRP_SHADER_3,
00091 ESNRP_SHADER_4,
00092 ESNRP_SHADER_5,
00093 ESNRP_SHADER_6,
00094 ESNRP_SHADER_7,
00095 ESNRP_SHADER_8,
00096 ESNRP_SHADER_9,
00097 ESNRP_SHADER_10,
00098
00100 ESNRP_COUNT
00101 };
00102
00103 class IMesh;
00104 class IMeshBuffer;
00105 class IAnimatedMesh;
00106 class IMeshCache;
00107 class ISceneNode;
00108 class ICameraSceneNode;
00109 class IAnimatedMeshSceneNode;
00110 class ISceneNodeAnimator;
00111 class ISceneNodeAnimatorCollisionResponse;
00112 class ILightSceneNode;
00113 class IBillboardSceneNode;
00114 class ITerrainSceneNode;
00115 class IMeshSceneNode;
00116 class IMeshLoader;
00117 class ISceneCollisionManager;
00118 class IParticleSystemSceneNode;
00119 class IDummyTransformationSceneNode;
00120 class ITriangleSelector;
00121 class IMetaTriangleSelector;
00122 class IMeshManipulator;
00123 class ITextSceneNode;
00124 class ISceneNodeFactory;
00125 class ISceneNodeAnimatorFactory;
00126 class ISceneUserDataSerializer;
00127
00128 namespace quake3
00129 {
00130 class SShader;
00131 }
00132
00134
00151 class ISceneManager : public virtual IReferenceCounted
00152 {
00153 public:
00154
00156 virtual ~ISceneManager() {}
00157
00159
00349 virtual IAnimatedMesh* getMesh(const c8* filename) = 0;
00350
00352
00358 virtual IAnimatedMesh* getMesh(io::IReadFile* file) = 0;
00359
00361
00364 virtual IMeshCache* getMeshCache() = 0;
00365
00367
00369 virtual video::IVideoDriver* getVideoDriver() = 0;
00370
00372
00374 virtual gui::IGUIEnvironment* getGUIEnvironment() = 0;
00375
00377
00388 virtual ISceneNode* addCubeSceneNode(f32 size=10.0f, ISceneNode* parent=0, s32 id=-1,
00389 const core::vector3df& position = core::vector3df(0,0,0),
00390 const core::vector3df& rotation = core::vector3df(0,0,0),
00391 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
00392
00394
00406 virtual ISceneNode* addSphereSceneNode(f32 radius=5.0f, s32 polyCount=16,
00407 ISceneNode* parent=0, s32 id=-1,
00408 const core::vector3df& position = core::vector3df(0,0,0),
00409 const core::vector3df& rotation = core::vector3df(0,0,0),
00410 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
00411
00413
00423 virtual IAnimatedMeshSceneNode* addAnimatedMeshSceneNode(IAnimatedMesh* mesh,
00424 ISceneNode* parent=0, s32 id=-1,
00425 const core::vector3df& position = core::vector3df(0,0,0),
00426 const core::vector3df& rotation = core::vector3df(0,0,0),
00427 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f),
00428 bool alsoAddIfMeshPointerZero=false) = 0;
00429
00431
00441 virtual IMeshSceneNode* addMeshSceneNode(IMesh* mesh, ISceneNode* parent=0, s32 id=-1,
00442 const core::vector3df& position = core::vector3df(0,0,0),
00443 const core::vector3df& rotation = core::vector3df(0,0,0),
00444 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f),
00445 bool alsoAddIfMeshPointerZero=false) = 0;
00446
00448
00462 virtual ISceneNode* addWaterSurfaceSceneNode(IMesh* mesh,
00463 f32 waveHeight=2.0f, f32 waveSpeed=300.0f, f32 waveLength=10.0f,
00464 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
00469
00471
00483 virtual ISceneNode* addOctTreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0,
00484 s32 id=-1, s32 minimalPolysPerNode=256, bool alsoAddIfMeshPointerZero=false) = 0;
00485
00487
00499 virtual ISceneNode* addOctTreeSceneNode(IMesh* mesh, ISceneNode* parent=0,
00500 s32 id=-1, s32 minimalPolysPerNode=256, bool alsoAddIfMeshPointerZero=false) = 0;
00501
00503
00513 virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0,
00514 const core::vector3df& position = core::vector3df(0,0,0),
00515 const core::vector3df& lookat = core::vector3df(0,0,100), s32 id=-1) = 0;
00516
00518
00527 virtual ICameraSceneNode* addCameraSceneNodeMaya(ISceneNode* parent = 0,
00528 f32 rotateSpeed = -1500.0f, f32 zoomSpeed = 200.0f,
00529 f32 translationSpeed = 1500.0f, s32 id=-1) = 0;
00530
00532
00577 virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0,
00578 f32 rotateSpeed = 100.0f, f32 moveSpeed = 500.0f, s32 id=-1,
00579 SKeyMap* keyMapArray=0, s32 keyMapSize=0, bool noVerticalMovement=false,
00580 f32 jumpSpeed = 0.f) = 0;
00581
00583
00595 virtual ILightSceneNode* addLightSceneNode(ISceneNode* parent = 0,
00596 const core::vector3df& position = core::vector3df(0,0,0),
00597 video::SColorf color = video::SColorf(1.0f, 1.0f, 1.0f),
00598 f32 radius=100.0f, s32 id=-1) = 0;
00599
00601
00615 virtual IBillboardSceneNode* addBillboardSceneNode(ISceneNode* parent = 0,
00616 const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f),
00617 const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1,
00618 video::SColor shade_top = 0xFFFFFFFF, video::SColor shade_down = 0xFFFFFFFF) = 0;
00619
00621
00635 virtual ISceneNode* addSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom,
00636 video::ITexture* left, video::ITexture* right, video::ITexture* front,
00637 video::ITexture* back, ISceneNode* parent = 0, s32 id=-1) = 0;
00638
00640
00656 virtual ISceneNode* addSkyDomeSceneNode(video::ITexture* texture,
00657 u32 horiRes, u32 vertRes, f64 texturePercentage, f64 spherePercentage,
00658 ISceneNode* parent = 0, s32 id=-1) = 0;
00659
00661
00673 virtual IParticleSystemSceneNode* addParticleSystemSceneNode(
00674 bool withDefaultEmitter=true, ISceneNode* parent=0, s32 id=-1,
00675 const core::vector3df& position = core::vector3df(0,0,0),
00676 const core::vector3df& rotation = core::vector3df(0,0,0),
00677 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
00678
00680
00735 virtual ITerrainSceneNode* addTerrainSceneNode(
00736 const c8* heightMapFileName,
00737 ISceneNode* parent=0, s32 id=-1,
00738 const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f),
00739 const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f),
00740 const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f),
00741 video::SColor vertexColor = video::SColor(255,255,255,255),
00742 s32 maxLOD=5, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17, s32 smoothFactor=0,
00743 bool addAlsoIfHeightmapEmpty = false) = 0;
00744
00746
00773 virtual ITerrainSceneNode* addTerrainSceneNode(
00774 io::IReadFile* heightMapFile,
00775 ISceneNode* parent=0, s32 id=-1,
00776 const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f),
00777 const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f),
00778 const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f),
00779 video::SColor vertexColor = video::SColor(255,255,255,255),
00780 s32 maxLOD=5, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17, s32 smoothFactor=0,
00781 bool addAlsoIfHeightmapEmpty = false) = 0;
00782
00784
00787 virtual ISceneNode* addQuake3SceneNode(IMeshBuffer* meshBuffer, const quake3::SShader * shader,
00788 ISceneNode* parent=0, s32 id=-1
00789 ) = 0;
00790
00791
00793
00797 virtual ISceneNode* addEmptySceneNode(ISceneNode* parent=0, s32 id=-1) = 0;
00798
00800
00806 virtual IDummyTransformationSceneNode* addDummyTransformationSceneNode(
00807 ISceneNode* parent=0, s32 id=-1) = 0;
00808
00810 virtual ITextSceneNode* addTextSceneNode(gui::IGUIFont* font, const wchar_t* text,
00811 video::SColor color=video::SColor(100,255,255,255),
00812 ISceneNode* parent = 0, const core::vector3df& position = core::vector3df(0,0,0),
00813 s32 id=-1) = 0;
00814
00816 virtual ITextSceneNode* addBillboardTextSceneNode( gui::IGUIFont* font, const wchar_t* text,
00817 ISceneNode* parent = 0,
00818 const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f),
00819 const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1,
00820 video::SColor shade_top = 0xFFFFFFFF, video::SColor shade_down = 0xFFFFFFFF) = 0;
00821
00823
00849 virtual IAnimatedMesh* addHillPlaneMesh(const c8* name,
00850 const core::dimension2d<f32>& tileSize, const core::dimension2d<u32>& tileCount,
00851 video::SMaterial* material = 0, f32 hillHeight = 0.0f,
00852 const core::dimension2d<f32>& countHills = core::dimension2d<f32>(0.0f, 0.0f),
00853 const core::dimension2d<f32>& textureRepeatCount = core::dimension2d<f32>(1.0f, 1.0f)) = 0;
00854
00856
00878 virtual IAnimatedMesh* addTerrainMesh(const c8* meshname,
00879 video::IImage* texture, video::IImage* heightmap,
00880 const core::dimension2d<f32>& stretchSize = core::dimension2d<f32>(10.0f,10.0f),
00881 f32 maxHeight=200.0f,
00882 const core::dimension2d<s32>& defaultVertexBlockSize = core::dimension2d<s32>(64,64)) = 0;
00883
00885 virtual IAnimatedMesh* addArrowMesh(const c8* name,
00886 video::SColor vtxColor0=0xFFFFFFFF,
00887 video::SColor vtxColor1=0xFFFFFFFF,
00888 u32 tesselationCylinder=4, u32 tesselationCone=8,
00889 f32 height=1.f, f32 cylinderHeight=0.6f,
00890 f32 width0=0.05f, f32 width1=0.3f) = 0;
00891
00893 virtual IAnimatedMesh* addSphereMesh(const c8* name,
00894 f32 radius=5.f, u32 polyCountX = 16,
00895 u32 polyCountY = 16) = 0;
00896
00898
00903 virtual ISceneNode* getRootSceneNode() = 0;
00904
00906
00912 virtual ISceneNode* getSceneNodeFromId(s32 id, ISceneNode* start=0) = 0;
00913
00915
00921 virtual ISceneNode* getSceneNodeFromName(const c8* name, ISceneNode* start=0) = 0;
00922
00924
00930 virtual ISceneNode* getSceneNodeFromType(scene::ESCENE_NODE_TYPE type, ISceneNode* start=0) = 0;
00931
00933
00938 virtual void getSceneNodesFromType(ESCENE_NODE_TYPE type,
00939 core::array<scene::ISceneNode*>& outNodes,
00940 ISceneNode* start=0) = 0;
00941
00943
00945 virtual ICameraSceneNode* getActiveCamera() = 0;
00946
00948
00950 virtual void setActiveCamera(ICameraSceneNode* camera) = 0;
00951
00953 virtual void setShadowColor(video::SColor color = video::SColor(150,0,0,0)) = 0;
00954
00956 virtual video::SColor getShadowColor() const = 0;
00957
00959
00967 virtual u32 registerNodeForRendering(ISceneNode* node,
00968 E_SCENE_NODE_RENDER_PASS pass = ESNRP_AUTOMATIC) = 0;
00969
00971
00975 virtual void drawAll() = 0;
00976
00978
00983 virtual ISceneNodeAnimator* createRotationAnimator(const core::vector3df& rotationPerSecond) = 0;
00984
00986
00994 virtual ISceneNodeAnimator* createFlyCircleAnimator(const core::vector3df& center,
00995 f32 radius, f32 speed=0.001f,
00996 const core::vector3df& direction=core::vector3df ( 0.f, 1.f, 0.f ) ) = 0;
00997
00999
01009 virtual ISceneNodeAnimator* createFlyStraightAnimator(const core::vector3df& startPoint,
01010 const core::vector3df& endPoint, u32 timeForWay, bool loop=false) = 0;
01011
01013
01022 virtual ISceneNodeAnimator* createTextureAnimator(const core::array<video::ITexture*>& textures,
01023 s32 timePerFrame, bool loop=true) = 0;
01024
01026
01031 virtual ISceneNodeAnimator* createDeleteAnimator(u32 timeMs) = 0;
01032
01034
01062 virtual ISceneNodeAnimatorCollisionResponse* createCollisionResponseAnimator(
01063 ITriangleSelector* world, ISceneNode* sceneNode,
01064 const core::vector3df& ellipsoidRadius = core::vector3df(30,60,30),
01065 const core::vector3df& gravityPerSecond = core::vector3df(0,-100.0f,0),
01066 const core::vector3df& ellipsoidTranslation = core::vector3df(0,0,0),
01067 f32 slidingValue = 0.0005f) = 0;
01068
01070
01076 virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime,
01077 const core::array< core::vector3df >& points,
01078 f32 speed = 1.0f, f32 tightness = 0.5f) = 0;
01079
01081
01099 virtual ITriangleSelector* createTriangleSelector(IMesh* mesh, ISceneNode* node) = 0;
01100
01102
01110 virtual ITriangleSelector* createTriangleSelectorFromBoundingBox(ISceneNode* node) = 0;
01111
01113
01135 virtual ITriangleSelector* createOctTreeTriangleSelector(IMesh* mesh,
01136 ISceneNode* node, s32 minimalPolysPerNode=32) = 0;
01137
01139
01146 virtual IMetaTriangleSelector* createMetaTriangleSelector() = 0;
01147
01149
01151 virtual ITriangleSelector* createTerrainTriangleSelector(
01152 ITerrainSceneNode* node, s32 LOD=0) = 0;
01153
01155
01161 virtual void addExternalMeshLoader(IMeshLoader* externalLoader) = 0;
01162
01164 virtual ISceneCollisionManager* getSceneCollisionManager() = 0;
01165
01167 virtual IMeshManipulator* getMeshManipulator() = 0;
01168
01170
01178 virtual void addToDeletionQueue(ISceneNode* node) = 0;
01179
01181
01183 virtual bool postEventFromUser(const SEvent& event) = 0;
01184
01186
01187 virtual void clear() = 0;
01188
01190
01195 virtual io::IAttributes* getParameters() = 0;
01196
01198
01204 virtual E_SCENE_NODE_RENDER_PASS getSceneNodeRenderPass() const = 0;
01205
01207 virtual ISceneNodeFactory* getDefaultSceneNodeFactory() = 0;
01208
01210
01212 virtual void registerSceneNodeFactory(ISceneNodeFactory* factoryToAdd) = 0;
01213
01215 virtual u32 getRegisteredSceneNodeFactoryCount() const = 0;
01216
01218 virtual ISceneNodeFactory* getSceneNodeFactory(u32 index) = 0;
01219
01221 virtual ISceneNodeAnimatorFactory* getDefaultSceneNodeAnimatorFactory() = 0;
01222
01224
01226 virtual void registerSceneNodeAnimatorFactory(ISceneNodeAnimatorFactory* factoryToAdd) = 0;
01227
01229 virtual u32 getRegisteredSceneNodeAnimatorFactoryCount() const = 0;
01230
01232 virtual ISceneNodeAnimatorFactory* getSceneNodeAnimatorFactory(u32 index) = 0;
01233
01235 virtual const c8* getSceneNodeTypeName(ESCENE_NODE_TYPE type) = 0;
01236
01238 virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0) = 0;
01239
01241
01259 virtual ISceneManager* createNewSceneManager(bool cloneContent=false) = 0;
01260
01262
01271 virtual bool saveScene(const c8* filename, ISceneUserDataSerializer* userDataSerializer=0) = 0;
01272
01274
01283 virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0) = 0;
01284
01286
01296 virtual bool loadScene(const c8* filename, ISceneUserDataSerializer* userDataSerializer=0) = 0;
01297
01299
01309 virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0) = 0;
01310
01312
01314 virtual IMeshWriter* createMeshWriter(EMESH_WRITER_TYPE type) = 0;
01315
01317 virtual void setAmbientLight(const video::SColorf &ambientColor) = 0;
01318
01320 virtual const video::SColorf& getAmbientLight() const = 0;
01321
01322 };
01323
01324
01325 }
01326 }
01327
01328 #endif
01329