Public Member Functions | Static Public Member Functions

sp::scene::SceneManager Class Reference

#include <spSceneManager.hpp>

List of all members.

Public Member Functions

 SceneManager ()
 ~SceneManager ()
MeshcreateMesh ()
MeshcreateMesh (const EBasicMeshes Model, const SMeshConstruct &BuildConstruct=SMeshConstruct())
MeshcreateSuperShape (const f32(&ValueList)[12], s32 Detail=DEF_MESH_SEGMENTS)
MeshcreateSkyBox (video::Texture *(&TextureList)[6], f32 Radius=50.0f)
MeshcreateHeightField (const video::Texture *TexHeightMap, const s32 Segments=DEF_MESH_SEGMENTS)
MeshcreateMeshList (std::list< Mesh * > MergeList, bool isOldDelete)
 Creates a mesh out of the specified meshes.
MeshcreateMeshSurface (Mesh *Model, u32 Surface)
 Creates a mesh out of the specified mesh's surface.
MeshloadMesh (io::stringc Filename, io::stringc TexturePath=video::TEXPATH_IGNORE, const EMeshFileFormats Format=MESHFORMAT_UNKNOWN, const s32 Flags=0)
MeshgetMesh (const io::stringc &Filename, io::stringc TexturePath=video::TEXPATH_IGNORE, const EMeshFileFormats Format=MESHFORMAT_UNKNOWN)
bool saveMesh (Mesh *Model, io::stringc Filename, const EMeshFileFormats Format=MESHFORMAT_UNKNOWN)
MeshloadScene (io::stringc Filename, io::stringc TexturePath=video::TEXPATH_IGNORE, const ESceneFileFormats Format=SCENEFORMAT_UNKNOWN, const s32 Flags=DEF_SCENE_FLAGS)
void createFurMesh (Mesh *Model, video::Texture *FurTexture, s32 LayerCount=25, f32 HairLength=0.2f, s32 HairCloseness=2)
 TODO! -> move this to "MeshGenerator" namespace.
SceneNodecreateNode ()
 Creates a simple scene node and returns the pointer to the new object.
CameracreateCamera ()
 Creates a standard camera. Without cameras you cannot see the scene which shall be rendered.
LightcreateLight (const ELightModels Type=LIGHT_DIRECTIONAL)
BillboardcreateBillboard (video::Texture *BaseTexture=0)
TerraincreateTerrain (const video::SHeightMapTexture &TextureHeightMap, const dim::size2di &Resolution, s32 GeoMIPLevels=DEF_GEOMIP_LEVELS)
SceneNodecopyNode (const SceneNode *TemplateObject)
MeshcopyNode (const Mesh *TemplateObject)
LightcopyNode (const Light *TemplateObject)
BillboardcopyNode (const Billboard *TemplateObject)
CameracopyNode (const Camera *TemplateObject)
TerraincopyNode (const Terrain *TemplateObject)
bool deleteNode (SceneNode *Object)
std::list< SceneNode * > findNodes (const io::stringc &Name) const
SceneNodefindNode (const io::stringc &Name) const
std::list< SceneNode * > findChildren (const SceneNode *Parent) const
SceneNodefindChild (const SceneNode *Parent, const io::stringc &Name) const
void deleteAnimation (Animation *Anim)
 Deletes the specified animation.
void clearAnimations ()
 Deletes all animations.
void updateAnimations ()
 Updates all animations.
void clearScene (bool isDeleteNodes=true, bool isDeleteMeshes=true, bool isDeleteCameras=true, bool isDeleteLights=true, bool isDeleteBillboards=true, bool isDeleteTerrains=true)
 Clears the whole scene from the specified objects.
void removeTexture (const video::Texture *Tex)
u32 getSceneMeshBufferCount () const
 Returns count of mesh buffers in the whole scene. Only Mesh objects are included.
u32 getSceneVertexCount () const
 Returns count of vertices in the whole scene. Only Mesh objects are included.
u32 getSceneTriangleCount () const
 Returns count of triangles in the whole scene. Only Mesh objects are included.
