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

An base class for instance of CMesh and CMeshMRM (which derive from CMeshBase). More...

#include <mesh_base_instance.h>

Inheritance diagram for NL3D::CMeshBaseInstance:

NL3D::CTransformShape NL3D::CTransform NL3D::IModel NL3D::ITransformable NLMISC::CRefCount NL3D::IAnimatable NL3D::CMeshInstance NL3D::CMeshMRMInstance NL3D::CMeshMultiLodInstance List of all members.

IAnimatable Interface (registering only IAnimatable sons).

enum  TAnimValues { OwnerBit = CTransformShape::AnimValueLast, AnimValueLast }
 Added values. More...

virtual void registerToChannelMixer (CChannelMixer *chanMixer, const std::string &prefix)
 register transform channels (in global anim mode). More...


Async Texture Loading

void releaseCurrentAsyncTextures ()
sint _AsyncTextureToLoadRefCount
bool _AsyncTextureDirty
bool _AsyncTextureMode
bool _AsyncTextureReady
std::vector< CAsyncTextureBlock_CurrentAsyncTextures
float _AsyncTextureDistance
class CAsyncTextureManager
 0 if all the texture are async loaded. Setup by the CAsyncTextureManager. More...


Public Types


Public Methods

void setAnimatedLightmap (CAnimatedLightmap *alm)
CScenegetScene () const
 Get the scene which owns this instance. More...

virtual void changeMRMDistanceSetup (float distanceFinest, float distanceMiddle, float distanceCoarsest)
 Change MRM Distance setup. More...

void selectTextureSet (uint id)
 temp: eval non detail animation The issue here is that this evaluation is performed after clipping. More...

Derived from CTransformShape.
virtual uint getNumMaterial () const
 Get the count of material in this transform shape. More...

virtual const CMaterialgetMaterial (uint materialId) const
 Get a material of the transform shape. More...

virtual CMaterialgetMaterial (uint materialId)
 Get a material of the transform shape. More...

Derived from ITransformable.
virtual ITrackgetDefaultTrack (uint valueId)
 Default Track Values. More...

LightMap properties
uint32 getNbLightMap ()
void getLightMapName (uint32 nLightMapNb, std::string &LightMapName)
void setLightMapFactor (const std::string &LightMapName, CRGBA nFactor)
BlendShape properties
uint32 getNbBlendShape ()
void getBlendShapeName (uint32 nBlendShapeNb, std::string &BlendShapeName)
void setBlendShapeFactor (const std::string &BlendShapeName, float rFactor)
std::vector< CAnimatedMorph > * getBlendShapeFactors ()
Async Texture Loading
void enableAsyncTextureMode (bool enable)
 if true, the instance is said in "AsyncTextureMode". More...

bool getAsyncTextureMode () const
void startAsyncTextureLoading ()
 Start to load all textures in AsyncTextures array (if needed) NB: old setup is kept in Material => instance is still rendered with "coherent" textures, until new textures are ready no op if not in async texture mode. More...

bool isAsyncTextureReady ()
 return true if all the async textures of the instances are uploaded. More...

void setAsyncTextureDistance (float dist)
 For Lod of texture, and load balancing, set the approximate distance of the instance to the camera. More...

float getAsyncTextureDistance () const
void setAsyncTextureDirty (bool flag)
 User is free to flag this state, to know if startAsyncTextureLoading() should be called. More...

bool isAsyncTextureDirty () const
 see dirtAsyncTextureState(). More...

sint getAsyncTextureId (uint matId, uint stage) const
 Get an AynscTextureId. More...


Static Public Methods

void registerBasic ()
 Call at the begining of the program, to register the model, and the basic observers. More...


Public Attributes

std::vector< CMaterialMaterials
 The list of materials, copied from the mesh. More...

std::vector< CAsyncTextureBlockAsyncTextures
 For Aynsc Texture Loading. More...

float _VPWindTreePhase
 CMeshVPWindTree instance specific part. More...


Protected Methods

 CMeshBaseInstance ()
 Constructor. More...

virtual ~CMeshBaseInstance ()
 Destructor. More...


