# 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::IModel Class Reference

A base model. More...

#include <mot.h>

Inheritance diagram for NL3D::IModel:

NLMISC::CRefCount NL3D::CQuadGridClipCluster NL3D::CRootModel NL3D::CSkipModel NL3D::CTransform NL3D::CCamera NL3D::CCluster NL3D::CCoarseMeshManager NL3D::CLandscapeModel NL3D::CPointLightModel NL3D::CTransformShape NL3D::CVegetableBlendLayerModel NL3D::CFlareModel NL3D::CMeshBaseInstance NL3D::CParticleSystemModel NL3D::CSegRemanence NL3D::CSkeletonModel NL3D::CWaterModel NL3D::CWaveMakerModel NL3D::CMeshInstance NL3D::CMeshMRMInstance NL3D::CMeshMultiLodInstance List of all members.

Notification system

enum  TDirty { Dirty = 0, Last }
 The Dirty states. More...

void foul (uint flag)
 The derived model should call foul() in update() or other mutator functions. More...

void validate ()
 check if the model is modified, and if yes, update him and his observers. More...

NLMISC::CBitSet TouchObs
 TouchObs say what part of the model has changed, so Observers can deal with this in Obs::update(). More...


Public Types


Protected Types

typedef std::map< NLMISC::CClassId,
IObs * > 
CObsMap

Protected Methods

 IModel ()
 Init a model. More...

virtual void initModel ()
 Extra init for a model. More...

virtual ~IModel ()
 Destrutor. More...

IObsgetObs (const NLMISC::CClassId &idTrav) const
 Get an observer according to his Traversal Id. NULL, if not found. More...

Notification system specification.
virtual void update ()
 This function must update the model (called by CMOT::validateModels()), and foul() necessary flags. More...

virtual void cleanTouch ()
 This function must clean the Touch information of the model (called by CMOT::validateModels()) It is called AFTER his observers are validated according to him. More...

void linkToValidateList ()
void unlinkFromValidateList ()

Protected Attributes

CObsMap Observers
NLMISC::CClassId LastClassId
IObsLastObs
CMOT_OwnerMot
IModel * _PrecModelToValidate
IModel * _NextModelToValidate

Friends

class CMOT
class IObs
class ITrav

Detailed Description

A base model.

A model is the base structure for any node. The user directly manipulates Models implemented by the deriver.

The deriver must implement a notification system so observers can know if they must update themselves. This is done with a NLMISC::CBitSet TouchObs. Deriver may add Additional flags, or additional info which may serves just as hint, to not compute everything (eg: vertex interval...). In CMOT::validateModels(), for each model, do:

DERIVERS RULES:
  • Possibly Add his own TDirty state (see TDirty and TouchObs), and resize TouchObs (see IModel()).
  • Implement the notification system (see update()/cleanTouch()), as descripted above.
The deriver may choose how to foul() himself: either automatic (on any mutator function), or by user (which may call a foul function).
See also:
CMOT IObs ITrav
Author:
Lionel Berenguier , Nevrax France
Date:
2000

Definition at line 258 of file mot.h.


Member Typedef Documentation

typedef std::map<NLMISC::CClassId, IObs*> NL3D::IModel::CObsMap [protected]
 

Definition at line 322 of file mot.h.


Member Enumeration Documentation

enum NL3D::IModel::TDirty
 

The Dirty states.

Derived models may add flags with similar enum. The first enum element must begin at CBaseClass::Last (where CBaseClass is the base class), so falg compatibility is maintained.

Enumeration values:
Dirty 
Last 

Reimplemented in NL3D::CTransform.

Definition at line 301 of file mot.h.


Constructor & Destructor Documentation

NL3D::IModel::IModel   [protected]
 

Init a model.

The user must create a Model only with CMOT::createModel(). This is required since, CMOT::createModel() create observers for his traversals and link them to this created model.

The deriver should do a TouchObs.resize(Last), to ensure he resize the BitSet correctly. The dervier should keep/declare ctor and dtor protected, to avoid user error (new and delete).

Definition at line 464 of file mot.cpp.

References _NextModelToValidate, _OwnerMot, _PrecModelToValidate, Last, LastClassId, LastObs, NLMISC::CBitSet::resize, and TouchObs.

Referenced by NL3D::CSkeletonModel::bindSkin, NL3D::CWaveMakerModel::creator, NL3D::CWaterModel::creator, NL3D::CVegetableBlendLayerModel::creator, NL3D::CTransformShape::creator, NL3D::CTransform::creator, NL3D::CSkipModel::creator, NL3D::CSkeletonModel::creator, NL3D::CSegRemanence::creator, NL3D::CRootModel::creator, NL3D::CQuadGridClipCluster::creator, NL3D::CPointLightModel::creator, NL3D::CParticleSystemModel::creator, NL3D::CMeshMultiLodInstance::creator, NL3D::CMeshMRMInstance::creator, NL3D::CMeshInstance::creator, NL3D::CMeshBaseInstance::creator, NL3D::CLandscapeModel::creator, NL3D::CFlareModel::creator, NL3D::CCoarseMeshManager::creator, NL3D::CCluster::creator, and NL3D::CCamera::creator.

NL3D::IModel::~IModel   [protected, virtual]
 

Destrutor.

Model's observers are deleted automatically. The user must delete a Model only with CMOT::deleteModel(). This ensure that model validity is correct during the life of CMOT.

The dervier should keep/declare ctor and dtor protected, to avoid user error (new and delete).