u32 getSceneObjectsCount () const
 Returns count of objects in the whole scene. Each kind of Node objects are included.
template<class T >
T * createCamera ()
template<class T >
T * createAnimation (const io::stringc &Name="")
 Creates a new animation. Use the NodeAnimation, MorphTargetAnimation and SkeletalAnimation classes.
const std::list< Mesh * > & getMeshList () const
const std::list< Billboard * > & getBillboardList () const
const std::list< Terrain * > & getTerrainList () const
const std::list< Light * > & getLightList () const
const std::list< Camera * > & getCameraList () const
const std::list< SceneNode * > & getNodeList () const
const std::list< Animation * > & getAnimationList () const

Static Public Member Functions

static void setDefaultVertexFormat (const video::VertexFormat *Format)
static const video::VertexFormatgetDefaultVertexFormat ()
 Returns the default vertex format.
static void setDefaultIndexFormat (const video::ERendererDataTypes Format)
static video::ERendererDataTypes getDefaultIndexFormat ()
 Returns the default index format.
static void setTextureLoadingState (bool AllowTextureLoading)
 Allows or disallows mesh loaders to load textures.
static bool getTextureLoadingState ()
static EMeshFileFormats getMeshFileFormat (const io::stringc &Filename, const EMeshFileFormats DefaultFormat)
static ESceneFileFormats getSceneFileFormat (const io::stringc &Filename, const ESceneFileFormats DefaultFormat)

Detailed Description

The scene manager is the object that manages all scene objects: meshes, lights, cameras etc. Whereas a scene graph can references to these objects which are to be rendered. e.g. meshes which are used to just describe a collision model should not be inserted into a scene graph.

Since:
Version 3.2
See also:
SceneGraph

Constructor & Destructor Documentation

sp::scene::SceneManager::SceneManager (  ) 
sp::scene::SceneManager::~SceneManager (  ) 

Member Function Documentation

void sp::scene::SceneManager::clearAnimations (  ) 

Deletes all animations.

void sp::scene::SceneManager::clearScene ( bool  isDeleteNodes = true,
bool  isDeleteMeshes = true,
bool  isDeleteCameras = true,
bool  isDeleteLights = true,
bool  isDeleteBillboards = true,
bool  isDeleteTerrains = true 
)

Clears the whole scene from the specified objects.

Mesh * sp::scene::SceneManager::copyNode ( const Mesh TemplateObject  ) 
Light * sp::scene::SceneManager::copyNode ( const Light TemplateObject  ) 
Billboard * sp::scene::SceneManager::copyNode ( const Billboard TemplateObject  ) 
Camera * sp::scene::SceneManager::copyNode ( const Camera TemplateObject  ) 
Terrain * sp::scene::SceneManager::copyNode ( const Terrain TemplateObject  ) 
SceneNode * sp::scene::SceneManager::copyNode ( const SceneNode TemplateObject  ) 

Copies the specified scene node and returns a pointer to the new object or a null pointer if the template object was specified as a null pointer.

template<class T >
T* sp::scene::SceneManager::createAnimation ( const io::stringc Name = ""  )  [inline]

Creates a new animation. Use the NodeAnimation, MorphTargetAnimation and SkeletalAnimation classes.

Billboard * sp::scene::SceneManager::createBillboard ( video::Texture BaseTexture = 0  ) 

Creates a Billboard. Billboards (or Sprites) are mostly used for effects like Fire, Sparks, Lense flares etc.

Parameters:
hTexture,: Billboard's base texture. 0 is also allowed but then you only have a white quad.
Returns:
Pointer to a Billboard object.
Camera * sp::scene::SceneManager::createCamera (  ) 

Creates a standard camera. Without cameras you cannot see the scene which shall be rendered.

template<class T >
T* sp::scene::SceneManager::createCamera (  )  [inline]

Creates a Camera. Without cameras you cannot see the scene which shall be rendered.

