Skylicht Engine
Loading...
Searching...
No Matches
irr::scene::ISceneManager Class Referenceabstract

The Scene Manager manages scene nodes, mesh recources, cameras and all the other stuff. More...

#include <C:/Projects/skylicht-engine/Projects/Irrlicht/Include/ISceneManager.h>

Inheritance diagram for irr::scene::ISceneManager:
irr::IReferenceCounted

Public Member Functions

virtual video::IVideoDrivergetVideoDriver ()=0
 Get the video driver.
virtual gui::IGUIEnvironment * getGUIEnvironment ()=0
 Get the active GUIEnvironment.
virtual io::IFileSystemgetFileSystem ()=0
 Get the active FileSystem.
virtual ICameraSceneNodeaddCameraSceneNode (ISceneNode *parent=0, const core::vector3df &position=core::vector3df(0, 0, 0), const core::vector3df &lookat=core::vector3df(0, 0, 100), s32 id=-1, bool makeActive=true)=0
 Adds a camera scene node to the scene graph and sets it as active camera.
virtual ISceneNode * addEmptySceneNode (ISceneNode *parent=0, s32 id=-1)=0
 Adds an empty scene node to the scene graph.
virtual ISceneNode * getRootSceneNode ()=0
 Gets the root scene node.
virtual ISceneNode * getSceneNodeFromId (s32 id, ISceneNode *start=0)=0
 Get the first scene node with the specified id.
virtual ISceneNode * getSceneNodeFromName (const c8 *name, ISceneNode *start=0)=0
 Get the first scene node with the specified name.
virtual ISceneNode * getSceneNodeFromType (scene::ESCENE_NODE_TYPE type, ISceneNode *start=0)=0
 Get the first scene node with the specified type.
virtual void getSceneNodesFromType (ESCENE_NODE_TYPE type, core::array< scene::ISceneNode * > &outNodes, ISceneNode *start=0)=0
 Get scene nodes by type.
virtual ICameraSceneNodegetActiveCamera () const =0
 Get the current active camera.
virtual void setActiveCamera (ICameraSceneNode *camera)=0
 Sets the currently active camera.
virtual void setShadowColor (video::SColor color=video::SColor(150, 0, 0, 0))=0
 Sets the color of stencil buffers shadows drawn by the scene manager.
virtual video::SColor getShadowColor () const =0
 Get the current color of shadows.
virtual u32 registerNodeForRendering (ISceneNode *node, E_SCENE_NODE_RENDER_PASS pass=ESNRP_AUTOMATIC)=0
 Registers a node for rendering it at a specific time.
virtual void drawAll ()=0
 Draws all the scene nodes.
virtual void update ()=0
virtual void draw ()=0
virtual void draw (E_SCENE_NODE_RENDER_PASS renderPass)=0
virtual ITriangleSelectorcreateTriangleSelector (IMesh *mesh, ISceneNode *node)=0
 Creates a simple ITriangleSelector, based on a mesh.
virtual ITriangleSelectorcreateTriangleSelectorFromBoundingBox (ISceneNode *node)=0
 Creates a simple dynamic ITriangleSelector, based on a axis aligned bounding box.
virtual ITriangleSelectorcreateOctreeTriangleSelector (IMesh *mesh, ISceneNode *node, s32 minimalPolysPerNode=32)=0
 Creates a Triangle Selector, optimized by an octree.
_IRR_DEPRECATED_ ITriangleSelectorcreateOctTreeTriangleSelector (IMesh *mesh, ISceneNode *node, s32 minimalPolysPerNode=32)
 //! Creates a Triangle Selector, optimized by an octree.
virtual IMetaTriangleSelectorcreateMetaTriangleSelector ()=0
 Creates a meta triangle selector.
virtual ISceneCollisionManagergetSceneCollisionManager ()=0
 Get pointer to the scene collision manager.
virtual IMeshManipulatorgetMeshManipulator ()=0
 Returns a pointer to the mesh manipulator.
virtual void addToDeletionQueue (ISceneNode *node)=0
 Adds a scene node to the deletion queue.
virtual bool postEventFromUser (const SEvent &event)=0
 Posts an input event to the environment.
