Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

oxygen::SceneServer Class Reference

The scene server manages displayable subtrees within the object hierarchy. More...

#include <sceneserver.h>

Inheritance diagram for oxygen::SceneServer:

Inheritance graph
[legend]
Collaboration diagram for oxygen::SceneServer:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SceneServer ()
 ~SceneServer ()
boost::shared_ptr< SceneCreateScene (const std::string &location)
 creates a new scene hierarchy at a specific location, new hierarchy is also made current
bool SetActiveScene (const std::string &location)
 sets the active scene
boost::shared_ptr< SceneGetActiveScene ()
 returns a reference to the current active scene
void Update (float deltaTime)
 updates the state of the current active scene (deltaTime is in seconds)
bool ImportScene (const std::string &fileName, boost::shared_ptr< BaseNode > root, boost::shared_ptr< zeitgeist::ParameterList > parameter)
 imports a scene from a file below the given BaseNode
bool InitSceneImporter (const std::string &importerName)
 creates an instance of

Static Public Member Functions

static int GetTransformMark ()
 returns the current label for modified transform nodes

Protected Member Functions

void UpdateCache ()
 gets missing references
void ResetCache ()
 resets all cached references
virtual void OnUnlink ()
 resets all cached references
void ReparentTransformChildren (boost::shared_ptr< Transform > node)
 reparents all children of node to the parent of node; Their local transform matrix is multiplied with the local transform matrix of node
void RemoveTransformPaths (boost::shared_ptr< zeitgeist::Leaf > root)
 recursively reparents all transform nodes whose only children are also transform node

Private Attributes

boost::shared_ptr< ScenemActiveScene
 the current active scene
boost::shared_ptr< SpacemActiveSpace
 cached reference to the Space node below the active scene
boost::shared_ptr< WorldmActiveWorld
 cached reference to the World node below the active scene

Static Private Attributes

static int mTransformMark = 0
 modified transform nodes are labeled with this value, the value is incremented each cycle to avoid a resetting

Detailed Description

The scene server manages displayable subtrees within the object hierarchy.

Each subtree begins with a Scene node. The scene server knows which scene node is currently active and updates that node (and its corresponding subtree).

Definition at line 57 of file sceneserver.h.


Constructor & Destructor Documentation

SceneServer::SceneServer  ) 
 

Definition at line 43 of file sceneserver.cpp.

SceneServer::~SceneServer  ) 
 

Definition at line 47 of file sceneserver.cpp.


Member Function Documentation

boost::shared_ptr< Scene > SceneServer::CreateScene const std::string &  location  ) 
 

creates a new scene hierarchy at a specific location, new hierarchy is also made current

Definition at line 51 of file sceneserver.cpp.

References zeitgeist::Object::GetCore(), mActiveScene, and ResetCache().

Here is the call graph for this function:

boost::shared_ptr<Scene> oxygen::SceneServer::GetActiveScene  )  [inline]
 

returns a reference to the current active scene

Definition at line 74 of file sceneserver.h.

int SceneServer::GetTransformMark  )  [static]
 

returns the current label for modified transform nodes

Definition at line 117 of file sceneserver.cpp.

References mTransformMark.

Referenced by oxygen::Transform::SetLocalPos(), oxygen::Transform::SetLocalRotation(), oxygen::Transform::SetLocalTransform(), and oxygen::Transform::SetWorldTransform().

bool oxygen::SceneServer::ImportScene const std::string &  fileName,
boost::shared_ptr< BaseNode root,
boost::shared_ptr< zeitgeist::ParameterList parameter
 

imports a scene from a file below the given BaseNode

bool SceneServer::InitSceneImporter const std::string &  importerName  ) 
 

creates an instance of

Parameters:
importerName and registers it as a SceneImporter to the SceneServer

Definition at line 328 of file sceneserver.cpp.

References zeitgeist::Node::AddChildReference(), zeitgeist::Object::GetCore(), and zeitgeist::Object::GetLog().

Here is the call graph for this function:

void SceneServer::OnUnlink  )  [protected, virtual]
 

resets all cached references

Reimplemented from zeitgeist::Leaf.

Definition at line 112 of file sceneserver.cpp.

References ResetCache().

Here is the call graph for this function:

void oxygen::SceneServer::RemoveTransformPaths boost::shared_ptr< zeitgeist::Leaf root  )  [protected]
 

recursively reparents all transform nodes whose only children are also transform node

void oxygen::SceneServer::ReparentTransformChildren boost::shared_ptr< Transform node  )  [protected]
 

reparents all children of node to the parent of node; Their local transform matrix is multiplied with the local transform matrix of node

void SceneServer::ResetCache  )  [protected]
 

resets all cached references

Definition at line 82 of file sceneserver.cpp.

References mActiveScene, mActiveSpace, and mActiveWorld.

Referenced by CreateScene(), OnUnlink(), SetActiveScene(), and UpdateCache().

bool SceneServer::SetActiveScene const std::string &  location  ) 
 

sets the active scene

Definition at line 67 of file sceneserver.cpp.

References zeitgeist::Object::GetCore(), mActiveScene, and ResetCache().

Here is the call graph for this function:

void SceneServer::Update float  deltaTime  ) 
 

updates the state of the current active scene (deltaTime is in seconds)

We do not make the distinction between 'controllers' and 'scene graph nodes'. This design forces us to perform several update passes through the hierarchy. Nevertheless, the more homogenuous structure is worth it.

An example Hierarchy:

scene |- transform |- body | |- quakecontroller | |- camera

The following passes are performed:

1st pass: PrePhysicsUpdate(deltaTime) The first update pass is responsible for updating the internal state of an object. For example, the quakecontroller has received input from the main application in terms of state changes like StrafeLeft, or Forward. As the controller is physics driven, it has to translate these commands to actual forces, which act on the body. This is done during this pass.

After the first pass pyhsics simulation and collision are calculated using ODE.

2nd pass: PostPhysicsUpdate() This pass can be used to affect other nodes. For example, 'Body' has undergone physics simulation and collision detection. It has reached its final 'simulated' position, which has to be passed to the parent Transform node.

3rd pass: UpdateHierarchy() As the second pass affects the position of objects, we have to recalculate the transformation hierarchy before we can display the scene.

Definition at line 160 of file sceneserver.cpp.

References mActiveScene, mActiveSpace, mActiveWorld, mTransformMark, and UpdateCache().

Here is the call graph for this function:

void SceneServer::UpdateCache  )  [protected]
 

gets missing references

Definition at line 89 of file sceneserver.cpp.

References mActiveScene, mActiveSpace, mActiveWorld, and ResetCache().

Referenced by Update().

Here is the call graph for this function:


Member Data Documentation

boost::shared_ptr<Scene> oxygen::SceneServer::mActiveScene [private]
 

the current active scene

Definition at line 120 of file sceneserver.h.

Referenced by CreateScene(), ResetCache(), SetActiveScene(), Update(), and UpdateCache().

boost::shared_ptr<Space> oxygen::SceneServer::mActiveSpace [private]
 

cached reference to the Space node below the active scene

Definition at line 123 of file sceneserver.h.

Referenced by ResetCache(), Update(), and UpdateCache().

boost::shared_ptr<World> oxygen::SceneServer::mActiveWorld [private]
 

cached reference to the World node below the active scene

Definition at line 126 of file sceneserver.h.

Referenced by ResetCache(), Update(), and UpdateCache().

int SceneServer::mTransformMark = 0 [static, private]
 

modified transform nodes are labeled with this value, the value is incremented each cycle to avoid a resetting

Definition at line 131 of file sceneserver.h.

Referenced by GetTransformMark(), and Update().


The documentation for this class was generated from the following files:
Generated on Thu Apr 6 15:47:15 2006 for rcssserver3d by  doxygen 1.4.4