Returns:
Pointer to the specified Camera or Camera derived class object.
void sp::scene::SceneManager::createFurMesh ( Mesh Model,
video::Texture FurTexture,
s32  LayerCount = 25,
f32  HairLength = 0.2f,
s32  HairCloseness = 2 
)

TODO! -> move this to "MeshGenerator" namespace.

Creates a fur mesh. This functions copies the model several times and creates a fur effect. Normally fur effects can be achieved better using shaders but for small meshes this function can be used.

Parameters:
Model,: 3D model which shall get a fur.
FurTexture,: Texture which is to be used as the fur surface.
LayerCount,: Count of mesh copies which represent the fur layers.
HairLength,: Length of hairs which specifies the distance from the first to the last layer.
HairCloseness,: Random value for ploting hairs in the fur texture. Higher values cater for less hairs.
Todo:
Move this to "MeshGenerator" namespace
Mesh * sp::scene::SceneManager::createHeightField ( const video::Texture TexHeightMap,
const s32  Segments = DEF_MESH_SEGMENTS 
)

Creates a height field. It is an alternate to a dynamic terrain.

Parameters:
HeightMapTexture,: Texture which holds the height-map data
Detail,: Segments for the height-field to be created

!!

Light * sp::scene::SceneManager::createLight ( const ELightModels  Type = LIGHT_DIRECTIONAL  ) 

Creates a dynamic light source.

Parameters:
Type,: Light's type. Supported are three types: Directional (by default), Point, Spot. Point and Spot lights can be volumetric using "Light::setVolumetric".
Returns:
Pointer to a Light object.
Mesh * sp::scene::SceneManager::createMesh (  ) 

Creates an empty Mesh object. With this you can build your own 3d models at the beginning. Look at the "Mesh" class reference to learn more about building models.

Returns:
Pointer to an Mesh object which represents the 3D models.
Mesh * sp::scene::SceneManager::createMesh ( const EBasicMeshes  Model,
const SMeshConstruct BuildConstruct = SMeshConstruct() 
)

Creates a standard primitive.

Parameters:
Type,: Type of the standard primitve (e.g. Cube, Sphere etc.).
BuildContruct,: Structure which holds the model contrstruction data (e.g. Segments, Radius etc.).
Mesh * sp::scene::SceneManager::createMeshList ( std::list< Mesh * >  MergeList,
bool  isOldDelete 
)

Creates a mesh out of the specified meshes.

Mesh * sp::scene::SceneManager::createMeshSurface ( Mesh Model,
u32  Surface 
)

Creates a mesh out of the specified mesh's surface.

SceneNode * sp::scene::SceneManager::createNode (  ) 

Creates a simple scene node and returns the pointer to the new object.

Mesh * sp::scene::SceneManager::createSkyBox ( video::Texture *(&)  TextureList[6],
f32  Radius = 50.0f 
)

Creates a skybox with 6 surfaces. For more information take a look at the "MeshGenerator" class.

See also:
MeshGenerator
MeshGenerator::createSkyBox
Mesh * sp::scene::SceneManager::createSuperShape ( const f32(&)  ValueList[12],
s32  Detail = DEF_MESH_SEGMENTS 
)

Creates a "SuperShape". This is a 'sphere-like' model which can look very strange with the right parameter values ;-).

Parameters:
ValueList,: List of the 12 values which describe the construction of the super-shape. Play with it to learn how the values affect the final model.
Detail,: Segments which defines the detail of the model.

!!

Terrain * sp::scene::SceneManager::createTerrain ( const video::SHeightMapTexture TextureHeightMap,
const dim::size2di Resolution,
s32  GeoMIPLevels = DEF_GEOMIP_LEVELS 
)

Creates a Terrain. Terrains are mostly used for mountains and large areas. These terrains can be used only for height-fields. Voxels are not supported.

Parameters:
TextureHeightMap,: Heightmap data object. You can also use a normal Texture because the SHeightMapData structure accepts this parameter. But if you want to create a height field with more detail (e.g. 32 bit height data) you can create a height field using floating-point arrays. With this feature you can save and load your own height-field texture data file formats. i.e. when using a 16 bit height field data type you can save memory and anyhow you have much more precise for your terrain.
Resolution,: Specifies the grid resolution for the terrain. If the resolution is e.g. 8*8 each quad-tree-node will have a mesh with 8*8*2 triangles (or 8*8 quads).
GeoMIPLevels,: Count of levels for geo-MIP-mapping which specifies the forks count of the quad-tree.
void sp::scene::SceneManager::deleteAnimation ( Animation Anim  ) 

Deletes the specified animation.

bool sp::scene::SceneManager::deleteNode ( SceneNode Object  ) 

Deletes the specified object. All renderer resources are also released.

Returns:
True if the object could be deleted. Otherwise the object does not exist in the SceneManager's list or an other error has been occured.
SceneNode * sp::scene::SceneManager::findChild ( const SceneNode Parent,
const io::stringc Name 
) const

Tries to find the specified child of the specified parent.

Parameters:
ParentNode,: Pointer to the Node object which is the parent of the wanted child.
Name,: Name of the wanted child.
Returns:
Pointer to the child Node object if the search was successful. Otherwise 0.
std::list< SceneNode * > sp::scene::SceneManager::findChildren ( const SceneNode Parent  )  const

Tries to find each child of the specified parent.

Parameters:
ParentNode,: Pointer to the Node object which is the parent of the wanted children.
Returns:
List with each Node object which could found.
SceneNode * sp::scene::SceneManager::findNode ( const io::stringc Name  )  const

Tries to find the specified node.

Parameters:
Name,: Name of the wanted node.
Returns:
Pointer to the Node object which could found. If no object could found the return value is 0.
std::list< SceneNode * > sp::scene::SceneManager::findNodes ( const io::stringc Name  )  const

Tries to find each node with the specified name.

Parameters:
Name,: Name of the wanted nodes.
Returns:
List with each Node object which could found.
const std::list<Animation*>& sp::scene::SceneManager::getAnimationList (  )  const [inline]
const std::list<Billboard*>& sp::scene::SceneManager::getBillboardList (  )  const [inline]
const std::list<Camera*>& sp::scene::SceneManager::getCameraList (  )  const [inline]
video::ERendererDataTypes sp::scene::SceneManager::getDefaultIndexFormat (  )  [static]

Returns the default index format.

const video::VertexFormat * sp::scene::SceneManager::getDefaultVertexFormat (  )  [static]

Returns the default vertex format.

const std::list<Light*>& sp::scene::SceneManager::getLightList (  )  const [inline]
Mesh * sp::scene::SceneManager::getMesh ( const io::stringc Filename,
io::stringc  TexturePath = video::TEXPATH_IGNORE,
const EMeshFileFormats  Format = MESHFORMAT_UNKNOWN 
)

Loads a model or instanciates it when it has already been loaded.

See also:
SceneGraph::loadMesh
Note:
When the root mesh will be deleted you also need to delete all derived meshes, too!
EMeshFileFormats sp::scene::SceneManager::getMeshFileFormat ( const io::stringc Filename,
const EMeshFileFormats  DefaultFormat 
) [static]
const std::list<Mesh*>& sp::scene::SceneManager::getMeshList (  )  const [inline]
const std::list<SceneNode*>& sp::scene::SceneManager::getNodeList (  )  const [inline]
ESceneFileFormats sp::scene::SceneManager::getSceneFileFormat ( const io::stringc Filename,
const ESceneFileFormats  DefaultFormat 
) [static]
u32 sp::scene::SceneManager::getSceneMeshBufferCount (  )  const

Returns count of mesh buffers in the whole scene. Only Mesh objects are included.

u32 sp::scene::SceneManager::getSceneObjectsCount (  )  const

Returns count of objects in the whole scene. Each kind of Node objects are included.

u32 sp::scene::SceneManager::getSceneTriangleCount (  )  const

Returns count of triangles in the whole scene. Only Mesh objects are included.

u32 sp::scene::SceneManager::getSceneVertexCount (  )  const

Returns count of vertices in the whole scene. Only Mesh objects are included.

