PixelLightAPI  .
Public Types | Public Member Functions | Protected Member Functions
PLScene::SceneContainer Class Reference

Scene container node (group node) class which is using scene nodes. More...

#include <SceneContainer.h>

Inheritance diagram for PLScene::SceneContainer:
Inheritance graph
[legend]

List of all members.

Public Types

enum  EFlags { NoRecursion = 1<<10 }
 Scene node flags (SceneNode flags extension) More...

Public Member Functions

PLS_API void SetFilename (const PLCore::String &sValue)
PLS_API SceneContainer ()
 Default constructor.
virtual PLS_API ~SceneContainer ()
 Destructor.
SceneNodeCreate (const PLCore::String &sClass, const PLCore::String &sName="", const PLCore::String &sParameters="")
 Creates a new scene node.
PLS_API SceneNodeCreateAtIndex (const PLCore::String &sClass, const PLCore::String &sName="", const PLCore::String &sParameters="", int nPosition=-1)
 Creates a new scene node at a certain index inside the scene node list.
PLS_API void CalculateAABoundingBox ()
 Calculates and sets the axis align bounding box in 'scene node space'.
PLS_API bool GetTransformMatrixTo (SceneContainer &cContainer, PLMath::Matrix3x4 &mTransform)
 Calculates a transform matrix to bring a transformation from 'this scene container' into 'another scene container'.
PLS_API SceneHierarchyCreateHierarchy (const PLCore::String &sClass="PLScene::SHList")
 Creates the scene hierarchy of this scene container.
PLS_API SceneHierarchyGetHierarchyInstance ()
 Returns the scene hierarchy of this scene container.
PLS_API SceneQueryCreateQuery (const PLCore::String &sClass)
 Creates a scene query.
PLS_API bool DestroyQuery (SceneQuery &cQuery)
 Destroys a scene query.
virtual PLS_API bool DeInit () override
 De-initializes the manager.
virtual PLS_API SceneNodeGetByIndex (PLCore::uint32 nIndex=0) const override
virtual PLS_API SceneNodeGetByName (const PLCore::String &sName) const override
 Returns the element with the given name.
virtual PLS_API bool LoadByFilename (const PLCore::String &sFilename, const PLCore::String &sParams="", const PLCore::String &sMethod="") override
 Loads the loadable from a file given by filename.
virtual PLS_API bool LoadByFile (PLCore::File &cFile, const PLCore::String &sParams="", const PLCore::String &sMethod="") override
 Loads the loadable from a file given by a reference.
virtual PLS_API bool Unload () override
 Unloads the loadable.
virtual PLS_API PLCore::String GetLoadableTypeName () const override
 Returns the loadable type name.

Protected Member Functions

virtual PLS_API void InitFunction () override
 This function is called when the scene node gets initialized.
virtual PLS_API void DeInitFunction () override
 This function is called when the scene node gets de-initialized.
virtual PLS_API void OnActivate (bool bActivate) override
 Called when the scene node has been activated or deactivated.
virtual PLS_API bool CallLoadable (PLCore::File &cFile, PLCore::Loader &cLoader, const PLCore::String &sMethod, const PLCore::String &sParams) override
 Calls the loadable in order to load or save.

Detailed Description

Scene container node (group node) class which is using scene nodes.

Remarks:
This is a root or inner node of the scene graph.
Note:
  • The 'scene node space' axis aligned bounding box should always cover all scene nodes of this container
  • Within GetByName(<Name>) you can also use 'absolute names' instead of 'relative' names. 'Root.MyScene.MyNode' for instance will return the scene node 'MyNode' within the scene container 'MyScene' which is a subnode of 'Root'. 'MyScene.MyNode' will return the node 'MyNode' of the container 'MyScene' which is an element of the current container. 'Parent.MyNode' will return the scene node 'MyNode' within the parent scene container. 'Parent' returns the parent scene container, 'This' returns THIS container, 'Root' will return the root scene container itself.
  • Use "GetSceneContext()->GetRoot()" to get the 'root' node in which you can insert your scenes
  • Derived classes should use a 'SC'-prefix (example: SCCell)
  • By default, all draw function flags are set

Member Enumeration Documentation

Scene node flags (SceneNode flags extension)

Enumerator:
NoRecursion 

Do NOT take the scene nodes of this container into account when for instance rendering the scene. 'SCRenderToTexture' for example sets this flag.

Reimplemented from PLScene::SceneNode.


Constructor & Destructor Documentation

Default constructor.

