# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::CScene Class Reference

A CScene, which own a list of Render Traversals, and a render() method. More...

#include <scene.h>

Inheritance diagram for NL3D::CScene

Inheritance graph
[legend]
Collaboration diagram for NL3D::CScene:

Collaboration graph
[legend]
List of all members.

Shape/Instances.

typedef std::multimap<std::string,
CTransformShape**> 
TWaitingInstancesMMap
CShapeBank_ShapeBank
TWaitingInstancesMMap _WaitingInstances

Public Methods

Construction / destruction.
 CScene ()
 Constructor. More...

 ~CScene ()
 Destructor. release(). More...

void initDefaultTravs ()
 Create / register the 5 basic traversals:CHrcTrav, CClipTrav, CLightTrav, CAnimDetailTrav, CRenderTravInit. More...

void initDefaultRoots ()
 Create/setRoot the defaults models roots: a CTransform and a CLightGroup. More...

void setDriver (IDriver *drv)
 Set the driver to render Traversal. More...

IDrivergetDriver () const
 Get the driver of render Traversal. More...

void addTrav (ITrav *v)
 Add a ITrav or a ITravScene to the scene. More...

void release ()
 Release all relative to the scene (Models, traversals...)... Destroy the Basic traversals too. More...

Render
void render (bool doHrcPass=true)
 Render the scene, via the registered ITravScene, from the CurrentCamera view. More...

Camera/Viewport.
void setCam (CCamera *cam)
 Set/Get the current camera/Viewport. More...

CCameragetCam ()
void setViewport (const class CViewport& viewport)
CViewport getViewport ()
Instance Mgt.
void setShapeBank (CShapeBank*pShapeBank)
 Set the shape bank. More...

virtual CTransformShapecreateInstance (const std::string &shapeName)
 Create a model, instance of the shape "shapename". More...

void createInstanceAsync (const std::string &shapeName, CTransformShape **pInstance)
 Create an instance, if the shape is not present, load the shape asynchronously. More...

void deleteInstance (CTransformShape*model)
 Delete an instance via his pointer. More...


Static Public Methods

Basic registration.
void registerBasics ()
 Register Basic models and observers. More...


Private Types

typedef std::map<sint, ITravScene*> TTravMap

Private Attributes

TTravMap RenderTraversals
CRefPtr<CCameraCurrentCamera
 The camera / Viewport. More...

CViewport _Viewport
CTransformRoot
The 5 default traversals, created / linked by CScene::initDefaultTraversals().
CHrcTravHrcTrav
CClipTravClipTrav
CLightTravLightTrav
CAnimDetailTravAnimDetailTrav
CRenderTravRenderTrav

Detailed Description

A CScene, which own a list of Render Traversals, and a render() method.

USER RULES:

CScene own those Traversals and those Root and kill them at ~CScene().

Coordinate System: right hand cordinates with: X to the right, Y to the far, Z to the top.

Z ^ | > Y | / | / |/ -------> X

Shape System:\n The scene has an instance Managagement:

  • IShape design the object that is instancied (a mesh as example).
  • ITransformShape is the instance, which smart_point to a IShape.
  • user can add shape manually in the scene CShapeBank with CShapeBank::add() (), or remove them with CShapeBank::release() ().
  • user create instance of a shape with CScene::createInstance(string shapeName); This create/load auto the shape if needed (searching in CPath, shapename must be a valid file name), and then create the instance, with help of IShape::createInstance().
Author(s):
Lionel Berenguier , Nevrax France
Date:
2000

Definition at line 109 of file scene.h.


Member Typedef Documentation

typedef std::map<sint, ITravScene*> NL3D::CScene::TTravMap [private]
 

Definition at line 195 of file scene.h.

typedef std::multimap<std::string,CTransformShape**> NL3D::CScene::TWaitingInstancesMMap [private]
 

Definition at line 219 of file scene.h.


Constructor & Destructor Documentation

NL3D::CScene::CScene ( )
 

Constructor.

Definition at line 70 of file scene.cpp.

NL3D::CScene::~CScene ( )
 

Destructor. release().

Definition at line 127 of file scene.cpp.


Member Function Documentation

void NL3D::CScene::addTrav ( ITrav * v )
 

Add a ITrav or a ITravScene to the scene.

If not a ITravScene (tested with help of dynamic_cast) or if trav->getRenderOrder()==0, The traversal is not added to the "render traversal list", else it is. Such a traversal will be traverse() -ed in the order given. The getRenderOrder() is called only in the addTrav() method (so this is a static information).