Static Private Methods

IModelcreator ()

Private Attributes

std::vector< CAnimatedMaterial_AnimatedMaterials
 The list of animated materials, instanciated from the mesh. More...

std::vector< CAnimatedLightmap * > _AnimatedLightmap
std::vector< CAnimatedMorph_AnimatedMorphFactor
CScene_OwnerScene
 The Scene where the instance is created. More...


Friends

class CMeshBase
class CMeshBaseInstanceAnimDetailObs

Detailed Description

An base class for instance of CMesh and CMeshMRM (which derive from CMeshBase).

NB: this class is a model but is not designed to be instanciated in CMOT. NB: no observers are needed, but AnimDetailObs, since same functionality as CTransformShape.

Author:
Lionel Berenguier , Nevrax France
Date:
2001

Definition at line 64 of file mesh_base_instance.h.


Member Enumeration Documentation

enum NL3D::CMeshBaseInstance::TAnimValues
 

Added values.

Enumeration values:
OwnerBit 
AnimValueLast 

Reimplemented from NL3D::ITransformable.

Definition at line 89 of file mesh_base_instance.h.


Constructor & Destructor Documentation

NL3D::CMeshBaseInstance::CMeshBaseInstance   [protected]
 

Constructor.

Definition at line 45 of file mesh_base_instance.cpp.

References _AsyncTextureDirty, _AsyncTextureDistance, _AsyncTextureMode, _AsyncTextureReady, _AsyncTextureToLoadRefCount, _OwnerScene, and AnimValueLast.

Referenced by creator.

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

Destructor.

Definition at line 60 of file mesh_base_instance.cpp.

References enableAsyncTextureMode.


Member Function Documentation

virtual void NL3D::CMeshBaseInstance::changeMRMDistanceSetup float    distanceFinest,
float    distanceMiddle,
float    distanceCoarsest
[inline, virtual]
 

Change MRM Distance setup.

Only for mesh which support MRM. NB MeshMultiLod apply it only on Lod0. NB: This apply to the shape direclty!! ie All instances using same shape will be affected NB: no-op if distanceFinest<0, distanceMiddle<=distanceFinest or if distanceCoarsest<=distanceMiddle.

Parameters:
distanceFinest  The MRM has its max faces when dist<=distanceFinest.
distanceMiddle  The MRM has 50% of its faces at dist==distanceMiddle.
distanceCoarsest  The MRM has faces/Divisor (ie near 0) when dist>=distanceCoarsest.

Reimplemented in NL3D::CMeshMRMInstance.

Definition at line 150 of file mesh_base_instance.h.

IModel* NL3D::CMeshBaseInstance::creator   [inline, static, private]
 

Reimplemented from NL3D::CTransformShape.

Reimplemented in NL3D::CMeshInstance.

Definition at line 214 of file mesh_base_instance.h.

References CMeshBaseInstance, and NL3D::IModel::IModel.

void NL3D::CMeshBaseInstance::enableAsyncTextureMode bool    enable
 

if true, the instance is said in "AsyncTextureMode".

Ie user must fill AsyncTextures field with name of the textures to load. At each startAsyncTextureLoading(), the system start to load async them. Then, isAsyncTextureReady() should be test each frame, to know if loading has completed. By default, AsyncTextureMode=false. When it swap from false to true, each texture file in Materials are replaced with "blank.tga", and true fileNames are copied into AsyncTextures. When it swap from true to false, the inverse is applied. NB: calling enableAsyncTextureMode(true) calls setAsyncTextureDirty(true)

Definition at line 341 of file mesh_base_instance.cpp.

References _AsyncTextureMode, _AsyncTextureReady, _AsyncTextureToLoadRefCount, _CurrentAsyncTextures, AsyncTextures, NLMISC::contReset, NL3D::IDRV_MAT_MAXTEXTURES, Materials, nlassert, releaseCurrentAsyncTextures, and setAsyncTextureDirty.

Referenced by ~CMeshBaseInstance.

float NL3D::CMeshBaseInstance::getAsyncTextureDistance   const [inline]
 

