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
00430 virtual IMeshSceneNode* addSphereSceneNode(f32 radius=5.0f, s32 polyCount=16,
00431 ISceneNode* parent=0, s32 id=-1,
00432 const core::vector3df& position = core::vector3df(0,0,0),
00433 const core::vector3df& rotation = core::vector3df(0,0,0),
00434 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
00435
00437
00447 virtual IAnimatedMeshSceneNode* addAnimatedMeshSceneNode(IAnimatedMesh* mesh,
00448 ISceneNode* parent=0, s32 id=-1,
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),
00452 bool alsoAddIfMeshPointerZero=false) = 0;
00453
00455
00465 virtual IMeshSceneNode* addMeshSceneNode(IMesh* mesh, ISceneNode* parent=0, s32 id=-1,
00466 const core::vector3df& position = core::vector3df(0,0,0),
00467 const core::vector3df& rotation = core::vector3df(0,0,0),
00468 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f),
00469 bool alsoAddIfMeshPointerZero=false) = 0;
00470
00472
00486 virtual ISceneNode* addWaterSurfaceSceneNode(IMesh* mesh,
00487 f32 waveHeight=2.0f, f32 waveSpeed=300.0f, f32 waveLength=10.0f,
00488 ISceneNode* parent=0, s32 id=-1,
00489 const core::vector3df& position = core::vector3df(0,0,0),
00490 const core::vector3df& rotation = core::vector3df(0,0,0),
00491 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
00492
00493
00495
00507 virtual IMeshSceneNode* addOctTreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0,
00508 s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false) = 0;
00509
00511
00523 virtual IMeshSceneNode* addOctTreeSceneNode(IMesh* mesh, ISceneNode* parent=0,
00524 s32 id=-1, s32 minimalPolysPerNode=256, bool alsoAddIfMeshPointerZero=false) = 0;
00525
00527
00541 virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0,
00542 const core::vector3df& position = core::vector3df(0,0,0),
00543 const core::vector3df& lookat = core::vector3df(0,0,100), s32 id=-1) = 0;
00544
00546
00555 virtual ICameraSceneNode* addCameraSceneNodeMaya(ISceneNode* parent = 0,
00556 f32 rotateSpeed = -1500.0f, f32 zoomSpeed = 200.0f,
00557 f32 translationSpeed = 1500.0f, s32 id=-1) = 0;
00558
00560
00621 virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0,
00622 f32 rotateSpeed = 100.0f, f32 moveSpeed = 0.5f, s32 id=-1,
00623 SKeyMap* keyMapArray=0, s32 keyMapSize=0, bool noVerticalMovement=false,
00624 f32 jumpSpeed = 0.f, bool invertMouse=false) = 0;
00625
00627
00639 virtual ILightSceneNode* addLightSceneNode(ISceneNode* parent = 0,
00640 const core::vector3df& position = core::vector3df(0,0,0),
00641 video::SColorf color = video::SColorf(1.0f, 1.0f, 1.0f),
00642 f32 radius=100.0f, s32 id=-1) = 0;
00643
00645
00659 virtual IBillboardSceneNode* addBillboardSceneNode(ISceneNode* parent = 0,
00660 const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f),
00661 const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1,
00662 video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF) = 0;
00663
00665
00679 virtual ISceneNode* addSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom,
00680 video::ITexture* left, video::ITexture* right, video::ITexture* front,
00681 video::ITexture* back, ISceneNode* parent = 0, s32 id=-1) = 0;
00682
00684
00701 virtual ISceneNode* addSkyDomeSceneNode(video::ITexture* texture,
00702 u32 horiRes=16, u32 vertRes=8,
00703 f32 texturePercentage=0.9, f32 spherePercentage=2.0,f32 radius = 1000.f,
00704 ISceneNode* parent=0, s32 id=-1) = 0;
00705
00707
00719 virtual IParticleSystemSceneNode* addParticleSystemSceneNode(
00720 bool withDefaultEmitter=true, ISceneNode* parent=0, s32 id=-1,
00721 const core::vector3df& position = core::vector3df(0,0,0),
00722 const core::vector3df& rotation = core::vector3df(0,0,0),
00723 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
00724
00726
00781 virtual ITerrainSceneNode* addTerrainSceneNode(
00782 const io::path& heightMapFileName,
00783 ISceneNode* parent=0, s32 id=-1,
00784 const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f),
00785 const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f),
00786 const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f),
00787 video::SColor vertexColor = video::SColor(255,255,255,255),
00788 s32 maxLOD=5, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17, s32 smoothFactor=0,
00789 bool addAlsoIfHeightmapEmpty = false) = 0;
00790
00792
00819 virtual ITerrainSceneNode* addTerrainSceneNode(
00820 io::IReadFile* heightMapFile,
00821 ISceneNode* parent=0, s32 id=-1,
00822 const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f),
00823 const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f),
00824 const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f),
00825 video::SColor vertexColor = video::SColor(255,255,255,255),
00826 s32 maxLOD=5, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17, s32 smoothFactor=0,
00827 bool addAlsoIfHeightmapEmpty = false) = 0;
00828
00830
00833 virtual IMeshSceneNode* addQuake3SceneNode(IMeshBuffer* meshBuffer, const quake3::IShader * shader,
00834 ISceneNode* parent=0, s32 id=-1
00835 ) = 0;
00836
00837
00839
00843 virtual ISceneNode* addEmptySceneNode(ISceneNode* parent=0, s32 id=-1) = 0;
00844
00846
00852 virtual IDummyTransformationSceneNode* addDummyTransformationSceneNode(
00853 ISceneNode* parent=0, s32 id=-1) = 0;
00854
00856 virtual ITextSceneNode* addTextSceneNode(gui::IGUIFont* font, const wchar_t* text,
00857 video::SColor color=video::SColor(100,255,255,255),
00858 ISceneNode* parent = 0, const core::vector3df& position = core::vector3df(0,0,0),
00859 s32 id=-1) = 0;
00860
00862
00873 virtual IBillboardTextSceneNode* addBillboardTextSceneNode( gui::IGUIFont* font, const wchar_t* text,
00874 ISceneNode* parent = 0,
00875 const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f),
00876 const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1,
00877 video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF) = 0;
00878
00880
00906 virtual IAnimatedMesh* addHillPlaneMesh(const io::path& name,
00907 const core::dimension2d<f32>& tileSize, const core::dimension2d<u32>& tileCount,
00908 video::SMaterial* material = 0, f32 hillHeight = 0.0f,
00909 const core::dimension2d<f32>& countHills = core::dimension2d<f32>(0.0f, 0.0f),
00910 const core::dimension2d<f32>& textureRepeatCount = core::dimension2d<f32>(1.0f, 1.0f)) = 0;
00911
00913
00935 virtual IAnimatedMesh* addTerrainMesh(const io::path& meshname,
00936 video::IImage* texture, video::IImage* heightmap,
00937 const core::dimension2d<f32>& stretchSize = core::dimension2d<f32>(10.0f,10.0f),
00938 f32 maxHeight=200.0f,
00939 const core::dimension2d<u32>& defaultVertexBlockSize = core::dimension2d<u32>(64,64)) = 0;
00940
00942
00953 virtual IAnimatedMesh* addArrowMesh(const io::path& name,
00954 video::SColor vtxColor0=0xFFFFFFFF,
00955 video::SColor vtxColor1=0xFFFFFFFF,
00956 u32 tesselationCylinder=4, u32 tesselationCone=8,
00957 f32 height=1.f, f32 cylinderHeight=0.6f,
00958 f32 width0=0.05f, f32 width1=0.3f) = 0;
00959
00961
00967 virtual IAnimatedMesh* addSphereMesh(const io::path& name,
00968 f32 radius=5.f, u32 polyCountX = 16,
00969 u32 polyCountY = 16) = 0;
00970
00972
00976 virtual IAnimatedMesh* addVolumeLightMesh(const io::path& name,
00977 const u32 SubdivideU = 32, const u32 SubdivideV = 32,
00978 const video::SColor FootColor = video::SColor(51, 0, 230, 180),
00979 const video::SColor TailColor = video::SColor(0, 0, 0, 0)) = 0;
00980
00982
00988 virtual ISceneNode* getRootSceneNode() = 0;
00989
00991
00998 virtual ISceneNode* getSceneNodeFromId(s32 id, ISceneNode* start=0) = 0;
00999
01001
01008 virtual ISceneNode* getSceneNodeFromName(const c8* name, ISceneNode* start=0) = 0;
01009
01011
01018 virtual ISceneNode* getSceneNodeFromType(scene::ESCENE_NODE_TYPE type, ISceneNode* start=0) = 0;
01019
01021
01026 virtual void getSceneNodesFromType(ESCENE_NODE_TYPE type,
01027 core::array<scene::ISceneNode*>& outNodes,
01028 ISceneNode* start=0) = 0;
01029
01031
01034 virtual ICameraSceneNode* getActiveCamera() const =0;
01035
01037
01039 virtual void setActiveCamera(ICameraSceneNode* camera) = 0;
01040
01042 virtual void setShadowColor(video::SColor color = video::SColor(150,0,0,0)) = 0;
01043
01045 virtual video::SColor getShadowColor() const = 0;
01046
01048
01056 virtual u32 registerNodeForRendering(ISceneNode* node,
01057 E_SCENE_NODE_RENDER_PASS pass = ESNRP_AUTOMATIC) = 0;
01058
01060
01064 virtual void drawAll() = 0;
01065
01067
01072 virtual ISceneNodeAnimator* createRotationAnimator(const core::vector3df& rotationSpeed) = 0;
01073
01075
01087 virtual ISceneNodeAnimator* createFlyCircleAnimator(
01088 const core::vector3df& center=core::vector3df(0.f,0.f,0.f),
01089 f32 radius=100.f, f32 speed=0.001f,
01090 const core::vector3df& direction=core::vector3df(0.f, 1.f, 0.f),
01091 f32 startPosition = 0.f,
01092 f32 radiusEllipsoid = 0.f) = 0;
01093
01095
01107 virtual ISceneNodeAnimator* createFlyStraightAnimator(const core::vector3df& startPoint,
01108 const core::vector3df& endPoint, u32 timeForWay, bool loop=false, bool pingpong = false) = 0;
01109
01111
01120 virtual ISceneNodeAnimator* createTextureAnimator(const core::array<video::ITexture*>& textures,
01121 s32 timePerFrame, bool loop=true) = 0;
01122
01124
01129 virtual ISceneNodeAnimator* createDeleteAnimator(u32 timeMs) = 0;
01130
01132
01162 virtual ISceneNodeAnimatorCollisionResponse* createCollisionResponseAnimator(
01163 ITriangleSelector* world, ISceneNode* sceneNode,
01164 const core::vector3df& ellipsoidRadius = core::vector3df(30,60,30),
01165 const core::vector3df& gravityPerSecond = core::vector3df(0,-10.0f,0),
01166 const core::vector3df& ellipsoidTranslation = core::vector3df(0,0,0),
01167 f32 slidingValue = 0.0005f) = 0;
01168
01170
01178 virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime,
01179 const core::array< core::vector3df >& points,
01180 f32 speed = 1.0f, f32 tightness = 0.5f) = 0;
01181
01183
01201 virtual ITriangleSelector* createTriangleSelector(IMesh* mesh, ISceneNode* node) = 0;
01202
01204
01209 virtual ITriangleSelector* createTriangleSelector(IAnimatedMeshSceneNode* node) = 0;
01210
01211
01213
01221 virtual ITriangleSelector* createTriangleSelectorFromBoundingBox(ISceneNode* node) = 0;
01222
01224
01246 virtual ITriangleSelector* createOctTreeTriangleSelector(IMesh* mesh,
01247 ISceneNode* node, s32 minimalPolysPerNode=32) = 0;
01248
01250
01257 virtual IMetaTriangleSelector* createMetaTriangleSelector() = 0;
01258
01260
01265 virtual ITriangleSelector* createTerrainTriangleSelector(
01266 ITerrainSceneNode* node, s32 LOD=0) = 0;
01267
01269
01275 virtual void addExternalMeshLoader(IMeshLoader* externalLoader) = 0;
01276
01278
01280 virtual ISceneCollisionManager* getSceneCollisionManager() = 0;
01281
01283
01285 virtual IMeshManipulator* getMeshManipulator() = 0;
01286
01288
01296 virtual void addToDeletionQueue(ISceneNode* node) = 0;
01297
01299
01301 virtual bool postEventFromUser(const SEvent& event) = 0;
01302
01304
01305 virtual void clear() = 0;
01306
01308
01313 virtual io::IAttributes* getParameters() = 0;
01314
01316
01322 virtual E_SCENE_NODE_RENDER_PASS getSceneNodeRenderPass() const = 0;
01323
01325
01327 virtual ISceneNodeFactory* getDefaultSceneNodeFactory() = 0;
01328
01330
01332 virtual void registerSceneNodeFactory(ISceneNodeFactory* factoryToAdd) = 0;
01333
01335 virtual u32 getRegisteredSceneNodeFactoryCount() const = 0;
01336
01338
01340 virtual ISceneNodeFactory* getSceneNodeFactory(u32 index) = 0;
01341
01343
01345 virtual ISceneNodeAnimatorFactory* getDefaultSceneNodeAnimatorFactory() = 0;
01346
01348
01350 virtual void registerSceneNodeAnimatorFactory(ISceneNodeAnimatorFactory* factoryToAdd) = 0;
01351
01353 virtual u32 getRegisteredSceneNodeAnimatorFactoryCount() const = 0;
01354
01356
01358 virtual ISceneNodeAnimatorFactory* getSceneNodeAnimatorFactory(u32 index) = 0;
01359
01361 virtual const c8* getSceneNodeTypeName(ESCENE_NODE_TYPE type) = 0;
01362
01364 virtual const c8* getAnimatorTypeName(ESCENE_NODE_ANIMATOR_TYPE type) = 0;
01365
01367
01369 virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0) = 0;
01370
01372
01390 virtual ISceneManager* createNewSceneManager(bool cloneContent=false) = 0;
01391
01393
01402 virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0) = 0;
01403
01405
01414 virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0) = 0;
01415
01417
01427 virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0) = 0;
01428
01430
01440 virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0) = 0;
01441
01443
01445 virtual IMeshWriter* createMeshWriter(EMESH_WRITER_TYPE type) = 0;
01446
01448
01450 virtual ISkinnedMesh* createSkinnedMesh() = 0;
01451
01453 virtual void setAmbientLight(const video::SColorf &ambientColor) = 0;
01454
01456 virtual const video::SColorf& getAmbientLight() const = 0;
01457
01459
01461 virtual void setLightManager(ILightManager* lightManager) = 0;
01462
01464
01466 virtual const IGeometryCreator* getGeometryCreator(void) const = 0;
01467
01469
01477 virtual bool isCulled(const ISceneNode* node) const =0;
01478 };
01479
01480
01481 }
01482 }
01483
01484 #endif
01485