]> git.lizzy.rs Git - irrlicht.git/blob - include/ISceneManager.h
Delete lots of unused features (#48)
[irrlicht.git] / include / ISceneManager.h
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #ifndef __I_SCENE_MANAGER_H_INCLUDED__\r
6 #define __I_SCENE_MANAGER_H_INCLUDED__\r
7 \r
8 #include "IReferenceCounted.h"\r
9 #include "irrArray.h"\r
10 #include "irrString.h"\r
11 #include "path.h"\r
12 #include "vector3d.h"\r
13 #include "dimension2d.h"\r
14 #include "SColor.h"\r
15 #include "ETerrainElements.h"\r
16 #include "ESceneNodeTypes.h"\r
17 #include "EMeshWriterEnums.h"\r
18 #include "SceneParameters.h"\r
19 #include "ISkinnedMesh.h"\r
20 \r
21 namespace irr\r
22 {\r
23         struct SKeyMap;\r
24         struct SEvent;\r
25 \r
26 namespace io\r
27 {\r
28         class IReadFile;\r
29         class IAttributes;\r
30         class IWriteFile;\r
31         class IFileSystem;\r
32 } // end namespace io\r
33 \r
34 namespace gui\r
35 {\r
36         class IGUIFont;\r
37         class IGUIEnvironment;\r
38 } // end namespace gui\r
39 \r
40 namespace video\r
41 {\r
42         class IVideoDriver;\r
43         class SMaterial;\r
44         class IImage;\r
45         class ITexture;\r
46 } // end namespace video\r
47 \r
48 namespace scene\r
49 {\r
50         //! Enumeration for render passes.\r
51         /** A parameter passed to the registerNodeForRendering() method of the ISceneManager,\r
52         specifying when the node wants to be drawn in relation to the other nodes.\r
53         Note: Despite the numbering this is not used as bit-field.\r
54         */\r
55         enum E_SCENE_NODE_RENDER_PASS\r
56         {\r
57                 //! No pass currently active\r
58                 ESNRP_NONE =0,\r
59 \r
60                 //! Camera pass. The active view is set up here. The very first pass.\r
61                 ESNRP_CAMERA =1,\r
62 \r
63                 //! In this pass, lights are transformed into camera space and added to the driver\r
64                 ESNRP_LIGHT =2,\r
65 \r
66                 //! This is used for sky boxes.\r
67                 ESNRP_SKY_BOX =4,\r
68 \r
69                 //! All normal objects can use this for registering themselves.\r
70                 /** This value will never be returned by\r
71                 ISceneManager::getSceneNodeRenderPass(). The scene manager\r
72                 will determine by itself if an object is transparent or solid\r
73                 and register the object as ESNRT_TRANSPARENT or ESNRP_SOLID\r
74                 automatically if you call registerNodeForRendering with this\r
75                 value (which is default). Note that it will register the node\r
76                 only as ONE type. If your scene node has both solid and\r
77                 transparent material types register it twice (one time as\r
78                 ESNRP_SOLID, the other time as ESNRT_TRANSPARENT) and in the\r
79                 render() method call getSceneNodeRenderPass() to find out the\r
80                 current render pass and render only the corresponding parts of\r
81                 the node. */\r
82                 ESNRP_AUTOMATIC =24,\r
83 \r
84                 //! Solid scene nodes or special scene nodes without materials.\r
85                 ESNRP_SOLID =8,\r
86 \r
87                 //! Transparent scene nodes, drawn after solid nodes. They are sorted from back to front and drawn in that order.\r
88                 ESNRP_TRANSPARENT =16,\r
89 \r
90                 //! Transparent effect scene nodes, drawn after Transparent nodes. They are sorted from back to front and drawn in that order.\r
91                 ESNRP_TRANSPARENT_EFFECT =32,\r
92 \r
93                 //! Drawn after the solid nodes, before the transparent nodes, the time for drawing shadow volumes\r
94                 ESNRP_SHADOW =64,\r
95 \r
96                 //! Drawn after transparent effect nodes. For custom gui's. Unsorted (in order nodes registered themselves). \r
97                 ESNRP_GUI = 128\r
98 \r
99         };\r
100 \r
101         class IAnimatedMesh;\r
102         class IAnimatedMeshSceneNode;\r
103         class IBillboardSceneNode;\r
104         class ICameraSceneNode;\r
105         class IDummyTransformationSceneNode;\r
106         class IMesh;\r
107         class IMeshBuffer;\r
108         class IMeshCache;\r
109         class IMeshLoader;\r
110         class IMeshManipulator;\r
111         class IMeshSceneNode;\r
112         class IMeshWriter;\r
113         class ISceneLoader;\r
114         class ISceneNode;\r
115         class ISceneNodeFactory;\r
116         class ISceneUserDataSerializer;\r
117 \r
118         //! The Scene Manager manages scene nodes, mesh resources, cameras and all the other stuff.\r
119         /** All Scene nodes can be created only here.\r
120         A scene node is a node in the hierarchical scene graph. Every scene node\r
121         may have children, which are other scene nodes. Children move relative\r
122         the their parents position. If the parent of a node is not visible, its\r
123         children won't be visible, too. In this way, it is for example easily\r
124         possible to attach a light to a moving car or to place a walking\r
125         character on a moving platform on a moving ship.\r
126         The SceneManager is also able to load 3d mesh files of different\r
127         formats. Take a look at getMesh() to find out what formats are\r
128         supported. If these formats are not enough, use\r
129         addExternalMeshLoader() to add new formats to the engine.\r
130         */\r
131         class ISceneManager : public virtual IReferenceCounted\r
132         {\r
133         public:\r
134 \r
135                 //! Get pointer to an animateable mesh. Loads the file if not loaded already.\r
136                 /**\r
137                  * If you want to remove a loaded mesh from the cache again, use removeMesh().\r
138                  *  Currently there are the following mesh formats supported:\r
139                  *  <TABLE border="1" cellpadding="2" cellspacing="0">\r
140                  *  <TR>\r
141                  *    <TD>Format</TD>\r
142                  *    <TD>Description</TD>\r
143                  *  </TR>\r
144                  *  <TR>\r
145                  *    <TD>3D Studio (.3ds)</TD>\r
146                  *    <TD>Loader for 3D-Studio files which lots of 3D packages\r
147                  *      are able to export. Only static meshes are currently\r
148                  *      supported by this importer.</TD>\r
149                  *  </TR>\r
150                  *  <TR>\r
151                  *    <TD>3D World Studio (.smf)</TD>\r
152                  *    <TD>Loader for Leadwerks SMF mesh files, a simple mesh format\r
153                  *    containing static geometry for games. The proprietary .STF texture format\r
154                  *    is not supported yet. This loader was originally written by Joseph Ellis. </TD>\r
155                  *  </TR>\r
156                  *  <TR>\r
157                  *    <TD>Bliz Basic B3D (.b3d)</TD>\r
158                  *    <TD>Loader for blitz basic files, developed by Mark\r
159                  *      Sibly. This is the ideal animated mesh format for game\r
160                  *      characters as it is both rigidly defined and widely\r
161                  *      supported by modeling and animation software.\r
162                  *      As this format supports skeletal animations, an\r
163                  *      ISkinnedMesh will be returned by this importer.</TD>\r
164                  *  </TR>\r
165                  *  <TR>\r
166                  *    <TD>Cartography shop 4 (.csm)</TD>\r
167                  *    <TD>Cartography Shop is a modeling program for creating\r
168                  *      architecture and calculating lighting. Irrlicht can\r
169                  *      directly import .csm files thanks to the IrrCSM library\r
170                  *      created by Saurav Mohapatra which is now integrated\r
171                  *      directly in Irrlicht.\r
172                  *  </TR>\r
173                  *  <TR>\r
174                  *    <TD>Delgine DeleD (.dmf)</TD>\r
175                  *    <TD>DeleD (delgine.com) is a 3D editor and level-editor\r
176                  *        combined into one and is specifically designed for 3D\r
177                  *        game-development. With this loader, it is possible to\r
178                  *        directly load all geometry is as well as textures and\r
179                  *        lightmaps from .dmf files. To set texture and\r
180                  *        material paths, see scene::DMF_USE_MATERIALS_DIRS.\r
181                  *        It is also possible to flip the alpha texture by setting\r
182                  *        scene::DMF_FLIP_ALPHA_TEXTURES to true and to set the\r
183                  *        material transparent reference value by setting\r
184                  *        scene::DMF_ALPHA_CHANNEL_REF to a float between 0 and\r
185                  *        1. The loader is based on Salvatore Russo's .dmf\r
186                  *        loader, I just changed some parts of it. Thanks to\r
187                  *        Salvatore for his work and for allowing me to use his\r
188                  *        code in Irrlicht and put it under Irrlicht's license.\r
189                  *        For newer and more enhanced versions of the loader,\r
190                  *        take a look at delgine.com.\r
191                  *    </TD>\r
192                  *  </TR>\r
193                  *  <TR>\r
194                  *    <TD>DirectX (.x)</TD>\r
195                  *    <TD>Platform independent importer (so not D3D-only) for\r
196                  *      .x files. Most 3D packages can export these natively\r
197                  *      and there are several tools for them available, e.g.\r
198                  *      the Maya exporter included in the DX SDK.\r
199                  *      .x files can include skeletal animations and Irrlicht\r
200                  *      is able to play and display them, users can manipulate\r
201                  *      the joints via the ISkinnedMesh interface. Currently,\r
202                  *      Irrlicht only supports uncompressed .x files.</TD>\r
203                  *  </TR>\r
204                  *  <TR>\r
205                  *    <TD>Half-Life model (.mdl)</TD>\r
206                  *    <TD>This loader opens Half-life 1 models, it was contributed\r
207                  *        by Fabio Concas and adapted by Thomas Alten.</TD>\r
208                  *  </TR>\r
209                  *  <TR>\r
210                  *    <TD>LightWave (.lwo)</TD>\r
211                  *    <TD>Native to NewTek's LightWave 3D, the LWO format is well\r
212                  *      known and supported by many exporters. This loader will\r
213                  *      import LWO2 models including lightmaps, bumpmaps and\r
214                  *      reflection textures.</TD>\r
215                  *  </TR>\r
216                  *  <TR>\r
217                  *    <TD>Maya (.obj)</TD>\r
218                  *    <TD>Most 3D software can create .obj files which contain\r
219                  *      static geometry without material data. The material\r
220                  *      files .mtl are also supported. This importer for\r
221                  *      Irrlicht can load them directly. </TD>\r
222                  *  </TR>\r
223                  *  <TR>\r
224                  *    <TD>Milkshape (.ms3d)</TD>\r
225                  *    <TD>.MS3D files contain models and sometimes skeletal\r
226                  *      animations from the Milkshape 3D modeling and animation\r
227                  *      software. Like the other skeletal mesh loaders, joints\r
228                  *      are exposed via the ISkinnedMesh animated mesh type.</TD>\r
229                  *  </TR>\r
230                  *  <TR>\r
231                  *  <TD>My3D (.my3d)</TD>\r
232                  *      <TD>.my3D is a flexible 3D file format. The My3DTools\r
233                  *        contains plug-ins to export .my3D files from several\r
234                  *        3D packages. With this built-in importer, Irrlicht\r
235                  *        can read and display those files directly. This\r
236                  *        loader was written by Zhuck Dimitry who also created\r
237                  *        the whole My3DTools package.\r
238                  *        </TD>\r
239                  *    </TR>\r
240                  *    <TR>\r
241                  *      <TD>OCT (.oct)</TD>\r
242                  *      <TD>The oct file format contains 3D geometry and\r
243                  *        lightmaps and can be loaded directly by Irrlicht. OCT\r
244                  *        files<br> can be created by FSRad, Paul Nette's\r
245                  *        radiosity processor or exported from Blender using\r
246                  *        OCTTools which can be found in the exporters/OCTTools\r
247                  *        directory of the SDK. Thanks to Murphy McCauley for\r
248                  *        creating all this.</TD>\r
249                  *    </TR>\r
250                  *    <TR>\r
251                  *      <TD>OGRE Meshes (.mesh)</TD>\r
252                  *      <TD>Ogre .mesh files contain 3D data for the OGRE 3D\r
253                  *        engine. Irrlicht can read and display them directly\r
254                  *        with this importer. To define materials for the mesh,\r
255                  *        copy a .material file named like the corresponding\r
256                  *        .mesh file where the .mesh file is. (For example\r
257                  *        ogrehead.material for ogrehead.mesh). Thanks to\r
258                  *        Christian Stehno who wrote and contributed this\r
259                  *        loader.</TD>\r
260                  *    </TR>\r
261                  *    <TR>\r
262                  *      <TD>Pulsar LMTools (.lmts)</TD>\r
263                  *      <TD>LMTools is a set of tools (Windows &amp; Linux) for\r
264                  *        creating lightmaps. Irrlicht can directly read .lmts\r
265                  *        files thanks to<br> the importer created by Jonas\r
266                  *        Petersen.\r
267                  *        Notes for<br> this version of the loader:<br>\r
268                  *        - It does not recognize/support user data in the\r
269                  *          *.lmts files.<br>\r
270                  *        - The TGAs generated by LMTools don't work in\r
271                  *          Irrlicht for some reason (the textures are upside\r
272                  *          down). Opening and resaving them in a graphics app\r
273                  *          will solve the problem.</TD>\r
274                  *    </TR>\r
275                  *    <TR>\r
276                  *      <TD>Quake 3 levels (.bsp)</TD>\r
277                  *      <TD>Quake 3 is a popular game by IDSoftware, and .pk3\r
278                  *        files contain .bsp files and textures/lightmaps\r
279                  *        describing huge prelighted levels. Irrlicht can read\r
280                  *        .pk3 and .bsp files directly and thus render Quake 3\r
281                  *        levels directly. Written by Nikolaus Gebhardt\r
282                  *        enhanced by Dean P. Macri with the curved surfaces\r
283                  *        feature. </TD>\r
284                  *    </TR>\r
285                  *    <TR>\r
286                  *      <TD>Quake 2 models (.md2)</TD>\r
287                  *      <TD>Quake 2 models are characters with morph target\r
288                  *        animation. Irrlicht can read, display and animate\r
289                  *        them directly with this importer. </TD>\r
290                  *    </TR>\r
291                  *    <TR>\r
292                  *      <TD>Quake 3 models (.md3)</TD>\r
293                  *      <TD>Quake 3 models are characters with morph target\r
294                  *        animation, they contain mount points for weapons and body\r
295                  *        parts and are typically made of several sections which are\r
296                  *        manually joined together.</TD>\r
297                  *    </TR>\r
298                  *    <TR>\r
299                  *      <TD>Stanford Triangle (.ply)</TD>\r
300                  *      <TD>Invented by Stanford University and known as the native\r
301                  *        format of the infamous "Stanford Bunny" model, this is a\r
302                  *        popular static mesh format used by 3D scanning hardware\r
303                  *        and software. This loader supports extremely large models\r
304                  *        in both ASCII and binary format, but only has rudimentary\r
305                  *        material support in the form of vertex colors and texture\r
306                  *        coordinates.</TD>\r
307                  *    </TR>\r
308                  *    <TR>\r
309                  *      <TD>Stereolithography (.stl)</TD>\r
310                  *      <TD>The STL format is used for rapid prototyping and\r
311                  *        computer-aided manufacturing, thus has no support for\r
312                  *        materials.</TD>\r
313                  *    </TR>\r
314                  *  </TABLE>\r
315                  *\r
316                  *  To load and display a mesh quickly, just do this:\r
317                  *  \code\r
318                  *  SceneManager->addAnimatedMeshSceneNode(\r
319                  *              SceneManager->getMesh("yourmesh.3ds"));\r
320                  * \endcode\r
321                  * If you would like to implement and add your own file format loader to Irrlicht,\r
322                  * see addExternalMeshLoader().\r
323                  * \param filename: Filename of the mesh to load.\r
324                  * \param alternativeCacheName: In case you want to have the mesh under another name in the cache (to create real copies)\r
325                  * \return Null if failed, otherwise pointer to the mesh.\r
326                  * This pointer should not be dropped. See IReferenceCounted::drop() for more information.\r
327                  **/\r
328                 virtual IAnimatedMesh* getMesh(const io::path& filename, const io::path& alternativeCacheName=io::path("")) = 0;\r
329 \r
330                 //! Get pointer to an animateable mesh. Loads the file if not loaded already.\r
331                 /** Works just as getMesh(const char* filename). If you want to\r
332                 remove a loaded mesh from the cache again, use removeMesh().\r
333                 \param file File handle of the mesh to load.\r
334                 \return NULL if failed and pointer to the mesh if successful.\r
335                 This pointer should not be dropped. See\r
336                 IReferenceCounted::drop() for more information. */\r
337                 virtual IAnimatedMesh* getMesh(io::IReadFile* file) = 0;\r
338 \r
339                 //! Get interface to the mesh cache which is shared between all existing scene managers.\r
340                 /** With this interface, it is possible to manually add new loaded\r
341                 meshes (if ISceneManager::getMesh() is not sufficient), to remove them and to iterate\r
342                 through already loaded meshes. */\r
343                 virtual IMeshCache* getMeshCache() = 0;\r
344 \r
345                 //! Get the video driver.\r
346                 /** \return Pointer to the video Driver.\r
347                 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
348                 virtual video::IVideoDriver* getVideoDriver() = 0;\r
349 \r
350                 //! Get the active GUIEnvironment\r
351                 /** \return Pointer to the GUIEnvironment\r
352                 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
353                 virtual gui::IGUIEnvironment* getGUIEnvironment() = 0;\r
354 \r
355                 //! Get the active FileSystem\r
356                 /** \return Pointer to the FileSystem\r
357                 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
358                 virtual io::IFileSystem* getFileSystem() = 0;\r
359 \r
360                 //! Adds a scene node for rendering an animated mesh model.\r
361                 /** \param mesh: Pointer to the loaded animated mesh to be displayed.\r
362                 \param parent: Parent of the scene node. Can be NULL if no parent.\r
363                 \param id: Id of the node. This id can be used to identify the scene node.\r
364                 \param position: Position of the space relative to its parent where the\r
365                 scene node will be placed.\r
366                 \param rotation: Initial rotation of the scene node.\r
367                 \param scale: Initial scale of the scene node.\r
368                 \param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed.\r
369                 \return Pointer to the created scene node.\r
370                 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
371                 virtual IAnimatedMeshSceneNode* addAnimatedMeshSceneNode(IAnimatedMesh* mesh,\r
372                                 ISceneNode* parent=0, s32 id=-1,\r
373                                 const core::vector3df& position = core::vector3df(0,0,0),\r
374                                 const core::vector3df& rotation = core::vector3df(0,0,0),\r
375                                 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f),\r
376                                 bool alsoAddIfMeshPointerZero=false) = 0;\r
377 \r
378                 //! Adds a scene node for rendering a static mesh.\r
379                 /** \param mesh: Pointer to the loaded static mesh to be displayed.\r
380                 \param parent: Parent of the scene node. Can be NULL if no parent.\r
381                 \param id: Id of the node. This id can be used to identify the scene node.\r
382                 \param position: Position of the space relative to its parent where the\r
383                 scene node will be placed.\r
384                 \param rotation: Initial rotation of the scene node.\r
385                 \param scale: Initial scale of the scene node.\r
386                 \param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed.\r
387                 \return Pointer to the created scene node.\r
388                 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
389                 virtual IMeshSceneNode* addMeshSceneNode(IMesh* mesh, ISceneNode* parent=0, s32 id=-1,\r
390                         const core::vector3df& position = core::vector3df(0,0,0),\r
391                         const core::vector3df& rotation = core::vector3df(0,0,0),\r
392                         const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f),\r
393                         bool alsoAddIfMeshPointerZero=false) = 0;\r
394 \r
395                 //! Adds a camera scene node to the scene graph and sets it as active camera.\r
396                 /** This camera does not react on user input.\r
397                 If you want to move or animate it, use ISceneNode::setPosition(),\r
398                 ICameraSceneNode::setTarget() etc methods.\r
399                 By default, a camera's look at position (set with setTarget()) and its scene node\r
400                 rotation (set with setRotation()) are independent. If you want to be able to\r
401                 control the direction that the camera looks by using setRotation() then call\r
402                 ICameraSceneNode::bindTargetAndRotation(true) on it.\r
403                 \param position: Position of the space relative to its parent where the camera will be placed.\r
404                 \param lookat: Position where the camera will look at. Also known as target.\r
405                 \param parent: Parent scene node of the camera. Can be null. If the parent moves,\r
406                 the camera will move too.\r
407                 \param id: id of the camera. This id can be used to identify the camera.\r
408                 \param makeActive Flag whether this camera should become the active one.\r
409                 Make sure you always have one active camera.\r
410                 \return Pointer to interface to camera if successful, otherwise 0.\r
411                 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
412                 virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0,\r
413                         const core::vector3df& position = core::vector3df(0,0,0),\r
414                         const core::vector3df& lookat = core::vector3df(0,0,100),\r
415                         s32 id=-1, bool makeActive=true) = 0;\r
416 \r
417                 //! Adds a billboard scene node to the scene graph.\r
418                 /** A billboard is like a 3d sprite: A 2d element,\r
419                 which always looks to the camera. It is usually used for things\r
420                 like explosions, fire, lensflares and things like that.\r
421                 \param parent Parent scene node of the billboard. Can be null.\r
422                 If the parent moves, the billboard will move too.\r
423                 \param size Size of the billboard. This size is 2 dimensional\r
424                 because a billboard only has width and height.\r
425                 \param position Position of the space relative to its parent\r
426                 where the billboard will be placed.\r
427                 \param id An id of the node. This id can be used to identify\r
428                 the node.\r
429                 \param colorTop The color of the vertices at the top of the\r
430                 billboard (default: white).\r
431                 \param colorBottom The color of the vertices at the bottom of\r
432                 the billboard (default: white).\r
433                 \return Pointer to the billboard if successful, otherwise NULL.\r
434                 This pointer should not be dropped. See\r
435                 IReferenceCounted::drop() for more information. */\r
436                 virtual IBillboardSceneNode* addBillboardSceneNode(ISceneNode* parent = 0,\r
437                         const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f),\r
438                         const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1,\r
439                         video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF) = 0;\r
440 \r
441                 //! Adds an empty scene node to the scene graph.\r
442                 /** Can be used for doing advanced transformations\r
443                 or structuring the scene graph.\r
444                 \return Pointer to the created scene node.\r
445                 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
446                 virtual ISceneNode* addEmptySceneNode(ISceneNode* parent=0, s32 id=-1) = 0;\r
447 \r
448                 //! Adds a dummy transformation scene node to the scene graph.\r
449                 /** This scene node does not render itself, and does not respond to set/getPosition,\r
450                 set/getRotation and set/getScale. Its just a simple scene node that takes a\r
451                 matrix as relative transformation, making it possible to insert any transformation\r
452                 anywhere into the scene graph.\r
453                 \return Pointer to the created scene node.\r
454                 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
455                 virtual IDummyTransformationSceneNode* addDummyTransformationSceneNode(\r
456                         ISceneNode* parent=0, s32 id=-1) = 0;\r
457 \r
458                 //! Gets the root scene node.\r
459                 /** This is the scene node which is parent\r
460                 of all scene nodes. The root scene node is a special scene node which\r
461                 only exists to manage all scene nodes. It will not be rendered and cannot\r
462                 be removed from the scene.\r
463                 \return Pointer to the root scene node.\r
464                 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
465                 virtual ISceneNode* getRootSceneNode() = 0;\r
466 \r
467                 //! Get the first scene node with the specified id.\r
468                 /** \param id: The id to search for\r
469                 \param start: Scene node to start from. All children of this scene\r
470                 node are searched. If null is specified, the root scene node is\r
471                 taken.\r
472                 \return Pointer to the first scene node with this id,\r
473                 and null if no scene node could be found.\r
474                 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
475                 virtual ISceneNode* getSceneNodeFromId(s32 id, ISceneNode* start=0) = 0;\r
476 \r
477                 //! Get the first scene node with the specified name.\r
478                 /** \param name: The name to search for\r
479                 \param start: Scene node to start from. All children of this scene\r
480                 node are searched. If null is specified, the root scene node is\r
481                 taken.\r
482                 \return Pointer to the first scene node with this id,\r
483                 and null if no scene node could be found.\r
484                 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
485                 virtual ISceneNode* getSceneNodeFromName(const c8* name, ISceneNode* start=0) = 0;\r
486 \r
487                 //! Get the first scene node with the specified type.\r
488                 /** \param type: The type to search for\r
489                 \param start: Scene node to start from. All children of this scene\r
490                 node are searched. If null is specified, the root scene node is\r
491                 taken.\r
492                 \return Pointer to the first scene node with this type,\r
493                 and null if no scene node could be found.\r
494                 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
495                 virtual ISceneNode* getSceneNodeFromType(scene::ESCENE_NODE_TYPE type, ISceneNode* start=0) = 0;\r
496 \r
497                 //! Get scene nodes by type.\r
498                 /** \param type: Type of scene node to find (ESNT_ANY will return all child nodes).\r
499                 \param outNodes: results will be added to this array (outNodes is not cleared).\r
500                 \param start: Scene node to start from. This node and all children of this scene\r
501                 node are checked (recursively, so also children of children, etc). If null is specified,\r
502                 the root scene node is taken as start-node. */\r
503                 virtual void getSceneNodesFromType(ESCENE_NODE_TYPE type,\r
504                                 core::array<scene::ISceneNode*>& outNodes,\r
505                                 ISceneNode* start=0) = 0;\r
506 \r
507                 //! Get the current active camera.\r
508                 /** \return The active camera is returned. Note that this can\r
509                 be NULL, if there was no camera created yet.\r
510                 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
511                 virtual ICameraSceneNode* getActiveCamera() const =0;\r
512 \r
513                 //! Sets the currently active camera.\r
514                 /** The previous active camera will be deactivated.\r
515                 \param camera: The new camera which should be active. */\r
516                 virtual void setActiveCamera(ICameraSceneNode* camera) = 0;\r
517 \r
518                 //! Registers a node for rendering it at a specific time.\r
519                 /** This method should only be used by SceneNodes when they get a\r
520                 ISceneNode::OnRegisterSceneNode() call.\r
521                 \param node: Node to register for drawing. Usually scene nodes would set 'this'\r
522                 as parameter here because they want to be drawn.\r
523                 \param pass: Specifies when the node wants to be drawn in relation to the other nodes.\r
524                 For example, if the node is a shadow, it usually wants to be drawn after all other nodes\r
525                 and will use ESNRP_SHADOW for this. See scene::E_SCENE_NODE_RENDER_PASS for details.\r
526                 Note: This is _not_ a bitfield. If you want to register a note for several render passes, then \r
527                 call this function once for each pass.\r
528                 \return scene will be rendered ( passed culling ) */\r
529                 virtual u32 registerNodeForRendering(ISceneNode* node,\r
530                         E_SCENE_NODE_RENDER_PASS pass = ESNRP_AUTOMATIC) = 0;\r
531 \r
532                 //! Clear all nodes which are currently registered for rendering\r
533                 /** Usually you don't have to care about this as drawAll will clear nodes\r
534                 after rendering them. But sometimes you might have to manully reset this.\r
535                 For example when you deleted nodes between registering and rendering. */\r
536                 virtual void clearAllRegisteredNodesForRendering() = 0;\r
537 \r
538                 //! Draws all the scene nodes.\r
539                 /** This can only be invoked between\r
540                 IVideoDriver::beginScene() and IVideoDriver::endScene(). Please note that\r
541                 the scene is not only drawn when calling this, but also animated\r
542                 by existing scene node animators, culling of scene nodes is done, etc. */\r
543                 virtual void drawAll() = 0;\r
544 \r
545                 //! Adds an external mesh loader for extending the engine with new file formats.\r
546                 /** If you want the engine to be extended with\r
547                 file formats it currently is not able to load (e.g. .cob), just implement\r
548                 the IMeshLoader interface in your loading class and add it with this method.\r
549                 Using this method it is also possible to override built-in mesh loaders with\r
550                 newer or updated versions without the need to recompile the engine.\r
551                 \param externalLoader: Implementation of a new mesh loader. */\r
552                 virtual void addExternalMeshLoader(IMeshLoader* externalLoader) = 0;\r
553 \r
554                 //! Returns the number of mesh loaders supported by Irrlicht at this time\r
555                 virtual u32 getMeshLoaderCount() const = 0;\r
556 \r
557                 //! Retrieve the given mesh loader\r
558                 /** \param index The index of the loader to retrieve. This parameter is an 0-based\r
559                 array index.\r
560                 \return A pointer to the specified loader, 0 if the index is incorrect. */\r
561                 virtual IMeshLoader* getMeshLoader(u32 index) const = 0;\r
562 \r
563                 //! Adds an external scene loader for extending the engine with new file formats.\r
564                 /** If you want the engine to be extended with\r
565                 file formats it currently is not able to load (e.g. .vrml), just implement\r
566                 the ISceneLoader interface in your loading class and add it with this method.\r
567                 Using this method it is also possible to override the built-in scene loaders\r
568                 with newer or updated versions without the need to recompile the engine.\r
569                 \param externalLoader: Implementation of a new mesh loader. */\r
570                 virtual void addExternalSceneLoader(ISceneLoader* externalLoader) = 0;\r
571 \r
572                 //! Returns the number of scene loaders supported by Irrlicht at this time\r
573                 virtual u32 getSceneLoaderCount() const = 0;\r
574 \r
575                 //! Retrieve the given scene loader\r
576                 /** \param index The index of the loader to retrieve. This parameter is an 0-based\r
577                 array index.\r
578                 \return A pointer to the specified loader, 0 if the index is incorrect. */\r
579                 virtual ISceneLoader* getSceneLoader(u32 index) const = 0;\r
580 \r
581                 //! Get pointer to the mesh manipulator.\r
582                 /** \return Pointer to the mesh manipulator\r
583                 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
584                 virtual IMeshManipulator* getMeshManipulator() = 0;\r
585 \r
586                 //! Adds a scene node to the deletion queue.\r
587                 /** The scene node is immediately\r
588                 deleted when it's secure. Which means when the scene node does not\r
589                 execute animators and things like that. This method is for example\r
590                 used for deleting scene nodes by their scene node animators. In\r
591                 most other cases, a ISceneNode::remove() call is enough, using this\r
592                 deletion queue is not necessary.\r
593                 See ISceneManager::createDeleteAnimator() for details.\r
594                 \param node: Node to delete. */\r
595                 virtual void addToDeletionQueue(ISceneNode* node) = 0;\r
596 \r
597                 //! Posts an input event to the environment.\r
598                 /** Usually you do not have to\r
599                 use this method, it is used by the internal engine. */\r
600                 virtual bool postEventFromUser(const SEvent& event) = 0;\r
601 \r
602                 //! Clears the whole scene.\r
603                 /** All scene nodes are removed. */\r
604                 virtual void clear() = 0;\r
605 \r
606                 //! Get interface to the parameters set in this scene.\r
607                 /** String parameters can be used by plugins and mesh loaders.\r
608                 See     COLLADA_CREATE_SCENE_INSTANCES and DMF_USE_MATERIALS_DIRS */\r
609                 virtual io::IAttributes* getParameters() = 0;\r
610 \r
611                 //! Get current render pass.\r
612                 /** All scene nodes are being rendered in a specific order.\r
613                 First lights, cameras, sky boxes, solid geometry, and then transparent\r
614                 stuff. During the rendering process, scene nodes may want to know what the scene\r
615                 manager is rendering currently, because for example they registered for rendering\r
616                 twice, once for transparent geometry and once for solid. When knowing what rendering\r
617                 pass currently is active they can render the correct part of their geometry. */\r
618                 virtual E_SCENE_NODE_RENDER_PASS getSceneNodeRenderPass() const = 0;\r
619 \r
620                 //! Get the default scene node factory which can create all built in scene nodes\r
621                 /** \return Pointer to the default scene node factory\r
622                 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
623                 virtual ISceneNodeFactory* getDefaultSceneNodeFactory() = 0;\r
624 \r
625                 //! Adds a scene node factory to the scene manager.\r
626                 /** Use this to extend the scene manager with new scene node types which it should be\r
627                 able to create automatically, for example when loading data from xml files. */\r
628                 virtual void registerSceneNodeFactory(ISceneNodeFactory* factoryToAdd) = 0;\r
629 \r
630                 //! Get amount of registered scene node factories.\r
631                 virtual u32 getRegisteredSceneNodeFactoryCount() const = 0;\r
632 \r
633                 //! Get a scene node factory by index\r
634                 /** \return Pointer to the requested scene node factory, or 0 if it does not exist.\r
635                 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
636                 virtual ISceneNodeFactory* getSceneNodeFactory(u32 index) = 0;\r
637 \r
638                 //! Get typename from a scene node type or null if not found\r
639                 virtual const c8* getSceneNodeTypeName(ESCENE_NODE_TYPE type) = 0;\r
640 \r
641                 //! Adds a scene node to the scene by name\r
642                 /** \return Pointer to the scene node added by a factory\r
643                 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */\r
644                 virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0) = 0;\r
645 \r
646                 //! Creates a new scene manager.\r
647                 /** This can be used to easily draw and/or store two\r
648                 independent scenes at the same time. The mesh cache will be\r
649                 shared between all existing scene managers, which means if you\r
650                 load a mesh in the original scene manager using for example\r
651                 getMesh(), the mesh will be available in all other scene\r
652                 managers too, without loading.\r
653                 The original/main scene manager will still be there and\r
654                 accessible via IrrlichtDevice::getSceneManager(). If you need\r
655                 input event in this new scene manager, for example for FPS\r
656                 cameras, you'll need to forward input to this manually: Just\r
657                 implement an IEventReceiver and call\r
658                 yourNewSceneManager->postEventFromUser(), and return true so\r
659                 that the original scene manager doesn't get the event.\r
660                 Otherwise, all input will go to the main scene manager\r
661                 automatically.\r
662                 If you no longer need the new scene manager, you should call\r
663                 ISceneManager::drop().\r
664                 See IReferenceCounted::drop() for more information. */\r
665                 virtual ISceneManager* createNewSceneManager(bool cloneContent=false) = 0;\r
666 \r
667                 //! Saves the current scene into a file.\r
668                 /** Scene nodes with the option isDebugObject set to true are\r
669                 not being saved. The scene is usually written to an .irr file,\r
670                 an xml based format. .irr files can Be edited with the Irrlicht\r
671                 Engine Editor, irrEdit (http://www.ambiera.com/irredit/). To\r
672                 load .irr files again, see ISceneManager::loadScene().\r
673                 \param filename Name of the file.\r
674                 \param userDataSerializer If you want to save some user data\r
675                 for every scene node into the file, implement the\r
676                 ISceneUserDataSerializer interface and provide it as parameter\r
677                 here. Otherwise, simply specify 0 as this parameter.\r
678                 \param node Node which is taken as the top node of the scene.\r
679                 This node and all of its descendants are saved into the scene\r
680                 file. Pass 0 or the scene manager to save the full scene (which\r
681                 is also the default).\r
682                 \return True if successful. */\r
683                 virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0;\r
684 \r
685                 //! Saves the current scene into a file.\r
686                 /** Scene nodes with the option isDebugObject set to true are\r
687                 not being saved. The scene is usually written to an .irr file,\r
688                 an xml based format. .irr files can Be edited with the Irrlicht\r
689                 Engine Editor, irrEdit (http://www.ambiera.com/irredit/). To\r
690                 load .irr files again, see ISceneManager::loadScene().\r
691                 \param file File where the scene is saved into.\r
692                 \param userDataSerializer If you want to save some user data\r
693                 for every scene node into the file, implement the\r
694                 ISceneUserDataSerializer interface and provide it as parameter\r
695                 here. Otherwise, simply specify 0 as this parameter.\r
696                 \param node Node which is taken as the top node of the scene.\r
697                 This node and all of its descendants are saved into the scene\r
698                 file. Pass 0 or the scene manager to save the full scene (which\r
699                 is also the default).\r
700                 \return True if successful. */\r
701                 virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0;\r
702 \r
703                 //! Loads a scene. Note that the current scene is not cleared before.\r
704                 /** The scene is usually loaded from an .irr file, an xml based\r
705                 format, but other scene formats can be added to the engine via\r
706                 ISceneManager::addExternalSceneLoader. .irr files can Be edited\r
707                 with the Irrlicht Engine Editor, irrEdit\r
708                 (http://www.ambiera.com/irredit/) or saved directly by the engine\r
709                 using ISceneManager::saveScene().\r
710                 \param filename Name of the file to load from.\r
711                 \param userDataSerializer If you want to load user data\r
712                 possibily saved in that file for some scene nodes in the file,\r
713                 implement the ISceneUserDataSerializer interface and provide it\r
714                 as parameter here. Otherwise, simply specify 0 as this\r
715                 parameter.\r
716                 \param rootNode Node which is taken as the root node of the\r
717                 scene. Pass 0 to add the scene directly to the scene manager\r
718                 (which is also the default).\r
719                 \return True if successful. */\r
720                 virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) = 0;\r
721 \r
722                 //! Loads a scene. Note that the current scene is not cleared before.\r
723                 /** The scene is usually loaded from an .irr file, an xml based\r
724                 format, but other scene formats can be added to the engine via\r
725                 ISceneManager::addExternalSceneLoader. .irr files can Be edited\r
726                 with the Irrlicht Engine Editor, irrEdit\r
727                 (http://www.ambiera.com/irredit/) or saved directly by the engine\r
728                 using ISceneManager::saveScene().\r
729                 \param file File where the scene is loaded from.\r
730                 \param userDataSerializer If you want to load user data\r
731                 saved in that file for some scene nodes in the file,\r
732                 implement the ISceneUserDataSerializer interface and provide it\r
733                 as parameter here. Otherwise, simply specify 0 as this\r
734                 parameter.\r
735                 \param rootNode Node which is taken as the root node of the\r
736                 scene. Pass 0 to add the scene directly to the scene manager\r
737                 (which is also the default).\r
738                 \return True if successful. */\r
739                 virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) = 0;\r
740 \r
741                 //! Get a mesh writer implementation if available\r
742                 /** Note: You need to drop() the pointer after use again, see IReferenceCounted::drop()\r
743                 for details. */\r
744                 virtual IMeshWriter* createMeshWriter(EMESH_WRITER_TYPE type) = 0;\r
745 \r
746                 //! Get a skinned mesh, which is not available as header-only code\r
747                 /** Note: You need to drop() the pointer after use again, see IReferenceCounted::drop()\r
748                 for details. */\r
749                 virtual ISkinnedMesh* createSkinnedMesh() = 0;\r
750 \r
751                 //! Sets ambient color of the scene\r
752                 virtual void setAmbientLight(const video::SColorf &ambientColor) = 0;\r
753 \r
754                 //! Get ambient color of the scene\r
755                 virtual const video::SColorf& getAmbientLight() const = 0;\r
756 \r
757                 //! Get current render pass.\r
758                 virtual E_SCENE_NODE_RENDER_PASS getCurrentRenderPass() const =0;\r
759 \r
760                 //! Set current render pass.\r
761                 virtual void setCurrentRenderPass(E_SCENE_NODE_RENDER_PASS nextPass) =0;\r
762 \r
763                 //! Check if node is culled in current view frustum\r
764                 /** Please note that depending on the used culling method this\r
765                 check can be rather coarse, or slow. A positive result is\r
766                 correct, though, i.e. if this method returns true the node is\r
767                 positively not visible. The node might still be invisible even\r
768                 if this method returns false.\r
769                 \param node The scene node which is checked for culling.\r
770                 \return True if node is not visible in the current scene, else\r
771                 false. */\r
772                 virtual bool isCulled(const ISceneNode* node) const =0;\r
773         };\r
774 \r
775 \r
776 } // end namespace scene\r
777 } // end namespace irr\r
778 \r
779 #endif\r
780 \r