Definition at line 187 of file mesh_base_instance.h.

References _AsyncTextureDistance.

sint NL3D::CMeshBaseInstance::getAsyncTextureId uint    matId,
uint    stage
const
 

Get an AynscTextureId.

ret -1 if not found, or not a textureFile. NB: the id returned is the one in _CurrentAsyncTexture it the valid ones (thoses loaded or being loaded) Can be used for some (non deleting) request to the AsyncTextureManager

Definition at line 513 of file mesh_base_instance.cpp.

References _CurrentAsyncTextures.

bool NL3D::CMeshBaseInstance::getAsyncTextureMode   const [inline]
 

Definition at line 170 of file mesh_base_instance.h.

References _AsyncTextureMode.

Referenced by startAsyncTextureLoading.

std::vector<CAnimatedMorph>* NL3D::CMeshBaseInstance::getBlendShapeFactors   [inline]
 

Definition at line 132 of file mesh_base_instance.h.

References _AnimatedMorphFactor.

void NL3D::CMeshBaseInstance::getBlendShapeName uint32    nBlendShapeNb,
std::string &    BlendShapeName
 

Definition at line 166 of file mesh_base_instance.cpp.

References _AnimatedMorphFactor.

ITrack * NL3D::CMeshBaseInstance::getDefaultTrack uint    valueId [virtual]
 

Default Track Values.

Reimplemented from NL3D::CTransform.

Definition at line 99 of file mesh_base_instance.cpp.

References CMeshBase, nlstop, and NL3D::CTransformShape::Shape.

void NL3D::CMeshBaseInstance::getLightMapName uint32    nLightMapNb,
std::string &    LightMapName
 

Definition at line 133 of file mesh_base_instance.cpp.

References CMeshBase, and NL3D::CTransformShape::Shape.

CMaterial * NL3D::CMeshBaseInstance::getMaterial uint    materialId [virtual]
 

Get a material of the transform shape.

Reimplemented from NL3D::CTransformShape.

Definition at line 327 of file mesh_base_instance.cpp.

References Materials.

const CMaterial * NL3D::CMeshBaseInstance::getMaterial uint    materialId const [virtual]
 

Get a material of the transform shape.

Reimplemented from NL3D::CTransformShape.

Definition at line 320 of file mesh_base_instance.cpp.

References Materials.

uint32 NL3D::CMeshBaseInstance::getNbBlendShape  
 

Definition at line 160 of file mesh_base_instance.cpp.

References _AnimatedMorphFactor.

uint32 NL3D::CMeshBaseInstance::getNbLightMap  
 

Definition at line 126 of file mesh_base_instance.cpp.

References CMeshBase, and NL3D::CTransformShape::Shape.

uint NL3D::CMeshBaseInstance::getNumMaterial   const [virtual]
 

Get the count of material in this transform shape.

Reimplemented from NL3D::CTransformShape.

Definition at line 313 of file mesh_base_instance.cpp.

References Materials.

CScene* NL3D::CMeshBaseInstance::getScene   const [inline]
 

Get the scene which owns this instance.

Definition at line 140 of file mesh_base_instance.h.

References _OwnerScene.

Referenced by NL3D::CMeshMultiLodInstance::deleteCoarseInstances, and NL3D::CMeshMultiLodInstance::getCoarseMeshLighting.

bool NL3D::CMeshBaseInstance::isAsyncTextureDirty   const [inline]
 

see dirtAsyncTextureState().

Definition at line 195 of file mesh_base_instance.h.

References _AsyncTextureDirty.

bool NL3D::CMeshBaseInstance::isAsyncTextureReady  
 

return true if all the async textures of the instances are uploaded.

if was not ready before, this swap the return always true if not in async texture mode, or if startAsyncTextureLoading() has not been called since last enableAsyncTextureMode(true)

Definition at line 473 of file mesh_base_instance.cpp.

References _AsyncTextureReady, _AsyncTextureToLoadRefCount, _CurrentAsyncTextures, NL3D::IDRV_MAT_MAXTEXTURES, and Materials.

