#include <spSceneManager.hpp>
Public Member Functions | |
SceneManager () | |
~SceneManager () | |
Mesh * | createMesh () |
Mesh * | createMesh (const EBasicMeshes Model, const SMeshConstruct &BuildConstruct=SMeshConstruct()) |
Mesh * | createSuperShape (const f32(&ValueList)[12], s32 Detail=DEF_MESH_SEGMENTS) |
Mesh * | createSkyBox (video::Texture *(&TextureList)[6], f32 Radius=50.0f) |
Mesh * | createHeightField (const video::Texture *TexHeightMap, const s32 Segments=DEF_MESH_SEGMENTS) |
Mesh * | createMeshList (std::list< Mesh * > MergeList, bool isOldDelete) |
Creates a mesh out of the specified meshes. | |
Mesh * | createMeshSurface (Mesh *Model, u32 Surface) |
Creates a mesh out of the specified mesh's surface. | |
Mesh * | loadMesh (io::stringc Filename, io::stringc TexturePath=video::TEXPATH_IGNORE, const EMeshFileFormats Format=MESHFORMAT_UNKNOWN, const s32 Flags=0) |
Mesh * | getMesh (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) |
Mesh * | loadScene (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. | |
SceneNode * | createNode () |
Creates a simple scene node and returns the pointer to the new object. | |
Camera * | createCamera () |
Creates a standard camera. Without cameras you cannot see the scene which shall be rendered. | |
Light * | createLight (const ELightModels Type=LIGHT_DIRECTIONAL) |
Billboard * | createBillboard (video::Texture *BaseTexture=0) |
Terrain * | createTerrain (const video::SHeightMapTexture &TextureHeightMap, const dim::size2di &Resolution, s32 GeoMIPLevels=DEF_GEOMIP_LEVELS) |
SceneNode * | copyNode (const SceneNode *TemplateObject) |
Mesh * | copyNode (const Mesh *TemplateObject) |
Light * | copyNode (const Light *TemplateObject) |
Billboard * | copyNode (const Billboard *TemplateObject) |
Camera * | copyNode (const Camera *TemplateObject) |
Terrain * | copyNode (const Terrain *TemplateObject) |
bool | deleteNode (SceneNode *Object) |
std::list< SceneNode * > | findNodes (const io::stringc &Name) const |
SceneNode * | findNode (const io::stringc &Name) const |
std::list< SceneNode * > | findChildren (const SceneNode *Parent) const |
SceneNode * | findChild (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::VertexFormat * | getDefaultVertexFormat () |
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) |
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.
sp::scene::SceneManager::SceneManager | ( | ) |
sp::scene::SceneManager::~SceneManager | ( | ) |
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.
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.
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 |
) |
Camera * sp::scene::SceneManager::createCamera | ( | ) |
Creates a standard camera. Without cameras you cannot see the scene which shall be rendered.
T* sp::scene::SceneManager::createCamera | ( | ) | [inline] |
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.
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. |
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.
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.
Type,: | Light's type. Supported are three types: Directional (by default), Point, Spot. Point and Spot lights can be volumetric using "Light::setVolumetric". |
Mesh * sp::scene::SceneManager::createMesh | ( | ) |
Mesh * sp::scene::SceneManager::createMesh | ( | const EBasicMeshes | Model, | |
const SMeshConstruct & | BuildConstruct = SMeshConstruct() | |||
) |
Creates a standard primitive.
Type,: | Type of the standard primitve (e.g. Cube, Sphere etc.). | |
BuildContruct,: | Structure which holds the model contrstruction data (e.g. Segments, Radius etc.). |
Creates a mesh out of the specified meshes.
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.
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 ;-).
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.
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.
SceneNode * sp::scene::SceneManager::findChild | ( | const SceneNode * | Parent, | |
const io::stringc & | Name | |||
) | const |
SceneNode * sp::scene::SceneManager::findNode | ( | const io::stringc & | Name | ) | const |
Tries to find the specified node.
Name,: | Name of the wanted node. |
std::list< SceneNode * > sp::scene::SceneManager::findNodes | ( | const io::stringc & | Name | ) | const |
Tries to find each node with the specified name.
Name,: | Name of the wanted nodes. |
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.
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".
[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. |
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).
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. |
void sp::scene::SceneManager::removeTexture | ( | const video::Texture * | Tex | ) |
Removes the specified texture from each "Mesh" and "Terrain" object which use this texture.
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.
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.
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.
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.