Definition at line 475 of file mot.cpp.

References Observers, and unlinkFromValidateList.


Member Function Documentation

virtual void NL3D::IModel::cleanTouch   [inline, protected, virtual]
 

This function must clean the Touch information of the model (called by CMOT::validateModels()) It is called AFTER his observers are validated according to him.

This function Must :

  • call BaseClass::cleanTouch() (eg: IModel::cleanTouch()).
  • maybe clean other Touch information (vertex intervals...).
NB: Touch bits are leared in validateModels().

The default behavior is just to clear flags of TouchObs, which may be sufficient, except if you have special touch information (eg: a vertex interval).

Definition at line 373 of file mot.h.

References NLMISC::CBitSet::clearAll.

Referenced by validate.

void NL3D::IModel::foul uint    flag [inline]
 

The derived model should call foul() in update() or other mutator functions.

Definition at line 309 of file mot.h.

References Dirty, and NLMISC::CBitSet::set.

Referenced by NL3D::CTransform::update.

IObs * NL3D::IModel::getObs const NLMISC::CClassId   idTrav const [protected]
 

Get an observer according to his Traversal Id. NULL, if not found.

Definition at line 489 of file mot.cpp.

References LastClassId, LastObs, and Observers.

Referenced by NL3D::CCluster::getClipObs, NL3D::CTransform::getLoadBalancingGroup, NL3D::CParticleSystemModel::getWorldMatrix, NL3D::CVegetableBlendLayerModel::initModel, NL3D::CTransform::initModel, NL3D::CSkeletonModel::initModel, NL3D::CPointLightModel::initModel, NL3D::CSegRemanence::samplePos, and NL3D::CTransform::setLoadBalancingGroup.

virtual void NL3D::IModel::initModel   [inline, protected, virtual]
 

Extra init for a model.

this method is called by the framework at the very end of CMOT::createModel() Warning! if the model is a CTransformShape, then when initModel() is called, Shape and other related member/setup of IShape::createInstance() are not yet done (because createModel() is called at the begining in createInstance()).

Because initModel() is called at the very end, deriver could implement anything like creating other models, but not deleting this model...

Default behavior is to do nothing.

Reimplemented in NL3D::CLandscapeModel.

Definition at line 281 of file mot.h.

void NL3D::IModel::linkToValidateList   [protected]
 

Definition at line 530 of file mot.cpp.

References _NextModelToValidate, _OwnerMot, and _PrecModelToValidate.

Referenced by NL3D::CTransform::unfreezeHRC.

void NL3D::IModel::unlinkFromValidateList   [protected]
 

Definition at line 549 of file mot.cpp.

References _NextModelToValidate, _OwnerMot, and _PrecModelToValidate.

Referenced by NL3D::CTransform::update, NL3D::CQuadGridClipCluster::update, and ~IModel.

virtual void NL3D::IModel::update   [inline, protected, virtual]
 

This function must update the model (called by CMOT::validateModels()), and foul() necessary flags.

Must :

  • call BaseClass::update() (eg: IModel::update()).
  • test if something is different (eg: animation modification). update Model information (eg compute new Matrix).
  • foul() good bits. (eg: foul(TransformDirty)).
  • maybe set other Touch information (vertex intervals...).
The default behavior is to do nothing.

NB: Touch information is reseted after observers validation in CMOT::validateModels(), using Model::cleanTouch()

Reimplemented in NL3D::CCamera.

Definition at line 357 of file mot.h.

Referenced by validate.

void NL3D::IModel::validate  
 

check if the model is modified, and if yes, update him and his observers.

Definition at line 508 of file mot.cpp.

References cleanTouch, IObs, Observers, TouchObs, and update.

Referenced by NL3D::CTransform::freeze.


Friends And Related Function Documentation

friend class CMOT [friend]
 

Definition at line 319 of file mot.h.

friend class IObs [friend]
 

Definition at line 320 of file mot.h.

Referenced by NL3D::CSkeletonModel::initModel, NL3D::CPointLightModel::initModel, and validate.

friend class ITrav [friend]
 

Definition at line 321 of file mot.h.


Member Data Documentation

IModel* NL3D::IModel::_NextModelToValidate [protected]
 

Definition at line 337 of file mot.h.

Referenced by IModel, linkToValidateList, and unlinkFromValidateList.

CMOT* NL3D::IModel::_OwnerMot [protected]
 

Definition at line 333 of file mot.h.

Referenced by IModel, NL3D::CLandscapeModel::initModel, linkToValidateList, and unlinkFromValidateList.

IModel* NL3D::IModel::_PrecModelToValidate [protected]
 

Definition at line 336 of file mot.h.

Referenced by IModel, linkToValidateList, and unlinkFromValidateList.

NLMISC::CClassId NL3D::IModel::LastClassId [protected]
 

Definition at line 326 of file mot.h.

Referenced by getObs, and IModel.

IObs* NL3D::IModel::LastObs [protected]
 

Definition at line 327 of file mot.h.

Referenced by getObs, and IModel.

CObsMap NL3D::IModel::Observers [protected]
 

Definition at line 323 of file mot.h.

Referenced by getObs, validate, and ~IModel.

NLMISC::CBitSet NL3D::IModel::TouchObs
 

TouchObs say what part of the model has changed, so Observers can deal with this in Obs::update().

Definition at line 307 of file mot.h.

Referenced by NL3D::CTransform::CTransform, IModel, and validate.


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