virtual PLS_API PLScene::SceneContainer::~SceneContainer ( ) [virtual]

Destructor.


Member Function Documentation

PLS_API void PLScene::SceneContainer::SetFilename ( const PLCore::String sValue)
SceneNode * PLScene::SceneContainer::Create ( const PLCore::String sClass,
const PLCore::String sName = "",
const PLCore::String sParameters = "" 
) [inline]

Creates a new scene node.

Parameters:
[in]sClassName of the scene node class to create an instance from
[in]sNameScene node name
[in]sParametersOptional parameter string
Returns:
Pointer to the new scene node or a null pointer if something went wrong (maybe unknown class or the class is not derived from SceneNode)
Note:
  • If the desired name is already in use, the name is chosen automatically
PLS_API SceneNode* PLScene::SceneContainer::CreateAtIndex ( const PLCore::String sClass,
const PLCore::String sName = "",
const PLCore::String sParameters = "",
int  nPosition = -1 
)

Creates a new scene node at a certain index inside the scene node list.

Parameters:
[in]sClassName of the scene node class to create an instance from
[in]sNameScene node name
[in]sParametersOptional parameter string
[in]nPositionOptional index position specifying the location within the scene node list where the scene node should be added, <0 for at the end
Returns:
Pointer to the new scene node or a null pointer if something went wrong (maybe unknown class or the class is not derived from SceneNode)
Note:
  • If the desired name is already in use, the name is chosen automatically

Calculates and sets the axis align bounding box in 'scene node space'.

Remarks:
Because the 'scene node space' axis aligned bounding box should always cover all scene nodes of this container, you can use this function to calculate and set this a bounding box automatically.
PLS_API bool PLScene::SceneContainer::GetTransformMatrixTo ( SceneContainer cContainer,
PLMath::Matrix3x4 mTransform 
)

Calculates a transform matrix to bring a transformation from 'this scene container' into 'another scene container'.

Parameters:
[in]cContainer'Target' scene container
[out]mTransformReceives the transform matrix, may contain an invalid matrix on error
Returns:
'true' if all went fine, else 'false'
PLS_API SceneHierarchy* PLScene::SceneContainer::CreateHierarchy ( const PLCore::String sClass = "PLScene::SHList")

Creates the scene hierarchy of this scene container.

Parameters:
[in]sClassClass name of the scene hierarchy to create, if empty this function will do nothing
Returns:
Pointer to the created scene hierarchy of this scene container. This is NEVER a null pointer - if no special hierarchy is used the default hierarchy 'PLScene::SHList' is used instead which is in fact only a simple list which is using the container directly.
Note:
  • This hierarchy is destroyed by this scene container automatically
  • All current container scene nodes are added to the hierarchy automatically and the hierarchy is created

Returns the scene hierarchy of this scene container.

Returns:
Pointer to the scene hierarchy of this scene container, can NEVER be a null pointer!
Remarks:
Before the hierarchy is returned, scene nodes are refreshed if required. So, do NOT backup the returned pointer, call this function if you need a pointer to the hierarchy!

Creates a scene query.

Parameters:
[in]sClassClass name of the scene query to create
Remarks:
Have a look at SceneQuery for scene query remarks. If your created query is no longer required you can destroy it using the DestroyQuery() functions. But note that if you need a query frequently it's not a good idea to create & destroy it every time you perform this query. For instance queries for rendering the scene will store different current rendering information, in this case it would be terrible to create & destroy the query every frame! Maybe the rendering algorithm doesn't work correctly if this is done because sometimes they will need information from the previous frame! Such queries should be created once and then be used all the time. Use SceneQueryHandler to hold your pointer to the query. If the container is destroyed your pointer is set to a null pointer automatically. If for instance the scene hierarchy was changed some queries like render queries have to update some internal data. The internal scene query manager of the scene container will inform it's queries in such a case. The created scene query can ONLY operate on this scene container and it's child scene nodes/ containers. Therefore you can limit your queries to for instance to a single room instead using the hold scene. Use the scene root (GetRootContainer()) to access the complete scene.
Returns:
Pointer to the created scene query operating on this scene container, a null pointer on error (maybe unknown class or the class is not derived from 'SceneQuery')

Destroys a scene query.

Parameters:
[in]cQueryScene query to destroy
Returns:
'true' if all went fine, else 'false' (invalid query :)
virtual PLS_API void PLScene::SceneContainer::InitFunction ( ) [override, protected, virtual]

This function is called when the scene node gets initialized.

