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