virtual void clear ()=0
 Clears the whole scene.
virtual io::IAttributesgetParameters ()=0
 Get interface to the parameters set in this scene.
virtual E_SCENE_NODE_RENDER_PASS getSceneNodeRenderPass () const =0
 Get current render pass.
virtual ISceneManagercreateNewSceneManager (bool cloneContent=false)=0
 Creates a new scene manager.
virtual void setAmbientLight (const video::SColorf &ambientColor)=0
 Sets ambient color of the scene.
virtual const video::SColorfgetAmbientLight () const =0
 Get ambient color of the scene.
virtual const IGeometryCreatorgetGeometryCreator (void) const =0
 Get an instance of a geometry creator.
virtual bool isCulled (const ISceneNode *node) const =0
 Check if node is culled in current view frustum.
Public Member Functions inherited from irr::IReferenceCounted
 IReferenceCounted ()
 Constructor.
virtual ~IReferenceCounted ()
 Destructor.
void grab () const
 Grabs the object. Increments the reference counter by one.
bool drop () const
 Drops the object. Decrements the reference counter by one.
s32 getReferenceCount () const
 Get the reference count.
const c8getDebugName () const
 Returns the debug name of the object.

Additional Inherited Members

Protected Member Functions inherited from irr::IReferenceCounted
void setDebugName (const c8 *newName)
 Sets the debug name of the object.

Detailed Description

The Scene Manager manages scene nodes, mesh recources, cameras and all the other stuff.

All Scene nodes can be created only here. There is a always growing list of scene nodes for lots of purposes: Indoor rendering scene nodes like the Octree (addOctreeSceneNode()) or the terrain renderer (addTerrainSceneNode()), different Camera scene nodes (addCameraSceneNode(), addCameraSceneNodeMaya()), scene nodes for Light (addLightSceneNode()), Billboards (addBillboardSceneNode()) and so on. A scene node is a node in the hierachical scene graph. Every scene node may have children, which are other scene nodes. Children move relative the their parents position. If the parent of a node is not visible, its children won't be visible, too. In this way, it is for example easily possible to attach a light to a moving car or to place a walking character on a moving platform on a moving ship. The SceneManager is also able to load 3d mesh files of different formats. Take a look at getMesh() to find out what formats are supported. If these formats are not enough, use addExternalMeshLoader() to add new formats to the engine.

Member Function Documentation

◆ addCameraSceneNode()

virtual ICameraSceneNode * irr::scene::ISceneManager::addCameraSceneNode ( ISceneNode * parent = 0,
const core::vector3df & position = core::vector3df(0, 0, 0),
const core::vector3df & lookat = core::vector3df(0, 0, 100),
s32 id = -1,
bool makeActive = true )
pure virtual

Adds a camera scene node to the scene graph and sets it as active camera.

This camera does not react on user input like for example the one created with addCameraSceneNodeFPS(). If you want to move or animate it, use animators or the ISceneNode::setPosition(), ICameraSceneNode::setTarget() etc methods. By default, a camera's look at position (set with setTarget()) and its scene node rotation (set with setRotation()) are independent. If you want to be able to control the direction that the camera looks by using setRotation() then call ICameraSceneNode::bindTargetAndRotation(true) on it.

Parameters
positionPosition of the space relative to its parent where the camera will be placed.
lookatPosition where the camera will look at. Also known as target.
parentParent scene node of the camera. Can be null. If the parent moves, the camera will move too.
idid of the camera. This id can be used to identify the camera.
makeActiveFlag whether this camera should become the active one. Make sure you always have one active camera.
Returns
Pointer to interface to camera if successful, otherwise 0. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addEmptySceneNode()

virtual ISceneNode * irr::scene::ISceneManager::addEmptySceneNode ( ISceneNode * parent = 0,
s32 id = -1 )
pure virtual

Adds an empty scene node to the scene graph.

Can be used for doing advanced transformations or structuring the scene graph.

Returns
Pointer to the created scene node. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ addToDeletionQueue()

virtual void irr::scene::ISceneManager::addToDeletionQueue ( ISceneNode * node)
pure virtual