Reimplemented from PLScene::SceneNode.

Reimplemented in PLScene::SCRenderToTexture, and PLPhysics::SCPhysicsWorld.

virtual PLS_API void PLScene::SceneContainer::DeInitFunction ( ) [override, protected, virtual]

This function is called when the scene node gets de-initialized.

Reimplemented from PLScene::SceneNode.

Reimplemented in PLPhysics::SCPhysicsWorld.

virtual PLS_API void PLScene::SceneContainer::OnActivate ( bool  bActivate) [override, protected, virtual]

Called when the scene node has been activated or deactivated.

Parameters:
[in]bActivate'true' if the scene node is now active, else 'false'
Note:
  • The scene node "Inactive"-flag as well as the "Frozen"-flag are taken into account
  • 'bActivate' will be 'true' if the scene node AND the parent scene container (recursive!) are active
  • 'bActivate' will be 'false' if the scene node OR the parent scene container (recursive!) is inactive
  • The default implementation calls the "OnActivate()" of all attached scene node modifiers

Reimplemented from PLScene::SceneNode.

Reimplemented in PLPhysics::SCPhysicsWorld.

virtual PLS_API bool PLScene::SceneContainer::DeInit ( ) [override, virtual]

De-initializes the manager.

Returns:
'true' if all went fine, else 'false'

Reimplemented from PLCore::ElementManager< AType >.

virtual PLS_API SceneNode* PLScene::SceneContainer::GetByIndex ( PLCore::uint32  nIndex = 0) const [override, virtual]
virtual PLS_API SceneNode* PLScene::SceneContainer::GetByName ( const PLCore::String sName) const [override, virtual]

Returns the element with the given name.

Parameters:
[in]sNameElement name
Returns:
The corresponding element, a null pointer if there's no match
Note:
  • You can overload this function to specialize the behavior. This is done for instance within SceneContainer to be able to use 'absolute names' like 'Root.MyScene.MyNode', too.

Reimplemented from PLCore::ElementManager< AType >.

virtual PLS_API bool PLScene::SceneContainer::LoadByFilename ( const PLCore::String sFilename,
const PLCore::String sParams = "",
const PLCore::String sMethod = "" 
) [override, virtual]

Loads the loadable from a file given by filename.

Parameters:
[in]sFilenameLoadable filename
[in]sParamsOptional load method parameters, can be an empty string
[in]sMethodOptional name of the load method to use, can be an empty string
Returns:
'true' if all went fine, else 'false'
Note:
  • If no method name was provided, 'Load' if sParams is empty, or 'LoadParams' if sParams is not empty is used automatically

Reimplemented from PLCore::Loadable.

Reimplemented in PLPhysics::SCPhysicsWorld.

virtual PLS_API bool PLScene::SceneContainer::LoadByFile ( PLCore::File cFile,
const PLCore::String sParams = "",
const PLCore::String sMethod = "" 
) [override, virtual]

Loads the loadable from a file given by a reference.

Parameters:
[in]cFileFile to load from, must be opened and readable
[in]sParamsOptional load method parameters, can be an empty string
[in]sMethodOptional name of the load method to use, can be an empty string
Returns:
'true' if all went fine, else 'false'
Note:
  • If no method name was provided, 'Load' if sParams is empty, or 'LoadParams' if sParams is not empty is used automatically

Reimplemented from PLCore::Loadable.

Reimplemented in PLPhysics::SCPhysicsWorld.

virtual PLS_API bool PLScene::SceneContainer::Unload ( ) [override, virtual]

Unloads the loadable.

Returns:
'true' if all went fine, else 'false'

Reimplemented from PLCore::Loadable.

virtual PLS_API PLCore::String PLScene::SceneContainer::GetLoadableTypeName ( ) const [override, virtual]

Returns the loadable type name.

Returns:
The loadable type name

Reimplemented from PLCore::Loadable.

virtual PLS_API bool PLScene::SceneContainer::CallLoadable ( PLCore::File cFile,
PLCore::Loader cLoader,
const PLCore::String sMethod,
const PLCore::String sParams 
) [override, protected, virtual]

Calls the loadable in order to load or save.

Parameters:
[in]cFileFile to load from, MUST be opened
[in]cLoaderLoader to use
[in]sMethodName of the method to use
[in]sParamsMethod parameters
Returns:
'true' if all went fine, else 'false'
Note:
  • The default implementation is empty and will return always 'false'

Reimplemented from PLCore::Loadable.


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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:40
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported