Wiki

Clone wiki

gengine / SceneManager API

Scene objects and scene management

Structure

Current approach to the scene management (the one which is currently used) is the common for the retained rendering.

Scene is defined as the hierarchical tree of the scene elements which defines their parent to child relation in terms of the spatial frame. Each child inherit visibility and reference spatial frame of the parent.

Scene tree plays several roles:

  • Spatial hierarchy
  • Scene object periodic updates (animations or anything like that)
  • Scene culling wrt. camera frustum

SceneGraph

Scene graph manages the forest of the scene trees, their lifetimes and updates. It doesn't know anything about hierarchy and the scene itself or spatial coordinates. The basic element of the scene is Element class which can be culled and drawn.

// Construct a new scene and optionally attach update task object.
SceneGraph(ModifierUpdateTask* task)

// Tests whether scene graph contains any elements
BOOL IsEmpty() const

// Add another scene/graph to this scene graph
// All the root nodes will be updated
void AddScene( Element* scene );

// Remove the scene supplied from the scene graph
// Returns false if scene does not exists
BOOL UnlinkScene( Element* scene );

// Delete the element supplied by the first adding it to
// the death row ( as a stay execution ). This will be
// deleted at the end of update cycle then death row is purged.
// This is done to avoid deleting objects that might
// be referenced to later in the update cycle.
void DelayedDelete( Element* elem );

// Purge and delete all elements on death row
void PurgeDeathRow();

// Update all scene graph using the time
// increment supplied
void Update( FLOAT dt );

// Get/set the global ambient color
const Color& GetAmbient();
void SetAmbient( const Color& clr );

// Get the current modifier task
ModifierUpdateTask* GetModifierTask();

// Set the current modifier task. If a task already exists,
// destroy it. 
// NOTE: This does not copy over any existing task - intended for
// initial creation only.
void SetModifierTask( ModifierUpdateTask* task );

Element

Particle

ModifierUpdateTask

Updated