Adds a scene node to the deletion queue.

The scene node is immediatly deleted when it's secure. Which means when the scene node does not execute animators and things like that. This method is for example used for deleting scene nodes by their scene node animators. In most other cases, a ISceneNode::remove() call is enough, using this deletion queue is not necessary. See ISceneManager::createDeleteAnimator() for details.

Parameters
nodeNode to detete.

◆ clear()

virtual void irr::scene::ISceneManager::clear ( )
pure virtual

Clears the whole scene.

All scene nodes are removed.

◆ createMetaTriangleSelector()

virtual IMetaTriangleSelector * irr::scene::ISceneManager::createMetaTriangleSelector ( )
pure virtual

Creates a meta triangle selector.

A meta triangle selector is nothing more than a collection of one or more triangle selectors providing together the interface of one triangle selector. In this way, collision tests can be done with different triangle soups in one pass.

Returns
The selector, or null if not successful. If you no longer need the selector, you should call ITriangleSelector::drop(). See IReferenceCounted::drop() for more information.

◆ createNewSceneManager()

virtual ISceneManager * irr::scene::ISceneManager::createNewSceneManager ( bool cloneContent = false)
pure virtual

Creates a new scene manager.

This can be used to easily draw and/or store two independent scenes at the same time. The mesh cache will be shared between all existing scene managers, which means if you load a mesh in the original scene manager using for example getMesh(), the mesh will be available in all other scene managers too, without loading. The original/main scene manager will still be there and accessible via IrrlichtDevice::getSceneManager(). If you need input event in this new scene manager, for example for FPS cameras, you'll need to forward input to this manually: Just implement an IEventReceiver and call yourNewSceneManager->postEventFromUser(), and return true so that the original scene manager doesn't get the event. Otherwise, all input will go to the main scene manager automatically. If you no longer need the new scene manager, you should call ISceneManager::drop(). See IReferenceCounted::drop() for more information.

◆ createOctreeTriangleSelector()

virtual ITriangleSelector * irr::scene::ISceneManager::createOctreeTriangleSelector ( IMesh * mesh,
ISceneNode * node,
s32 minimalPolysPerNode = 32 )
pure virtual

Creates a Triangle Selector, optimized by an octree.

Triangle selectors can be used for doing collision detection. This triangle selector is optimized for huge amounts of triangle, it organizes them in an octree. Please note that the created triangle selector is not automaticly attached to the scene node. You will have to call ISceneNode::setTriangleSelector() for this. To create and attach a triangle selector is done like this:

ITriangleSelector* s = sceneManager->createOctreeTriangleSelector(yourMesh,
yourSceneNode);
yourSceneNode->setTriangleSelector(s);
s->drop();
bool drop() const
Drops the object. Decrements the reference counter by one.
Definition IReferenceCounted.h:126
Interface to return triangles with specific properties.
Definition ITriangleSelector.h:29

For more informations and examples on this, take a look at the collision tutorial in the SDK.

Parameters
meshMesh of which the triangles are taken.
nodeScene node of which visibility and transformation is used.
minimalPolysPerNodeSpecifies the minimal polygons contained a octree node. If a node gets less polys the this value, it will not be splitted into smaller nodes.
Returns
The selector, or null if not successful. If you no longer need the selector, you should call ITriangleSelector::drop(). See IReferenceCounted::drop() for more information.

◆ createOctTreeTriangleSelector()

_IRR_DEPRECATED_ ITriangleSelector * irr::scene::ISceneManager::createOctTreeTriangleSelector ( IMesh * mesh,
ISceneNode * node,
s32 minimalPolysPerNode = 32 )
inline

//! Creates a Triangle Selector, optimized by an octree.

Deprecated
Use createOctreeTriangleSelector instead. This method may be removed by Irrlicht 1.9.

◆ createTriangleSelector()

virtual ITriangleSelector * irr::scene::ISceneManager::createTriangleSelector ( IMesh * mesh,
ISceneNode * node )
pure virtual

Creates a simple ITriangleSelector, based on a mesh.

