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 {
00052 class IMeshWriter;
00053
00055
00057 enum E_SCENE_NODE_RENDER_PASS
00058 {
00060 ESNRP_NONE =0,
00061
00063 ESNRP_CAMERA =1,
00064
00066 ESNRP_LIGHT =2,
00067
00069 ESNRP_SKY_BOX =4,
00070
00072
00084 ESNRP_AUTOMATIC =24,
00085
00087 ESNRP_SOLID =8,
00088
00090 ESNRP_TRANSPARENT =16,
00091
00093 ESNRP_TRANSPARENT_EFFECT =32,
00094
00096 ESNRP_SHADOW =64
00097 };
00098
00099 class IMesh;
00100 class IMeshBuffer;
00101 class IAnimatedMesh;
00102 class IMeshCache;
00103 class ISceneNode;
00104 class ICameraSceneNode;
00105 class IAnimatedMeshSceneNode;
00106 class ISceneNodeAnimator;
00107 class ISceneNodeAnimatorCollisionResponse;
00108 class ILightSceneNode;
00109 class IBillboardSceneNode;
00110 class ITerrainSceneNode;
00111 class IMeshSceneNode;
00112 class IMeshLoader;
00113 class ISceneCollisionManager;
00114 class IParticleSystemSceneNode;
00115 class IDummyTransformationSceneNode;
00116 class ITriangleSelector;
00117 class IMetaTriangleSelector;
00118 class IMeshManipulator;
00119 class ITextSceneNode;
00120 class IBillboardTextSceneNode;
00121 class IVolumeLightSceneNode;
00122 class ISceneNodeFactory;
00123 class ISceneNodeAnimatorFactory;
00124 class ISceneUserDataSerializer;
00125 class ILightManager;
00126
00127 namespace quake3
00128 {
00129 struct IShader;
00130 }
00131
00133
00150 class ISceneManager : public virtual IReferenceCounted
00151 {
00152 public:
00153
00155 virtual ~ISceneManager() {}
00156
00158
00347 virtual IAnimatedMesh* getMesh(const io::path& filename) = 0;
00348
00350
00356 virtual IAnimatedMesh* getMesh(io::IReadFile* file) = 0;
00357
00359
00362 virtual IMeshCache* getMeshCache() = 0;
00363
00365
00367 virtual video::IVideoDriver* getVideoDriver() = 0;
00368
00370
00372 virtual gui::IGUIEnvironment* getGUIEnvironment() = 0;
00373
00375
00377 virtual io::IFileSystem* getFileSystem() = 0;
00378
00380
00393 virtual IVolumeLightSceneNode* addVolumeLightSceneNode(ISceneNode* parent=0, s32 id=-1,
00394 const u32 subdivU = 32, const u32 subdivV = 32,
00395 const video::SColor foot = video::SColor(51, 0, 230, 180),
00396 const video::SColor tail = video::SColor(0, 0, 0, 0),
00397 const core::vector3df& position = core::vector3df(0,0,0),
00398 const core::vector3df& rotation = core::vector3df(0,0,0),
00399 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
00400
00402
00412 virtual IMeshSceneNode* addCubeSceneNode(f32 size=10.0f, ISceneNode* parent=0, s32 id=-1,
00413 const core::vector3df& position = core::vector3df(0,0,0),
00414 const core::vector3df& rotation = core::vector3df(0,0,0),
00415 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
00416
00418
00432 virtual IMeshSceneNode* addSphereSceneNode(f32 radius=5.0f, s32 polyCount=16,
00433 ISceneNode* parent=0, s32 id=-1,
00434 const core::vector3df& position = core::vector3df(0,0,0),
00435 const core::vector3df& rotation = core::vector3df(0,0,0),
00436 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
00437
00439
00449 virtual IAnimatedMeshSceneNode* addAnimatedMeshSceneNode(IAnimatedMesh* mesh,
00450 ISceneNode* parent=0, s32 id=-1,
00451 const core::vector3df& position = core::vector3df(0,0,0),
00452 const core::vector3df& rotation = core::vector3df(0,0,0),
00453 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f),
00454 bool alsoAddIfMeshPointerZero=false) = 0;
00455
00457
00467 virtual IMeshSceneNode* addMeshSceneNode(IMesh* mesh, ISceneNode* parent=0, s32 id=-1,
00468 const core::vector3df& position = core::vector3df(0,0,0),
00469 const core::vector3df& rotation = core::vector3df(0,0,0),
00470 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f),
00471 bool alsoAddIfMeshPointerZero=false) = 0;
00472
00474
00488 virtual ISceneNode* addWaterSurfaceSceneNode(IMesh* mesh,
00489 f32 waveHeight=2.0f, f32 waveSpeed=300.0f, f32 waveLength=10.0f,
00490 ISceneNode* parent=0, s32 id=-1,
00491 const core::vector3df& position = core::vector3df(0,0,0),
00492 const core::vector3df& rotation = core::vector3df(0,0,0),
00493 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
00494
00495
00497
00509 virtual IMeshSceneNode* addOctreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0,
00510 s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false) = 0;
00511
00513
00514 _IRR_DEPRECATED_ IMeshSceneNode* addOctTreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0,
00515 s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false)
00516 {
00517 return addOctreeSceneNode(mesh, parent, id, minimalPolysPerNode, alsoAddIfMeshPointerZero);
00518 }
00519
00521
00533 virtual IMeshSceneNode* addOctreeSceneNode(IMesh* mesh, ISceneNode* parent=0,
00534 s32 id=-1, s32 minimalPolysPerNode=256, bool alsoAddIfMeshPointerZero=false) = 0;
00535
00537
00538 _IRR_DEPRECATED_ IMeshSceneNode* addOctTreeSceneNode(IMesh* mesh, ISceneNode* parent=0,
00539 s32 id=-1, s32 minimalPolysPerNode=256, bool alsoAddIfMeshPointerZero=false)
00540 {
00541 return addOctreeSceneNode(mesh, parent, id, minimalPolysPerNode, alsoAddIfMeshPointerZero);
00542 }
00543
00545
00561 virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0,
00562 const core::vector3df& position = core::vector3df(0,0,0),
00563 const core::vector3df& lookat = core::vector3df(0,0,100),
00564 s32 id=-1, bool makeActive=true) = 0;
00565
00567
00578 virtual ICameraSceneNode* addCameraSceneNodeMaya(ISceneNode* parent = 0,
00579 f32 rotateSpeed = -1500.0f, f32 zoomSpeed = 200.0f,
00580 f32 translationSpeed = 1500.0f, s32 id=-1,
00581 bool makeActive=true) = 0;
00582
00584
00647 virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0,
00648 f32 rotateSpeed = 100.0f, f32 moveSpeed = 0.5f, s32 id=-1,
00649 SKeyMap* keyMapArray=0, s32 keyMapSize=0, bool noVerticalMovement=false,
00650 f32 jumpSpeed = 0.f, bool invertMouse=false,
00651 bool makeActive=true) = 0;
00652
00654
00666 virtual ILightSceneNode* addLightSceneNode(ISceneNode* parent = 0,
00667 const core::vector3df& position = core::vector3df(0,0,0),
00668 video::SColorf color = video::SColorf(1.0f, 1.0f, 1.0f),
00669 f32 radius=100.0f, s32 id=-1) = 0;
00670
00672
00690 virtual IBillboardSceneNode* addBillboardSceneNode(ISceneNode* parent = 0,
00691 const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f),
00692 const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1,
00693 video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF) = 0;
00694
00696
00710 virtual ISceneNode* addSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom,
00711 video::ITexture* left, video::ITexture* right, video::ITexture* front,
00712 video::ITexture* back, ISceneNode* parent = 0, s32 id=-1) = 0;
00713
00715
00732 virtual ISceneNode* addSkyDomeSceneNode(video::ITexture* texture,
00733 u32 horiRes=16, u32 vertRes=8,
00734 f32 texturePercentage=0.9, f32 spherePercentage=2.0,f32 radius = 1000.f,
00735 ISceneNode* parent=0, s32 id=-1) = 0;
00736
00738
00750 virtual IParticleSystemSceneNode* addParticleSystemSceneNode(
00751 bool withDefaultEmitter=true, ISceneNode* parent=0, s32 id=-1,
00752 const core::vector3df& position = core::vector3df(0,0,0),
00753 const core::vector3df& rotation = core::vector3df(0,0,0),
00754 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
00755
00757
00812 virtual ITerrainSceneNode* addTerrainSceneNode(
00813 const io::path& heightMapFileName,
00814 ISceneNode* parent=0, s32 id=-1,
00815 const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f),
00816 const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f),
00817 const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f),
00818 video::SColor vertexColor = video::SColor(255,255,255,255),
00819 s32 maxLOD=5, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17, s32 smoothFactor=0,
00820 bool addAlsoIfHeightmapEmpty = false) = 0;
00821
00823
00850 virtual ITerrainSceneNode* addTerrainSceneNode(
00851 io::IReadFile* heightMapFile,
00852 ISceneNode* parent=0, s32 id=-1,
00853 const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f),
00854 const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f),
00855 const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f),
00856 video::SColor vertexColor = video::SColor(255,255,255,255),
00857 s32 maxLOD=5, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17, s32 smoothFactor=0,
00858 bool addAlsoIfHeightmapEmpty = false) = 0;
00859
00861
00864 virtual IMeshSceneNode* addQuake3SceneNode(const IMeshBuffer* meshBuffer, const quake3::IShader * shader,
00865 ISceneNode* parent=0, s32 id=-1
00866 ) = 0;
00867
00868
00870
00874 virtual ISceneNode* addEmptySceneNode(ISceneNode* parent=0, s32 id=-1) = 0;
00875
00877
00883 virtual IDummyTransformationSceneNode* addDummyTransformationSceneNode(
00884 ISceneNode* parent=0, s32 id=-1) = 0;
00885
00887 virtual ITextSceneNode* addTextSceneNode(gui::IGUIFont* font, const wchar_t* text,
00888 video::SColor color=video::SColor(100,255,255,255),
00889 ISceneNode* parent = 0, const core::vector3df& position = core::vector3df(0,0,0),
00890 s32 id=-1) = 0;
00891
00893
00904 virtual IBillboardTextSceneNode* addBillboardTextSceneNode( gui::IGUIFont* font, const wchar_t* text,
00905 ISceneNode* parent = 0,
00906 const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f),
00907 const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1,
00908 video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF) = 0;
00909
00911
00937 virtual IAnimatedMesh* addHillPlaneMesh(const io::path& name,
00938 const core::dimension2d<f32>& tileSize, const core::dimension2d<u32>& tileCount,
00939 video::SMaterial* material = 0, f32 hillHeight = 0.0f,
00940 const core::dimension2d<f32>& countHills = core::dimension2d<f32>(0.0f, 0.0f),
00941 const core::dimension2d<f32>& textureRepeatCount = core::dimension2d<f32>(1.0f, 1.0f)) = 0;
00942
00944
00966 virtual IAnimatedMesh* addTerrainMesh(const io::path& meshname,
00967 video::IImage* texture, video::IImage* heightmap,
00968 const core::dimension2d<f32>& stretchSize = core::dimension2d<f32>(10.0f,10.0f),
00969 f32 maxHeight=200.0f,
00970 const core::dimension2d<u32>& defaultVertexBlockSize = core::dimension2d<u32>(64,64)) = 0;
00971
00973
00984 virtual IAnimatedMesh* addArrowMesh(const io::path& name,
00985 video::SColor vtxColor0=0xFFFFFFFF,
00986 video::SColor vtxColor1=0xFFFFFFFF,
00987 u32 tesselationCylinder=4, u32 tesselationCone=8,
00988 f32 height=1.f, f32 cylinderHeight=0.6f,
00989 f32 width0=0.05f, f32 width1=0.3f) = 0;
00990
00992
00998 virtual IAnimatedMesh* addSphereMesh(const io::path& name,
00999 f32 radius=5.f, u32 polyCountX = 16,
01000 u32 polyCountY = 16) = 0;
01001
01003
01011 virtual IAnimatedMesh* addVolumeLightMesh(const io::path& name,
01012 const u32 SubdivideU = 32, const u32 SubdivideV = 32,
01013 const video::SColor FootColor = video::SColor(51, 0, 230, 180),
01014 const video::SColor TailColor = video::SColor(0, 0, 0, 0)) = 0;
01015
01017
01023 virtual ISceneNode* getRootSceneNode() = 0;
01024
01026
01033 virtual ISceneNode* getSceneNodeFromId(s32 id, ISceneNode* start=0) = 0;
01034
01036
01043 virtual ISceneNode* getSceneNodeFromName(const c8* name, ISceneNode* start=0) = 0;
01044
01046
01053 virtual ISceneNode* getSceneNodeFromType(scene::ESCENE_NODE_TYPE type, ISceneNode* start=0) = 0;
01054
01056
01061 virtual void getSceneNodesFromType(ESCENE_NODE_TYPE type,
01062 core::array<scene::ISceneNode*>& outNodes,
01063 ISceneNode* start=0) = 0;
01064
01066
01069 virtual ICameraSceneNode* getActiveCamera() const =0;
01070
01072
01074 virtual void setActiveCamera(ICameraSceneNode* camera) = 0;
01075
01077 virtual void setShadowColor(video::SColor color = video::SColor(150,0,0,0)) = 0;
01078
01080 virtual video::SColor getShadowColor() const = 0;
01081
01083
01091 virtual u32 registerNodeForRendering(ISceneNode* node,
01092 E_SCENE_NODE_RENDER_PASS pass = ESNRP_AUTOMATIC) = 0;
01093
01095
01099 virtual void drawAll() = 0;
01100
01102
01107 virtual ISceneNodeAnimator* createRotationAnimator(const core::vector3df& rotationSpeed) = 0;
01108
01110
01122 virtual ISceneNodeAnimator* createFlyCircleAnimator(
01123 const core::vector3df& center=core::vector3df(0.f,0.f,0.f),
01124 f32 radius=100.f, f32 speed=0.001f,
01125 const core::vector3df& direction=core::vector3df(0.f, 1.f, 0.f),
01126 f32 startPosition = 0.f,
01127 f32 radiusEllipsoid = 0.f) = 0;
01128
01130
01142 virtual ISceneNodeAnimator* createFlyStraightAnimator(const core::vector3df& startPoint,
01143 const core::vector3df& endPoint, u32 timeForWay, bool loop=false, bool pingpong = false) = 0;
01144
01146
01155 virtual ISceneNodeAnimator* createTextureAnimator(const core::array<video::ITexture*>& textures,
01156 s32 timePerFrame, bool loop=true) = 0;
01157
01159
01164 virtual ISceneNodeAnimator* createDeleteAnimator(u32 timeMs) = 0;
01165
01167
01197 virtual ISceneNodeAnimatorCollisionResponse* createCollisionResponseAnimator(
01198 ITriangleSelector* world, ISceneNode* sceneNode,
01199 const core::vector3df& ellipsoidRadius = core::vector3df(30,60,30),
01200 const core::vector3df& gravityPerSecond = core::vector3df(0,-10.0f,0),
01201 const core::vector3df& ellipsoidTranslation = core::vector3df(0,0,0),
01202 f32 slidingValue = 0.0005f) = 0;
01203
01205
01213 virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime,
01214 const core::array< core::vector3df >& points,
01215 f32 speed = 1.0f, f32 tightness = 0.5f, bool loop=true, bool pingpong=false) = 0;
01216
01218
01236 virtual ITriangleSelector* createTriangleSelector(IMesh* mesh, ISceneNode* node) = 0;
01237
01239
01244 virtual ITriangleSelector* createTriangleSelector(IAnimatedMeshSceneNode* node) = 0;
01245
01246
01248
01256 virtual ITriangleSelector* createTriangleSelectorFromBoundingBox(ISceneNode* node) = 0;
01257
01259
01281 virtual ITriangleSelector* createOctreeTriangleSelector(IMesh* mesh,
01282 ISceneNode* node, s32 minimalPolysPerNode=32) = 0;
01283
01285
01286 _IRR_DEPRECATED_ ITriangleSelector* createOctTreeTriangleSelector(IMesh* mesh,
01287 ISceneNode* node, s32 minimalPolysPerNode=32)
01288 {
01289 return createOctreeTriangleSelector(mesh, node, minimalPolysPerNode);
01290 }
01291
01293
01300 virtual IMetaTriangleSelector* createMetaTriangleSelector() = 0;
01301
01303
01308 virtual ITriangleSelector* createTerrainTriangleSelector(
01309 ITerrainSceneNode* node, s32 LOD=0) = 0;
01310
01312
01318 virtual void addExternalMeshLoader(IMeshLoader* externalLoader) = 0;
01319
01321
01323 virtual ISceneCollisionManager* getSceneCollisionManager() = 0;
01324
01326
01328 virtual IMeshManipulator* getMeshManipulator() = 0;
01329
01331
01339 virtual void addToDeletionQueue(ISceneNode* node) = 0;
01340
01342
01344 virtual bool postEventFromUser(const SEvent& event) = 0;
01345
01347
01348 virtual void clear() = 0;
01349
01351
01356 virtual io::IAttributes* getParameters() = 0;
01357
01359
01365 virtual E_SCENE_NODE_RENDER_PASS getSceneNodeRenderPass() const = 0;
01366
01368
01370 virtual ISceneNodeFactory* getDefaultSceneNodeFactory() = 0;
01371
01373
01375 virtual void registerSceneNodeFactory(ISceneNodeFactory* factoryToAdd) = 0;
01376
01378 virtual u32 getRegisteredSceneNodeFactoryCount() const = 0;
01379
01381
01383 virtual ISceneNodeFactory* getSceneNodeFactory(u32 index) = 0;
01384
01386
01388 virtual ISceneNodeAnimatorFactory* getDefaultSceneNodeAnimatorFactory() = 0;
01389
01391
01393 virtual void registerSceneNodeAnimatorFactory(ISceneNodeAnimatorFactory* factoryToAdd) = 0;
01394
01396 virtual u32 getRegisteredSceneNodeAnimatorFactoryCount() const = 0;
01397
01399
01401 virtual ISceneNodeAnimatorFactory* getSceneNodeAnimatorFactory(u32 index) = 0;
01402
01404 virtual const c8* getSceneNodeTypeName(ESCENE_NODE_TYPE type) = 0;
01405
01407 virtual const c8* getAnimatorTypeName(ESCENE_NODE_ANIMATOR_TYPE type) = 0;
01408
01410
01412 virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0) = 0;
01413
01415
01433 virtual ISceneManager* createNewSceneManager(bool cloneContent=false) = 0;
01434
01436
01445 virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0) = 0;
01446
01448
01457 virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0) = 0;
01458
01460
01470 virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0) = 0;
01471
01473
01483 virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0) = 0;
01484
01486
01488 virtual IMeshWriter* createMeshWriter(EMESH_WRITER_TYPE type) = 0;
01489
01491
01493 virtual ISkinnedMesh* createSkinnedMesh() = 0;
01494
01496 virtual void setAmbientLight(const video::SColorf &ambientColor) = 0;
01497
01499 virtual const video::SColorf& getAmbientLight() const = 0;
01500
01502
01504 virtual void setLightManager(ILightManager* lightManager) = 0;
01505
01507
01509 virtual const IGeometryCreator* getGeometryCreator(void) const = 0;
01510
01512
01520 virtual bool isCulled(const ISceneNode* node) const =0;
01521 };
01522
01523
01524 }
01525 }
01526
01527 #endif
01528