void NL3D::CMeshBaseInstance::registerBasic   [static]
 

Call at the begining of the program, to register the model, and the basic observers.

Reimplemented from NL3D::CTransformShape.

Reimplemented in NL3D::CMeshInstance.

Definition at line 70 of file mesh_base_instance.cpp.

References NL3D::AnimDetailTravId, NL3D::MeshBaseInstanceId, and NL3D::TransformShapeId.

void NL3D::CMeshBaseInstance::registerToChannelMixer CChannelMixer   chanMixer,
const std::string &    prefix
[virtual]
 

register transform channels (in global anim mode).

See also:
setChannelMixerOwnerShip

Reimplemented from NL3D::CTransform.

Definition at line 78 of file mesh_base_instance.cpp.

References _AnimatedMaterials, _AnimatedMorphFactor, and getName.

void NL3D::CMeshBaseInstance::releaseCurrentAsyncTextures   [private]
 

Definition at line 452 of file mesh_base_instance.cpp.

References _CurrentAsyncTextures, _OwnerScene, CAsyncTextureManager, and NL3D::IDRV_MAT_MAXTEXTURES.

Referenced by enableAsyncTextureMode, and startAsyncTextureLoading.

void NL3D::CMeshBaseInstance::selectTextureSet uint    id
 

temp: eval non detail animation The issue here is that this evaluation is performed after clipping.

This means that rotation will be ok, but translation may not work

Definition at line 256 of file mesh_base_instance.cpp.

References _AsyncTextureMode, AsyncTextures, CMeshBase, id, NL3D::IDRV_MAT_MAXTEXTURES, NLAISCRIPT::l, Materials, nlassert, setAsyncTextureDirty, and NL3D::CTransformShape::Shape.

void NL3D::CMeshBaseInstance::setAnimatedLightmap CAnimatedLightmap   alm
 

Definition at line 304 of file mesh_base_instance.cpp.

References _AnimatedLightmap.

void NL3D::CMeshBaseInstance::setAsyncTextureDirty bool    flag [inline]
 

User is free to flag this state, to know if startAsyncTextureLoading() should be called.

Internal system don't use this flag. Default is false

Definition at line 193 of file mesh_base_instance.h.

References _AsyncTextureDirty.

Referenced by enableAsyncTextureMode, and selectTextureSet.

void NL3D::CMeshBaseInstance::setAsyncTextureDistance float    dist [inline]
 

For Lod of texture, and load balancing, set the approximate distance of the instance to the camera.

Definition at line 186 of file mesh_base_instance.h.

References _AsyncTextureDistance.

void NL3D::CMeshBaseInstance::setBlendShapeFactor const std::string &    BlendShapeName,
float    rFactor
 

Definition at line 174 of file mesh_base_instance.cpp.

References _AnimatedMorphFactor.

void NL3D::CMeshBaseInstance::setLightMapFactor const std::string &    LightMapName,
CRGBA    nFactor
 

Definition at line 144 of file mesh_base_instance.cpp.

References CMeshBase, Materials, and NL3D::CTransformShape::Shape.

void NL3D::CMeshBaseInstance::startAsyncTextureLoading  
 

Start to load all textures in AsyncTextures array (if needed) NB: old setup is kept in Material => instance is still rendered with "coherent" textures, until new textures are ready no op if not in async texture mode.

Definition at line 411 of file mesh_base_instance.cpp.

References _AsyncTextureReady, _CurrentAsyncTextures, _OwnerScene, AsyncTextures, CAsyncTextureManager, getAsyncTextureMode, id, NL3D::IDRV_MAT_MAXTEXTURES, and releaseCurrentAsyncTextures.


Friends And Related Function Documentation

friend class CAsyncTextureManager [friend]
 

0 if all the texture are async loaded. Setup by the CAsyncTextureManager.

Definition at line 233 of file mesh_base_instance.h.

Referenced by releaseCurrentAsyncTextures, and startAsyncTextureLoading.

friend class CMeshBase [friend]
 

Definition at line 215 of file mesh_base_instance.h.

Referenced by getDefaultTrack, getLightMapName, getNbLightMap, selectTextureSet, and setLightMapFactor.

friend class CMeshBaseInstanceAnimDetailObs [friend]
 

Definition at line 216 of file mesh_base_instance.h.


Member Data Documentation

std::vector<CAnimatedLightmap*> NL3D::CMeshBaseInstance::_AnimatedLightmap [private]
 

Definition at line 223 of file mesh_base_instance.h.

Referenced by setAnimatedLightmap.

std::vector<CAnimatedMaterial> NL3D::CMeshBaseInstance::_AnimatedMaterials [private]
 

The list of animated materials, instanciated from the mesh.

Definition at line 221 of file mesh_base_instance.h.

Referenced by registerToChannelMixer.

std::vector<CAnimatedMorph> NL3D::CMeshBaseInstance::_AnimatedMorphFactor [private]
 

Definition at line 225 of file mesh_base_instance.h.

Referenced by getBlendShapeFactors, getBlendShapeName, getNbBlendShape, registerToChannelMixer, and setBlendShapeFactor.

bool NL3D::CMeshBaseInstance::_AsyncTextureDirty [private]
 

Definition at line 235 of file mesh_base_instance.h.

Referenced by CMeshBaseInstance, isAsyncTextureDirty, and setAsyncTextureDirty.

float NL3D::CMeshBaseInstance::_AsyncTextureDistance [private]
 

Definition at line 241 of file mesh_base_instance.h.

Referenced by CMeshBaseInstance, getAsyncTextureDistance, and setAsyncTextureDistance.

bool NL3D::CMeshBaseInstance::_AsyncTextureMode [private]
 

Definition at line 236 of file mesh_base_instance.h.

Referenced by CMeshBaseInstance, enableAsyncTextureMode, getAsyncTextureMode, and selectTextureSet.

bool NL3D::CMeshBaseInstance::_AsyncTextureReady [private]
 

Definition at line 237 of file mesh_base_instance.h.

Referenced by CMeshBaseInstance, enableAsyncTextureMode, isAsyncTextureReady, and startAsyncTextureLoading.

sint NL3D::CMeshBaseInstance::_AsyncTextureToLoadRefCount [private]
 

Definition at line 234 of file mesh_base_instance.h.

Referenced by CMeshBaseInstance, enableAsyncTextureMode, and isAsyncTextureReady.

std::vector<CAsyncTextureBlock> NL3D::CMeshBaseInstance::_CurrentAsyncTextures [private]
 

Definition at line 239 of file mesh_base_instance.h.

Referenced by enableAsyncTextureMode, getAsyncTextureId, isAsyncTextureReady, releaseCurrentAsyncTextures, and startAsyncTextureLoading.

CScene* NL3D::CMeshBaseInstance::_OwnerScene [private]
 

The Scene where the instance is created.

Definition at line 228 of file mesh_base_instance.h.

Referenced by CMeshBaseInstance, getScene, releaseCurrentAsyncTextures, and startAsyncTextureLoading.

float NL3D::CMeshBaseInstance::_VPWindTreePhase
 

CMeshVPWindTree instance specific part.

Definition at line 251 of file mesh_base_instance.h.

std::vector<CAsyncTextureBlock> NL3D::CMeshBaseInstance::AsyncTextures
 

For Aynsc Texture Loading.

This has the same size as Materials. User can fill here the name of the texture he want to async load. WARNING: once AsyncTextureMode is set, Material's Texture fields should not be modified, else undefined results

Definition at line 84 of file mesh_base_instance.h.

Referenced by enableAsyncTextureMode, selectTextureSet, and startAsyncTextureLoading.

std::vector<CMaterial> NL3D::CMeshBaseInstance::Materials
 

The list of materials, copied from the mesh.

Each CMeshBaseInstance has those materials, so they can be animated or modified for each instance. By default, they are copied from the Mesh.

Definition at line 77 of file mesh_base_instance.h.

Referenced by enableAsyncTextureMode, getMaterial, getNumMaterial, isAsyncTextureReady, selectTextureSet, and setLightMapFactor.


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