Reimplemented from NL3D::CMOT.

Definition at line 161 of file scene.cpp.

CTransformShape * NL3D::CScene::createInstance ( const std::string & shapeName ) [virtual]
 

Create a model, instance of the shape "shapename".

If not present, try to load "shapename" via the CPath. If fails, return NULL.

Definition at line 273 of file scene.cpp.

void NL3D::CScene::createInstanceAsync ( const std::string & shapeName,
CTransformShape ** pInstance )
 

Create an instance, if the shape is not present, load the shape asynchronously.

The instance is really created when we process it in the rendering.

Definition at line 295 of file scene.cpp.

void NL3D::CScene::deleteInstance ( CTransformShape * pTrfmShp )
 

Delete an instance via his pointer.

An instance is an entity which reference a shape.

Definition at line 313 of file scene.cpp.

CCamera * NL3D::CScene::getCam ( ) [inline]
 

Definition at line 162 of file scene.h.

IDriver * NL3D::CScene::getDriver ( ) const
 

Get the driver of render Traversal.

Definition at line 249 of file scene.cpp.

CViewport NL3D::CScene::getViewport ( ) [inline]
 

Definition at line 167 of file scene.h.

void NL3D::CScene::initDefaultRoots ( )
 

Create/setRoot the defaults models roots: a CTransform and a CLightGroup.

Definition at line 149 of file scene.cpp.

void NL3D::CScene::initDefaultTravs ( )
 

Create / register the 5 basic traversals:CHrcTrav, CClipTrav, CLightTrav, CAnimDetailTrav, CRenderTravInit.

Definition at line 132 of file scene.cpp.

void NL3D::CScene::registerBasics ( ) [static]
 

Register Basic models and observers.

Definition at line 54 of file scene.cpp.

void NL3D::CScene::release ( void )
 

Release all relative to the scene (Models, traversals...)... Destroy the Basic traversals too.

Reimplemented from NL3D::CMOT.

Definition at line 84 of file scene.cpp.

void NL3D::CScene::render ( bool doHrcPass = true )
 

Render the scene, via the registered ITravScene, from the CurrentCamera view.

NB: no Driver clear buffers (color or ZBuffer) are done.... This call t->traverse() function to registered render traversal following their order given.

Parameters:
doHrcPass   set it to false to indicate that the CHrcTrav have not to be traversed. UseFull to optimize if you know that NONE of your models have moved (a good example is a shoot of the scene from different cameras).

Definition at line 179 of file scene.cpp.

void NL3D::CScene::setCam ( CCamera * cam ) [inline]
 

Set/Get the current camera/Viewport.

Definition at line 161 of file scene.h.

void NL3D::CScene::setDriver ( IDriver * drv )
 

Set the driver to render Traversal.

Definition at line 242 of file scene.cpp.

void NL3D::CScene::setShapeBank ( CShapeBank * pShapeBank )
 

Set the shape bank.

Definition at line 266 of file scene.cpp.

void NL3D::CScene::setViewport ( const class CViewport & viewport ) [inline]
 

Definition at line 163 of file scene.h.


Member Data Documentation

CAnimDetailTrav * NL3D::CScene::AnimDetailTrav [private]
 

Definition at line 207 of file scene.h.

CClipTrav * NL3D::CScene::ClipTrav [private]
 

Definition at line 205 of file scene.h.

CRefPtr< CCamera > NL3D::CScene::CurrentCamera [private]
 

The camera / Viewport.

Definition at line 199 of file scene.h.

CHrcTrav * NL3D::CScene::HrcTrav [private]
 

Definition at line 204 of file scene.h.

CLightTrav * NL3D::CScene::LightTrav [private]
 

Definition at line 206 of file scene.h.

CRenderTrav * NL3D::CScene::RenderTrav [private]
 

Definition at line 208 of file scene.h.

TTravMap NL3D::CScene::RenderTraversals [private]
 

Definition at line 196 of file scene.h.

CTransform * NL3D::CScene::Root [private]
 

Definition at line 212 of file scene.h.

CShapeBank * NL3D::CScene::_ShapeBank [private]
 

Definition at line 217 of file scene.h.

CViewport NL3D::CScene::_Viewport [private]
 

Definition at line 200 of file scene.h.

TWaitingInstancesMMap NL3D::CScene::_WaitingInstances [private]
 

Definition at line 220 of file scene.h.


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