Triangle selectors can be used for doing collision detection. Don't use this selector for a huge amount of triangles like in Quake3 maps. Instead, use for example ISceneManager::createOctreeTriangleSelector(). Please note that the created triangle selector is not automaticly attached to the scene node. You will have to call ISceneNode::setTriangleSelector() for this. To create and attach a triangle selector is done like this:

ITriangleSelector* s = sceneManager->createTriangleSelector(yourMesh,
yourSceneNode);
yourSceneNode->setTriangleSelector(s);
s->drop();
Parameters
meshMesh of which the triangles are taken.
nodeScene node of which visibility and transformation is used.
Returns
The selector, or null if not successful. If you no longer need the selector, you should call ITriangleSelector::drop(). See IReferenceCounted::drop() for more information.

◆ createTriangleSelectorFromBoundingBox()

virtual ITriangleSelector * irr::scene::ISceneManager::createTriangleSelectorFromBoundingBox ( ISceneNode * node)
pure virtual

Creates a simple dynamic ITriangleSelector, based on a axis aligned bounding box.

Triangle selectors can be used for doing collision detection. Every time when triangles are queried, the triangle selector gets the bounding box of the scene node, an creates new triangles. In this way, it works good with animated scene nodes.

Parameters
nodeScene node of which the bounding box, visibility and transformation is used.
Returns
The selector, or null if not successful. If you no longer need the selector, you should call ITriangleSelector::drop(). See IReferenceCounted::drop() for more information.

◆ drawAll()

virtual void irr::scene::ISceneManager::drawAll ( )
pure virtual

Draws all the scene nodes.

This can only be invoked between IVideoDriver::beginScene() and IVideoDriver::endScene(). Please note that the scene is not only drawn when calling this, but also animated by existing scene node animators, culling of scene nodes is done, etc.

◆ getActiveCamera()

virtual ICameraSceneNode * irr::scene::ISceneManager::getActiveCamera ( ) const
pure virtual

Get the current active camera.

Returns
The active camera is returned. Note that this can be NULL, if there was no camera created yet. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ getFileSystem()

virtual io::IFileSystem * irr::scene::ISceneManager::getFileSystem ( )
pure virtual

Get the active FileSystem.

Returns
Pointer to the FileSystem This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ getGeometryCreator()

virtual const IGeometryCreator * irr::scene::ISceneManager::getGeometryCreator ( void ) const
pure virtual

Get an instance of a geometry creator.

The geometry creator provides some helper methods to create various types of basic geometry. This can be useful for custom scene nodes.

◆ getGUIEnvironment()

virtual gui::IGUIEnvironment * irr::scene::ISceneManager::getGUIEnvironment ( )
pure virtual

Get the active GUIEnvironment.

Returns
Pointer to the GUIEnvironment This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ getParameters()

virtual io::IAttributes * irr::scene::ISceneManager::getParameters ( )
pure virtual

Get interface to the parameters set in this scene.

String parameters can be used by plugins and mesh loaders. For example the CMS and LMTS loader want a parameter named 'CSM_TexturePath' and 'LMTS_TexturePath' set to the path were attached textures can be found. See CSM_TEXTURE_PATH, LMTS_TEXTURE_PATH, MY3D_TEXTURE_PATH, COLLADA_CREATE_SCENE_INSTANCES, DMF_TEXTURE_PATH and DMF_USE_MATERIALS_DIRS

◆ getRootSceneNode()

virtual ISceneNode * irr::scene::ISceneManager::getRootSceneNode ( )
pure virtual

Gets the root scene node.

This is the scene node which is parent of all scene nodes. The root scene node is a special scene node which only exists to manage all scene nodes. It will not be rendered and cannot be removed from the scene.

Returns
Pointer to the root scene node. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ getSceneCollisionManager()

virtual ISceneCollisionManager * irr::scene::ISceneManager::getSceneCollisionManager ( )
pure virtual

Get pointer to the scene collision manager.

Returns
Pointer to the collision manager This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ getSceneNodeFromId()

virtual ISceneNode * irr::scene::ISceneManager::getSceneNodeFromId ( s32 id,
ISceneNode * start = 0 )
pure virtual

Get the first scene node with the specified id.

