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
00686 virtual IBillboardSceneNode* addBillboardSceneNode(ISceneNode* parent = 0,
00687 const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f),
00688 const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1,
00689 video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF) = 0;
00690
00692
00706 virtual ISceneNode* addSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom,
00707 video::ITexture* left, video::ITexture* right, video::ITexture* front,
00708 video::ITexture* back, ISceneNode* parent = 0, s32 id=-1) = 0;
00709
00711
00728 virtual ISceneNode* addSkyDomeSceneNode(video::ITexture* texture,
00729 u32 horiRes=16, u32 vertRes=8,
00730 f32 texturePercentage=0.9, f32 spherePercentage=2.0,f32 radius = 1000.f,
00731 ISceneNode* parent=0, s32 id=-1) = 0;
00732
00734
00746 virtual IParticleSystemSceneNode* addParticleSystemSceneNode(
00747 bool withDefaultEmitter=true, ISceneNode* parent=0, s32 id=-1,
00748 const core::vector3df& position = core::vector3df(0,0,0),
00749 const core::vector3df& rotation = core::vector3df(0,0,0),
00750 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
00751
00753
00808 virtual ITerrainSceneNode* addTerrainSceneNode(
00809 const io::path& heightMapFileName,
00810 ISceneNode* parent=0, s32 id=-1,
00811 const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f),
00812 const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f),
00813 const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f),
00814 video::SColor vertexColor = video::SColor(255,255,255,255),
00815 s32 maxLOD=5, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17, s32 smoothFactor=0,
00816 bool addAlsoIfHeightmapEmpty = false) = 0;
00817
00819
00846 virtual ITerrainSceneNode* addTerrainSceneNode(
00847 io::IReadFile* heightMapFile,
00848 ISceneNode* parent=0, s32 id=-1,
00849 const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f),
00850 const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f),
00851 const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f),
00852 video::SColor vertexColor = video::SColor(255,255,255,255),
00853 s32 maxLOD=5, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17, s32 smoothFactor=0,
00854 bool addAlsoIfHeightmapEmpty = false) = 0;
00855
00857
00860 virtual IMeshSceneNode* addQuake3SceneNode(const IMeshBuffer* meshBuffer, const quake3::IShader * shader,
00861 ISceneNode* parent=0, s32 id=-1
00862 ) = 0;
00863
00864
00866
00870 virtual ISceneNode* addEmptySceneNode(ISceneNode* parent=0, s32 id=-1) = 0;
00871
00873
00879 virtual IDummyTransformationSceneNode* addDummyTransformationSceneNode(
00880 ISceneNode* parent=0, s32 id=-1) = 0;
00881
00883 virtual ITextSceneNode* addTextSceneNode(gui::IGUIFont* font, const wchar_t* text,
00884 video::SColor color=video::SColor(100,255,255,255),
00885 ISceneNode* parent = 0, const core::vector3df& position = core::vector3df(0,0,0),
00886 s32 id=-1) = 0;
00887
00889
00900 virtual IBillboardTextSceneNode* addBillboardTextSceneNode( gui::IGUIFont* font, const wchar_t* text,
00901 ISceneNode* parent = 0,
00902 const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f),
00903 const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1,
00904 video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF) = 0;
00905
00907
00933 virtual IAnimatedMesh* addHillPlaneMesh(const io::path& name,
00934 const core::dimension2d<f32>& tileSize, const core::dimension2d<u32>& tileCount,
00935 video::SMaterial* material = 0, f32 hillHeight = 0.0f,
00936 const core::dimension2d<f32>& countHills = core::dimension2d<f32>(0.0f, 0.0f),
00937 const core::dimension2d<f32>& textureRepeatCount = core::dimension2d<f32>(1.0f, 1.0f)) = 0;
00938
00940
00962 virtual IAnimatedMesh* addTerrainMesh(const io::path& meshname,
00963 video::IImage* texture, video::IImage* heightmap,
00964 const core::dimension2d<f32>& stretchSize = core::dimension2d<f32>(10.0f,10.0f),
00965 f32 maxHeight=200.0f,
00966 const core::dimension2d<u32>& defaultVertexBlockSize = core::dimension2d<u32>(64,64)) = 0;
00967
00969
00980 virtual IAnimatedMesh* addArrowMesh(const io::path& name,
00981 video::SColor vtxColor0=0xFFFFFFFF,
00982 video::SColor vtxColor1=0xFFFFFFFF,
00983 u32 tesselationCylinder=4, u32 tesselationCone=8,
00984 f32 height=1.f, f32 cylinderHeight=0.6f,
00985 f32 width0=0.05f, f32 width1=0.3f) = 0;
00986
00988
00994 virtual IAnimatedMesh* addSphereMesh(const io::path& name,
00995 f32 radius=5.f, u32 polyCountX = 16,
00996 u32 polyCountY = 16) = 0;
00997
00999
01007 virtual IAnimatedMesh* addVolumeLightMesh(const io::path& name,
01008 const u32 SubdivideU = 32, const u32 SubdivideV = 32,
01009 const video::SColor FootColor = video::SColor(51, 0, 230, 180),
01010 const video::SColor TailColor = video::SColor(0, 0, 0, 0)) = 0;
01011
01013
01019 virtual ISceneNode* getRootSceneNode() = 0;
01020
01022
01029 virtual ISceneNode* getSceneNodeFromId(s32 id, ISceneNode* start=0) = 0;
01030
01032
01039 virtual ISceneNode* getSceneNodeFromName(const c8* name, ISceneNode* start=0) = 0;
01040
01042
01049 virtual ISceneNode* getSceneNodeFromType(scene::ESCENE_NODE_TYPE type, ISceneNode* start=0) = 0;
01050
01052
01057 virtual void getSceneNodesFromType(ESCENE_NODE_TYPE type,
01058 core::array<scene::ISceneNode*>& outNodes,
01059 ISceneNode* start=0) = 0;
01060
01062
01065 virtual ICameraSceneNode* getActiveCamera() const =0;
01066
01068
01070 virtual void setActiveCamera(ICameraSceneNode* camera) = 0;
01071
01073 virtual void setShadowColor(video::SColor color = video::SColor(150,0,0,0)) = 0;
01074
01076 virtual video::SColor getShadowColor() const = 0;
01077
01079
01087 virtual u32 registerNodeForRendering(ISceneNode* node,
01088 E_SCENE_NODE_RENDER_PASS pass = ESNRP_AUTOMATIC) = 0;
01089
01091
01095 virtual void drawAll() = 0;
01096
01098
01103 virtual ISceneNodeAnimator* createRotationAnimator(const core::vector3df& rotationSpeed) = 0;
01104
01106
01118 virtual ISceneNodeAnimator* createFlyCircleAnimator(
01119 const core::vector3df& center=core::vector3df(0.f,0.f,0.f),
01120 f32 radius=100.f, f32 speed=0.001f,
01121 const core::vector3df& direction=core::vector3df(0.f, 1.f, 0.f),
01122 f32 startPosition = 0.f,
01123 f32 radiusEllipsoid = 0.f) = 0;
01124
01126
01138 virtual ISceneNodeAnimator* createFlyStraightAnimator(const core::vector3df& startPoint,
01139 const core::vector3df& endPoint, u32 timeForWay, bool loop=false, bool pingpong = false) = 0;
01140
01142
01151 virtual ISceneNodeAnimator* createTextureAnimator(const core::array<video::ITexture*>& textures,
01152 s32 timePerFrame, bool loop=true) = 0;
01153
01155
01160 virtual ISceneNodeAnimator* createDeleteAnimator(u32 timeMs) = 0;
01161
01163
01193 virtual ISceneNodeAnimatorCollisionResponse* createCollisionResponseAnimator(
01194 ITriangleSelector* world, ISceneNode* sceneNode,
01195 const core::vector3df& ellipsoidRadius = core::vector3df(30,60,30),
01196 const core::vector3df& gravityPerSecond = core::vector3df(0,-10.0f,0),
01197 const core::vector3df& ellipsoidTranslation = core::vector3df(0,0,0),
01198 f32 slidingValue = 0.0005f) = 0;
01199
01201
01209 virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime,
01210 const core::array< core::vector3df >& points,
01211 f32 speed = 1.0f, f32 tightness = 0.5f, bool loop=true, bool pingpong=false) = 0;
01212
01214
01232 virtual ITriangleSelector* createTriangleSelector(IMesh* mesh, ISceneNode* node) = 0;
01233
01235
01240 virtual ITriangleSelector* createTriangleSelector(IAnimatedMeshSceneNode* node) = 0;
01241
01242
01244
01252 virtual ITriangleSelector* createTriangleSelectorFromBoundingBox(ISceneNode* node) = 0;
01253
01255
01277 virtual ITriangleSelector* createOctreeTriangleSelector(IMesh* mesh,
01278 ISceneNode* node, s32 minimalPolysPerNode=32) = 0;
01279
01281
01282 _IRR_DEPRECATED_ ITriangleSelector* createOctTreeTriangleSelector(IMesh* mesh,
01283 ISceneNode* node, s32 minimalPolysPerNode=32)
01284 {
01285 return createOctreeTriangleSelector(mesh, node, minimalPolysPerNode);
01286 }
01287
01289
01296 virtual IMetaTriangleSelector* createMetaTriangleSelector() = 0;
01297
01299
01304 virtual ITriangleSelector* createTerrainTriangleSelector(
01305 ITerrainSceneNode* node, s32 LOD=0) = 0;
01306
01308
01314 virtual void addExternalMeshLoader(IMeshLoader* externalLoader) = 0;
01315
01317
01319 virtual ISceneCollisionManager* getSceneCollisionManager() = 0;
01320
01322
01324 virtual IMeshManipulator* getMeshManipulator() = 0;
01325
01327
01335 virtual void addToDeletionQueue(ISceneNode* node) = 0;
01336
01338
01340 virtual bool postEventFromUser(const SEvent& event) = 0;
01341
01343
01344 virtual void clear() = 0;
01345
01347
01352 virtual io::IAttributes* getParameters() = 0;
01353
01355
01361 virtual E_SCENE_NODE_RENDER_PASS getSceneNodeRenderPass() const = 0;
01362
01364
01366 virtual ISceneNodeFactory* getDefaultSceneNodeFactory() = 0;
01367
01369
01371 virtual void registerSceneNodeFactory(ISceneNodeFactory* factoryToAdd) = 0;
01372
01374 virtual u32 getRegisteredSceneNodeFactoryCount() const = 0;
01375
01377
01379 virtual ISceneNodeFactory* getSceneNodeFactory(u32 index) = 0;
01380
01382
01384 virtual ISceneNodeAnimatorFactory* getDefaultSceneNodeAnimatorFactory() = 0;
01385
01387
01389 virtual void registerSceneNodeAnimatorFactory(ISceneNodeAnimatorFactory* factoryToAdd) = 0;
01390
01392 virtual u32 getRegisteredSceneNodeAnimatorFactoryCount() const = 0;
01393
01395
01397 virtual ISceneNodeAnimatorFactory* getSceneNodeAnimatorFactory(u32 index) = 0;
01398
01400 virtual const c8* getSceneNodeTypeName(ESCENE_NODE_TYPE type) = 0;
01401
01403 virtual const c8* getAnimatorTypeName(ESCENE_NODE_ANIMATOR_TYPE type) = 0;
01404
01406
01408 virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0) = 0;
01409
01411
01429 virtual ISceneManager* createNewSceneManager(bool cloneContent=false) = 0;
01430
01432
01441 virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0) = 0;
01442
01444
01453 virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0) = 0;
01454
01456
01466 virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0) = 0;
01467
01469
01479 virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0) = 0;
01480
01482
01484 virtual IMeshWriter* createMeshWriter(EMESH_WRITER_TYPE type) = 0;
01485
01487
01489 virtual ISkinnedMesh* createSkinnedMesh() = 0;
01490
01492 virtual void setAmbientLight(const video::SColorf &ambientColor) = 0;
01493
01495 virtual const video::SColorf& getAmbientLight() const = 0;
01496
01498
01500 virtual void setLightManager(ILightManager* lightManager) = 0;
01501
01503
01505 virtual const IGeometryCreator* getGeometryCreator(void) const = 0;
01506
01508
01516 virtual bool isCulled(const ISceneNode* node) const =0;
01517 };
01518
01519
01520 }
01521 }
01522
01523 #endif
01524