diff options
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CSceneManager.h')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CSceneManager.h | 1316 |
1 files changed, 658 insertions, 658 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CSceneManager.h b/libraries/irrlicht-1.8/source/Irrlicht/CSceneManager.h index 19afe32..a9b04c4 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CSceneManager.h +++ b/libraries/irrlicht-1.8/source/Irrlicht/CSceneManager.h | |||
@@ -1,658 +1,658 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt |
2 | // This file is part of the "Irrlicht Engine". | 2 | // This file is part of the "Irrlicht Engine". |
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h |
4 | 4 | ||
5 | #ifndef __C_SCENE_MANAGER_H_INCLUDED__ | 5 | #ifndef __C_SCENE_MANAGER_H_INCLUDED__ |
6 | #define __C_SCENE_MANAGER_H_INCLUDED__ | 6 | #define __C_SCENE_MANAGER_H_INCLUDED__ |
7 | 7 | ||
8 | #include "ISceneManager.h" | 8 | #include "ISceneManager.h" |
9 | #include "ISceneNode.h" | 9 | #include "ISceneNode.h" |
10 | #include "ICursorControl.h" | 10 | #include "ICursorControl.h" |
11 | #include "irrString.h" | 11 | #include "irrString.h" |
12 | #include "irrArray.h" | 12 | #include "irrArray.h" |
13 | #include "IMeshLoader.h" | 13 | #include "IMeshLoader.h" |
14 | #include "CAttributes.h" | 14 | #include "CAttributes.h" |
15 | #include "ILightManager.h" | 15 | #include "ILightManager.h" |
16 | 16 | ||
17 | namespace irr | 17 | namespace irr |
18 | { | 18 | { |
19 | namespace io | 19 | namespace io |
20 | { | 20 | { |
21 | class IXMLWriter; | 21 | class IXMLWriter; |
22 | class IFileSystem; | 22 | class IFileSystem; |
23 | } | 23 | } |
24 | namespace scene | 24 | namespace scene |
25 | { | 25 | { |
26 | class IMeshCache; | 26 | class IMeshCache; |
27 | class IGeometryCreator; | 27 | class IGeometryCreator; |
28 | 28 | ||
29 | /*! | 29 | /*! |
30 | The Scene Manager manages scene nodes, mesh recources, cameras and all the other stuff. | 30 | The Scene Manager manages scene nodes, mesh recources, cameras and all the other stuff. |
31 | */ | 31 | */ |
32 | class CSceneManager : public ISceneManager, public ISceneNode | 32 | class CSceneManager : public ISceneManager, public ISceneNode |
33 | { | 33 | { |
34 | public: | 34 | public: |
35 | 35 | ||
36 | //! constructor | 36 | //! constructor |
37 | CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs, | 37 | CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs, |
38 | gui::ICursorControl* cursorControl, IMeshCache* cache = 0, | 38 | gui::ICursorControl* cursorControl, IMeshCache* cache = 0, |
39 | gui::IGUIEnvironment *guiEnvironment = 0); | 39 | gui::IGUIEnvironment *guiEnvironment = 0); |
40 | 40 | ||
41 | //! destructor | 41 | //! destructor |
42 | virtual ~CSceneManager(); | 42 | virtual ~CSceneManager(); |
43 | 43 | ||
44 | //! gets an animateable mesh. loads it if needed. returned pointer must not be dropped. | 44 | //! gets an animateable mesh. loads it if needed. returned pointer must not be dropped. |
45 | virtual IAnimatedMesh* getMesh(const io::path& filename); | 45 | virtual IAnimatedMesh* getMesh(const io::path& filename); |
46 | 46 | ||
47 | //! gets an animateable mesh. loads it if needed. returned pointer must not be dropped. | 47 | //! gets an animateable mesh. loads it if needed. returned pointer must not be dropped. |
48 | virtual IAnimatedMesh* getMesh(io::IReadFile* file); | 48 | virtual IAnimatedMesh* getMesh(io::IReadFile* file); |
49 | 49 | ||
50 | //! Returns an interface to the mesh cache which is shared beween all existing scene managers. | 50 | //! Returns an interface to the mesh cache which is shared beween all existing scene managers. |
51 | virtual IMeshCache* getMeshCache(); | 51 | virtual IMeshCache* getMeshCache(); |
52 | 52 | ||
53 | //! returns the video driver | 53 | //! returns the video driver |
54 | virtual video::IVideoDriver* getVideoDriver(); | 54 | virtual video::IVideoDriver* getVideoDriver(); |
55 | 55 | ||
56 | //! return the gui environment | 56 | //! return the gui environment |
57 | virtual gui::IGUIEnvironment* getGUIEnvironment(); | 57 | virtual gui::IGUIEnvironment* getGUIEnvironment(); |
58 | 58 | ||
59 | //! return the filesystem | 59 | //! return the filesystem |
60 | virtual io::IFileSystem* getFileSystem(); | 60 | virtual io::IFileSystem* getFileSystem(); |
61 | 61 | ||
62 | //! adds Volume Lighting Scene Node. | 62 | //! adds Volume Lighting Scene Node. |
63 | //! the returned pointer must not be dropped. | 63 | //! the returned pointer must not be dropped. |
64 | virtual IVolumeLightSceneNode* addVolumeLightSceneNode(ISceneNode* parent=0, s32 id=-1, | 64 | virtual IVolumeLightSceneNode* addVolumeLightSceneNode(ISceneNode* parent=0, s32 id=-1, |
65 | const u32 subdivU = 32, const u32 subdivV = 32, | 65 | const u32 subdivU = 32, const u32 subdivV = 32, |
66 | const video::SColor foot = video::SColor(51, 0, 230, 180), | 66 | const video::SColor foot = video::SColor(51, 0, 230, 180), |
67 | const video::SColor tail = video::SColor(0, 0, 0, 0), | 67 | const video::SColor tail = video::SColor(0, 0, 0, 0), |
68 | const core::vector3df& position = core::vector3df(0,0,0), | 68 | const core::vector3df& position = core::vector3df(0,0,0), |
69 | const core::vector3df& rotation = core::vector3df(0,0,0), | 69 | const core::vector3df& rotation = core::vector3df(0,0,0), |
70 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)); | 70 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)); |
71 | 71 | ||
72 | //! adds a cube scene node to the scene. It is a simple cube of (1,1,1) size. | 72 | //! adds a cube scene node to the scene. It is a simple cube of (1,1,1) size. |
73 | //! the returned pointer must not be dropped. | 73 | //! the returned pointer must not be dropped. |
74 | virtual IMeshSceneNode* addCubeSceneNode(f32 size=10.0f, ISceneNode* parent=0, s32 id=-1, | 74 | virtual IMeshSceneNode* addCubeSceneNode(f32 size=10.0f, ISceneNode* parent=0, s32 id=-1, |
75 | const core::vector3df& position = core::vector3df(0,0,0), const core::vector3df& rotation = core::vector3df(0,0,0), const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)); | 75 | const core::vector3df& position = core::vector3df(0,0,0), const core::vector3df& rotation = core::vector3df(0,0,0), const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)); |
76 | 76 | ||
77 | //! Adds a sphere scene node to the scene. | 77 | //! Adds a sphere scene node to the scene. |
78 | virtual IMeshSceneNode* addSphereSceneNode(f32 radius=5.0f, s32 polyCount=16, ISceneNode* parent=0, s32 id=-1, | 78 | virtual IMeshSceneNode* addSphereSceneNode(f32 radius=5.0f, s32 polyCount=16, ISceneNode* parent=0, s32 id=-1, |
79 | const core::vector3df& position = core::vector3df(0,0,0), | 79 | const core::vector3df& position = core::vector3df(0,0,0), |
80 | const core::vector3df& rotation = core::vector3df(0,0,0), | 80 | const core::vector3df& rotation = core::vector3df(0,0,0), |
81 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)); | 81 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)); |
82 | 82 | ||
83 | //! adds a scene node for rendering an animated mesh model | 83 | //! adds a scene node for rendering an animated mesh model |
84 | virtual IAnimatedMeshSceneNode* addAnimatedMeshSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0, s32 id=-1, | 84 | virtual IAnimatedMeshSceneNode* addAnimatedMeshSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0, s32 id=-1, |
85 | const core::vector3df& position = core::vector3df(0,0,0), | 85 | const core::vector3df& position = core::vector3df(0,0,0), |
86 | const core::vector3df& rotation = core::vector3df(0,0,0), | 86 | const core::vector3df& rotation = core::vector3df(0,0,0), |
87 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f), | 87 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f), |
88 | bool alsoAddIfMeshPointerZero=false); | 88 | bool alsoAddIfMeshPointerZero=false); |
89 | 89 | ||
90 | //! adds a scene node for rendering a static mesh | 90 | //! adds a scene node for rendering a static mesh |
91 | //! the returned pointer must not be dropped. | 91 | //! the returned pointer must not be dropped. |
92 | virtual IMeshSceneNode* addMeshSceneNode(IMesh* mesh, ISceneNode* parent=0, s32 id=-1, | 92 | virtual IMeshSceneNode* addMeshSceneNode(IMesh* mesh, ISceneNode* parent=0, s32 id=-1, |
93 | const core::vector3df& position = core::vector3df(0,0,0), | 93 | const core::vector3df& position = core::vector3df(0,0,0), |
94 | const core::vector3df& rotation = core::vector3df(0,0,0), | 94 | const core::vector3df& rotation = core::vector3df(0,0,0), |
95 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f), | 95 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f), |
96 | bool alsoAddIfMeshPointerZero=false); | 96 | bool alsoAddIfMeshPointerZero=false); |
97 | 97 | ||
98 | //! Adds a scene node for rendering a animated water surface mesh. | 98 | //! Adds a scene node for rendering a animated water surface mesh. |
99 | virtual ISceneNode* addWaterSurfaceSceneNode(IMesh* mesh, f32 waveHeight, f32 waveSpeed, f32 wlenght, ISceneNode* parent=0, s32 id=-1, | 99 | virtual ISceneNode* addWaterSurfaceSceneNode(IMesh* mesh, f32 waveHeight, f32 waveSpeed, f32 wlenght, ISceneNode* parent=0, s32 id=-1, |
100 | const core::vector3df& position = core::vector3df(0,0,0), | 100 | const core::vector3df& position = core::vector3df(0,0,0), |
101 | const core::vector3df& rotation = core::vector3df(0,0,0), | 101 | const core::vector3df& rotation = core::vector3df(0,0,0), |
102 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)); | 102 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)); |
103 | 103 | ||
104 | //! renders the node. | 104 | //! renders the node. |
105 | virtual void render(); | 105 | virtual void render(); |
106 | 106 | ||
107 | //! returns the axis aligned bounding box of this node | 107 | //! returns the axis aligned bounding box of this node |
108 | virtual const core::aabbox3d<f32>& getBoundingBox() const; | 108 | virtual const core::aabbox3d<f32>& getBoundingBox() const; |
109 | 109 | ||
110 | //! registers a node for rendering it at a specific time. | 110 | //! registers a node for rendering it at a specific time. |
111 | virtual u32 registerNodeForRendering(ISceneNode* node, E_SCENE_NODE_RENDER_PASS pass = ESNRP_AUTOMATIC); | 111 | virtual u32 registerNodeForRendering(ISceneNode* node, E_SCENE_NODE_RENDER_PASS pass = ESNRP_AUTOMATIC); |
112 | 112 | ||
113 | //! draws all scene nodes | 113 | //! draws all scene nodes |
114 | virtual void drawAll(); | 114 | virtual void drawAll(); |
115 | 115 | ||
116 | //! Adds a scene node for rendering using a octree to the scene graph. This a good method for rendering | 116 | //! Adds a scene node for rendering using a octree to the scene graph. This a good method for rendering |
117 | //! scenes with lots of geometry. The Octree is built on the fly from the mesh, much | 117 | //! scenes with lots of geometry. The Octree is built on the fly from the mesh, much |
118 | //! faster then a bsp tree. | 118 | //! faster then a bsp tree. |
119 | virtual IMeshSceneNode* addOctreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0, | 119 | virtual IMeshSceneNode* addOctreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0, |
120 | s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false); | 120 | s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false); |
121 | 121 | ||
122 | //! Adss a scene node for rendering using a octree. This a good method for rendering | 122 | //! Adss a scene node for rendering using a octree. This a good method for rendering |
123 | //! scenes with lots of geometry. The Octree is built on the fly from the mesh, much | 123 | //! scenes with lots of geometry. The Octree is built on the fly from the mesh, much |
124 | //! faster then a bsp tree. | 124 | //! faster then a bsp tree. |
125 | virtual IMeshSceneNode* addOctreeSceneNode(IMesh* mesh, ISceneNode* parent=0, | 125 | virtual IMeshSceneNode* addOctreeSceneNode(IMesh* mesh, ISceneNode* parent=0, |
126 | s32 id=-1, s32 minimalPolysPerNode=128, bool alsoAddIfMeshPointerZero=false); | 126 | s32 id=-1, s32 minimalPolysPerNode=128, bool alsoAddIfMeshPointerZero=false); |
127 | 127 | ||
128 | //! Adds a camera scene node to the tree and sets it as active camera. | 128 | //! Adds a camera scene node to the tree and sets it as active camera. |
129 | //! \param position: Position of the space relative to its parent where the camera will be placed. | 129 | //! \param position: Position of the space relative to its parent where the camera will be placed. |
130 | //! \param lookat: Position where the camera will look at. Also known as target. | 130 | //! \param lookat: Position where the camera will look at. Also known as target. |
131 | //! \param parent: Parent scene node of the camera. Can be null. If the parent moves, | 131 | //! \param parent: Parent scene node of the camera. Can be null. If the parent moves, |
132 | //! the camera will move too. | 132 | //! the camera will move too. |
133 | //! \return Pointer to interface to camera | 133 | //! \return Pointer to interface to camera |
134 | virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0, | 134 | virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0, |
135 | const core::vector3df& position = core::vector3df(0,0,0), | 135 | const core::vector3df& position = core::vector3df(0,0,0), |
136 | const core::vector3df& lookat = core::vector3df(0,0,100), | 136 | const core::vector3df& lookat = core::vector3df(0,0,100), |
137 | s32 id=-1, bool makeActive=true); | 137 | s32 id=-1, bool makeActive=true); |
138 | 138 | ||
139 | //! Adds a camera scene node which is able to be controlle with the mouse similar | 139 | //! Adds a camera scene node which is able to be controlle with the mouse similar |
140 | //! like in the 3D Software Maya by Alias Wavefront. | 140 | //! like in the 3D Software Maya by Alias Wavefront. |
141 | //! The returned pointer must not be dropped. | 141 | //! The returned pointer must not be dropped. |
142 | virtual ICameraSceneNode* addCameraSceneNodeMaya(ISceneNode* parent=0, | 142 | virtual ICameraSceneNode* addCameraSceneNodeMaya(ISceneNode* parent=0, |
143 | f32 rotateSpeed=-1500.f, f32 zoomSpeed=200.f, | 143 | f32 rotateSpeed=-1500.f, f32 zoomSpeed=200.f, |
144 | f32 translationSpeed=1500.f, s32 id=-1, f32 distance=70.f, | 144 | f32 translationSpeed=1500.f, s32 id=-1, f32 distance=70.f, |
145 | bool makeActive=true); | 145 | bool makeActive=true); |
146 | 146 | ||
147 | //! Adds a camera scene node which is able to be controled with the mouse and keys | 147 | //! Adds a camera scene node which is able to be controled with the mouse and keys |
148 | //! like in most first person shooters (FPS): | 148 | //! like in most first person shooters (FPS): |
149 | virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0, | 149 | virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0, |
150 | f32 rotateSpeed = 100.0f, f32 moveSpeed = .5f, s32 id=-1, | 150 | f32 rotateSpeed = 100.0f, f32 moveSpeed = .5f, s32 id=-1, |
151 | SKeyMap* keyMapArray=0, s32 keyMapSize=0, | 151 | SKeyMap* keyMapArray=0, s32 keyMapSize=0, |
152 | bool noVerticalMovement=false, f32 jumpSpeed = 0.f, | 152 | bool noVerticalMovement=false, f32 jumpSpeed = 0.f, |
153 | bool invertMouseY=false, bool makeActive=true); | 153 | bool invertMouseY=false, bool makeActive=true); |
154 | 154 | ||
155 | //! Adds a dynamic light scene node. The light will cast dynamic light on all | 155 | //! Adds a dynamic light scene node. The light will cast dynamic light on all |
156 | //! other scene nodes in the scene, which have the material flag video::MTF_LIGHTING | 156 | //! other scene nodes in the scene, which have the material flag video::MTF_LIGHTING |
157 | //! turned on. (This is the default setting in most scene nodes). | 157 | //! turned on. (This is the default setting in most scene nodes). |
158 | virtual ILightSceneNode* addLightSceneNode(ISceneNode* parent = 0, | 158 | virtual ILightSceneNode* addLightSceneNode(ISceneNode* parent = 0, |
159 | const core::vector3df& position = core::vector3df(0,0,0), | 159 | const core::vector3df& position = core::vector3df(0,0,0), |
160 | video::SColorf color = video::SColorf(1.0f, 1.0f, 1.0f), | 160 | video::SColorf color = video::SColorf(1.0f, 1.0f, 1.0f), |
161 | f32 range=100.0f, s32 id=-1); | 161 | f32 range=100.0f, s32 id=-1); |
162 | 162 | ||
163 | //! Adds a billboard scene node to the scene. A billboard is like a 3d sprite: A 2d element, | 163 | //! Adds a billboard scene node to the scene. A billboard is like a 3d sprite: A 2d element, |
164 | //! which always looks to the camera. It is usually used for things like explosions, fire, | 164 | //! which always looks to the camera. It is usually used for things like explosions, fire, |
165 | //! lensflares and things like that. | 165 | //! lensflares and things like that. |
166 | virtual IBillboardSceneNode* addBillboardSceneNode(ISceneNode* parent = 0, | 166 | virtual IBillboardSceneNode* addBillboardSceneNode(ISceneNode* parent = 0, |
167 | const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f), | 167 | const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f), |
168 | const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1, | 168 | const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1, |
169 | video::SColor shadeTop = 0xFFFFFFFF, video::SColor shadeBottom = 0xFFFFFFFF); | 169 | video::SColor shadeTop = 0xFFFFFFFF, video::SColor shadeBottom = 0xFFFFFFFF); |
170 | 170 | ||
171 | //! Adds a skybox scene node. A skybox is a big cube with 6 textures on it and | 171 | //! Adds a skybox scene node. A skybox is a big cube with 6 textures on it and |
172 | //! is drawn around the camera position. | 172 | //! is drawn around the camera position. |
173 | virtual ISceneNode* addSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom, | 173 | virtual ISceneNode* addSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom, |
174 | video::ITexture* left, video::ITexture* right, video::ITexture* front, | 174 | video::ITexture* left, video::ITexture* right, video::ITexture* front, |
175 | video::ITexture* back, ISceneNode* parent = 0, s32 id=-1); | 175 | video::ITexture* back, ISceneNode* parent = 0, s32 id=-1); |
176 | 176 | ||
177 | //! Adds a skydome scene node. A skydome is a large (half-) sphere with a | 177 | //! Adds a skydome scene node. A skydome is a large (half-) sphere with a |
178 | //! panoramic texture on it and is drawn around the camera position. | 178 | //! panoramic texture on it and is drawn around the camera position. |
179 | virtual ISceneNode* addSkyDomeSceneNode(video::ITexture* texture, | 179 | virtual ISceneNode* addSkyDomeSceneNode(video::ITexture* texture, |
180 | u32 horiRes=16, u32 vertRes=8, | 180 | u32 horiRes=16, u32 vertRes=8, |
181 | f32 texturePercentage=0.9, f32 spherePercentage=2.0,f32 radius = 1000.f, | 181 | f32 texturePercentage=0.9, f32 spherePercentage=2.0,f32 radius = 1000.f, |
182 | ISceneNode* parent=0, s32 id=-1); | 182 | ISceneNode* parent=0, s32 id=-1); |
183 | 183 | ||
184 | //! Adds a text scene node, which is able to display | 184 | //! Adds a text scene node, which is able to display |
185 | //! 2d text at a position in three dimensional space | 185 | //! 2d text at a position in three dimensional space |
186 | virtual ITextSceneNode* addTextSceneNode(gui::IGUIFont* font, const wchar_t* text, | 186 | virtual ITextSceneNode* addTextSceneNode(gui::IGUIFont* font, const wchar_t* text, |
187 | video::SColor color=video::SColor(100,255,255,255), | 187 | video::SColor color=video::SColor(100,255,255,255), |
188 | ISceneNode* parent = 0, const core::vector3df& position = core::vector3df(0,0,0), | 188 | ISceneNode* parent = 0, const core::vector3df& position = core::vector3df(0,0,0), |
189 | s32 id=-1); | 189 | s32 id=-1); |
190 | 190 | ||
191 | //! Adds a text scene node, which uses billboards | 191 | //! Adds a text scene node, which uses billboards |
192 | virtual IBillboardTextSceneNode* addBillboardTextSceneNode(gui::IGUIFont* font, const wchar_t* text, | 192 | virtual IBillboardTextSceneNode* addBillboardTextSceneNode(gui::IGUIFont* font, const wchar_t* text, |
193 | ISceneNode* parent = 0, | 193 | ISceneNode* parent = 0, |
194 | const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f), | 194 | const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f), |
195 | const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1, | 195 | const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1, |
196 | video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF); | 196 | video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF); |
197 | 197 | ||
198 | //! Adds a scene node, which can render a quake3 shader | 198 | //! Adds a scene node, which can render a quake3 shader |
199 | virtual IMeshSceneNode* addQuake3SceneNode(const IMeshBuffer* meshBuffer, const quake3::IShader * shader, | 199 | virtual IMeshSceneNode* addQuake3SceneNode(const IMeshBuffer* meshBuffer, const quake3::IShader * shader, |
200 | ISceneNode* parent=0, s32 id=-1 | 200 | ISceneNode* parent=0, s32 id=-1 |
201 | ); | 201 | ); |
202 | 202 | ||
203 | 203 | ||
204 | //! Adds a Hill Plane mesh to the mesh pool. The mesh is | 204 | //! Adds a Hill Plane mesh to the mesh pool. The mesh is |
205 | //! generated on the fly and looks like a plane with some hills | 205 | //! generated on the fly and looks like a plane with some hills |
206 | //! on it. You can specify how many hills should be on the plane | 206 | //! on it. You can specify how many hills should be on the plane |
207 | //! and how high they should be. Also you must specify a name | 207 | //! and how high they should be. Also you must specify a name |
208 | //! for the mesh because the mesh is added to the mesh pool and | 208 | //! for the mesh because the mesh is added to the mesh pool and |
209 | //! can be retrieved back using ISceneManager::getMesh with the | 209 | //! can be retrieved back using ISceneManager::getMesh with the |
210 | //! name as parameter. | 210 | //! name as parameter. |
211 | virtual IAnimatedMesh* addHillPlaneMesh(const io::path& name, | 211 | virtual IAnimatedMesh* addHillPlaneMesh(const io::path& name, |
212 | const core::dimension2d<f32>& tileSize, const core::dimension2d<u32>& tileCount, | 212 | const core::dimension2d<f32>& tileSize, const core::dimension2d<u32>& tileCount, |
213 | video::SMaterial* material = 0, f32 hillHeight = 0.0f, | 213 | video::SMaterial* material = 0, f32 hillHeight = 0.0f, |
214 | const core::dimension2d<f32>& countHills = core::dimension2d<f32>(1.0f, 1.0f), | 214 | const core::dimension2d<f32>& countHills = core::dimension2d<f32>(1.0f, 1.0f), |
215 | const core::dimension2d<f32>& textureRepeatCount = core::dimension2d<f32>(1.0f, 1.0f)); | 215 | const core::dimension2d<f32>& textureRepeatCount = core::dimension2d<f32>(1.0f, 1.0f)); |
216 | 216 | ||
217 | //! Adds a terrain mesh to the mesh pool. | 217 | //! Adds a terrain mesh to the mesh pool. |
218 | virtual IAnimatedMesh* addTerrainMesh(const io::path& meshname, video::IImage* texture, video::IImage* heightmap, | 218 | virtual IAnimatedMesh* addTerrainMesh(const io::path& meshname, video::IImage* texture, video::IImage* heightmap, |
219 | const core::dimension2d<f32>& stretchSize = core::dimension2d<f32>(10.0f,10.0f), | 219 | const core::dimension2d<f32>& stretchSize = core::dimension2d<f32>(10.0f,10.0f), |
220 | f32 maxHeight=200.0f, | 220 | f32 maxHeight=200.0f, |
221 | const core::dimension2d<u32>& defaultVertexBlockSize = core::dimension2d<u32>(64,64)); | 221 | const core::dimension2d<u32>& defaultVertexBlockSize = core::dimension2d<u32>(64,64)); |
222 | 222 | ||
223 | //! Add a arrow mesh to the mesh pool | 223 | //! Add a arrow mesh to the mesh pool |
224 | virtual IAnimatedMesh* addArrowMesh(const io::path& name, | 224 | virtual IAnimatedMesh* addArrowMesh(const io::path& name, |
225 | video::SColor vtxColor0, video::SColor vtxColor1, | 225 | video::SColor vtxColor0, video::SColor vtxColor1, |
226 | u32 tesselationCylinder, u32 tesselationCone, | 226 | u32 tesselationCylinder, u32 tesselationCone, |
227 | f32 height, f32 cylinderHeight, f32 width0, | 227 | f32 height, f32 cylinderHeight, f32 width0, |
228 | f32 width1); | 228 | f32 width1); |
229 | 229 | ||
230 | //! Adds a static sphere mesh to the mesh pool. | 230 | //! Adds a static sphere mesh to the mesh pool. |
231 | IAnimatedMesh* addSphereMesh(const io::path& name, | 231 | IAnimatedMesh* addSphereMesh(const io::path& name, |
232 | f32 radius=5.f, u32 polyCountX=16, u32 polyCountY=16); | 232 | f32 radius=5.f, u32 polyCountX=16, u32 polyCountY=16); |
233 | 233 | ||
234 | //! Adds a static volume light mesh to the mesh pool. | 234 | //! Adds a static volume light mesh to the mesh pool. |
235 | IAnimatedMesh* addVolumeLightMesh(const io::path& name, | 235 | IAnimatedMesh* addVolumeLightMesh(const io::path& name, |
236 | const u32 SubdivideU = 32, const u32 SubdivideV = 32, | 236 | const u32 SubdivideU = 32, const u32 SubdivideV = 32, |
237 | const video::SColor FootColor = video::SColor(51, 0, 230, 180), | 237 | const video::SColor FootColor = video::SColor(51, 0, 230, 180), |
238 | const video::SColor TailColor = video::SColor(0, 0, 0, 0)); | 238 | const video::SColor TailColor = video::SColor(0, 0, 0, 0)); |
239 | 239 | ||
240 | //! Adds a particle system scene node. | 240 | //! Adds a particle system scene node. |
241 | virtual IParticleSystemSceneNode* addParticleSystemSceneNode( | 241 | virtual IParticleSystemSceneNode* addParticleSystemSceneNode( |
242 | bool withDefaultEmitter=true, ISceneNode* parent=0, s32 id=-1, | 242 | bool withDefaultEmitter=true, ISceneNode* parent=0, s32 id=-1, |
243 | const core::vector3df& position = core::vector3df(0,0,0), | 243 | const core::vector3df& position = core::vector3df(0,0,0), |
244 | const core::vector3df& rotation = core::vector3df(0,0,0), | 244 | const core::vector3df& rotation = core::vector3df(0,0,0), |
245 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)); | 245 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)); |
246 | 246 | ||
247 | //! Adds a terrain scene node to the scene graph. | 247 | //! Adds a terrain scene node to the scene graph. |
248 | virtual ITerrainSceneNode* addTerrainSceneNode( | 248 | virtual ITerrainSceneNode* addTerrainSceneNode( |
249 | const io::path& heightMapFileName, | 249 | const io::path& heightMapFileName, |
250 | ISceneNode* parent=0, s32 id=-1, | 250 | ISceneNode* parent=0, s32 id=-1, |
251 | const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f), | 251 | const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f), |
252 | const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f), | 252 | const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f), |
253 | const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f), | 253 | const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f), |
254 | video::SColor vertexColor = video::SColor(255,255,255,255), | 254 | video::SColor vertexColor = video::SColor(255,255,255,255), |
255 | s32 maxLOD=4, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17,s32 smoothFactor=0, | 255 | s32 maxLOD=4, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17,s32 smoothFactor=0, |
256 | bool addAlsoIfHeightmapEmpty = false); | 256 | bool addAlsoIfHeightmapEmpty = false); |
257 | 257 | ||
258 | //! Adds a terrain scene node to the scene graph. | 258 | //! Adds a terrain scene node to the scene graph. |
259 | virtual ITerrainSceneNode* addTerrainSceneNode( | 259 | virtual ITerrainSceneNode* addTerrainSceneNode( |
260 | io::IReadFile* heightMap, | 260 | io::IReadFile* heightMap, |
261 | ISceneNode* parent=0, s32 id=-1, | 261 | ISceneNode* parent=0, s32 id=-1, |
262 | const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f), | 262 | const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f), |
263 | const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f), | 263 | const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f), |
264 | const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f), | 264 | const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f), |
265 | video::SColor vertexColor = video::SColor(255,255,255,255), | 265 | video::SColor vertexColor = video::SColor(255,255,255,255), |
266 | s32 maxLOD=4, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17,s32 smoothFactor=0, | 266 | s32 maxLOD=4, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17,s32 smoothFactor=0, |
267 | bool addAlsoIfHeightmapEmpty=false); | 267 | bool addAlsoIfHeightmapEmpty=false); |
268 | 268 | ||
269 | //! Adds a dummy transformation scene node to the scene graph. | 269 | //! Adds a dummy transformation scene node to the scene graph. |
270 | virtual IDummyTransformationSceneNode* addDummyTransformationSceneNode( | 270 | virtual IDummyTransformationSceneNode* addDummyTransformationSceneNode( |
271 | ISceneNode* parent=0, s32 id=-1); | 271 | ISceneNode* parent=0, s32 id=-1); |
272 | 272 | ||
273 | //! Adds an empty scene node. | 273 | //! Adds an empty scene node. |
274 | virtual ISceneNode* addEmptySceneNode(ISceneNode* parent, s32 id=-1); | 274 | virtual ISceneNode* addEmptySceneNode(ISceneNode* parent, s32 id=-1); |
275 | 275 | ||
276 | //! Returns the root scene node. This is the scene node wich is parent | 276 | //! Returns the root scene node. This is the scene node wich is parent |
277 | //! of all scene nodes. The root scene node is a special scene node which | 277 | //! of all scene nodes. The root scene node is a special scene node which |
278 | //! only exists to manage all scene nodes. It is not rendered and cannot | 278 | //! only exists to manage all scene nodes. It is not rendered and cannot |
279 | //! be removed from the scene. | 279 | //! be removed from the scene. |
280 | //! \return Pointer to the root scene node. | 280 | //! \return Pointer to the root scene node. |
281 | virtual ISceneNode* getRootSceneNode(); | 281 | virtual ISceneNode* getRootSceneNode(); |
282 | 282 | ||
283 | //! Returns the current active camera. | 283 | //! Returns the current active camera. |
284 | //! \return The active camera is returned. Note that this can be NULL, if there | 284 | //! \return The active camera is returned. Note that this can be NULL, if there |
285 | //! was no camera created yet. | 285 | //! was no camera created yet. |
286 | virtual ICameraSceneNode* getActiveCamera() const; | 286 | virtual ICameraSceneNode* getActiveCamera() const; |
287 | 287 | ||
288 | //! Sets the active camera. The previous active camera will be deactivated. | 288 | //! Sets the active camera. The previous active camera will be deactivated. |
289 | //! \param camera: The new camera which should be active. | 289 | //! \param camera: The new camera which should be active. |
290 | virtual void setActiveCamera(ICameraSceneNode* camera); | 290 | virtual void setActiveCamera(ICameraSceneNode* camera); |
291 | 291 | ||
292 | //! creates a rotation animator, which rotates the attached scene node around itself. | 292 | //! creates a rotation animator, which rotates the attached scene node around itself. |
293 | //! \param rotationPerSecond: Specifies the speed of the animation | 293 | //! \param rotationPerSecond: Specifies the speed of the animation |
294 | //! \return The animator. Attach it to a scene node with ISceneNode::addAnimator() | 294 | //! \return The animator. Attach it to a scene node with ISceneNode::addAnimator() |
295 | //! and the animator will animate it. | 295 | //! and the animator will animate it. |
296 | virtual ISceneNodeAnimator* createRotationAnimator(const core::vector3df& rotationPerSecond); | 296 | virtual ISceneNodeAnimator* createRotationAnimator(const core::vector3df& rotationPerSecond); |
297 | 297 | ||
298 | //! creates a fly circle animator | 298 | //! creates a fly circle animator |
299 | /** Lets the attached scene node fly around a center. | 299 | /** Lets the attached scene node fly around a center. |
300 | \param center Center relative to node origin | 300 | \param center Center relative to node origin |
301 | \param speed: The orbital speed, in radians per millisecond. | 301 | \param speed: The orbital speed, in radians per millisecond. |
302 | \param direction: Specifies the upvector used for alignment of the mesh. | 302 | \param direction: Specifies the upvector used for alignment of the mesh. |
303 | \param startPosition: The position on the circle where the animator will | 303 | \param startPosition: The position on the circle where the animator will |
304 | begin. Value is in multiples of a circle, i.e. 0.5 is half way around. | 304 | begin. Value is in multiples of a circle, i.e. 0.5 is half way around. |
305 | \return The animator. Attach it to a scene node with ISceneNode::addAnimator() | 305 | \return The animator. Attach it to a scene node with ISceneNode::addAnimator() |
306 | */ | 306 | */ |
307 | virtual ISceneNodeAnimator* createFlyCircleAnimator( | 307 | virtual ISceneNodeAnimator* createFlyCircleAnimator( |
308 | const core::vector3df& center=core::vector3df(0.f, 0.f, 0.f), | 308 | const core::vector3df& center=core::vector3df(0.f, 0.f, 0.f), |
309 | f32 radius=100.f, f32 speed=0.001f, | 309 | f32 radius=100.f, f32 speed=0.001f, |
310 | const core::vector3df& direction=core::vector3df(0.f, 1.f, 0.f), | 310 | const core::vector3df& direction=core::vector3df(0.f, 1.f, 0.f), |
311 | f32 startPosition = 0.f, | 311 | f32 startPosition = 0.f, |
312 | f32 radiusEllipsoid = 0.f); | 312 | f32 radiusEllipsoid = 0.f); |
313 | 313 | ||
314 | //! Creates a fly straight animator, which lets the attached scene node | 314 | //! Creates a fly straight animator, which lets the attached scene node |
315 | //! fly or move along a line between two points. | 315 | //! fly or move along a line between two points. |
316 | virtual ISceneNodeAnimator* createFlyStraightAnimator(const core::vector3df& startPoint, | 316 | virtual ISceneNodeAnimator* createFlyStraightAnimator(const core::vector3df& startPoint, |
317 | const core::vector3df& endPoint, u32 timeForWay, bool loop=false,bool pingpong = false); | 317 | const core::vector3df& endPoint, u32 timeForWay, bool loop=false,bool pingpong = false); |
318 | 318 | ||
319 | //! Creates a texture animator, which switches the textures of the target scene | 319 | //! Creates a texture animator, which switches the textures of the target scene |
320 | //! node based on a list of textures. | 320 | //! node based on a list of textures. |
321 | virtual ISceneNodeAnimator* createTextureAnimator(const core::array<video::ITexture*>& textures, | 321 | virtual ISceneNodeAnimator* createTextureAnimator(const core::array<video::ITexture*>& textures, |
322 | s32 timePerFrame, bool loop); | 322 | s32 timePerFrame, bool loop); |
323 | 323 | ||
324 | //! Creates a scene node animator, which deletes the scene node after | 324 | //! Creates a scene node animator, which deletes the scene node after |
325 | //! some time automaticly. | 325 | //! some time automaticly. |
326 | virtual ISceneNodeAnimator* createDeleteAnimator(u32 timeMS); | 326 | virtual ISceneNodeAnimator* createDeleteAnimator(u32 timeMS); |
327 | 327 | ||
328 | 328 | ||
329 | //! Creates a special scene node animator for doing automatic collision detection | 329 | //! Creates a special scene node animator for doing automatic collision detection |
330 | //! and response. | 330 | //! and response. |
331 | virtual ISceneNodeAnimatorCollisionResponse* createCollisionResponseAnimator( | 331 | virtual ISceneNodeAnimatorCollisionResponse* createCollisionResponseAnimator( |
332 | ITriangleSelector* world, ISceneNode* sceneNode, | 332 | ITriangleSelector* world, ISceneNode* sceneNode, |
333 | const core::vector3df& ellipsoidRadius = core::vector3df(30,60,30), | 333 | const core::vector3df& ellipsoidRadius = core::vector3df(30,60,30), |
334 | const core::vector3df& gravityPerSecond = core::vector3df(0,-1.0f,0), | 334 | const core::vector3df& gravityPerSecond = core::vector3df(0,-1.0f,0), |
335 | const core::vector3df& ellipsoidTranslation = core::vector3df(0,0,0), | 335 | const core::vector3df& ellipsoidTranslation = core::vector3df(0,0,0), |
336 | f32 slidingValue = 0.0005f); | 336 | f32 slidingValue = 0.0005f); |
337 | 337 | ||
338 | //! Creates a follow spline animator. | 338 | //! Creates a follow spline animator. |
339 | virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime, | 339 | virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime, |
340 | const core::array< core::vector3df >& points, | 340 | const core::array< core::vector3df >& points, |
341 | f32 speed, f32 tightness, bool loop, bool pingpong); | 341 | f32 speed, f32 tightness, bool loop, bool pingpong); |
342 | 342 | ||
343 | 343 | ||
344 | //! Creates a simple ITriangleSelector, based on a mesh. | 344 | //! Creates a simple ITriangleSelector, based on a mesh. |
345 | virtual ITriangleSelector* createTriangleSelector(IMesh* mesh, ISceneNode* node); | 345 | virtual ITriangleSelector* createTriangleSelector(IMesh* mesh, ISceneNode* node); |
346 | 346 | ||
347 | //! Creates a simple ITriangleSelector, based on an animated mesh scene node. | 347 | //! Creates a simple ITriangleSelector, based on an animated mesh scene node. |
348 | //! Details of the mesh associated with the node will be extracted internally. | 348 | //! Details of the mesh associated with the node will be extracted internally. |
349 | //! Call ITriangleSelector::update() to have the triangle selector updated based | 349 | //! Call ITriangleSelector::update() to have the triangle selector updated based |
350 | //! on the current frame of the animated mesh scene node. | 350 | //! on the current frame of the animated mesh scene node. |
351 | //! \param: The animated mesh scene node from which to build the selector | 351 | //! \param: The animated mesh scene node from which to build the selector |
352 | virtual ITriangleSelector* createTriangleSelector(IAnimatedMeshSceneNode* node); | 352 | virtual ITriangleSelector* createTriangleSelector(IAnimatedMeshSceneNode* node); |
353 | 353 | ||
354 | //! Creates a simple ITriangleSelector, based on a mesh. | 354 | //! Creates a simple ITriangleSelector, based on a mesh. |
355 | virtual ITriangleSelector* createOctreeTriangleSelector(IMesh* mesh, | 355 | virtual ITriangleSelector* createOctreeTriangleSelector(IMesh* mesh, |
356 | ISceneNode* node, s32 minimalPolysPerNode); | 356 | ISceneNode* node, s32 minimalPolysPerNode); |
357 | 357 | ||
358 | //! Creates a simple dynamic ITriangleSelector, based on a axis aligned bounding box. | 358 | //! Creates a simple dynamic ITriangleSelector, based on a axis aligned bounding box. |
359 | virtual ITriangleSelector* createTriangleSelectorFromBoundingBox( | 359 | virtual ITriangleSelector* createTriangleSelectorFromBoundingBox( |
360 | ISceneNode* node); | 360 | ISceneNode* node); |
361 | 361 | ||
362 | //! Creates a meta triangle selector. | 362 | //! Creates a meta triangle selector. |
363 | virtual IMetaTriangleSelector* createMetaTriangleSelector(); | 363 | virtual IMetaTriangleSelector* createMetaTriangleSelector(); |
364 | 364 | ||
365 | //! Creates a triangle selector which can select triangles from a terrain scene node | 365 | //! Creates a triangle selector which can select triangles from a terrain scene node |
366 | //! \param: Pointer to the created terrain scene node | 366 | //! \param: Pointer to the created terrain scene node |
367 | //! \param: Level of detail, 0 for highest detail. | 367 | //! \param: Level of detail, 0 for highest detail. |
368 | virtual ITriangleSelector* createTerrainTriangleSelector( | 368 | virtual ITriangleSelector* createTerrainTriangleSelector( |
369 | ITerrainSceneNode* node, s32 LOD=0); | 369 | ITerrainSceneNode* node, s32 LOD=0); |
370 | 370 | ||
371 | //! Adds an external mesh loader. | 371 | //! Adds an external mesh loader. |
372 | virtual void addExternalMeshLoader(IMeshLoader* externalLoader); | 372 | virtual void addExternalMeshLoader(IMeshLoader* externalLoader); |
373 | 373 | ||
374 | //! Returns the number of mesh loaders supported by Irrlicht at this time | 374 | //! Returns the number of mesh loaders supported by Irrlicht at this time |
375 | virtual u32 getMeshLoaderCount() const; | 375 | virtual u32 getMeshLoaderCount() const; |
376 | 376 | ||
377 | //! Retrieve the given mesh loader | 377 | //! Retrieve the given mesh loader |
378 | virtual IMeshLoader* getMeshLoader(u32 index) const; | 378 | virtual IMeshLoader* getMeshLoader(u32 index) const; |
379 | 379 | ||
380 | //! Adds an external scene loader. | 380 | //! Adds an external scene loader. |
381 | virtual void addExternalSceneLoader(ISceneLoader* externalLoader); | 381 | virtual void addExternalSceneLoader(ISceneLoader* externalLoader); |
382 | 382 | ||
383 | //! Returns the number of scene loaders supported by Irrlicht at this time | 383 | //! Returns the number of scene loaders supported by Irrlicht at this time |
384 | virtual u32 getSceneLoaderCount() const; | 384 | virtual u32 getSceneLoaderCount() const; |
385 | 385 | ||
386 | //! Retrieve the given scene loader | 386 | //! Retrieve the given scene loader |
387 | virtual ISceneLoader* getSceneLoader(u32 index) const; | 387 | virtual ISceneLoader* getSceneLoader(u32 index) const; |
388 | 388 | ||
389 | //! Returns a pointer to the scene collision manager. | 389 | //! Returns a pointer to the scene collision manager. |
390 | virtual ISceneCollisionManager* getSceneCollisionManager(); | 390 | virtual ISceneCollisionManager* getSceneCollisionManager(); |
391 | 391 | ||
392 | //! Returns a pointer to the mesh manipulator. | 392 | //! Returns a pointer to the mesh manipulator. |
393 | virtual IMeshManipulator* getMeshManipulator(); | 393 | virtual IMeshManipulator* getMeshManipulator(); |
394 | 394 | ||
395 | //! Sets the color of stencil buffers shadows drawn by the scene manager. | 395 | //! Sets the color of stencil buffers shadows drawn by the scene manager. |
396 | virtual void setShadowColor(video::SColor color); | 396 | virtual void setShadowColor(video::SColor color); |
397 | 397 | ||
398 | //! Returns the current color of shadows. | 398 | //! Returns the current color of shadows. |
399 | virtual video::SColor getShadowColor() const; | 399 | virtual video::SColor getShadowColor() const; |
400 | 400 | ||
401 | //! Adds a scene node to the deletion queue. | 401 | //! Adds a scene node to the deletion queue. |
402 | virtual void addToDeletionQueue(ISceneNode* node); | 402 | virtual void addToDeletionQueue(ISceneNode* node); |
403 | 403 | ||
404 | //! Returns the first scene node with the specified id. | 404 | //! Returns the first scene node with the specified id. |
405 | virtual ISceneNode* getSceneNodeFromId(s32 id, ISceneNode* start=0); | 405 | virtual ISceneNode* getSceneNodeFromId(s32 id, ISceneNode* start=0); |
406 | 406 | ||
407 | //! Returns the first scene node with the specified name. | 407 | //! Returns the first scene node with the specified name. |
408 | virtual ISceneNode* getSceneNodeFromName(const c8* name, ISceneNode* start=0); | 408 | virtual ISceneNode* getSceneNodeFromName(const c8* name, ISceneNode* start=0); |
409 | 409 | ||
410 | //! Returns the first scene node with the specified type. | 410 | //! Returns the first scene node with the specified type. |
411 | virtual ISceneNode* getSceneNodeFromType(scene::ESCENE_NODE_TYPE type, ISceneNode* start=0); | 411 | virtual ISceneNode* getSceneNodeFromType(scene::ESCENE_NODE_TYPE type, ISceneNode* start=0); |
412 | 412 | ||
413 | //! returns scene nodes by type. | 413 | //! returns scene nodes by type. |
414 | virtual void getSceneNodesFromType(ESCENE_NODE_TYPE type, core::array<scene::ISceneNode*>& outNodes, ISceneNode* start=0); | 414 | virtual void getSceneNodesFromType(ESCENE_NODE_TYPE type, core::array<scene::ISceneNode*>& outNodes, ISceneNode* start=0); |
415 | 415 | ||
416 | //! Posts an input event to the environment. Usually you do not have to | 416 | //! Posts an input event to the environment. Usually you do not have to |
417 | //! use this method, it is used by the internal engine. | 417 | //! use this method, it is used by the internal engine. |
418 | virtual bool postEventFromUser(const SEvent& event); | 418 | virtual bool postEventFromUser(const SEvent& event); |
419 | 419 | ||
420 | //! Clears the whole scene. All scene nodes are removed. | 420 | //! Clears the whole scene. All scene nodes are removed. |
421 | virtual void clear(); | 421 | virtual void clear(); |
422 | 422 | ||
423 | //! Removes all children of this scene node | 423 | //! Removes all children of this scene node |
424 | virtual void removeAll(); | 424 | virtual void removeAll(); |
425 | 425 | ||
426 | //! Returns interface to the parameters set in this scene. | 426 | //! Returns interface to the parameters set in this scene. |
427 | virtual io::IAttributes* getParameters(); | 427 | virtual io::IAttributes* getParameters(); |
428 | 428 | ||
429 | //! Returns current render pass. | 429 | //! Returns current render pass. |
430 | virtual E_SCENE_NODE_RENDER_PASS getSceneNodeRenderPass() const; | 430 | virtual E_SCENE_NODE_RENDER_PASS getSceneNodeRenderPass() const; |
431 | 431 | ||
432 | //! Creates a new scene manager. | 432 | //! Creates a new scene manager. |
433 | virtual ISceneManager* createNewSceneManager(bool cloneContent); | 433 | virtual ISceneManager* createNewSceneManager(bool cloneContent); |
434 | 434 | ||
435 | //! Returns type of the scene node | 435 | //! Returns type of the scene node |
436 | virtual ESCENE_NODE_TYPE getType() const { return ESNT_SCENE_MANAGER; } | 436 | virtual ESCENE_NODE_TYPE getType() const { return ESNT_SCENE_MANAGER; } |
437 | 437 | ||
438 | //! Returns the default scene node factory which can create all built in scene nodes | 438 | //! Returns the default scene node factory which can create all built in scene nodes |
439 | virtual ISceneNodeFactory* getDefaultSceneNodeFactory(); | 439 | virtual ISceneNodeFactory* getDefaultSceneNodeFactory(); |
440 | 440 | ||
441 | //! Adds a scene node factory to the scene manager. | 441 | //! Adds a scene node factory to the scene manager. |
442 | /** Use this to extend the scene manager with new scene node types which it should be | 442 | /** Use this to extend the scene manager with new scene node types which it should be |
443 | able to create automaticly, for example when loading data from xml files. */ | 443 | able to create automaticly, for example when loading data from xml files. */ |
444 | virtual void registerSceneNodeFactory(ISceneNodeFactory* factoryToAdd); | 444 | virtual void registerSceneNodeFactory(ISceneNodeFactory* factoryToAdd); |
445 | 445 | ||
446 | //! Returns amount of registered scene node factories. | 446 | //! Returns amount of registered scene node factories. |
447 | virtual u32 getRegisteredSceneNodeFactoryCount() const; | 447 | virtual u32 getRegisteredSceneNodeFactoryCount() const; |
448 | 448 | ||
449 | //! Returns a scene node factory by index | 449 | //! Returns a scene node factory by index |
450 | virtual ISceneNodeFactory* getSceneNodeFactory(u32 index); | 450 | virtual ISceneNodeFactory* getSceneNodeFactory(u32 index); |
451 | 451 | ||
452 | //! Returns a typename from a scene node type or null if not found | 452 | //! Returns a typename from a scene node type or null if not found |
453 | virtual const c8* getSceneNodeTypeName(ESCENE_NODE_TYPE type); | 453 | virtual const c8* getSceneNodeTypeName(ESCENE_NODE_TYPE type); |
454 | 454 | ||
455 | //! Returns a typename from a scene node animator type or null if not found | 455 | //! Returns a typename from a scene node animator type or null if not found |
456 | virtual const c8* getAnimatorTypeName(ESCENE_NODE_ANIMATOR_TYPE type); | 456 | virtual const c8* getAnimatorTypeName(ESCENE_NODE_ANIMATOR_TYPE type); |
457 | 457 | ||
458 | //! Adds a scene node to the scene by name | 458 | //! Adds a scene node to the scene by name |
459 | virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0); | 459 | virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0); |
460 | 460 | ||
461 | //! creates a scene node animator based on its type name | 461 | //! creates a scene node animator based on its type name |
462 | virtual ISceneNodeAnimator* createSceneNodeAnimator(const char* typeName, ISceneNode* target=0); | 462 | virtual ISceneNodeAnimator* createSceneNodeAnimator(const char* typeName, ISceneNode* target=0); |
463 | 463 | ||
464 | //! Returns the default scene node animator factory which can create all built-in scene node animators | 464 | //! Returns the default scene node animator factory which can create all built-in scene node animators |
465 | virtual ISceneNodeAnimatorFactory* getDefaultSceneNodeAnimatorFactory(); | 465 | virtual ISceneNodeAnimatorFactory* getDefaultSceneNodeAnimatorFactory(); |
466 | 466 | ||
467 | //! Adds a scene node animator factory to the scene manager. | 467 | //! Adds a scene node animator factory to the scene manager. |
468 | virtual void registerSceneNodeAnimatorFactory(ISceneNodeAnimatorFactory* factoryToAdd); | 468 | virtual void registerSceneNodeAnimatorFactory(ISceneNodeAnimatorFactory* factoryToAdd); |
469 | 469 | ||
470 | //! Returns amount of registered scene node animator factories. | 470 | //! Returns amount of registered scene node animator factories. |
471 | virtual u32 getRegisteredSceneNodeAnimatorFactoryCount() const; | 471 | virtual u32 getRegisteredSceneNodeAnimatorFactoryCount() const; |
472 | 472 | ||
473 | //! Returns a scene node animator factory by index | 473 | //! Returns a scene node animator factory by index |
474 | virtual ISceneNodeAnimatorFactory* getSceneNodeAnimatorFactory(u32 index); | 474 | virtual ISceneNodeAnimatorFactory* getSceneNodeAnimatorFactory(u32 index); |
475 | 475 | ||
476 | //! Saves the current scene into a file. | 476 | //! Saves the current scene into a file. |
477 | virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0); | 477 | virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0); |
478 | 478 | ||
479 | //! Saves the current scene into a file. | 479 | //! Saves the current scene into a file. |
480 | virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0); | 480 | virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0); |
481 | 481 | ||
482 | //! Saves the current scene into a file. | 482 | //! Saves the current scene into a file. |
483 | virtual bool saveScene(io::IXMLWriter* writer, const io::path& currentPath, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0); | 483 | virtual bool saveScene(io::IXMLWriter* writer, const io::path& currentPath, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0); |
484 | 484 | ||
485 | //! Loads a scene. Note that the current scene is not cleared before. | 485 | //! Loads a scene. Note that the current scene is not cleared before. |
486 | virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0); | 486 | virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0); |
487 | 487 | ||
488 | //! Loads a scene. Note that the current scene is not cleared before. | 488 | //! Loads a scene. Note that the current scene is not cleared before. |
489 | virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0); | 489 | virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0); |
490 | 490 | ||
491 | //! Writes attributes of the scene node. | 491 | //! Writes attributes of the scene node. |
492 | virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const; | 492 | virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const; |
493 | 493 | ||
494 | //! Reads attributes of the scene node. | 494 | //! Reads attributes of the scene node. |
495 | virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0); | 495 | virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0); |
496 | 496 | ||
497 | //! Returns a mesh writer implementation if available | 497 | //! Returns a mesh writer implementation if available |
498 | virtual IMeshWriter* createMeshWriter(EMESH_WRITER_TYPE type); | 498 | virtual IMeshWriter* createMeshWriter(EMESH_WRITER_TYPE type); |
499 | 499 | ||
500 | //! Get a skinned mesh, which is not available as header-only code | 500 | //! Get a skinned mesh, which is not available as header-only code |
501 | virtual ISkinnedMesh* createSkinnedMesh(); | 501 | virtual ISkinnedMesh* createSkinnedMesh(); |
502 | 502 | ||
503 | //! Sets ambient color of the scene | 503 | //! Sets ambient color of the scene |
504 | virtual void setAmbientLight(const video::SColorf &ambientColor); | 504 | virtual void setAmbientLight(const video::SColorf &ambientColor); |
505 | 505 | ||
506 | //! Returns ambient color of the scene | 506 | //! Returns ambient color of the scene |
507 | virtual const video::SColorf& getAmbientLight() const; | 507 | virtual const video::SColorf& getAmbientLight() const; |
508 | 508 | ||
509 | //! Register a custom callbacks manager which gets callbacks during scene rendering. | 509 | //! Register a custom callbacks manager which gets callbacks during scene rendering. |
510 | virtual void setLightManager(ILightManager* lightManager); | 510 | virtual void setLightManager(ILightManager* lightManager); |
511 | 511 | ||
512 | //! Get current render time. | 512 | //! Get current render time. |
513 | virtual E_SCENE_NODE_RENDER_PASS getCurrentRendertime() const { return CurrentRendertime; } | 513 | virtual E_SCENE_NODE_RENDER_PASS getCurrentRendertime() const { return CurrentRendertime; } |
514 | 514 | ||
515 | //! Set current render time. | 515 | //! Set current render time. |
516 | virtual void setCurrentRendertime(E_SCENE_NODE_RENDER_PASS currentRendertime) { CurrentRendertime = currentRendertime; } | 516 | virtual void setCurrentRendertime(E_SCENE_NODE_RENDER_PASS currentRendertime) { CurrentRendertime = currentRendertime; } |
517 | 517 | ||
518 | //! Get an instance of a geometry creator. | 518 | //! Get an instance of a geometry creator. |
519 | virtual const IGeometryCreator* getGeometryCreator(void) const { return GeometryCreator; } | 519 | virtual const IGeometryCreator* getGeometryCreator(void) const { return GeometryCreator; } |
520 | 520 | ||
521 | //! returns if node is culled | 521 | //! returns if node is culled |
522 | virtual bool isCulled(const ISceneNode* node) const; | 522 | virtual bool isCulled(const ISceneNode* node) const; |
523 | 523 | ||
524 | private: | 524 | private: |
525 | 525 | ||
526 | //! clears the deletion list | 526 | //! clears the deletion list |
527 | void clearDeletionList(); | 527 | void clearDeletionList(); |
528 | 528 | ||
529 | //! writes a scene node | 529 | //! writes a scene node |
530 | void writeSceneNode(io::IXMLWriter* writer, ISceneNode* node, ISceneUserDataSerializer* userDataSerializer, const fschar_t* currentPath=0, bool init=false); | 530 | void writeSceneNode(io::IXMLWriter* writer, ISceneNode* node, ISceneUserDataSerializer* userDataSerializer, const fschar_t* currentPath=0, bool init=false); |
531 | 531 | ||
532 | struct DefaultNodeEntry | 532 | struct DefaultNodeEntry |
533 | { | 533 | { |
534 | DefaultNodeEntry(ISceneNode* n) : | 534 | DefaultNodeEntry(ISceneNode* n) : |
535 | Node(n), TextureValue(0) | 535 | Node(n), TextureValue(0) |
536 | { | 536 | { |
537 | if (n->getMaterialCount()) | 537 | if (n->getMaterialCount()) |
538 | TextureValue = (n->getMaterial(0).getTexture(0)); | 538 | TextureValue = (n->getMaterial(0).getTexture(0)); |
539 | } | 539 | } |
540 | 540 | ||
541 | bool operator < (const DefaultNodeEntry& other) const | 541 | bool operator < (const DefaultNodeEntry& other) const |
542 | { | 542 | { |
543 | return (TextureValue < other.TextureValue); | 543 | return (TextureValue < other.TextureValue); |
544 | } | 544 | } |
545 | 545 | ||
546 | ISceneNode* Node; | 546 | ISceneNode* Node; |
547 | private: | 547 | private: |
548 | void* TextureValue; | 548 | void* TextureValue; |
549 | }; | 549 | }; |
550 | 550 | ||
551 | //! sort on distance (center) to camera | 551 | //! sort on distance (center) to camera |
552 | struct TransparentNodeEntry | 552 | struct TransparentNodeEntry |
553 | { | 553 | { |
554 | TransparentNodeEntry(ISceneNode* n, const core::vector3df& camera) | 554 | TransparentNodeEntry(ISceneNode* n, const core::vector3df& camera) |
555 | : Node(n) | 555 | : Node(n) |
556 | { | 556 | { |
557 | Distance = Node->getAbsoluteTransformation().getTranslation().getDistanceFromSQ(camera); | 557 | Distance = Node->getAbsoluteTransformation().getTranslation().getDistanceFromSQ(camera); |
558 | } | 558 | } |
559 | 559 | ||
560 | bool operator < (const TransparentNodeEntry& other) const | 560 | bool operator < (const TransparentNodeEntry& other) const |
561 | { | 561 | { |
562 | return Distance > other.Distance; | 562 | return Distance > other.Distance; |
563 | } | 563 | } |
564 | 564 | ||
565 | ISceneNode* Node; | 565 | ISceneNode* Node; |
566 | private: | 566 | private: |
567 | f64 Distance; | 567 | f64 Distance; |
568 | }; | 568 | }; |
569 | 569 | ||
570 | //! sort on distance (sphere) to camera | 570 | //! sort on distance (sphere) to camera |
571 | struct DistanceNodeEntry | 571 | struct DistanceNodeEntry |
572 | { | 572 | { |
573 | DistanceNodeEntry(ISceneNode* n, const core::vector3df& cameraPos) | 573 | DistanceNodeEntry(ISceneNode* n, const core::vector3df& cameraPos) |
574 | : Node(n) | 574 | : Node(n) |
575 | { | 575 | { |
576 | setNodeAndDistanceFromPosition(n, cameraPos); | 576 | setNodeAndDistanceFromPosition(n, cameraPos); |
577 | } | 577 | } |
578 | 578 | ||
579 | bool operator < (const DistanceNodeEntry& other) const | 579 | bool operator < (const DistanceNodeEntry& other) const |
580 | { | 580 | { |
581 | return Distance < other.Distance; | 581 | return Distance < other.Distance; |
582 | } | 582 | } |
583 | 583 | ||
584 | void setNodeAndDistanceFromPosition(ISceneNode* n, const core::vector3df & fromPosition) | 584 | void setNodeAndDistanceFromPosition(ISceneNode* n, const core::vector3df & fromPosition) |
585 | { | 585 | { |
586 | Node = n; | 586 | Node = n; |
587 | Distance = Node->getAbsoluteTransformation().getTranslation().getDistanceFromSQ(fromPosition); | 587 | Distance = Node->getAbsoluteTransformation().getTranslation().getDistanceFromSQ(fromPosition); |
588 | Distance -= Node->getBoundingBox().getExtent().getLengthSQ() * 0.5; | 588 | Distance -= Node->getBoundingBox().getExtent().getLengthSQ() * 0.5; |
589 | } | 589 | } |
590 | 590 | ||
591 | ISceneNode* Node; | 591 | ISceneNode* Node; |
592 | private: | 592 | private: |
593 | f64 Distance; | 593 | f64 Distance; |
594 | }; | 594 | }; |
595 | 595 | ||
596 | //! video driver | 596 | //! video driver |
597 | video::IVideoDriver* Driver; | 597 | video::IVideoDriver* Driver; |
598 | 598 | ||
599 | //! file system | 599 | //! file system |
600 | io::IFileSystem* FileSystem; | 600 | io::IFileSystem* FileSystem; |
601 | 601 | ||
602 | //! GUI Enviroment ( Debug Purpose ) | 602 | //! GUI Enviroment ( Debug Purpose ) |
603 | gui::IGUIEnvironment* GUIEnvironment; | 603 | gui::IGUIEnvironment* GUIEnvironment; |
604 | 604 | ||
605 | //! cursor control | 605 | //! cursor control |
606 | gui::ICursorControl* CursorControl; | 606 | gui::ICursorControl* CursorControl; |
607 | 607 | ||
608 | //! collision manager | 608 | //! collision manager |
609 | ISceneCollisionManager* CollisionManager; | 609 | ISceneCollisionManager* CollisionManager; |
610 | 610 | ||
611 | //! render pass lists | 611 | //! render pass lists |
612 | core::array<ISceneNode*> CameraList; | 612 | core::array<ISceneNode*> CameraList; |
613 | core::array<ISceneNode*> LightList; | 613 | core::array<ISceneNode*> LightList; |
614 | core::array<ISceneNode*> ShadowNodeList; | 614 | core::array<ISceneNode*> ShadowNodeList; |
615 | core::array<ISceneNode*> SkyBoxList; | 615 | core::array<ISceneNode*> SkyBoxList; |
616 | core::array<DefaultNodeEntry> SolidNodeList; | 616 | core::array<DefaultNodeEntry> SolidNodeList; |
617 | core::array<TransparentNodeEntry> TransparentNodeList; | 617 | core::array<TransparentNodeEntry> TransparentNodeList; |
618 | core::array<TransparentNodeEntry> TransparentEffectNodeList; | 618 | core::array<TransparentNodeEntry> TransparentEffectNodeList; |
619 | 619 | ||
620 | core::array<IMeshLoader*> MeshLoaderList; | 620 | core::array<IMeshLoader*> MeshLoaderList; |
621 | core::array<ISceneLoader*> SceneLoaderList; | 621 | core::array<ISceneLoader*> SceneLoaderList; |
622 | core::array<ISceneNode*> DeletionList; | 622 | core::array<ISceneNode*> DeletionList; |
623 | core::array<ISceneNodeFactory*> SceneNodeFactoryList; | 623 | core::array<ISceneNodeFactory*> SceneNodeFactoryList; |
624 | core::array<ISceneNodeAnimatorFactory*> SceneNodeAnimatorFactoryList; | 624 | core::array<ISceneNodeAnimatorFactory*> SceneNodeAnimatorFactoryList; |
625 | 625 | ||
626 | //! current active camera | 626 | //! current active camera |
627 | ICameraSceneNode* ActiveCamera; | 627 | ICameraSceneNode* ActiveCamera; |
628 | core::vector3df camWorldPos; // Position of camera for transparent nodes. | 628 | core::vector3df camWorldPos; // Position of camera for transparent nodes. |
629 | 629 | ||
630 | video::SColor ShadowColor; | 630 | video::SColor ShadowColor; |
631 | video::SColorf AmbientLight; | 631 | video::SColorf AmbientLight; |
632 | 632 | ||
633 | //! String parameters | 633 | //! String parameters |
634 | io::CAttributes Parameters; | 634 | io::CAttributes Parameters; |
635 | 635 | ||
636 | //! Mesh cache | 636 | //! Mesh cache |
637 | IMeshCache* MeshCache; | 637 | IMeshCache* MeshCache; |
638 | 638 | ||
639 | E_SCENE_NODE_RENDER_PASS CurrentRendertime; | 639 | E_SCENE_NODE_RENDER_PASS CurrentRendertime; |
640 | 640 | ||
641 | //! An optional callbacks manager to allow the user app finer control | 641 | //! An optional callbacks manager to allow the user app finer control |
642 | //! over the scene lighting and rendering. | 642 | //! over the scene lighting and rendering. |
643 | ILightManager* LightManager; | 643 | ILightManager* LightManager; |
644 | 644 | ||
645 | //! constants for reading and writing XML. | 645 | //! constants for reading and writing XML. |
646 | //! Not made static due to portability problems. | 646 | //! Not made static due to portability problems. |
647 | const core::stringw IRR_XML_FORMAT_SCENE; | 647 | const core::stringw IRR_XML_FORMAT_SCENE; |
648 | const core::stringw IRR_XML_FORMAT_NODE; | 648 | const core::stringw IRR_XML_FORMAT_NODE; |
649 | const core::stringw IRR_XML_FORMAT_NODE_ATTR_TYPE; | 649 | const core::stringw IRR_XML_FORMAT_NODE_ATTR_TYPE; |
650 | 650 | ||
651 | IGeometryCreator* GeometryCreator; | 651 | IGeometryCreator* GeometryCreator; |
652 | }; | 652 | }; |
653 | 653 | ||
654 | } // end namespace video | 654 | } // end namespace video |
655 | } // end namespace scene | 655 | } // end namespace scene |
656 | 656 | ||
657 | #endif | 657 | #endif |
658 | 658 | ||