Parameters
idThe id to search for
startScene node to start from. All children of this scene node are searched. If null is specified, the root scene node is taken.
Returns
Pointer to the first scene node with this id, and null if no scene node could be found. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ getSceneNodeFromName()

virtual ISceneNode * irr::scene::ISceneManager::getSceneNodeFromName ( const c8 * name,
ISceneNode * start = 0 )
pure virtual

Get the first scene node with the specified name.

Parameters
nameThe name to search for
startScene node to start from. All children of this scene node are searched. If null is specified, the root scene node is taken.
Returns
Pointer to the first scene node with this id, and null if no scene node could be found. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ getSceneNodeFromType()

virtual ISceneNode * irr::scene::ISceneManager::getSceneNodeFromType ( scene::ESCENE_NODE_TYPE type,
ISceneNode * start = 0 )
pure virtual

Get the first scene node with the specified type.

Parameters
typeThe type to search for
startScene node to start from. All children of this scene node are searched. If null is specified, the root scene node is taken.
Returns
Pointer to the first scene node with this type, and null if no scene node could be found. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ getSceneNodeRenderPass()

virtual E_SCENE_NODE_RENDER_PASS irr::scene::ISceneManager::getSceneNodeRenderPass ( ) const
pure virtual

Get current render pass.

All scene nodes are being rendered in a specific order. First lights, cameras, sky boxes, solid geometry, and then transparent stuff. During the rendering process, scene nodes may want to know what the scene manager is rendering currently, because for example they registered for rendering twice, once for transparent geometry and once for solid. When knowing what rendering pass currently is active they can render the correct part of their geometry.

◆ getSceneNodesFromType()

virtual void irr::scene::ISceneManager::getSceneNodesFromType ( ESCENE_NODE_TYPE type,
core::array< scene::ISceneNode * > & outNodes,
ISceneNode * start = 0 )
pure virtual

Get scene nodes by type.

Parameters
typeType of scene node to find (ESNT_ANY will return all child nodes).
outNodesarray to be filled with results.
startScene node to start from. All children of this scene node are searched. If null is specified, the root scene node is taken.

◆ getVideoDriver()

virtual video::IVideoDriver * irr::scene::ISceneManager::getVideoDriver ( )
pure virtual

Get the video driver.

Returns
Pointer to the video Driver. This pointer should not be dropped. See IReferenceCounted::drop() for more information.

◆ isCulled()

virtual bool irr::scene::ISceneManager::isCulled ( const ISceneNode * node) const
pure virtual

Check if node is culled in current view frustum.

Please note that depending on the used culling method this check can be rather coarse, or slow. A positive result is correct, though, i.e. if this method returns true the node is positively not visible. The node might still be invisible even if this method returns false.

Parameters
nodeThe scene node which is checked for culling.
Returns
True if node is not visible in the current scene, else false.

◆ postEventFromUser()

virtual bool irr::scene::ISceneManager::postEventFromUser ( const SEvent & event)
pure virtual

Posts an input event to the environment.

Usually you do not have to use this method, it is used by the internal engine.

◆ registerNodeForRendering()

virtual u32 irr::scene::ISceneManager::registerNodeForRendering ( ISceneNode * node,
E_SCENE_NODE_RENDER_PASS pass = ESNRP_AUTOMATIC )
pure virtual

Registers a node for rendering it at a specific time.

This method should only be used by SceneNodes when they get a ISceneNode::OnRegisterSceneNode() call.

Parameters
nodeNode to register for drawing. Usually scene nodes would set 'this' as parameter here because they want to be drawn.
passSpecifies when the node wants to be drawn in relation to the other nodes. For example, if the node is a shadow, it usually wants to be drawn after all other nodes and will use ESNRP_SHADOW for this. See scene::E_SCENE_NODE_RENDER_PASS for details.
Returns
scene will be rendered ( passed culling )

◆ setActiveCamera()

virtual void irr::scene::ISceneManager::setActiveCamera ( ICameraSceneNode * camera)
pure virtual

Sets the currently active camera.

The previous active camera will be deactivated.

Parameters
cameraThe new camera which should be active.

The documentation for this class was generated from the following file: