1 // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 // This file is part of the "Irrlicht Engine". 3 // For conditions of distribution and use, see copyright notice in irrlicht.h 4 5 #ifndef __I_SCENE_MANAGER_H_INCLUDED__ 6 #define __I_SCENE_MANAGER_H_INCLUDED__ 7 8 #include "IReferenceCounted.h" 9 #include "irrArray.h" 10 #include "irrString.h" 11 #include "path.h" 12 #include "vector3d.h" 13 #include "dimension2d.h" 14 #include "SColor.h" 15 #include "ETerrainElements.h" 16 #include "ESceneNodeTypes.h" 17 #include "ESceneNodeAnimatorTypes.h" 18 #include "EMeshWriterEnums.h" 19 #include "SceneParameters.h" 20 #include "IGeometryCreator.h" 21 #include "ISkinnedMesh.h" 22 23 namespace irr 24 { 25 struct SKeyMap; 26 struct SEvent; 27 28 namespace io 29 { 30 class IReadFile; 31 class IAttributes; 32 class IWriteFile; 33 class IFileSystem; 34 } // end namespace io 35 36 namespace gui 37 { 38 class IGUIFont; 39 class IGUIEnvironment; 40 } // end namespace gui 41 42 namespace video 43 { 44 class IVideoDriver; 45 class SMaterial; 46 class IImage; 47 class ITexture; 48 } // end namespace video 49 50 namespace scene 51 { 52 //! Enumeration for render passes. 53 /** A parameter passed to the registerNodeForRendering() method of the ISceneManager, 54 specifying when the node wants to be drawn in relation to the other nodes. */ 55 enum E_SCENE_NODE_RENDER_PASS 56 { 57 //! No pass currently active 58 ESNRP_NONE =0, 59 60 //! Camera pass. The active view is set up here. The very first pass. 61 ESNRP_CAMERA =1, 62 63 //! In this pass, lights are transformed into camera space and added to the driver 64 ESNRP_LIGHT =2, 65 66 //! This is used for sky boxes. 67 ESNRP_SKY_BOX =4, 68 69 //! All normal objects can use this for registering themselves. 70 /** This value will never be returned by 71 ISceneManager::getSceneNodeRenderPass(). The scene manager 72 will determine by itself if an object is transparent or solid 73 and register the object as SNRT_TRANSPARENT or SNRT_SOLD 74 automatically if you call registerNodeForRendering with this 75 value (which is default). Note that it will register the node 76 only as ONE type. If your scene node has both solid and 77 transparent material types register it twice (one time as 78 SNRT_SOLID, the other time as SNRT_TRANSPARENT) and in the 79 render() method call getSceneNodeRenderPass() to find out the 80 current render pass and render only the corresponding parts of 81 the node. */ 82 ESNRP_AUTOMATIC =24, 83 84 //! Solid scene nodes or special scene nodes without materials. 85 ESNRP_SOLID =8, 86 87 //! Transparent scene nodes, drawn after solid nodes. They are sorted from back to front and drawn in that order. 88 ESNRP_TRANSPARENT =16, 89 90 //! Transparent effect scene nodes, drawn after Transparent nodes. They are sorted from back to front and drawn in that order. 91 ESNRP_TRANSPARENT_EFFECT =32, 92 93 //! Drawn after the solid nodes, before the transparent nodes, the time for drawing shadow volumes 94 ESNRP_SHADOW =64 95 }; 96 97 class IAnimatedMesh; 98 class IAnimatedMeshSceneNode; 99 class IBillboardSceneNode; 100 class IBillboardTextSceneNode; 101 class ICameraSceneNode; 102 class IDummyTransformationSceneNode; 103 class ILightManager; 104 class ILightSceneNode; 105 class IMesh; 106 class IMeshBuffer; 107 class IMeshCache; 108 class IMeshLoader; 109 class IMeshManipulator; 110 class IMeshSceneNode; 111 class IMeshWriter; 112 class IMetaTriangleSelector; 113 class IParticleSystemSceneNode; 114 class ISceneCollisionManager; 115 class ISceneLoader; 116 class ISceneNode; 117 class ISceneNodeAnimator; 118 class ISceneNodeAnimatorCollisionResponse; 119 class ISceneNodeAnimatorFactory; 120 class ISceneNodeFactory; 121 class ISceneUserDataSerializer; 122 class ITerrainSceneNode; 123 class ITextSceneNode; 124 class ITriangleSelector; 125 class IVolumeLightSceneNode; 126 127 //! The Scene Manager manages scene nodes, mesh recources, cameras and all the other stuff. 128 /** All Scene nodes can be created only here. There is a always growing 129 list of scene nodes for lots of purposes: Indoor rendering scene nodes 130 like the Octree (addOctreeSceneNode()) or the terrain renderer 131 (addTerrainSceneNode()), different Camera scene nodes 132 (addCameraSceneNode(), addCameraSceneNodeMaya()), scene nodes for Light 133 (addLightSceneNode()), Billboards (addBillboardSceneNode()) and so on. 134 A scene node is a node in the hierachical scene graph. Every scene node 135 may have children, which are other scene nodes. Children move relative 136 the their parents position. If the parent of a node is not visible, its 137 children won't be visible, too. In this way, it is for example easily 138 possible to attach a light to a moving car or to place a walking 139 character on a moving platform on a moving ship. 140 The SceneManager is also able to load 3d mesh files of different 141 formats. Take a look at getMesh() to find out what formats are 142 supported. If these formats are not enough, use 143 addExternalMeshLoader() to add new formats to the engine. 144 */ 145 class ISceneManager : public virtual IReferenceCounted 146 { 147 public: 148 149 //! Get pointer to an animateable mesh. Loads the file if not loaded already. 150 /** 151 * If you want to remove a loaded mesh from the cache again, use removeMesh(). 152 * Currently there are the following mesh formats supported: 153 * <TABLE border="1" cellpadding="2" cellspacing="0"> 154 * <TR> 155 * <TD>Format</TD> 156 * <TD>Description</TD> 157 * </TR> 158 * <TR> 159 * <TD>3D Studio (.3ds)</TD> 160 * <TD>Loader for 3D-Studio files which lots of 3D packages 161 * are able to export. Only static meshes are currently 162 * supported by this importer.</TD> 163 * </TR> 164 * <TR> 165 * <TD>3D World Studio (.smf)</TD> 166 * <TD>Loader for Leadwerks SMF mesh files, a simple mesh format 167 * containing static geometry for games. The proprietary .STF texture format 168 * is not supported yet. This loader was originally written by Joseph Ellis. </TD> 169 * </TR> 170 * <TR> 171 * <TD>Bliz Basic B3D (.b3d)</TD> 172 * <TD>Loader for blitz basic files, developed by Mark 173 * Sibly. This is the ideal animated mesh format for game 174 * characters as it is both rigidly defined and widely 175 * supported by modeling and animation software. 176 * As this format supports skeletal animations, an 177 * ISkinnedMesh will be returned by this importer.</TD> 178 * </TR> 179 * <TR> 180 * <TD>Cartography shop 4 (.csm)</TD> 181 * <TD>Cartography Shop is a modeling program for creating 182 * architecture and calculating lighting. Irrlicht can 183 * directly import .csm files thanks to the IrrCSM library 184 * created by Saurav Mohapatra which is now integrated 185 * directly in Irrlicht. If you are using this loader, 186 * please note that you'll have to set the path of the 187 * textures before loading .csm files. You can do this 188 * using 189 * SceneManager->getParameters()->setAttribute(scene::CSM_TEXTURE_PATH, 190 * "path/to/your/textures");</TD> 191 * </TR> 192 * <TR> 193 * <TD>COLLADA (.dae, .xml)</TD> 194 * <TD>COLLADA is an open Digital Asset Exchange Schema for 195 * the interactive 3D industry. There are exporters and 196 * importers for this format available for most of the 197 * big 3d packagesat http://collada.org. Irrlicht can 198 * import COLLADA files by using the 199 * ISceneManager::getMesh() method. COLLADA files need 200 * not contain only one single mesh but multiple meshes 201 * and a whole scene setup with lights, cameras and mesh 202 * instances, this loader can set up a scene as 203 * described by the COLLADA file instead of loading and 204 * returning one single mesh. By default, this loader 205 * behaves like the other loaders and does not create 206 * instances, but it can be switched into this mode by 207 * using 208 * SceneManager->getParameters()->setAttribute(COLLADA_CREATE_SCENE_INSTANCES, true); 209 * Created scene nodes will be named as the names of the 210 * nodes in the COLLADA file. The returned mesh is just 211 * a dummy object in this mode. Meshes included in the 212 * scene will be added into the scene manager with the 213 * following naming scheme: 214 * "path/to/file/file.dea#meshname". The loading of such 215 * meshes is logged. Currently, this loader is able to 216 217 218 * create meshes (made of only polygons), lights, and 219 * cameras. Materials and animations are currently not 220 * supported but this will change with future releases. 221 * </TD> 222 * </TR> 223 * <TR> 224 * <TD>Delgine DeleD (.dmf)</TD> 225 * <TD>DeleD (delgine.com) is a 3D editor and level-editor 226 * combined into one and is specifically designed for 3D 227 * game-development. With this loader, it is possible to 228 * directly load all geometry is as well as textures and 229 * lightmaps from .dmf files. To set texture and 230 * material paths, see scene::DMF_USE_MATERIALS_DIRS and 231 * scene::DMF_TEXTURE_PATH. It is also possible to flip 232 * the alpha texture by setting 233 * scene::DMF_FLIP_ALPHA_TEXTURES to true and to set the 234 * material transparent reference value by setting 235 * scene::DMF_ALPHA_CHANNEL_REF to a float between 0 and 236 * 1. The loader is based on Salvatore Russo's .dmf 237 * loader, I just changed some parts of it. Thanks to 238 * Salvatore for his work and for allowing me to use his 239 * code in Irrlicht and put it under Irrlicht's license. 240 * For newer and more enchanced versions of the loader, 241 * take a look at delgine.com. 242 * </TD> 243 * </TR> 244 * <TR> 245 * <TD>DirectX (.x)</TD> 246 * <TD>Platform independent importer (so not D3D-only) for 247 * .x files. Most 3D packages can export these natively 248 * and there are several tools for them available, e.g. 249 * the Maya exporter included in the DX SDK. 250 * .x files can include skeletal animations and Irrlicht 251 * is able to play and display them, users can manipulate 252 * the joints via the ISkinnedMesh interface. Currently, 253 * Irrlicht only supports uncompressed .x files.</TD> 254 * </TR> 255 * <TR> 256 * <TD>Half-Life model (.mdl)</TD> 257 * <TD>This loader opens Half-life 1 models, it was contributed 258 * by Fabio Concas and adapted by Thomas Alten.</TD> 259 * </TR> 260 * <TR> 261 * <TD>Irrlicht Mesh (.irrMesh)</TD> 262 * <TD>This is a static mesh format written in XML, native 263 * to Irrlicht and written by the irr mesh writer. 264 * This format is exported by the CopperCube engine's 265 * lightmapper.</TD> 266 * </TR> 267 * <TR> 268 * <TD>LightWave (.lwo)</TD> 269 * <TD>Native to NewTek's LightWave 3D, the LWO format is well 270 * known and supported by many exporters. This loader will 271 * import LWO2 models including lightmaps, bumpmaps and 272 * reflection textures.</TD> 273 * </TR> 274 * <TR> 275 * <TD>Maya (.obj)</TD> 276 * <TD>Most 3D software can create .obj files which contain 277 * static geometry without material data. The material 278 * files .mtl are also supported. This importer for 279 * Irrlicht can load them directly. </TD> 280 * </TR> 281 * <TR> 282 * <TD>Milkshape (.ms3d)</TD> 283 * <TD>.MS3D files contain models and sometimes skeletal 284 * animations from the Milkshape 3D modeling and animation 285 * software. Like the other skeletal mesh loaders, oints 286 * are exposed via the ISkinnedMesh animated mesh type.</TD> 287 * </TR> 288 * <TR> 289 * <TD>My3D (.my3d)</TD> 290 * <TD>.my3D is a flexible 3D file format. The My3DTools 291 * contains plug-ins to export .my3D files from several 292 * 3D packages. With this built-in importer, Irrlicht 293 * can read and display those files directly. This 294 * loader was written by Zhuck Dimitry who also created 295 * the whole My3DTools package. If you are using this 296 * loader, please note that you can set the path of the 297 * textures before loading .my3d files. You can do this 298 * using 299 * SceneManager->getParameters()->setAttribute(scene::MY3D_TEXTURE_PATH, 300 * "path/to/your/textures"); 301 * </TD> 302 * </TR> 303 * <TR> 304 * <TD>OCT (.oct)</TD> 305 * <TD>The oct file format contains 3D geometry and 306 * lightmaps and can be loaded directly by Irrlicht. OCT 307 * files<br> can be created by FSRad, Paul Nette's 308 * radiosity processor or exported from Blender using 309 * OCTTools which can be found in the exporters/OCTTools 310 * directory of the SDK. Thanks to Murphy McCauley for 311 * creating all this.</TD> 312 * </TR> 313 * <TR> 314 * <TD>OGRE Meshes (.mesh)</TD> 315 * <TD>Ogre .mesh files contain 3D data for the OGRE 3D 316 * engine. Irrlicht can read and display them directly 317 * with this importer. To define materials for the mesh, 318 * copy a .material file named like the corresponding 319 * .mesh file where the .mesh file is. (For example 320 * ogrehead.material for ogrehead.mesh). Thanks to 321 * Christian Stehno who wrote and contributed this 322 * loader.</TD> 323 * </TR> 324 * <TR> 325 * <TD>Pulsar LMTools (.lmts)</TD> 326 * <TD>LMTools is a set of tools (Windows & Linux) for 327 * creating lightmaps. Irrlicht can directly read .lmts 328 * files thanks to<br> the importer created by Jonas 329 * Petersen. If you are using this loader, please note 330 * that you can set the path of the textures before 331 * loading .lmts files. You can do this using 332 * SceneManager->getParameters()->setAttribute(scene::LMTS_TEXTURE_PATH, 333 * "path/to/your/textures"); 334 * Notes for<br> this version of the loader:<br> 335 * - It does not recognise/support user data in the 336 * *.lmts files.<br> 337 * - The TGAs generated by LMTools don't work in 338 * Irrlicht for some reason (the textures are upside 339 * down). Opening and resaving them in a graphics app 340 * will solve the problem.</TD> 341 * </TR> 342 * <TR> 343 * <TD>Quake 3 levels (.bsp)</TD> 344 * <TD>Quake 3 is a popular game by IDSoftware, and .pk3 345 * files contain .bsp files and textures/lightmaps 346 * describing huge prelighted levels. Irrlicht can read 347 * .pk3 and .bsp files directly and thus render Quake 3 348 * levels directly. Written by Nikolaus Gebhardt 349 * enhanced by Dean P. Macri with the curved surfaces 350 * feature. </TD> 351 * </TR> 352 * <TR> 353 * <TD>Quake 2 models (.md2)</TD> 354 * <TD>Quake 2 models are characters with morph target 355 * animation. Irrlicht can read, display and animate 356 * them directly with this importer. </TD> 357 * </TR> 358 * <TR> 359 * <TD>Quake 3 models (.md3)</TD> 360 * <TD>Quake 3 models are characters with morph target 361 * animation, they contain mount points for weapons and body 362 * parts and are typically made of several sections which are 363 * manually joined together.</TD> 364 * </TR> 365 * <TR> 366 * <TD>Stanford Triangle (.ply)</TD> 367 * <TD>Invented by Stanford University and known as the native 368 * format of the infamous "Stanford Bunny" model, this is a 369 * popular static mesh format used by 3D scanning hardware 370 * and software. This loader supports extremely large models 371 * in both ASCII and binary format, but only has rudimentary 372 * material support in the form of vertex colors and texture 373 * coordinates.</TD> 374 * </TR> 375 * <TR> 376 * <TD>Stereolithography (.stl)</TD> 377 * <TD>The STL format is used for rapid prototyping and 378 * computer-aided manufacturing, thus has no support for 379 * materials.</TD> 380 * </TR> 381 * </TABLE> 382 * 383 * To load and display a mesh quickly, just do this: 384 * \code 385 * SceneManager->addAnimatedMeshSceneNode( 386 * SceneManager->getMesh("yourmesh.3ds")); 387 * \endcode 388 * If you would like to implement and add your own file format loader to Irrlicht, 389 * see addExternalMeshLoader(). 390 * \param filename: Filename of the mesh to load. 391 * \return Null if failed, otherwise pointer to the mesh. 392 * This pointer should not be dropped. See IReferenceCounted::drop() for more information. 393 **/ 394 virtual IAnimatedMesh* getMesh(const io::path& filename) = 0; 395 396 //! Get pointer to an animateable mesh. Loads the file if not loaded already. 397 /** Works just as getMesh(const char* filename). If you want to 398 remove a loaded mesh from the cache again, use removeMesh(). 399 \param file File handle of the mesh to load. 400 \return NULL if failed and pointer to the mesh if successful. 401 This pointer should not be dropped. See 402 IReferenceCounted::drop() for more information. */ 403 virtual IAnimatedMesh* getMesh(io::IReadFile* file) = 0; 404 405 //! Get interface to the mesh cache which is shared beween all existing scene managers. 406 /** With this interface, it is possible to manually add new loaded 407 meshes (if ISceneManager::getMesh() is not sufficient), to remove them and to iterate 408 through already loaded meshes. */ 409 virtual IMeshCache* getMeshCache() = 0; 410 411 //! Get the video driver. 412 /** \return Pointer to the video Driver. 413 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 414 virtual video::IVideoDriver* getVideoDriver() = 0; 415 416 //! Get the active GUIEnvironment 417 /** \return Pointer to the GUIEnvironment 418 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 419 virtual gui::IGUIEnvironment* getGUIEnvironment() = 0; 420 421 //! Get the active FileSystem 422 /** \return Pointer to the FileSystem 423 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 424 virtual io::IFileSystem* getFileSystem() = 0; 425 426 //! Adds a cube scene node 427 /** \param size: Size of the cube, uniformly in each dimension. 428 \param parent: Parent of the scene node. Can be 0 if no parent. 429 \param id: Id of the node. This id can be used to identify the scene node. 430 \param position: Position of the space relative to its parent 431 where the scene node will be placed. 432 \param rotation: Initital rotation of the scene node. 433 \param scale: Initial scale of the scene node. 434 \return Pointer to the created test scene node. This 435 pointer should not be dropped. See IReferenceCounted::drop() 436 for more information. */ 437 virtual IMeshSceneNode* addCubeSceneNode(f32 size=10.0f, ISceneNode* parent=0, s32 id=-1, 438 const core::vector3df& position = core::vector3df(0,0,0), 439 const core::vector3df& rotation = core::vector3df(0,0,0), 440 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0; 441 442 //! Adds a sphere scene node of the given radius and detail 443 /** \param radius: Radius of the sphere. 444 \param polyCount: The number of vertices in horizontal and 445 vertical direction. The total polyCount of the sphere is 446 polyCount*polyCount. This parameter must be less than 256 to 447 stay within the 16-bit limit of the indices of a meshbuffer. 448 \param parent: Parent of the scene node. Can be 0 if no parent. 449 \param id: Id of the node. This id can be used to identify the scene node. 450 \param position: Position of the space relative to its parent 451 where the scene node will be placed. 452 \param rotation: Initital rotation of the scene node. 453 \param scale: Initial scale of the scene node. 454 \return Pointer to the created test scene node. This 455 pointer should not be dropped. See IReferenceCounted::drop() 456 for more information. */ 457 virtual IMeshSceneNode* addSphereSceneNode(f32 radius=5.0f, s32 polyCount=16, 458 ISceneNode* parent=0, s32 id=-1, 459 const core::vector3df& position = core::vector3df(0,0,0), 460 const core::vector3df& rotation = core::vector3df(0,0,0), 461 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0; 462 463 //! Adds a scene node for rendering an animated mesh model. 464 /** \param mesh: Pointer to the loaded animated mesh to be displayed. 465 \param parent: Parent of the scene node. Can be NULL if no parent. 466 \param id: Id of the node. This id can be used to identify the scene node. 467 \param position: Position of the space relative to its parent where the 468 scene node will be placed. 469 \param rotation: Initital rotation of the scene node. 470 \param scale: Initial scale of the scene node. 471 \param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed. 472 \return Pointer to the created scene node. 473 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 474 virtual IAnimatedMeshSceneNode* addAnimatedMeshSceneNode(IAnimatedMesh* mesh, 475 ISceneNode* parent=0, s32 id=-1, 476 const core::vector3df& position = core::vector3df(0,0,0), 477 const core::vector3df& rotation = core::vector3df(0,0,0), 478 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f), 479 bool alsoAddIfMeshPointerZero=false) = 0; 480 481 //! Adds a scene node for rendering a static mesh. 482 /** \param mesh: Pointer to the loaded static mesh to be displayed. 483 \param parent: Parent of the scene node. Can be NULL if no parent. 484 \param id: Id of the node. This id can be used to identify the scene node. 485 \param position: Position of the space relative to its parent where the 486 scene node will be placed. 487 \param rotation: Initital rotation of the scene node. 488 \param scale: Initial scale of the scene node. 489 \param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed. 490 \return Pointer to the created scene node. 491 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 492 virtual IMeshSceneNode* addMeshSceneNode(IMesh* mesh, ISceneNode* parent=0, s32 id=-1, 493 const core::vector3df& position = core::vector3df(0,0,0), 494 const core::vector3df& rotation = core::vector3df(0,0,0), 495 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f), 496 bool alsoAddIfMeshPointerZero=false) = 0; 497 498 //! Adds a scene node for rendering a animated water surface mesh. 499 /** Looks really good when the Material type EMT_TRANSPARENT_REFLECTION 500 is used. 501 \param waveHeight: Height of the water waves. 502 \param waveSpeed: Speed of the water waves. 503 \param waveLength: Lenght of a water wave. 504 \param mesh: Pointer to the loaded static mesh to be displayed with water waves on it. 505 \param parent: Parent of the scene node. Can be NULL if no parent. 506 \param id: Id of the node. This id can be used to identify the scene node. 507 \param position: Position of the space relative to its parent where the 508 scene node will be placed. 509 \param rotation: Initital rotation of the scene node. 510 \param scale: Initial scale of the scene node. 511 \return Pointer to the created scene node. 512 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 513 virtual ISceneNode* addWaterSurfaceSceneNode(IMesh* mesh, 514 f32 waveHeight=2.0f, f32 waveSpeed=300.0f, f32 waveLength=10.0f, 515 ISceneNode* parent=0, s32 id=-1, 516 const core::vector3df& position = core::vector3df(0,0,0), 517 const core::vector3df& rotation = core::vector3df(0,0,0), 518 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0; 519 520 521 //! Adds a scene node for rendering using a octree to the scene graph. 522 /** This a good method for rendering 523 scenes with lots of geometry. The Octree is built on the fly from the mesh. 524 \param mesh: The mesh containing all geometry from which the octree will be build. 525 If this animated mesh has more than one frames in it, the first frame is taken. 526 \param parent: Parent node of the octree node. 527 \param id: id of the node. This id can be used to identify the node. 528 \param minimalPolysPerNode: Specifies the minimal polygons contained a octree node. 529 If a node gets less polys than this value it will not be split into 530 smaller nodes. 531 \param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed. 532 \return Pointer to the Octree if successful, otherwise 0. 533 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 534 virtual IMeshSceneNode* addOctreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0, 535 s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false) = 0; 536 537 //! Adds a scene node for rendering using a octree to the scene graph. 538 /** \deprecated Use addOctreeSceneNode instead. This method may be removed by Irrlicht 1.9. */ 539 _IRR_DEPRECATED_ IMeshSceneNode* addOctTreeSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0, 540 s32 id=-1, s32 minimalPolysPerNode=512, bool alsoAddIfMeshPointerZero=false) 541 { 542 return addOctreeSceneNode(mesh, parent, id, minimalPolysPerNode, alsoAddIfMeshPointerZero); 543 } 544 545 //! Adds a scene node for rendering using a octree to the scene graph. 546 /** This a good method for rendering scenes with lots of 547 geometry. The Octree is built on the fly from the mesh, much 548 faster then a bsp tree. 549 \param mesh: The mesh containing all geometry from which the octree will be build. 550 \param parent: Parent node of the octree node. 551 \param id: id of the node. This id can be used to identify the node. 552 \param minimalPolysPerNode: Specifies the minimal polygons contained a octree node. 553 If a node gets less polys than this value it will not be split into 554 smaller nodes. 555 \param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed. 556 \return Pointer to the octree if successful, otherwise 0. 557 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 558 virtual IMeshSceneNode* addOctreeSceneNode(IMesh* mesh, ISceneNode* parent=0, 559 s32 id=-1, s32 minimalPolysPerNode=256, bool alsoAddIfMeshPointerZero=false) = 0; 560 561 //! Adds a scene node for rendering using a octree to the scene graph. 562 /** \deprecated Use addOctreeSceneNode instead. This method may be removed by Irrlicht 1.9. */ 563 _IRR_DEPRECATED_ IMeshSceneNode* addOctTreeSceneNode(IMesh* mesh, ISceneNode* parent=0, 564 s32 id=-1, s32 minimalPolysPerNode=256, bool alsoAddIfMeshPointerZero=false) 565 { 566 return addOctreeSceneNode(mesh, parent, id, minimalPolysPerNode, alsoAddIfMeshPointerZero); 567 } 568 569 //! Adds a camera scene node to the scene graph and sets it as active camera. 570 /** This camera does not react on user input like for example the one created with 571 addCameraSceneNodeFPS(). If you want to move or animate it, use animators or the 572 ISceneNode::setPosition(), ICameraSceneNode::setTarget() etc methods. 573 By default, a camera's look at position (set with setTarget()) and its scene node 574 rotation (set with setRotation()) are independent. If you want to be able to 575 control the direction that the camera looks by using setRotation() then call 576 ICameraSceneNode::bindTargetAndRotation(true) on it. 577 \param position: Position of the space relative to its parent where the camera will be placed. 578 \param lookat: Position where the camera will look at. Also known as target. 579 \param parent: Parent scene node of the camera. Can be null. If the parent moves, 580 the camera will move too. 581 \param id: id of the camera. This id can be used to identify the camera. 582 \param makeActive Flag whether this camera should become the active one. 583 Make sure you always have one active camera. 584 \return Pointer to interface to camera if successful, otherwise 0. 585 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 586 virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0, 587 const core::vector3df& position = core::vector3df(0,0,0), 588 const core::vector3df& lookat = core::vector3df(0,0,100), 589 s32 id=-1, bool makeActive=true) = 0; 590 591 //! Adds a maya style user controlled camera scene node to the scene graph. 592 /** This is a standard camera with an animator that provides mouse control similar 593 to camera in the 3D Software Maya by Alias Wavefront. 594 The camera does not react on setPosition anymore after applying this animator. Instead 595 use setTarget, to fix the target the camera the camera hovers around. And setDistance 596 to set the current distance from that target, i.e. the radius of the orbit the camera 597 hovers on. 598 \param parent: Parent scene node of the camera. Can be null. 599 \param rotateSpeed: Rotation speed of the camera. 600 \param zoomSpeed: Zoom speed of the camera. 601 \param translationSpeed: TranslationSpeed of the camera. 602 \param id: id of the camera. This id can be used to identify the camera. 603 \param distance Initial distance of the camera from the object 604 \param makeActive Flag whether this camera should become the active one. 605 Make sure you always have one active camera. 606 \return Returns a pointer to the interface of the camera if successful, otherwise 0. 607 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 608 virtual ICameraSceneNode* addCameraSceneNodeMaya(ISceneNode* parent=0, 609 f32 rotateSpeed=-1500.f, f32 zoomSpeed=200.f, 610 f32 translationSpeed=1500.f, s32 id=-1, f32 distance=70.f, 611 bool makeActive=true) =0; 612 613 //! Adds a camera scene node with an animator which provides mouse and keyboard control appropriate for first person shooters (FPS). 614 /** This FPS camera is intended to provide a demonstration of a 615 camera that behaves like a typical First Person Shooter. It is 616 useful for simple demos and prototyping but is not intended to 617 provide a full solution for a production quality game. It binds 618 the camera scene node rotation to the look-at target; @see 619 ICameraSceneNode::bindTargetAndRotation(). With this camera, 620 you look with the mouse, and move with cursor keys. If you want 621 to change the key layout, you can specify your own keymap. For 622 example to make the camera be controlled by the cursor keys AND 623 the keys W,A,S, and D, do something like this: 624 \code 625 SKeyMap keyMap[8]; 626 keyMap[0].Action = EKA_MOVE_FORWARD; 627 keyMap[0].KeyCode = IRR_KEY_UP; 628 keyMap[1].Action = EKA_MOVE_FORWARD; 629 keyMap[1].KeyCode = IRR_KEY_W; 630 631 keyMap[2].Action = EKA_MOVE_BACKWARD; 632 keyMap[2].KeyCode = IRR_KEY_DOWN; 633 keyMap[3].Action = EKA_MOVE_BACKWARD; 634 keyMap[3].KeyCode = IRR_KEY_S; 635 636 keyMap[4].Action = EKA_STRAFE_LEFT; 637 keyMap[4].KeyCode = IRR_KEY_LEFT; 638 keyMap[5].Action = EKA_STRAFE_LEFT; 639 keyMap[5].KeyCode = IRR_KEY_A; 640 641 keyMap[6].Action = EKA_STRAFE_RIGHT; 642 keyMap[6].KeyCode = IRR_KEY_RIGHT; 643 keyMap[7].Action = EKA_STRAFE_RIGHT; 644 keyMap[7].KeyCode = IRR_KEY_D; 645 646 camera = sceneManager->addCameraSceneNodeFPS(0, 100, 500, -1, keyMap, 8); 647 \endcode 648 \param parent: Parent scene node of the camera. Can be null. 649 \param rotateSpeed: Speed in degress with which the camera is 650 rotated. This can be done only with the mouse. 651 \param moveSpeed: Speed in units per millisecond with which 652 the camera is moved. Movement is done with the cursor keys. 653 \param id: id of the camera. This id can be used to identify 654 the camera. 655 \param keyMapArray: Optional pointer to an array of a keymap, 656 specifying what keys should be used to move the camera. If this 657 is null, the default keymap is used. You can define actions 658 more then one time in the array, to bind multiple keys to the 659 same action. 660 \param keyMapSize: Amount of items in the keymap array. 661 \param noVerticalMovement: Setting this to true makes the 662 camera only move within a horizontal plane, and disables 663 vertical movement as known from most ego shooters. Default is 664 'false', with which it is possible to fly around in space, if 665 no gravity is there. 666 \param jumpSpeed: Speed with which the camera is moved when 667 jumping. 668 \param invertMouse: Setting this to true makes the camera look 669 up when the mouse is moved down and down when the mouse is 670 moved up, the default is 'false' which means it will follow the 671 movement of the mouse cursor. 672 \param makeActive Flag whether this camera should become the active one. 673 Make sure you always have one active camera. 674 \return Pointer to the interface of the camera if successful, 675 otherwise 0. This pointer should not be dropped. See 676 IReferenceCounted::drop() for more information. */ 677 virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0, 678 f32 rotateSpeed = 100.0f, f32 moveSpeed = 0.5f, s32 id=-1, 679 SKeyMap* keyMapArray=0, s32 keyMapSize=0, bool noVerticalMovement=false, 680 f32 jumpSpeed = 0.f, bool invertMouse=false, 681 bool makeActive=true) = 0; 682 683 //! Adds a dynamic light scene node to the scene graph. 684 /** The light will cast dynamic light on all 685 other scene nodes in the scene, which have the material flag video::MTF_LIGHTING 686 turned on. (This is the default setting in most scene nodes). 687 \param parent: Parent scene node of the light. Can be null. If the parent moves, 688 the light will move too. 689 \param position: Position of the space relative to its parent where the light will be placed. 690 \param color: Diffuse color of the light. Ambient or Specular colors can be set manually with 691 the ILightSceneNode::getLightData() method. 692 \param radius: Radius of the light. 693 \param id: id of the node. This id can be used to identify the node. 694 \return Pointer to the interface of the light if successful, otherwise NULL. 695 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 696 virtual ILightSceneNode* addLightSceneNode(ISceneNode* parent = 0, 697 const core::vector3df& position = core::vector3df(0,0,0), 698 video::SColorf color = video::SColorf(1.0f, 1.0f, 1.0f), 699 f32 radius=100.0f, s32 id=-1) = 0; 700 701 //! Adds a billboard scene node to the scene graph. 702 /** A billboard is like a 3d sprite: A 2d element, 703 which always looks to the camera. It is usually used for things 704 like explosions, fire, lensflares and things like that. 705 \param parent Parent scene node of the billboard. Can be null. 706 If the parent moves, the billboard will move too. 707 \param size Size of the billboard. This size is 2 dimensional 708 because a billboard only has width and height. 709 \param position Position of the space relative to its parent 710 where the billboard will be placed. 711 \param id An id of the node. This id can be used to identify 712 the node. 713 \param colorTop The color of the vertices at the top of the 714 billboard (default: white). 715 \param colorBottom The color of the vertices at the bottom of 716 the billboard (default: white). 717 \return Pointer to the billboard if successful, otherwise NULL. 718 This pointer should not be dropped. See 719 IReferenceCounted::drop() for more information. */ 720 virtual IBillboardSceneNode* addBillboardSceneNode(ISceneNode* parent = 0, 721 const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f), 722 const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1, 723 video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF) = 0; 724 725 //! Adds a skybox scene node to the scene graph. 726 /** A skybox is a big cube with 6 textures on it and 727 is drawn around the camera position. 728 \param top: Texture for the top plane of the box. 729 \param bottom: Texture for the bottom plane of the box. 730 \param left: Texture for the left plane of the box. 731 \param right: Texture for the right plane of the box. 732 \param front: Texture for the front plane of the box. 733 \param back: Texture for the back plane of the box. 734 \param parent: Parent scene node of the skybox. A skybox usually has no parent, 735 so this should be null. Note: If a parent is set to the skybox, the box will not 736 change how it is drawn. 737 \param id: An id of the node. This id can be used to identify the node. 738 \return Pointer to the sky box if successful, otherwise NULL. 739 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 740 virtual ISceneNode* addSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom, 741 video::ITexture* left, video::ITexture* right, video::ITexture* front, 742 video::ITexture* back, ISceneNode* parent = 0, s32 id=-1) = 0; 743 744 //! Adds a skydome scene node to the scene graph. 745 /** A skydome is a large (half-) sphere with a panoramic texture 746 on the inside and is drawn around the camera position. 747 \param texture: Texture for the dome. 748 \param horiRes: Number of vertices of a horizontal layer of the sphere. 749 \param vertRes: Number of vertices of a vertical layer of the sphere. 750 \param texturePercentage: How much of the height of the 751 texture is used. Should be between 0 and 1. 752 \param spherePercentage: How much of the sphere is drawn. 753 Value should be between 0 and 2, where 1 is an exact 754 half-sphere and 2 is a full sphere. 755 \param radius The Radius of the sphere 756 \param parent: Parent scene node of the dome. A dome usually has no parent, 757 so this should be null. Note: If a parent is set, the dome will not 758 change how it is drawn. 759 \param id: An id of the node. This id can be used to identify the node. 760 \return Pointer to the sky dome if successful, otherwise NULL. 761 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 762 virtual ISceneNode* addSkyDomeSceneNode(video::ITexture* texture, 763 u32 horiRes=16, u32 vertRes=8, 764 f32 texturePercentage=0.9, f32 spherePercentage=2.0,f32 radius = 1000.f, 765 ISceneNode* parent=0, s32 id=-1) = 0; 766 767 //! Adds a particle system scene node to the scene graph. 768 /** \param withDefaultEmitter: Creates a default working point emitter 769 which emitts some particles. Set this to true to see a particle system 770 in action. If set to false, you'll have to set the emitter you want by 771 calling IParticleSystemSceneNode::setEmitter(). 772 \param parent: Parent of the scene node. Can be NULL if no parent. 773 \param id: Id of the node. This id can be used to identify the scene node. 774 \param position: Position of the space relative to its parent where the 775 scene node will be placed. 776 \param rotation: Initital rotation of the scene node. 777 \param scale: Initial scale of the scene node. 778 \return Pointer to the created scene node. 779 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 780 virtual IParticleSystemSceneNode* addParticleSystemSceneNode( 781 bool withDefaultEmitter=true, ISceneNode* parent=0, s32 id=-1, 782 const core::vector3df& position = core::vector3df(0,0,0), 783 const core::vector3df& rotation = core::vector3df(0,0,0), 784 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0; 785 786 //! Adds a terrain scene node to the scene graph. 787 /** This node implements is a simple terrain renderer which uses 788 a technique known as geo mip mapping 789 for reducing the detail of triangle blocks which are far away. 790 The code for the TerrainSceneNode is based on the terrain 791 renderer by Soconne and the GeoMipMapSceneNode developed by 792 Spintz. They made their code available for Irrlicht and allowed 793 it to be distributed under this licence. I only modified some 794 parts. A lot of thanks go to them. 795 796 This scene node is capable of loading terrains and updating 797 the indices at runtime to enable viewing very large terrains 798 very quickly. It uses a CLOD (Continuous Level of Detail) 799 algorithm which updates the indices for each patch based on 800 a LOD (Level of Detail) which is determined based on a patch's 801 distance from the camera. 802 803 The patch size of the terrain must always be a size of 2^N+1, 804 i.e. 8+1(9), 16+1(17), etc. 805 The MaxLOD available is directly dependent on the patch size 806 of the terrain. LOD 0 contains all of the indices to draw all 807 the triangles at the max detail for a patch. As each LOD goes 808 up by 1 the step taken, in generating indices increases by 809 -2^LOD, so for LOD 1, the step taken is 2, for LOD 2, the step 810 taken is 4, LOD 3 - 8, etc. The step can be no larger than 811 the size of the patch, so having a LOD of 8, with a patch size 812 of 17, is asking the algoritm to generate indices every 2^8 ( 813 256 ) vertices, which is not possible with a patch size of 17. 814 The maximum LOD for a patch size of 17 is 2^4 ( 16 ). So, 815 with a MaxLOD of 5, you'll have LOD 0 ( full detail ), LOD 1 ( 816 every 2 vertices ), LOD 2 ( every 4 vertices ), LOD 3 ( every 817 8 vertices ) and LOD 4 ( every 16 vertices ). 818 \param heightMapFileName: The name of the file on disk, to read vertex data from. This should 819 be a gray scale bitmap. 820 \param parent: Parent of the scene node. Can be 0 if no parent. 821 \param id: Id of the node. This id can be used to identify the scene node. 822 \param position: The absolute position of this node. 823 \param rotation: The absolute rotation of this node. ( NOT YET IMPLEMENTED ) 824 \param scale: The scale factor for the terrain. If you're 825 using a heightmap of size 129x129 and would like your terrain 826 to be 12900x12900 in game units, then use a scale factor of ( 827 core::vector ( 100.0f, 100.0f, 100.0f ). If you use a Y 828 scaling factor of 0.0f, then your terrain will be flat. 829 \param vertexColor: The default color of all the vertices. If no texture is associated 830 with the scene node, then all vertices will be this color. Defaults to white. 831 \param maxLOD: The maximum LOD (level of detail) for the node. Only change if you 832 know what you are doing, this might lead to strange behavior. 833 \param patchSize: patch size of the terrain. Only change if you 834 know what you are doing, this might lead to strange behavior. 835 \param smoothFactor: The number of times the vertices are smoothed. 836 \param addAlsoIfHeightmapEmpty: Add terrain node even with empty heightmap. 837 \return Pointer to the created scene node. Can be null 838 if the terrain could not be created, for example because the 839 heightmap could not be loaded. The returned pointer should 840 not be dropped. See IReferenceCounted::drop() for more 841 information. */ 842 virtual ITerrainSceneNode* addTerrainSceneNode( 843 const io::path& heightMapFileName, 844 ISceneNode* parent=0, s32 id=-1, 845 const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f), 846 const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f), 847 const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f), 848 video::SColor vertexColor = video::SColor(255,255,255,255), 849 s32 maxLOD=5, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17, s32 smoothFactor=0, 850 bool addAlsoIfHeightmapEmpty = false) = 0; 851 852 //! Adds a terrain scene node to the scene graph. 853 /** Just like the other addTerrainSceneNode() method, but takes an IReadFile 854 pointer as parameter for the heightmap. For more informations take a look 855 at the other function. 856 \param heightMapFile: The file handle to read vertex data from. This should 857 be a gray scale bitmap. 858 \param parent: Parent of the scene node. Can be 0 if no parent. 859 \param id: Id of the node. This id can be used to identify the scene node. 860 \param position: The absolute position of this node. 861 \param rotation: The absolute rotation of this node. ( NOT YET IMPLEMENTED ) 862 \param scale: The scale factor for the terrain. If you're 863 using a heightmap of size 129x129 and would like your terrain 864 to be 12900x12900 in game units, then use a scale factor of ( 865 core::vector ( 100.0f, 100.0f, 100.0f ). If you use a Y 866 scaling factor of 0.0f, then your terrain will be flat. 867 \param vertexColor: The default color of all the vertices. If no texture is associated 868 with the scene node, then all vertices will be this color. Defaults to white. 869 \param maxLOD: The maximum LOD (level of detail) for the node. Only change if you 870 know what you are doing, this might lead to strange behavior. 871 \param patchSize: patch size of the terrain. Only change if you 872 know what you are doing, this might lead to strange behavior. 873 \param smoothFactor: The number of times the vertices are smoothed. 874 \param addAlsoIfHeightmapEmpty: Add terrain node even with empty heightmap. 875 \return Pointer to the created scene node. Can be null 876 if the terrain could not be created, for example because the 877 heightmap could not be loaded. The returned pointer should 878 not be dropped. See IReferenceCounted::drop() for more 879 information. */ 880 virtual ITerrainSceneNode* addTerrainSceneNode( 881 io::IReadFile* heightMapFile, 882 ISceneNode* parent=0, s32 id=-1, 883 const core::vector3df& position = core::vector3df(0.0f,0.0f,0.0f), 884 const core::vector3df& rotation = core::vector3df(0.0f,0.0f,0.0f), 885 const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f), 886 video::SColor vertexColor = video::SColor(255,255,255,255), 887 s32 maxLOD=5, E_TERRAIN_PATCH_SIZE patchSize=ETPS_17, s32 smoothFactor=0, 888 bool addAlsoIfHeightmapEmpty = false) = 0; 889 890 891 //! Adds an empty scene node to the scene graph. 892 /** Can be used for doing advanced transformations 893 or structuring the scene graph. 894 \return Pointer to the created scene node. 895 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 896 virtual ISceneNode* addEmptySceneNode(ISceneNode* parent=0, s32 id=-1) = 0; 897 898 //! Adds a dummy transformation scene node to the scene graph. 899 /** This scene node does not render itself, and does not respond to set/getPosition, 900 set/getRotation and set/getScale. Its just a simple scene node that takes a 901 matrix as relative transformation, making it possible to insert any transformation 902 anywhere into the scene graph. 903 \return Pointer to the created scene node. 904 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 905 virtual IDummyTransformationSceneNode* addDummyTransformationSceneNode( 906 ISceneNode* parent=0, s32 id=-1) = 0; 907 908 //! Adds a text scene node, which is able to display 2d text at a position in three dimensional space 909 virtual ITextSceneNode* addTextSceneNode(gui::IGUIFont* font, const wchar_t* text, 910 video::SColor color=video::SColor(100,255,255,255), 911 ISceneNode* parent = 0, const core::vector3df& position = core::vector3df(0,0,0), 912 s32 id=-1) = 0; 913 914 //! Adds a text scene node, which uses billboards. The node, and the text on it, will scale with distance. 915 /** 916 \param font The font to use on the billboard. Pass 0 to use the GUI environment's default font. 917 \param text The text to display on the billboard. 918 \param parent The billboard's parent. Pass 0 to use the root scene node. 919 \param size The billboard's width and height. 920 \param position The billboards position relative to its parent. 921 \param id: An id of the node. This id can be used to identify the node. 922 \param colorTop: The color of the vertices at the top of the billboard (default: white). 923 \param colorBottom: The color of the vertices at the bottom of the billboard (default: white). 924 \return Pointer to the billboard if successful, otherwise NULL. 925 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 926 virtual IBillboardTextSceneNode* addBillboardTextSceneNode( gui::IGUIFont* font, const wchar_t* text, 927 ISceneNode* parent = 0, 928 const core::dimension2d<f32>& size = core::dimension2d<f32>(10.0f, 10.0f), 929 const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1, 930 video::SColor colorTop = 0xFFFFFFFF, video::SColor colorBottom = 0xFFFFFFFF) = 0; 931 932 //! Adds a Hill Plane mesh to the mesh pool. 933 /** The mesh is generated on the fly 934 and looks like a plane with some hills on it. It is uses mostly for quick 935 tests of the engine only. You can specify how many hills there should be 936 on the plane and how high they should be. Also you must specify a name for 937 the mesh, because the mesh is added to the mesh pool, and can be retrieved 938 again using ISceneManager::getMesh() with the name as parameter. 939 \param name: The name of this mesh which must be specified in order 940 to be able to retrieve the mesh later with ISceneManager::getMesh(). 941 \param tileSize: Size of a tile of the mesh. (10.0f, 10.0f) would be a 942 good value to start, for example. 943 \param tileCount: Specifies how much tiles there will be. If you specifiy 944 for example that a tile has the size (10.0f, 10.0f) and the tileCount is 945 (10,10), than you get a field of 100 tiles which has the dimension 100.0fx100.0f. 946 \param material: Material of the hill mesh. 947 \param hillHeight: Height of the hills. If you specify a negative value 948 you will get holes instead of hills. If the height is 0, no hills will be 949 created. 950 \param countHills: Amount of hills on the plane. There will be countHills.X 951 hills along the X axis and countHills.Y along the Y axis. So in total there 952 will be countHills.X * countHills.Y hills. 953 \param textureRepeatCount: Defines how often the texture will be repeated in 954 x and y direction. 955 return Null if the creation failed. The reason could be that you 956 specified some invalid parameters or that a mesh with that name already 957 exists. If successful, a pointer to the mesh is returned. 958 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 959 virtual IAnimatedMesh* addHillPlaneMesh(const io::path& name, 960 const core::dimension2d<f32>& tileSize, const core::dimension2d<u32>& tileCount, 961 video::SMaterial* material = 0, f32 hillHeight = 0.0f, 962 const core::dimension2d<f32>& countHills = core::dimension2d<f32>(0.0f, 0.0f), 963 const core::dimension2d<f32>& textureRepeatCount = core::dimension2d<f32>(1.0f, 1.0f)) = 0; 964 965 //! Adds a static terrain mesh to the mesh pool. 966 /** The mesh is generated on the fly 967 from a texture file and a height map file. Both files may be huge 968 (8000x8000 pixels would be no problem) because the generator splits the 969 files into smaller textures if necessary. 970 You must specify a name for the mesh, because the mesh is added to the mesh pool, 971 and can be retrieved again using ISceneManager::getMesh() with the name as parameter. 972 \param meshname: The name of this mesh which must be specified in order 973 to be able to retrieve the mesh later with ISceneManager::getMesh(). 974 \param texture: Texture for the terrain. Please note that this is not a 975 hardware texture as usual (ITexture), but an IImage software texture. 976 You can load this texture with IVideoDriver::createImageFromFile(). 977 \param heightmap: A grayscaled heightmap image. Like the texture, 978 it can be created with IVideoDriver::createImageFromFile(). The amount 979 of triangles created depends on the size of this texture, so use a small 980 heightmap to increase rendering speed. 981 \param stretchSize: Parameter defining how big a is pixel on the heightmap. 982 \param maxHeight: Defines how high a white pixel on the heighmap is. 983 \param defaultVertexBlockSize: Defines the initial dimension between vertices. 984 \return Null if the creation failed. The reason could be that you 985 specified some invalid parameters, that a mesh with that name already 986 exists, or that a texture could not be found. If successful, a pointer to the mesh is returned. 987 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 988 virtual IAnimatedMesh* addTerrainMesh(const io::path& meshname, 989 video::IImage* texture, video::IImage* heightmap, 990 const core::dimension2d<f32>& stretchSize = core::dimension2d<f32>(10.0f,10.0f), 991 f32 maxHeight=200.0f, 992 const core::dimension2d<u32>& defaultVertexBlockSize = core::dimension2d<u32>(64,64)) = 0; 993 994 //! add a static arrow mesh to the meshpool 995 /** \param name Name of the mesh 996 \param vtxColorCylinder color of the cylinder 997 \param vtxColorCone color of the cone 998 \param tesselationCylinder Number of quads the cylinder side consists of 999 \param tesselationCone Number of triangles the cone's roof consits of 1000 \param height Total height of the arrow 1001 \param cylinderHeight Total height of the cylinder, should be lesser than total height 1002 \param widthCylinder Diameter of the cylinder 1003 \param widthCone Diameter of the cone's base, should be not smaller than the cylinder's diameter 1004 \return Pointer to the arrow mesh if successful, otherwise 0. 1005 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 1006 virtual IAnimatedMesh* addArrowMesh(const io::path& name, 1007 video::SColor vtxColorCylinder=0xFFFFFFFF, 1008 video::SColor vtxColorCone=0xFFFFFFFF, 1009 u32 tesselationCylinder=4, u32 tesselationCone=8, 1010 f32 height=1.f, f32 cylinderHeight=0.6f, 1011 f32 widthCylinder=0.05f, f32 widthCone=0.3f) = 0; 1012 1013 //! add a static sphere mesh to the meshpool 1014 /** \param name Name of the mesh 1015 \param radius Radius of the sphere 1016 \param polyCountX Number of quads used for the horizontal tiling 1017 \param polyCountY Number of quads used for the vertical tiling 1018 \return Pointer to the sphere mesh if successful, otherwise 0. 1019 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 1020 virtual IAnimatedMesh* addSphereMesh(const io::path& name, 1021 f32 radius=5.f, u32 polyCountX = 16, 1022 u32 polyCountY = 16) = 0; 1023 1024 //! Add a volume light mesh to the meshpool 1025 /** \param name Name of the mesh 1026 \param SubdivideU Horizontal subdivision count 1027 \param SubdivideV Vertical subdivision count 1028 \param FootColor Color of the bottom of the light 1029 \param TailColor Color of the top of the light 1030 \return Pointer to the volume light mesh if successful, otherwise 0. 1031 This pointer should not be dropped. See IReferenceCounted::drop() for more information. 1032 */ 1033 virtual IAnimatedMesh* addVolumeLightMesh(const io::path& name, 1034 const u32 SubdivideU = 32, const u32 SubdivideV = 32, 1035 const video::SColor FootColor = video::SColor(51, 0, 230, 180), 1036 const video::SColor TailColor = video::SColor(0, 0, 0, 0)) = 0; 1037 1038 //! Gets the root scene node. 1039 /** This is the scene node which is parent 1040 of all scene nodes. The root scene node is a special scene node which 1041 only exists to manage all scene nodes. It will not be rendered and cannot 1042 be removed from the scene. 1043 \return Pointer to the root scene node. 1044 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 1045 virtual ISceneNode* getRootSceneNode() = 0; 1046 1047 //! Get the first scene node with the specified id. 1048 /** \param id: The id to search for 1049 \param start: Scene node to start from. All children of this scene 1050 node are searched. If null is specified, the root scene node is 1051 taken. 1052 \return Pointer to the first scene node with this id, 1053 and null if no scene node could be found. 1054 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 1055 virtual ISceneNode* getSceneNodeFromId(s32 id, ISceneNode* start=0) = 0; 1056 1057 //! Get the first scene node with the specified name. 1058 /** \param name: The name to search for 1059 \param start: Scene node to start from. All children of this scene 1060 node are searched. If null is specified, the root scene node is 1061 taken. 1062 \return Pointer to the first scene node with this id, 1063 and null if no scene node could be found. 1064 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 1065 virtual ISceneNode* getSceneNodeFromName(const c8* name, ISceneNode* start=0) = 0; 1066 1067 //! Get the first scene node with the specified type. 1068 /** \param type: The type to search for 1069 \param start: Scene node to start from. All children of this scene 1070 node are searched. If null is specified, the root scene node is 1071 taken. 1072 \return Pointer to the first scene node with this type, 1073 and null if no scene node could be found. 1074 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 1075 virtual ISceneNode* getSceneNodeFromType(scene::ESCENE_NODE_TYPE type, ISceneNode* start=0) = 0; 1076 1077 //! Get scene nodes by type. 1078 /** \param type: Type of scene node to find (ESNT_ANY will return all child nodes). 1079 \param outNodes: array to be filled with results. 1080 \param start: Scene node to start from. All children of this scene 1081 node are searched. If null is specified, the root scene node is 1082 taken. */ 1083 virtual void getSceneNodesFromType(ESCENE_NODE_TYPE type, 1084 core::array<scene::ISceneNode*>& outNodes, 1085 ISceneNode* start=0) = 0; 1086 1087 //! Get the current active camera. 1088 /** \return The active camera is returned. Note that this can 1089 be NULL, if there was no camera created yet. 1090 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 1091 virtual ICameraSceneNode* getActiveCamera() const =0; 1092 1093 //! Sets the currently active camera. 1094 /** The previous active camera will be deactivated. 1095 \param camera: The new camera which should be active. */ 1096 virtual void setActiveCamera(ICameraSceneNode* camera) = 0; 1097 1098 //! Sets the color of stencil buffers shadows drawn by the scene manager. 1099 virtual void setShadowColor(video::SColor color = video::SColor(150,0,0,0)) = 0; 1100 1101 //! Get the current color of shadows. 1102 virtual video::SColor getShadowColor() const = 0; 1103 1104 //! Registers a node for rendering it at a specific time. 1105 /** This method should only be used by SceneNodes when they get a 1106 ISceneNode::OnRegisterSceneNode() call. 1107 \param node: Node to register for drawing. Usually scene nodes would set 'this' 1108 as parameter here because they want to be drawn. 1109 \param pass: Specifies when the node wants to be drawn in relation to the other nodes. 1110 For example, if the node is a shadow, it usually wants to be drawn after all other nodes 1111 and will use ESNRP_SHADOW for this. See scene::E_SCENE_NODE_RENDER_PASS for details. 1112 \return scene will be rendered ( passed culling ) */ 1113 virtual u32 registerNodeForRendering(ISceneNode* node, 1114 E_SCENE_NODE_RENDER_PASS pass = ESNRP_AUTOMATIC) = 0; 1115 1116 //! Draws all the scene nodes. 1117 /** This can only be invoked between 1118 IVideoDriver::beginScene() and IVideoDriver::endScene(). Please note that 1119 the scene is not only drawn when calling this, but also animated 1120 by existing scene node animators, culling of scene nodes is done, etc. 1121 \param flags Allows you to disable/enable specific render passes by passing bitwise OR combinations of E_SCENE_NODE_RENDER_PASS values*/ 1122 virtual void drawAll(u32 flags = 0xFFFFFFFF) = 0; 1123 1124 //! Creates a rotation animator, which rotates the attached scene node around itself. 1125 /** \param rotationSpeed Specifies the speed of the animation in degree per 10 milliseconds. 1126 \return The animator. Attach it to a scene node with ISceneNode::addAnimator() 1127 and the animator will animate it. 1128 If you no longer need the animator, you should call ISceneNodeAnimator::drop(). 1129 See IReferenceCounted::drop() for more information. */ 1130 virtual ISceneNodeAnimator* createRotationAnimator(const core::vector3df& rotationSpeed) = 0; 1131 1132 //! Creates a fly circle animator, which lets the attached scene node fly around a center. 1133 /** \param center: Center of the circle. 1134 \param radius: Radius of the circle. 1135 \param speed: The orbital speed, in radians per millisecond. 1136 \param direction: Specifies the upvector used for alignment of the mesh. 1137 \param startPosition: The position on the circle where the animator will 1138 begin. Value is in multiples of a circle, i.e. 0.5 is half way around. (phase) 1139 \param radiusEllipsoid: if radiusEllipsoid != 0 then radius2 froms a ellipsoid 1140 begin. Value is in multiples of a circle, i.e. 0.5 is half way around. (phase) 1141 \return The animator. Attach it to a scene node with ISceneNode::addAnimator() 1142 and the animator will animate it. 1143 If you no longer need the animator, you should call ISceneNodeAnimator::drop(). 1144 See IReferenceCounted::drop() for more information. */ 1145 virtual ISceneNodeAnimator* createFlyCircleAnimator( 1146 const core::vector3df& center=core::vector3df(0.f,0.f,0.f), 1147 f32 radius=100.f, f32 speed=0.001f, 1148 const core::vector3df& direction=core::vector3df(0.f, 1.f, 0.f), 1149 f32 startPosition = 0.f, 1150 f32 radiusEllipsoid = 0.f) = 0; 1151 1152 //! Creates a fly straight animator, which lets the attached scene node fly or move along a line between two points. 1153 /** \param startPoint: Start point of the line. 1154 \param endPoint: End point of the line. 1155 \param timeForWay: Time in milli seconds how long the node should need to 1156 move from the start point to the end point. 1157 \param loop: If set to false, the node stops when the end point is reached. 1158 If loop is true, the node begins again at the start. 1159 \param pingpong Flag to set whether the animator should fly 1160 back from end to start again. 1161 \return The animator. Attach it to a scene node with ISceneNode::addAnimator() 1162 and the animator will animate it. 1163 If you no longer need the animator, you should call ISceneNodeAnimator::drop(). 1164 See IReferenceCounted::drop() for more information. */ 1165 virtual ISceneNodeAnimator* createFlyStraightAnimator(const core::vector3df& startPoint, 1166 const core::vector3df& endPoint, u32 timeForWay, bool loop=false, bool pingpong = false) = 0; 1167 1168 //! Creates a texture animator, which switches the textures of the target scene node based on a list of textures. 1169 /** \param textures: List of textures to use. 1170 \param timePerFrame: Time in milliseconds, how long any texture in the list 1171 should be visible. 1172 \param loop: If set to to false, the last texture remains set, and the animation 1173 stops. If set to true, the animation restarts with the first texture. 1174 \return The animator. Attach it to a scene node with ISceneNode::addAnimator() 1175 and the animator will animate it. 1176 If you no longer need the animator, you should call ISceneNodeAnimator::drop(). 1177 See IReferenceCounted::drop() for more information. */ 1178 virtual ISceneNodeAnimator* createTextureAnimator(const core::array<video::ITexture*>& textures, 1179 s32 timePerFrame, bool loop=true) = 0; 1180 1181 //! Creates a scene node animator, which deletes the scene node after some time automatically. 1182 /** \param timeMs: Time in milliseconds, after when the node will be deleted. 1183 \return The animator. Attach it to a scene node with ISceneNode::addAnimator() 1184 and the animator will animate it. 1185 If you no longer need the animator, you should call ISceneNodeAnimator::drop(). 1186 See IReferenceCounted::drop() for more information. */ 1187 virtual ISceneNodeAnimator* createDeleteAnimator(u32 timeMs) = 0; 1188 1189 //! Creates a special scene node animator for doing automatic collision detection and response. 1190 /** See ISceneNodeAnimatorCollisionResponse for details. 1191 \param world: Triangle selector holding all triangles of the world with which 1192 the scene node may collide. You can create a triangle selector with 1193 ISceneManager::createTriangleSelector(); 1194 \param sceneNode: SceneNode which should be manipulated. After you added this animator 1195 to the scene node, the scene node will not be able to move through walls and is 1196 affected by gravity. If you need to teleport the scene node to a new position without 1197 it being effected by the collision geometry, then call sceneNode->setPosition(); then 1198 animator->setTargetNode(sceneNode); 1199 \param ellipsoidRadius: Radius of the ellipsoid with which collision detection and 1200 response is done. If you have got a scene node, and you are unsure about 1201 how big the radius should be, you could use the following code to determine 1202 it: 1203 \code 1204 const core::aabbox3d<f32>& box = yourSceneNode->getBoundingBox(); 1205 core::vector3df radius = box.MaxEdge - box.getCenter(); 1206 \endcode 1207 \param gravityPerSecond: Sets the gravity of the environment, as an acceleration in 1208 units per second per second. If your units are equivalent to metres, then 1209 core::vector3df(0,-10.0f,0) would give an approximately realistic gravity. 1210 You can disable gravity by setting it to core::vector3df(0,0,0). 1211 \param ellipsoidTranslation: By default, the ellipsoid for collision detection is created around 1212 the center of the scene node, which means that the ellipsoid surrounds 1213 it completely. If this is not what you want, you may specify a translation 1214 for the ellipsoid. 1215 \param slidingValue: DOCUMENTATION NEEDED. 1216 \return The animator. Attach it to a scene node with ISceneNode::addAnimator() 1217 and the animator will cause it to do collision detection and response. 1218 If you no longer need the animator, you should call ISceneNodeAnimator::drop(). 1219 See IReferenceCounted::drop() for more information. */ 1220 virtual ISceneNodeAnimatorCollisionResponse* createCollisionResponseAnimator( 1221 ITriangleSelector* world, ISceneNode* sceneNode, 1222 const core::vector3df& ellipsoidRadius = core::vector3df(30,60,30), 1223 const core::vector3df& gravityPerSecond = core::vector3df(0,-10.0f,0), 1224 const core::vector3df& ellipsoidTranslation = core::vector3df(0,0,0), 1225 f32 slidingValue = 0.0005f) = 0; 1226 1227 //! Creates a follow spline animator. 1228 /** The animator modifies the position of 1229 the attached scene node to make it follow a hermite spline. 1230 It uses a subset of hermite splines: either cardinal splines 1231 (tightness != 0.5) or catmull-rom-splines (tightness == 0.5). 1232 The animator moves from one control point to the next in 1233 1/speed seconds. This code was sent in by Matthias Gall. 1234 If you no longer need the animator, you should call ISceneNodeAnimator::drop(). 1235 See IReferenceCounted::drop() for more information. */ 1236 virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime, 1237 const core::array< core::vector3df >& points, 1238 f32 speed = 1.0f, f32 tightness = 0.5f, bool loop=true, bool pingpong=false) = 0; 1239 1240 //! Creates a simple ITriangleSelector, based on a mesh. 1241 /** Triangle selectors 1242 can be used for doing collision detection. Don't use this selector 1243 for a huge amount of triangles like in Quake3 maps. 1244 Instead, use for example ISceneManager::createOctreeTriangleSelector(). 1245 Please note that the created triangle selector is not automaticly attached 1246 to the scene node. You will have to call ISceneNode::setTriangleSelector() 1247 for this. To create and attach a triangle selector is done like this: 1248 \code 1249 ITriangleSelector* s = sceneManager->createTriangleSelector(yourMesh, 1250 yourSceneNode); 1251 yourSceneNode->setTriangleSelector(s); 1252 s->drop(); 1253 \endcode 1254 \param mesh: Mesh of which the triangles are taken. 1255 \param node: Scene node of which visibility and transformation is used. 1256 \return The selector, or null if not successful. 1257 If you no longer need the selector, you should call ITriangleSelector::drop(). 1258 See IReferenceCounted::drop() for more information. */ 1259 virtual ITriangleSelector* createTriangleSelector(IMesh* mesh, ISceneNode* node) = 0; 1260 1261 //! Creates a simple ITriangleSelector, based on an animated mesh scene node. 1262 /** Details of the mesh associated with the node will be extracted internally. 1263 Call ITriangleSelector::update() to have the triangle selector updated based 1264 on the current frame of the animated mesh scene node. 1265 \param node The animated mesh scene node from which to build the selector 1266 */ 1267 virtual ITriangleSelector* createTriangleSelector(IAnimatedMeshSceneNode* node) = 0; 1268 1269 1270 //! Creates a simple dynamic ITriangleSelector, based on a axis aligned bounding box. 1271 /** Triangle selectors 1272 can be used for doing collision detection. Every time when triangles are 1273 queried, the triangle selector gets the bounding box of the scene node, 1274 an creates new triangles. In this way, it works good with animated scene nodes. 1275 \param node: Scene node of which the bounding box, visibility and transformation is used. 1276 \return The selector, or null if not successful. 1277 If you no longer need the selector, you should call ITriangleSelector::drop(). 1278 See IReferenceCounted::drop() for more information. */ 1279 virtual ITriangleSelector* createTriangleSelectorFromBoundingBox(ISceneNode* node) = 0; 1280 1281 //! Creates a Triangle Selector, optimized by an octree. 1282 /** Triangle selectors 1283 can be used for doing collision detection. This triangle selector is 1284 optimized for huge amounts of triangle, it organizes them in an octree. 1285 Please note that the created triangle selector is not automaticly attached 1286 to the scene node. You will have to call ISceneNode::setTriangleSelector() 1287 for this. To create and attach a triangle selector is done like this: 1288 \code 1289 ITriangleSelector* s = sceneManager->createOctreeTriangleSelector(yourMesh, 1290 yourSceneNode); 1291 yourSceneNode->setTriangleSelector(s); 1292 s->drop(); 1293 \endcode 1294 For more informations and examples on this, take a look at the collision 1295 tutorial in the SDK. 1296 \param mesh: Mesh of which the triangles are taken. 1297 \param node: Scene node of which visibility and transformation is used. 1298 \param minimalPolysPerNode: Specifies the minimal polygons contained a octree node. 1299 If a node gets less polys the this value, it will not be splitted into 1300 smaller nodes. 1301 \return The selector, or null if not successful. 1302 If you no longer need the selector, you should call ITriangleSelector::drop(). 1303 See IReferenceCounted::drop() for more information. */ 1304 virtual ITriangleSelector* createOctreeTriangleSelector(IMesh* mesh, 1305 ISceneNode* node, s32 minimalPolysPerNode=32) = 0; 1306 1307 //! //! Creates a Triangle Selector, optimized by an octree. 1308 /** \deprecated Use createOctreeTriangleSelector instead. This method may be removed by Irrlicht 1.9. */ 1309 _IRR_DEPRECATED_ ITriangleSelector* createOctTreeTriangleSelector(IMesh* mesh, 1310 ISceneNode* node, s32 minimalPolysPerNode=32) 1311 { 1312 return createOctreeTriangleSelector(mesh, node, minimalPolysPerNode); 1313 } 1314 1315 //! Creates a meta triangle selector. 1316 /** A meta triangle selector is nothing more than a 1317 collection of one or more triangle selectors providing together 1318 the interface of one triangle selector. In this way, 1319 collision tests can be done with different triangle soups in one pass. 1320 \return The selector, or null if not successful. 1321 If you no longer need the selector, you should call ITriangleSelector::drop(). 1322 See IReferenceCounted::drop() for more information. */ 1323 virtual IMetaTriangleSelector* createMetaTriangleSelector() = 0; 1324 1325 //! Creates a triangle selector which can select triangles from a terrain scene node. 1326 /** \param node: Pointer to the created terrain scene node 1327 \param LOD: Level of detail, 0 for highest detail. 1328 \return The selector, or null if not successful. 1329 If you no longer need the selector, you should call ITriangleSelector::drop(). 1330 See IReferenceCounted::drop() for more information. */ 1331 virtual ITriangleSelector* createTerrainTriangleSelector( 1332 ITerrainSceneNode* node, s32 LOD=0) = 0; 1333 1334 //! Adds an external mesh loader for extending the engine with new file formats. 1335 /** If you want the engine to be extended with 1336 file formats it currently is not able to load (e.g. .cob), just implement 1337 the IMeshLoader interface in your loading class and add it with this method. 1338 Using this method it is also possible to override built-in mesh loaders with 1339 newer or updated versions without the need to recompile the engine. 1340 \param externalLoader: Implementation of a new mesh loader. */ 1341 virtual void addExternalMeshLoader(IMeshLoader* externalLoader) = 0; 1342 1343 //! Returns the number of mesh loaders supported by Irrlicht at this time 1344 virtual u32 getMeshLoaderCount() const = 0; 1345 1346 //! Retrieve the given mesh loader 1347 /** \param index The index of the loader to retrieve. This parameter is an 0-based 1348 array index. 1349 \return A pointer to the specified loader, 0 if the index is incorrect. */ 1350 virtual IMeshLoader* getMeshLoader(u32 index) const = 0; 1351 1352 //! Adds an external scene loader for extending the engine with new file formats. 1353 /** If you want the engine to be extended with 1354 file formats it currently is not able to load (e.g. .vrml), just implement 1355 the ISceneLoader interface in your loading class and add it with this method. 1356 Using this method it is also possible to override the built-in scene loaders 1357 with newer or updated versions without the need to recompile the engine. 1358 \param externalLoader: Implementation of a new mesh loader. */ 1359 virtual void addExternalSceneLoader(ISceneLoader* externalLoader) = 0; 1360 1361 //! Returns the number of scene loaders supported by Irrlicht at this time 1362 virtual u32 getSceneLoaderCount() const = 0; 1363 1364 //! Retrieve the given scene loader 1365 /** \param index The index of the loader to retrieve. This parameter is an 0-based 1366 array index. 1367 \return A pointer to the specified loader, 0 if the index is incorrect. */ 1368 virtual ISceneLoader* getSceneLoader(u32 index) const = 0; 1369 1370 //! Get pointer to the scene collision manager. 1371 /** \return Pointer to the collision manager 1372 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 1373 virtual ISceneCollisionManager* getSceneCollisionManager() = 0; 1374 1375 //! Get pointer to the mesh manipulator. 1376 /** \return Pointer to the mesh manipulator 1377 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 1378 virtual IMeshManipulator* getMeshManipulator() = 0; 1379 1380 //! Adds a scene node to the deletion queue. 1381 /** The scene node is immediatly 1382 deleted when it's secure. Which means when the scene node does not 1383 execute animators and things like that. This method is for example 1384 used for deleting scene nodes by their scene node animators. In 1385 most other cases, a ISceneNode::remove() call is enough, using this 1386 deletion queue is not necessary. 1387 See ISceneManager::createDeleteAnimator() for details. 1388 \param node: Node to detete. */ 1389 virtual void addToDeletionQueue(ISceneNode* node) = 0; 1390 1391 //! Posts an input event to the environment. 1392 /** Usually you do not have to 1393 use this method, it is used by the internal engine. */ 1394 virtual bool postEventFromUser(const SEvent& event) = 0; 1395 1396 //! Clears the whole scene. 1397 /** All scene nodes are removed. */ 1398 virtual void clear() = 0; 1399 1400 //! Get interface to the parameters set in this scene. 1401 /** String parameters can be used by plugins and mesh loaders. 1402 For example the CMS and LMTS loader want a parameter named 'CSM_TexturePath' 1403 and 'LMTS_TexturePath' set to the path were attached textures can be found. See 1404 CSM_TEXTURE_PATH, LMTS_TEXTURE_PATH, MY3D_TEXTURE_PATH, 1405 COLLADA_CREATE_SCENE_INSTANCES, DMF_TEXTURE_PATH and DMF_USE_MATERIALS_DIRS*/ 1406 virtual io::IAttributes* getParameters() = 0; 1407 1408 //! Get current render pass. 1409 /** All scene nodes are being rendered in a specific order. 1410 First lights, cameras, sky boxes, solid geometry, and then transparent 1411 stuff. During the rendering process, scene nodes may want to know what the scene 1412 manager is rendering currently, because for example they registered for rendering 1413 twice, once for transparent geometry and once for solid. When knowing what rendering 1414 pass currently is active they can render the correct part of their geometry. */ 1415 virtual E_SCENE_NODE_RENDER_PASS getSceneNodeRenderPass() const = 0; 1416 1417 //! Get the default scene node factory which can create all built in scene nodes 1418 /** \return Pointer to the default scene node factory 1419 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 1420 virtual ISceneNodeFactory* getDefaultSceneNodeFactory() = 0; 1421 1422 //! Adds a scene node factory to the scene manager. 1423 /** Use this to extend the scene manager with new scene node types which it should be 1424 able to create automaticly, for example when loading data from xml files. */ 1425 virtual void registerSceneNodeFactory(ISceneNodeFactory* factoryToAdd) = 0; 1426 1427 //! Get amount of registered scene node factories. 1428 virtual u32 getRegisteredSceneNodeFactoryCount() const = 0; 1429 1430 //! Get a scene node factory by index 1431 /** \return Pointer to the requested scene node factory, or 0 if it does not exist. 1432 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 1433 virtual ISceneNodeFactory* getSceneNodeFactory(u32 index) = 0; 1434 1435 //! Get the default scene node animator factory which can create all built-in scene node animators 1436 /** \return Pointer to the default scene node animator factory 1437 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 1438 virtual ISceneNodeAnimatorFactory* getDefaultSceneNodeAnimatorFactory() = 0; 1439 1440 //! Adds a scene node animator factory to the scene manager. 1441 /** Use this to extend the scene manager with new scene node animator types which it should be 1442 able to create automaticly, for example when loading data from xml files. */ 1443 virtual void registerSceneNodeAnimatorFactory(ISceneNodeAnimatorFactory* factoryToAdd) = 0; 1444 1445 //! Get amount of registered scene node animator factories. 1446 virtual u32 getRegisteredSceneNodeAnimatorFactoryCount() const = 0; 1447 1448 //! Get scene node animator factory by index 1449 /** \return Pointer to the requested scene node animator factory, or 0 if it does not exist. 1450 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 1451 virtual ISceneNodeAnimatorFactory* getSceneNodeAnimatorFactory(u32 index) = 0; 1452 1453 //! Get typename from a scene node type or null if not found 1454 virtual const c8* getSceneNodeTypeName(ESCENE_NODE_TYPE type) = 0; 1455 1456 //! Returns a typename from a scene node animator type or null if not found 1457 virtual const c8* getAnimatorTypeName(ESCENE_NODE_ANIMATOR_TYPE type) = 0; 1458 1459 //! Adds a scene node to the scene by name 1460 /** \return Pointer to the scene node added by a factory 1461 This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ 1462 virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0) = 0; 1463 1464 //! creates a scene node animator based on its type name 1465 /** \param typeName: Type of the scene node animator to add. 1466 \param target: Target scene node of the new animator. 1467 \return Returns pointer to the new scene node animator or null if not successful. You need to 1468 drop this pointer after calling this, see IReferenceCounted::drop() for details. */ 1469 virtual ISceneNodeAnimator* createSceneNodeAnimator(const char* typeName, ISceneNode* target=0) = 0; 1470 1471 //! Creates a new scene manager. 1472 /** This can be used to easily draw and/or store two 1473 independent scenes at the same time. The mesh cache will be 1474 shared between all existing scene managers, which means if you 1475 load a mesh in the original scene manager using for example 1476 getMesh(), the mesh will be available in all other scene 1477 managers too, without loading. 1478 The original/main scene manager will still be there and 1479 accessible via IrrlichtDevice::getSceneManager(). If you need 1480 input event in this new scene manager, for example for FPS 1481 cameras, you'll need to forward input to this manually: Just 1482 implement an IEventReceiver and call 1483 yourNewSceneManager->postEventFromUser(), and return true so 1484 that the original scene manager doesn't get the event. 1485 Otherwise, all input will go to the main scene manager 1486 automatically. 1487 If you no longer need the new scene manager, you should call 1488 ISceneManager::drop(). 1489 See IReferenceCounted::drop() for more information. */ 1490 virtual ISceneManager* createNewSceneManager(bool cloneContent=false) = 0; 1491 1492 //! Saves the current scene into a file. 1493 /** Scene nodes with the option isDebugObject set to true are 1494 not being saved. The scene is usually written to an .irr file, 1495 an xml based format. .irr files can Be edited with the Irrlicht 1496 Engine Editor, irrEdit (http://irredit.irrlicht3d.org). To 1497 load .irr files again, see ISceneManager::loadScene(). 1498 \param filename Name of the file. 1499 \param userDataSerializer If you want to save some user data 1500 for every scene node into the file, implement the 1501 ISceneUserDataSerializer interface and provide it as parameter 1502 here. Otherwise, simply specify 0 as this parameter. 1503 \param node Node which is taken as the top node of the scene. 1504 This node and all of its descendants are saved into the scene 1505 file. Pass 0 or the scene manager to save the full scene (which 1506 is also the default). 1507 \return True if successful. */ 1508 virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0; 1509 1510 //! Saves the current scene into a file. 1511 /** Scene nodes with the option isDebugObject set to true are 1512 not being saved. The scene is usually written to an .irr file, 1513 an xml based format. .irr files can Be edited with the Irrlicht 1514 Engine Editor, irrEdit (http://irredit.irrlicht3d.org). To 1515 load .irr files again, see ISceneManager::loadScene(). 1516 \param file File where the scene is saved into. 1517 \param userDataSerializer If you want to save some user data 1518 for every scene node into the file, implement the 1519 ISceneUserDataSerializer interface and provide it as parameter 1520 here. Otherwise, simply specify 0 as this parameter. 1521 \param node Node which is taken as the top node of the scene. 1522 This node and all of its descendants are saved into the scene 1523 file. Pass 0 or the scene manager to save the full scene (which 1524 is also the default). 1525 \return True if successful. */ 1526 virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0; 1527 1528 //! Saves the current scene into a file. 1529 /** Scene nodes with the option isDebugObject set to true are 1530 not being saved. The scene is usually written to an .irr file, 1531 an xml based format. .irr files can Be edited with the Irrlicht 1532 Engine Editor, irrEdit (http://irredit.irrlicht3d.org). To 1533 load .irr files again, see ISceneManager::loadScene(). 1534 \param writer XMLWriter with which the scene is saved. 1535 \param currentPath Path which is used for relative file names. 1536 Usually the directory of the file written into. 1537 \param userDataSerializer If you want to save some user data 1538 for every scene node into the file, implement the 1539 ISceneUserDataSerializer interface and provide it as parameter 1540 here. Otherwise, simply specify 0 as this parameter. 1541 \param node Node which is taken as the top node of the scene. 1542 This node and all of its descendants are saved into the scene 1543 file. Pass 0 or the scene manager to save the full scene (which 1544 is also the default). 1545 \return True if successful. */ 1546 virtual bool saveScene(io::IXMLWriter* writer, const io::path& currentPath, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0; 1547 1548 //! Loads a scene. Note that the current scene is not cleared before. 1549 /** The scene is usually loaded from an .irr file, an xml based 1550 format, but other scene formats can be added to the engine via 1551 ISceneManager::addExternalSceneLoader. .irr files can Be edited 1552 with the Irrlicht Engine Editor, irrEdit 1553 (http://irredit.irrlicht3d.org) or saved directly by the engine 1554 using ISceneManager::saveScene(). 1555 \param filename Name of the file to load from. 1556 \param userDataSerializer If you want to load user data 1557 possibily saved in that file for some scene nodes in the file, 1558 implement the ISceneUserDataSerializer interface and provide it 1559 as parameter here. Otherwise, simply specify 0 as this 1560 parameter. 1561 \param rootNode Node which is taken as the root node of the 1562 scene. Pass 0 to add the scene directly to the scene manager 1563 (which is also the default). 1564 \return True if successful. */ 1565 virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) = 0; 1566 1567 //! Loads a scene. Note that the current scene is not cleared before. 1568 /** The scene is usually loaded from an .irr file, an xml based 1569 format, but other scene formats can be added to the engine via 1570 ISceneManager::addExternalSceneLoader. .irr files can Be edited 1571 with the Irrlicht Engine Editor, irrEdit 1572 (http://irredit.irrlicht3d.org) or saved directly by the engine 1573 using ISceneManager::saveScene(). 1574 \param file File where the scene is loaded from. 1575 \param userDataSerializer If you want to load user data 1576 possibily saved in that file for some scene nodes in the file, 1577 implement the ISceneUserDataSerializer interface and provide it 1578 as parameter here. Otherwise, simply specify 0 as this 1579 parameter. 1580 \param rootNode Node which is taken as the root node of the 1581 scene. Pass 0 to add the scene directly to the scene manager 1582 (which is also the default). 1583 \return True if successful. */ 1584 virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) = 0; 1585 1586 //! Get a mesh writer implementation if available 1587 /** Note: You need to drop() the pointer after use again, see IReferenceCounted::drop() 1588 for details. */ 1589 virtual IMeshWriter* createMeshWriter(EMESH_WRITER_TYPE type) = 0; 1590 1591 //! Get a skinned mesh, which is not available as header-only code 1592 /** Note: You need to drop() the pointer after use again, see IReferenceCounted::drop() 1593 for details. */ 1594 virtual ISkinnedMesh* createSkinnedMesh() = 0; 1595 1596 //! Sets ambient color of the scene 1597 virtual void setAmbientLight(const video::SColorf &ambientColor) = 0; 1598 1599 //! Get ambient color of the scene 1600 virtual const video::SColorf& getAmbientLight() const = 0; 1601 1602 //! Register a custom callbacks manager which gets callbacks during scene rendering. 1603 /** \param[in] lightManager: the new callbacks manager. You may pass 0 to remove the 1604 current callbacks manager and restore the default behavior. */ 1605 virtual void setLightManager(ILightManager* lightManager) = 0; 1606 1607 virtual void setCurrentRendertime(E_SCENE_NODE_RENDER_PASS pass) =0; 1608 1609 //! Get an instance of a geometry creator. 1610 /** The geometry creator provides some helper methods to create various types of 1611 basic geometry. This can be useful for custom scene nodes. */ 1612 virtual const IGeometryCreator* getGeometryCreator(void) const = 0; 1613 1614 //! Check if node is culled in current view frustum 1615 /** Please note that depending on the used culling method this 1616 check can be rather coarse, or slow. A positive result is 1617 correct, though, i.e. if this method returns true the node is 1618 positively not visible. The node might still be invisible even 1619 if this method returns false. 1620 \param node The scene node which is checked for culling. 1621 \return True if node is not visible in the current scene, else 1622 false. */ 1623 virtual bool isCulled(const ISceneNode* node) const =0; 1624 }; 1625 1626 1627 } // end namespace scene 1628 } // end namespace irr 1629 1630 #endif 1631 1632