const std::list<Terrain*>& sp::scene::SceneManager::getTerrainList (  )  const [inline]
bool sp::scene::SceneManager::getTextureLoadingState (  )  [static]
Mesh * sp::scene::SceneManager::loadMesh ( io::stringc  Filename,
io::stringc  TexturePath = video::TEXPATH_IGNORE,
const EMeshFileFormats  Format = MESHFORMAT_UNKNOWN,
const s32  Flags = 0 
)

Loads a 3D model from file. The supported file formats are listed in the "EModelTypes" enumeration and at the "SoftPixel Engine"'s homepage under "features".

Parameters:
[in] Filename Specifies the model filename which is to be loaded.
[in] TexturePath Specifies the directory path where the model's textures are stored. When a texture filename is saved in the model file (e.g. "Texture1.bmp") the "TexturePath" is pushed to the front and loaded. e.g. [TexturePath + "Texture1.bmp"]. By default the path where the model is saved is used.
[in] Format Specifies which file format the model has. By default the format will be determined automatically.
[in] Flags Specifies the loading flags. This can be a combination of the EMeshLoaderFlags enumeration values.
See also:
EMeshLoaderFlags
Mesh * sp::scene::SceneManager::loadScene ( io::stringc  Filename,
io::stringc  TexturePath = video::TEXPATH_IGNORE,
const ESceneFileFormats  Format = SCENEFORMAT_UNKNOWN,
const s32  Flags = DEF_SCENE_FLAGS 
)

Loads a scene (or rather game map).

Parameters:
Filename,: Filename/ path of the scene to be loaded.
TexturePath,: Directory path in which the scene's textures are stored. When loading a BSP1 (Quake 1/ Half-Life 1) map file you can set the WAD (texture storage file) file directly.
FileType,: Specifies which file format the scene has. By default the engine can determine it self.
Flags,: Specifies some possible options. This has been added particular for the SPSB (SoftPixel Sandbox Scene) file format which has been integrated since version 3.1.
Returns:
Pointer to the main Mesh object and 0 (Null) when loading an SPSB file (SoftPixel Sandbox Scene).
Note:
When loading an SPSB file (SoftPixel Sandbox Scene) the return value is always 0 (Null). It is anyway the best idea to write an own class and derive from the SceneLoaderSPSB class to have more access of how the scene will be loaded.
void sp::scene::SceneManager::removeTexture ( const video::Texture Tex  ) 

Removes the specified texture from each "Mesh" and "Terrain" object which use this texture.

Parameters:
hTexture,: Texture which is to be removed.
bool sp::scene::SceneManager::saveMesh ( Mesh Model,
io::stringc  Filename,
const EMeshFileFormats  Format = MESHFORMAT_UNKNOWN 
)

Saves a model to the disk.

Parameters:
Model,: 3D model which is to be saved.
Filename,: Filename/ path where the file shall be created.
FileType,: Specifies which file format the file shall get. By default the engine can decide it by the filename's extension
void sp::scene::SceneManager::setDefaultIndexFormat ( const video::ERendererDataTypes  Format  )  [static]

Sets the default index format which will be used when loading or creating a new mesh.

Parameters:
Format,: Specifies the new default index format. By default ATTRIBUTE_UNSIGNED_SHORT. Must be one of the following values: ATTRIBUTE_UNSIGNED_BYTE (only for OpenGL), ATTRIBUTE_UNSIGNED_SHORT or ATTRIBUTE_UNSIGNED_INT.
void sp::scene::SceneManager::setDefaultVertexFormat ( const video::VertexFormat Format  )  [static]

Sets the default vertex format which will be used when loading or creating a new mesh.

Parameters:
Format,: Specifies the new default vertex format. By default RenderSystem::getVertexFormatDefault(). If 0 the initial default vertex format will be used again.
void sp::scene::SceneManager::setTextureLoadingState ( bool  AllowTextureLoading  )  [static]

Allows or disallows mesh loaders to load textures.

void sp::scene::SceneManager::updateAnimations (  ) 

Updates all animations.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines