ISceneManager.h 85 KB

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