ScEng::SceneEngine Class Reference

The Scene Engine main class. More...

#include <sceneengine.h>

List of all members.

Public Member Functions

 SceneEngine ()
 ~SceneEngine ()
 Destructor.
BlockGetBlock (void *ae)
void * GetApplicationElement (Block *block)
void CreateRelationship (Block *sb, void *ae)
void InitBlocks (Block *block)
 Please add comments here.
void SetIDToBlock (Block *block, int &id)
 Please add comments here.
void SetBlockIDs ()
 Please add comments here.
void DestroyBlockLoadData ()
 Please add comments here.
void DeleteScene ()
void LoadBlocks (SceneLoad *scene_load)
 Loads Binary Data.
bool SaveBlock (Block *block, SceneSave *scene_save)
 Savess Binary Data.
void InitScene ()
void ResetScene ()
int SaveScene (const char *filename)
int LoadScene (const char *filename)
int MergeScene (const char *filename)
void SetParentPointer (Node *node)
Status SetParent (Node *parent_node, Node *child_node)
ScEng::NodeCreateEmptyNode (GMT::Point3F position, const char *name)
ScEng::NodeCreateEmptyNode (GMT::Matrix3F tm, const char *name)
void UpdateDataTables (Block *block)
void CallPostLoad (Block *block)
void UpdateDataTables ()
void EnumBlock (Block *block, int &id, std::vector< Block * > &scene_blocks)
void EnumBlocks (std::vector< Block * > &scene_blocks)
void EvaluateNode (Node *node, int time)
void EvaluateScene (int time, bool force_eval_all=false)
bool ApplyModifierToNodes (std::vector< Node * > nodes, Modifier *mod)
void GetAllChildrenNodes (Node *parent_node, std::vector< Node * > &all_nodes)
void GetAllSceneNodes (std::vector< Node * > &all_nodes)
void CleanObjectsHistory ()
 Cleans all the object_history of the nodes.
void SceneEngine::ReevaluateAllNodes (int t)

Static Public Member Functions

static void DestroyFactories ()
static void StateRecorderInit ()
 Initializes that State Recorder by creating a new state_recorder.
static void StateRecorderDelete ()
 Deletes the State Recorder.
static void StateRecorderBegin ()
 Begins a new state_level in the state_recorder stack.
static void StateRecorderPut (StateContainer *obj)
 Puts a container in the current state_level in the state_recorder stack.
static void StateRecorderRestore ()
 Restores the condition to the current stack_container.
static void StateRecorderCancel ()
 Cancels the current state_level and empties it.
static bool StateRecorderIsHolding ()
static void StateRecorderAccept (char *szLevelname)
 Closes the current stack_level and sets the visible name for the undo-redo command.
static bool StateRecorderCanUndo ()
static bool StateRecorderCanRedo ()
 
Returns:
true if there is something to redo

static void StateRecorderUndo ()
 Undoes the current stack_level.
static void StateRecorderRedo ()
 Redoes the next stack_level.
static void StateRecorderClear ()
 Removes all state containers from the stack.

Public Attributes

std::vector< AppRelationshipsrelationships
 Please add comments here.
std::vector< BlockLoadData * > scload_blocks
 Please add comments here.
MainScenemain_scene
 Please add comments here.
int num_save_blocks
 Please add comments here.
int num_load_blocks
 Please add comments here.

Static Public Attributes

static Log log
 The log for writing output to a text file.
static std::vector< BlockFactory * > block_factories
 Please add comments here.
static StateRecorder * state_recorder


Detailed Description

The Scene Engine main class.

Please add comments here


Constructor & Destructor Documentation

ScEng::SceneEngine::SceneEngine (  ) 

Constructor The SceneEngine constructor doesn't initialise the scene. The main_scene element is set to NULL. This because the developer can either load a file, which loads all the blocks, including main_scene, or create a new scene from scratch. If you need to create a new scene, call SceneEngine::InitSceneEngine right after creating your scene.


Member Function Documentation

Block * ScEng::SceneEngine::GetBlock ( void *  ae  ) 

Returns a specific Block Searchs in the relationships array a Block related with the specified appliaction element.

Parameters:
ae the pointer to the application element
Returns:
If there is a Block related with the application element, returns the Block. If not returns NULL.
See also:
void * GetApplicationElement( Block * block )

void * ScEng::SceneEngine::GetApplicationElement ( Block block  ) 

Returns a specific application element Searchs in the relationships array an appliaction element related with the specified Block.

Parameters:
block the pointer to the Block
Returns:
If there is an application element related with the Block, returns the application element.If not returns NULL.
See also:
Block * GetBlock( void * ae )

void ScEng::SceneEngine::CreateRelationship ( Block sb,
void *  ae 
)

Creates a relationship Creates a relation an AppRelationship between the given Block and the application element and adds it to the relationship array.

Parameters:
sb the Block to create the relationship
ae the application element to create the relationship

static void ScEng::SceneEngine::DestroyFactories (  )  [inline, static]

This static method deletes all the factories. It should be called only at the end of the session when the application is shutting down.

void ScEng::SceneEngine::DeleteScene (  ) 

Deletes the main scene. Note. This method removes all the blocks in SceneEngine starting from main_scene, but it doesn't delete the SceneEngine instance itself. The developer still have to do that himself.

void ScEng::SceneEngine::InitScene (  ) 

Initializes the scene This function creates a new main_scene and assigns a Node called "Main Node" to the main_node of the scene.

void ScEng::SceneEngine::ResetScene (  ) 

Resets the scene This function creates a new main_scene and assigns a Node called "Main Node" to the main_node of the scene.

See also:
InitScene. ResetScene calls InitScene. This is just a convenient wrapper.

int ScEng::SceneEngine::SaveScene ( const char *  filename  ) 

Saves the scene to a file

Parameters:
filename the name for the file where the scene info will be stored
Returns:
Returns 0 if the the file was saved

int ScEng::SceneEngine::LoadScene ( const char *  filename  ) 

Loads a scene from a file This method deletes the current scene and loads a new scene from file.

Parameters:
filename the name for the file where the scene is stored
Returns:
Returns 0 if the the file was loaded
See also:
MergeScene

int ScEng::SceneEngine::MergeScene ( const char *  filename  ) 

Merges a scene from a file into the current scene This method loads a scene from a file but without deleting the current scene.

Parameters:
filename the name for the file where the scene is stored
Returns:
Returns 0 if the the file was loaded
See also:
LoadScene

void ScEng::SceneEngine::SetParentPointer ( Node node  ) 

Fills all the parent pointers in all the children nodes below this node

Parameters:
node the parent node. All the children nodes below this one get their parent pointer set.

Status ScEng::SceneEngine::SetParent ( Node parent_node,
Node child_node 
)

Sets parent_node as the hierarchy parent for child_node This method also removes child_node from the children vector of any other block it has as parent

Node * ScEng::SceneEngine::CreateEmptyNode ( GMT::Point3F  position,
const char *  name 
)

Creates an NULL node (no object) in the given position and with the given name.

Parameters:
position The position where the node is created.
name The name of the created node.

Node * ScEng::SceneEngine::CreateEmptyNode ( GMT::Matrix3F  tm,
const char *  name 
)

Creates an NULL node (no object) in the given transform space and with the given name.

Parameters:
tm The transformation matrix of the created node.
name The name of the created node.

void ScEng::SceneEngine::UpdateDataTables ( Block block  ) 

Updates all the data tables below and including the block.
The parent block from which the update process is gonna be started.

void ScEng::SceneEngine::CallPostLoad ( Block block  ) 

Recursive method that traverses all the blocks in the scene calling Block::PostLoad. This method is called on the blocks in order from top to bottom of the DAG

void ScEng::SceneEngine::UpdateDataTables (  ) 

Updates all the data tables in the scene.
Starts the Update process from main_scene.

void ScEng::SceneEngine::EnumBlock ( Block block,
int &  id,
std::vector< Block * > &  scene_blocks 
)

Fills the scene_blocks vector with all the blocks that are dependencies of the given block.
Starts the Update process from main_scene.

void ScEng::SceneEngine::EnumBlocks ( std::vector< Block * > &  scene_blocks  ) 

Fills the scene_blocks vector with all the blocks in the scene.
Starts the Update process from main_scene.

void ScEng::SceneEngine::EvaluateNode ( Node node,
int  time 
)

Evaluates the node to have the most updated version.

Parameters:
node The node to be evaluated.
time The time at which the scene is evaluated.

void ScEng::SceneEngine::EvaluateScene ( int  time,
bool  force_eval_all = false 
)

Evaluates all nodes and blocks in the scene to have the most updated version.

Parameters:
time The time at which the scene is evaluated.
force_eval_all If true, all nodes and blocks are rebuilt again, everything is processed.

bool ScEng::SceneEngine::ApplyModifierToNodes ( std::vector< Node * >  nodes,
Modifier *  mod 
)

Applies a modifier to a node.

Parameters:
nodes The nodes that get the modifier applied.
mod The modifier to be applied to the node. return Returns true if the modifier was applied to the node, false if it wasn't applied. If the modifier was not applied to the node, then the caller of this function must delete the modifier. If the modifier was applied, SceneEngine takes control of that modifier and the caller cannot delete it.

void ScEng::SceneEngine::GetAllChildrenNodes ( Node parent_node,
std::vector< Node * > &  all_nodes 
)

Returns in the all_nodes table all the nodes that are descendants of the parent node.
The parent_node is not included in the all_nodes vector, only its descendants.

Parameters:
parent_node,: The node whose all descendats this function returns.
all_nodes,: A vector where all descendants nodes are returned.

void ScEng::SceneEngine::GetAllSceneNodes ( std::vector< Node * > &  all_nodes  ) 

Returns in the all_nodes table all the nodes in the scene.

Parameters:
all_nodes,: A vector where all the nodes are returned.

void ScEng::SceneEngine::SceneEngine::ReevaluateAllNodes ( int  t  ) 

Reevaluates all the nodes at the time t.

Parameters:
t the time at which all nodes will be evaluated.

bool ScEng::SceneEngine::StateRecorderIsHolding (  )  [static]

Returns:
true is there is at least one state_container in the current state_level, false if the stack_level is empty.

bool ScEng::SceneEngine::StateRecorderCanUndo (  )  [static]

Returns:
true if it is possible to undo a state_level, this is if the stack is not empty or if the first level was undone.


Member Data Documentation

StateRecorder * ScEng::SceneEngine::state_recorder [static]

The undo-redo system is implemented using this class. This is a static member and only gets initialized (new) using StateRecorderInit()


The documentation for this class was generated from the following files:
Generated on Thu Sep 6 10:49:23 2007 for SceneEngine by  doxygen 1.5.1-p1