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

UInstance implementation. More...

#include <instance_user.h>

Inheritance diagram for NL3D::CInstanceUser:

NL3D::UInstance NL3D::CTransformUser NL3D::UTransform NL3D::UTransform NL3D::CTransformableUser NL3D::UTransformable NL3D::UTransformable NL3D::UTransformable NL3D::CWaterInstanceUser List of all members.

Public Methods

virtual void getShapeAABBox (NLMISC::CAABBox &bbox) const
 Get the untransformed AABBox of the mesh. More...

virtual void setBlendShapeFactor (const std::string &blendShapeName, float factor, bool dynamic)
 Set the blend shape factor for this instance blenShapeName is the name of the blendshape we want to set factor the blendshape percentage from 0.0 to 100.0 dynamic tells the optimizer if the blendshape have to change in real time. More...

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

virtual void setShapeDistMax (float distMax)
 Change Max Display distance. More...

virtual float getShapeDistMax () const
 see setShapeDistMax(). More...

virtual bool canStartStop ()
 Test if there is a start/stop caps in the objects (some fxs such as remanence). More...

virtual void start ()
virtual void stop ()
virtual bool isStarted () const
virtual float getDistMax () const
virtual void setDistMax (float distMax)
virtual void setCoarseMeshDist (float dist)
virtual float getCoarseMeshDist () const
Object
 CInstanceUser (CScene *scene, IModel *trans)
 This model should have been created with Scene::createInstance(). More...

virtual ~CInstanceUser ()
Material access.
virtual uint getNumMaterials () const
 return number of materials this mesh instance use. More...

virtual UInstanceMaterialgetMaterial (uint materialId)
 return a local access on a material, to change its values. (NB: overwrited, if animated). More...

virtual void selectTextureSet (uint id)
 Select textures of material among several sets (if available) NB: if success and if getAsyncTextureMode()==true, then setAsyncTextureDirty(true) is called. More...

Async Texture Loading
virtual void enableAsyncTextureMode (bool enable)
 if true, the instance is said in "AsyncTextureMode". More...

virtual bool getAsyncTextureMode () const
virtual 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...

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

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

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

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


Public Attributes

CTransformShape_Instance
 This is the SAME pointer than _Transform, but correctly casted. More...

std::vector< CInstanceMaterialUser_Materials
 This is a mirror of _Instance->Materials. More...


Detailed Description

UInstance implementation.

Author:
Lionel Berenguier , Nevrax France
Date:
2001

Definition at line 50 of file instance_user.h.


Constructor & Destructor Documentation

NL3D::CInstanceUser::CInstanceUser CScene   scene,
IModel   trans
 

This model should have been created with Scene::createInstance().

Definition at line 41 of file instance_user.cpp.

References _Instance, and _Materials.

Referenced by NL3D::CWaterInstanceUser::CWaterInstanceUser.

virtual NL3D::CInstanceUser::~CInstanceUser   [inline, virtual]
 

Definition at line 66 of file instance_user.h.

References _Instance, and NL3D_MEM_INSTANCE.


Member Function Documentation

virtual bool NL3D::CInstanceUser::canStartStop   [inline, virtual]
 

Test if there is a start/stop caps in the objects (some fxs such as remanence).

Implements NL3D::UInstance.

Definition at line 105 of file instance_user.h.

References _Instance, and NL3D_MEM_INSTANCE.

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

Change MRM Distance setup.

Only for mesh which support MRM. NB MeshMultiLod apply it only on Lod0 (if Lod0 is a MRM). 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.

Implements NL3D::UInstance.

Definition at line 83 of file instance_user.cpp.

void NL3D::CInstanceUser::enableAsyncTextureMode bool    enable [virtual]
 

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)

Implements NL3D::UInstance.

Definition at line 129 of file instance_user.cpp.

References _Instance, and nlassert.

float NL3D::CInstanceUser::getAsyncTextureDistance   const [virtual]
 

See also:
setAsyncTextureDistance()

Implements NL3D::UInstance.

Definition at line 169 of file instance_user.cpp.

References _Instance, and nlassert.

bool NL3D::CInstanceUser::getAsyncTextureMode   const [virtual]
 

Implements NL3D::UInstance.

Definition at line 137 of file instance_user.cpp.

References _Instance, and nlassert.

float NL3D::CInstanceUser::getCoarseMeshDist   const [virtual]
 

Implements NL3D::UInstance.

Definition at line 201 of file instance_user.cpp.

virtual float NL3D::CInstanceUser::getDistMax   const [inline, virtual]
 

Implements NL3D::UInstance.

Definition at line 125 of file instance_user.h.

References _Instance, and NL3D_MEM_INSTANCE.

virtual UInstanceMaterial& NL3D::CInstanceUser::getMaterial uint    materialId [inline, virtual]
 

return a local access on a material, to change its values. (NB: overwrited, if animated).

Implements NL3D::UInstance.

Definition at line 88 of file instance_user.h.

References _Materials, NL3D_MEM_INSTANCE, and nlerror.

virtual uint NL3D::CInstanceUser::getNumMaterials   const [inline, virtual]
 

return number of materials this mesh instance use.

Implements NL3D::UInstance.

Definition at line 83 of file instance_user.h.

References _Materials, and NL3D_MEM_INSTANCE.

void NL3D::CInstanceUser::getShapeAABBox NLMISC::CAABBox   bbox const [virtual]
 

Get the untransformed AABBox of the mesh.

NULL (gtSize()==0) if no mesh.

Implements NL3D::UInstance.

Definition at line 63 of file instance_user.cpp.

References _Instance.

float NL3D::CInstanceUser::getShapeDistMax   const [virtual]
 

see setShapeDistMax().

Implements NL3D::UInstance.

Definition at line 107 of file instance_user.cpp.

References _Instance.

bool NL3D::CInstanceUser::isAsyncTextureDirty   const [virtual]
 

see dirtAsyncTextureState().

Implements NL3D::UInstance.

Definition at line 185 of file instance_user.cpp.

References _Instance, and nlassert.

bool NL3D::CInstanceUser::isAsyncTextureReady   [virtual]
 

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

if was not ready before, this swap the upload textures into the rendered ones so they are rendered return always true if not in async texture mode, or if startAsyncTextureLoading() has not been called since last enableAsyncTextureMode(true)

Implements NL3D::UInstance.

Definition at line 153 of file instance_user.cpp.

References _Instance, and nlassert.

virtual bool NL3D::CInstanceUser::isStarted   const [inline, virtual]
 

Implements NL3D::UInstance.

Definition at line 120 of file instance_user.h.

References _Instance, and NL3D_MEM_INSTANCE.

void NL3D::CInstanceUser::selectTextureSet uint    id [virtual]
 

Select textures of material among several sets (if available) NB: if success and if getAsyncTextureMode()==true, then setAsyncTextureDirty(true) is called.

Implements NL3D::UInstance.

Definition at line 120 of file instance_user.cpp.

References id.

void NL3D::CInstanceUser::setAsyncTextureDirty bool    flag [virtual]
 

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

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

Implements NL3D::UInstance.

Definition at line 177 of file instance_user.cpp.

References _Instance, and nlassert.

void NL3D::CInstanceUser::setAsyncTextureDistance float    dist [virtual]
 

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

Implements NL3D::UInstance.

Definition at line 161 of file instance_user.cpp.

References _Instance, and nlassert.

void NL3D::CInstanceUser::setBlendShapeFactor const std::string &    blendShapeName,
float    factor,
bool    dynamic
[virtual]
 

Set the blend shape factor for this instance blenShapeName is the name of the blendshape we want to set factor the blendshape percentage from 0.0 to 100.0 dynamic tells the optimizer if the blendshape have to change in real time.

Reimplemented from NL3D::UInstance.

Definition at line 70 of file instance_user.cpp.

void NL3D::CInstanceUser::setCoarseMeshDist float    dist [virtual]
 

Implements NL3D::UInstance.

Definition at line 194 of file instance_user.cpp.

virtual void NL3D::CInstanceUser::setDistMax float    distMax [inline, virtual]
 

Implements NL3D::UInstance.

Definition at line 130 of file instance_user.h.

References _Instance, and NL3D_MEM_INSTANCE.

void NL3D::CInstanceUser::setShapeDistMax float    distMax [virtual]
 

Change Max Display distance.

After this distance the shape won't be displayed. setting <0 means -1 and so means DistMax = infinite (default in meshs but multilod meshes). NB: This apply to the shape direclty!! ie All instances using same shape will be affected

Note: If the instance is skinned/sticked to a skeleton, this setup is not taken into account. But you can call USkeleton::setShapeDistMax() to have same effect.

Note (complex): All instances of the same shape which are freezeHRC()-ed and are linked to the QuadGridClipManager (ie not linked to a cluster) may not be updated corretcly. In other words, you should setup this value only at beginning of program, just after creating your instance (more exactly before UScene::render()), and all instances of the same shape should be setuped with same value (or don't call setShapeDistMax() for subsequent instances). If you don't do this, QuadGridClipManager may clip such instances nearer than they should

Implements NL3D::UInstance.

Definition at line 97 of file instance_user.cpp.

References _Instance.

virtual void NL3D::CInstanceUser::start   [inline, virtual]
 

Implements NL3D::UInstance.

Definition at line 110 of file instance_user.h.

References _Instance, and NL3D_MEM_INSTANCE.

void NL3D::CInstanceUser::startAsyncTextureLoading   [virtual]
 

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.

Implements NL3D::UInstance.

Definition at line 145 of file instance_user.cpp.

References _Instance, and nlassert.

virtual void NL3D::CInstanceUser::stop void    [inline, virtual]
 

Implements NL3D::UInstance.

Definition at line 115 of file instance_user.h.

References _Instance, and NL3D_MEM_INSTANCE.


Member Data Documentation

CTransformShape* NL3D::CInstanceUser::_Instance
 

This is the SAME pointer than _Transform, but correctly casted.

Definition at line 54 of file instance_user.h.

Referenced by canStartStop, CInstanceUser, enableAsyncTextureMode, getAsyncTextureDistance, getAsyncTextureMode, getDistMax, getShapeAABBox, getShapeDistMax, isAsyncTextureDirty, isAsyncTextureReady, isStarted, setAsyncTextureDirty, setAsyncTextureDistance, setDistMax, setShapeDistMax, start, startAsyncTextureLoading, stop, and ~CInstanceUser.

std::vector<CInstanceMaterialUser> NL3D::CInstanceUser::_Materials
 

This is a mirror of _Instance->Materials.

Definition at line 57 of file instance_user.h.

Referenced by CInstanceUser, getMaterial, and getNumMaterials.


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