NL3D::CInstanceGroupUser Class Reference

Implementation of the user interface managing instance groups. More...

#include <instance_group_user.h>

Inherits NL3D::UInstanceGroup.

List of all members.

Public Member Functions

 CInstanceGroupUser ()
virtual ~CInstanceGroupUser ()
bool init (const std::string &instanceGroup, bool async=false)
CInstanceGroupgetInternalIG ()

Private Member Functions

void setTransformNameCallback (ITransformName *pTN)
 Set up the callback used at loading and instanciating of the instanceGroup.
void setAddRemoveInstanceCallback (IAddRemoveInstance *callback)
 set a callback to know when an instance has been added / removed from scene
void setIGAddBeginCallback (IIGAddBegin *callback)
 Set a callback to know when an instance group is being created, and how many instances it contains.
void addToScene (class UScene &scene, UDriver *driver, uint selectedTexture)
 Add all the instances to the scene.
void addToScene (class CScene &scene, IDriver *driver, uint selectedTexture)
void addToSceneAsync (class UScene &scene, UDriver *driver, uint selectedTexture)
TState getAddToSceneState ()
void stopAddToSceneAsync ()
virtual UInstance getInstance (uint instanceNb) const
 Return an instance of the group.
virtual void setDistMax (uint instance, float dist)
virtual float getDistMax (uint instance) const
virtual void setCoarseMeshDist (uint instance, float dist)
virtual float getCoarseMeshDist (uint instance) const
void removeFromScene (class UScene &scene)
 remove this instance group from the given scene
uint getNumInstance () const
 Return the count of shape instance in this group.
const std::string & getShapeName (uint instanceNb) const
 Return the name of the shape refered by an instance of the group.
const std::string & getInstanceName (uint instanceNb) const
 Return the name of an instance of the group.
virtual void getInstanceMatrix (uint instanceNb, NLMISC::CMatrix &dest) const
 Return the transformation matrix of an instance in the group NB no pivot is added.
const NLMISC::CVectorgetInstancePos (uint instanceNb) const
 Return the position of an instance of the group.
const NLMISC::CQuatgetInstanceRot (uint instanceNb) const
 Return the rotation of an instance of the group.
const NLMISC::CVectorgetInstanceScale (uint instanceNb) const
 Return the scale of an instance of the group.
UInstance getByName (const std::string &name) const
 Return the instance at a given position (const version).
sint getIndexByName (const std::string &name) const
 get index of instance from its name, or -1 if not found NB: lienar search so this is slow
void setBlendShapeFactor (const std::string &bsName, float rFactor)
 Control a blendshape.
void createRoot (UScene &scene)
 Create the link between scene and instance group before the addToScene to allow the instance group to be moved without being linked to a father cluster system.
void setClusterSystemForInstances (UInstanceGroup *pClusterSystem)
bool linkToParentCluster (UInstanceGroup *father)
UInstanceGroupgetParentCluster () const
 return the parent cluster system of this IG.
void getDynamicPortals (std::vector< std::string > &names)
 Get all dynamic portals in the instance group.
void setDynamicPortal (std::string &name, bool opened)
 Set the state of a dynamic portal.
bool getDynamicPortal (std::string &name)
 Get the state of a dynamic portal.
void setPos (const NLMISC::CVector &pos)
 Set the position of the instance group Take care if the instance group is a cluster system, you must not move it outside its father cluster which is assigned at addToScene moment.
void setRotQuat (const NLMISC::CQuat &q)
 Set the rotation of the instance group.
bool getStaticLightSetup (NLMISC::CRGBA sunAmbient, uint retrieverIdentifier, sint surfaceId, const NLMISC::CVector &localPos, std::vector< CPointLightInfluence > &pointLightList, uint8 &sunContribution, NLMISC::CRGBA &localAmbient)
 get the StaticLightSetup for a model at position localPos/retrieverIdentifier/surfaceId.
NLMISC::CVector getPos ()
 Get the position.
NLMISC::CQuat getRotQuat ()
 Get the rotation.
virtual void freezeHRC ()
 see UTransform::freezeHRC(). Do it for all instances (not clusters), and for the root of the IG.
virtual void unfreezeHRC ()
 see UTransform::unfreezeHRC(). Do it for all instances (not clusters), and for the root of the IG.
virtual void displayDebugClusters (UDriver *drv, UTextContext *txtCtx)
 For debug purpose, display clusters as poly/lines. The matrixs and frustum should have been setuped.
virtual bool dontCastShadowForInterior (uint instance) const
 return the DontCastShadowForInterior flag of an instance.
virtual bool dontCastShadowForExterior (uint instance) const
 return the DontCastShadowForExterior flag of an instance.
void removeInstancesUser ()

Private Attributes

CInstanceGroup _InstanceGroup
std::map< std::string,
CTransformShape * > 
_InstanceMap
TState _AddToSceneState
UScene_AddToSceneTempScene
UDriver_AddToSceneTempDriver

Friends

class CTransformUser
class CSceneUser

Detailed Description

Implementation of the user interface managing instance groups.

Author:
Cyril 'Hulud' Corvazier
Nevrax France
Date:
2001

Definition at line 52 of file instance_group_user.h.


Constructor & Destructor Documentation

NL3D::CInstanceGroupUser::CInstanceGroupUser (  ) 
NL3D::CInstanceGroupUser::~CInstanceGroupUser (  )  [virtual]

Definition at line 101 of file instance_group_user.cpp.

References removeInstancesUser().


Member Function Documentation

void NL3D::CInstanceGroupUser::addToScene ( class CScene scene,
IDriver driver,
uint  selectedTexture 
) [private]
void NL3D::CInstanceGroupUser::addToScene ( class UScene scene,
UDriver driver,
uint  selectedTexture 
) [private, virtual]

Add all the instances to the scene.

By default, freezeHRC() those instances and the root.

Parameters:
scene is the scene in which you want to add the instance group.
driver is a pointer to a driver. If this pointer is not NULL, the textures used by the shapes will be preloaded in this driver. If the pointer is NULL (default), textures will ve loaded when the shape will be used.

Implements NL3D::UInstanceGroup.

Definition at line 173 of file instance_group_user.cpp.

References NLMISC::safe_cast().

void NL3D::CInstanceGroupUser::addToSceneAsync ( class UScene scene,
UDriver driver,
uint  selectedTexture 
) [private, virtual]
void NL3D::CInstanceGroupUser::createRoot ( UScene scene  )  [private, virtual]

Create the link between scene and instance group before the addToScene to allow the instance group to be moved without being linked to a father cluster system.

Implements NL3D::UInstanceGroup.

Definition at line 344 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::createRoot().

void NL3D::CInstanceGroupUser::displayDebugClusters ( UDriver drv,
UTextContext txtCtx 
) [private, virtual]

For debug purpose, display clusters as poly/lines. The matrixs and frustum should have been setuped.

Implements NL3D::UInstanceGroup.

Definition at line 520 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::displayDebugClusters().

bool NL3D::CInstanceGroupUser::dontCastShadowForExterior ( uint  instance  )  const [private, virtual]

return the DontCastShadowForExterior flag of an instance.

Warning: if DontCastShadow=true, and DontCastShadowForExterior=false, false is still returned

Implements NL3D::UInstanceGroup.

Definition at line 542 of file instance_group_user.cpp.

References _InstanceGroup, NL3D::CInstanceGroup::getInstance(), and NL3D::CInstanceGroup::getNumInstance().

bool NL3D::CInstanceGroupUser::dontCastShadowForInterior ( uint  instance  )  const [private, virtual]

return the DontCastShadowForInterior flag of an instance.

Warning: if DontCastShadow=true, and DontCastShadowForInterior=false, false is still returned

Implements NL3D::UInstanceGroup.

Definition at line 534 of file instance_group_user.cpp.

References _InstanceGroup, NL3D::CInstanceGroup::getInstance(), and NL3D::CInstanceGroup::getNumInstance().

void NL3D::CInstanceGroupUser::freezeHRC (  )  [private, virtual]

see UTransform::freezeHRC(). Do it for all instances (not clusters), and for the root of the IG.

Implements NL3D::UInstanceGroup.

Definition at line 411 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::freezeHRC().

UInstanceGroup::TState NL3D::CInstanceGroupUser::getAddToSceneState (  )  [private, virtual]
UInstance NL3D::CInstanceGroupUser::getByName ( const std::string &  name  )  const [private, virtual]

Return the instance at a given position (const version).

Implements NL3D::UInstanceGroup.

Definition at line 314 of file instance_group_user.cpp.

References _InstanceMap.

float NL3D::CInstanceGroupUser::getCoarseMeshDist ( uint  instance  )  const [private, virtual]
float NL3D::CInstanceGroupUser::getDistMax ( uint  instance  )  const [private, virtual]
bool NL3D::CInstanceGroupUser::getDynamicPortal ( std::string &  name  )  [private, virtual]

Get the state of a dynamic portal.

Returns:
the state (true=opened, false=closed) of a dynamic portal

Implements NL3D::UInstanceGroup.

Definition at line 380 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::getDynamicPortal().

void NL3D::CInstanceGroupUser::getDynamicPortals ( std::vector< std::string > &  names  )  [private, virtual]

Get all dynamic portals in the instance group.

Returns:
a vector of portal names

Implements NL3D::UInstanceGroup.

Definition at line 368 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::getDynamicPortals().

sint NL3D::CInstanceGroupUser::getIndexByName ( const std::string &  name  )  const [private, virtual]

get index of instance from its name, or -1 if not found NB: lienar search so this is slow

Implements NL3D::UInstanceGroup.

Definition at line 324 of file instance_group_user.cpp.

References _InstanceGroup, _InstanceMap, and NL3D::CInstanceGroup::_Instances.

UInstance NL3D::CInstanceGroupUser::getInstance ( uint  instanceNb  )  const [private, virtual]

Return an instance of the group.

The instance lifeTime is the same of the instangeGroup lifeTime

Parameters:
instanceNb is the number of the instance.

Implements NL3D::UInstanceGroup.

Definition at line 488 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::_Instances.

void NL3D::CInstanceGroupUser::getInstanceMatrix ( uint  instanceNb,
NLMISC::CMatrix dest 
) const [private, virtual]

Return the transformation matrix of an instance in the group NB no pivot is added.

Implements NL3D::UInstanceGroup.

Definition at line 183 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::getInstanceMatrix().

const std::string & NL3D::CInstanceGroupUser::getInstanceName ( uint  instanceNb  )  const [private, virtual]

Return the name of an instance of the group.

Parameters:
instanceNb is the number of the instance.
Returns:
the name of the instance.

Implements NL3D::UInstanceGroup.

Definition at line 273 of file instance_group_user.cpp.

References _InstanceGroup, NL3D::CInstanceGroup::getInstanceName(), NL3D::CInstanceGroup::getNumInstance(), and nlerror.

const NLMISC::CVector & NL3D::CInstanceGroupUser::getInstancePos ( uint  instanceNb  )  const [private, virtual]

Return the position of an instance of the group.

Parameters:
instanceNb is the number of the instance.
Returns:
the position of the instance.

Implements NL3D::UInstanceGroup.

Definition at line 283 of file instance_group_user.cpp.

References _InstanceGroup, NL3D::CInstanceGroup::getInstancePos(), NL3D::CInstanceGroup::getNumInstance(), and nlerror.

const NLMISC::CQuat & NL3D::CInstanceGroupUser::getInstanceRot ( uint  instanceNb  )  const [private, virtual]

Return the rotation of an instance of the group.

Parameters:
instanceNb is the number of the instance.
Returns:
the rotation of the instance.

Implements NL3D::UInstanceGroup.

Definition at line 293 of file instance_group_user.cpp.

References _InstanceGroup, NL3D::CInstanceGroup::getInstanceRot(), NL3D::CInstanceGroup::getNumInstance(), and nlerror.

const NLMISC::CVector & NL3D::CInstanceGroupUser::getInstanceScale ( uint  instanceNb  )  const [private, virtual]

Return the scale of an instance of the group.

Parameters:
instanceNb is the number of the instance.
Returns:
the scale of the instance.

Implements NL3D::UInstanceGroup.

Definition at line 303 of file instance_group_user.cpp.

References _InstanceGroup, NL3D::CInstanceGroup::getInstanceScale(), NL3D::CInstanceGroup::getNumInstance(), and nlerror.

CInstanceGroup& NL3D::CInstanceGroupUser::getInternalIG (  )  [inline]

Definition at line 145 of file instance_group_user.h.

References _InstanceGroup.

uint NL3D::CInstanceGroupUser::getNumInstance (  )  const [private, virtual]

Return the count of shape instance in this group.

Implements NL3D::UInstanceGroup.

Definition at line 256 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::getNumInstance().

UInstanceGroup * NL3D::CInstanceGroupUser::getParentCluster (  )  const [private, virtual]

return the parent cluster system of this IG.

NULL if this is the GlobalInstanceGroup.

Returns:
true if the link succeeded

Implements NL3D::UInstanceGroup.

Definition at line 509 of file instance_group_user.cpp.

References _InstanceGroup, NL3D::CInstanceGroup::getParentClusterSystem(), and NL3D::CInstanceGroup::getUserInterface().

CVector NL3D::CInstanceGroupUser::getPos (  )  [private, virtual]

Get the position.

Implements NL3D::UInstanceGroup.

Definition at line 398 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::getPos().

CQuat NL3D::CInstanceGroupUser::getRotQuat (  )  [private, virtual]

Get the rotation.

Implements NL3D::UInstanceGroup.

Definition at line 404 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::getRotQuat().

const std::string & NL3D::CInstanceGroupUser::getShapeName ( uint  instanceNb  )  const [private, virtual]

Return the name of the shape refered by an instance of the group.

Parameters:
instanceNb is the number of the instance.
Returns:
the name of the shape.

Implements NL3D::UInstanceGroup.

Definition at line 263 of file instance_group_user.cpp.

References _InstanceGroup, NL3D::CInstanceGroup::getNumInstance(), NL3D::CInstanceGroup::getShapeName(), and nlerror.

bool NL3D::CInstanceGroupUser::getStaticLightSetup ( NLMISC::CRGBA  sunAmbient,
uint  retrieverIdentifier,
sint  surfaceId,
const NLMISC::CVector localPos,
std::vector< CPointLightInfluence > &  pointLightList,
uint8 sunContribution,
NLMISC::CRGBA localAmbient 
) [private, virtual]

get the StaticLightSetup for a model at position localPos/retrieverIdentifier/surfaceId.

NB: all are get with help of UGlobalPosition. localPos= gp.LocalPosition.Estimated NB: retrieverIdentifier= globalRetriever->getLocalRetrieverId(gp);

Implements NL3D::UInstanceGroup.

Definition at line 424 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::getStaticLightSetup().

bool NL3D::CInstanceGroupUser::init ( const std::string &  instanceGroup,
bool  async = false 
)
bool NL3D::CInstanceGroupUser::linkToParentCluster ( UInstanceGroup father  )  [private]
void NL3D::CInstanceGroupUser::removeFromScene ( class UScene scene  )  [private, virtual]

remove this instance group from the given scene

Implements NL3D::UInstanceGroup.

Definition at line 248 of file instance_group_user.cpp.

References _InstanceGroup, NL3D::CInstanceGroup::removeFromScene(), and removeInstancesUser().

void NL3D::CInstanceGroupUser::removeInstancesUser (  )  [private]

Definition at line 497 of file instance_group_user.cpp.

References _InstanceMap.

Referenced by removeFromScene(), and ~CInstanceGroupUser().

void NL3D::CInstanceGroupUser::setAddRemoveInstanceCallback ( IAddRemoveInstance callback  )  [private, virtual]

set a callback to know when an instance has been added / removed from scene

Implements NL3D::UInstanceGroup.

Definition at line 158 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::setAddRemoveInstanceCallback().

void NL3D::CInstanceGroupUser::setBlendShapeFactor ( const std::string &  bsName,
float  rFactor 
) [private, virtual]

Control a blendshape.

Implements NL3D::UInstanceGroup.

Definition at line 337 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::setBlendShapeFactor().

void NL3D::CInstanceGroupUser::setClusterSystemForInstances ( UInstanceGroup pClusterSystem  )  [private]
void NL3D::CInstanceGroupUser::setCoarseMeshDist ( uint  instance,
float  dist 
) [private, virtual]
void NL3D::CInstanceGroupUser::setDistMax ( uint  instance,
float  dist 
) [private, virtual]
void NL3D::CInstanceGroupUser::setDynamicPortal ( std::string &  name,
bool  opened 
) [private, virtual]

Set the state of a dynamic portal.

Parameters:
name is the name of the dynamic portal to open or close
opened is the state the portal will have (true=opened, false=closed)

Implements NL3D::UInstanceGroup.

Definition at line 374 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::setDynamicPortal().

void NL3D::CInstanceGroupUser::setIGAddBeginCallback ( IIGAddBegin callback  )  [private, virtual]

Set a callback to know when an instance group is being created, and how many instances it contains.

Implements NL3D::UInstanceGroup.

Definition at line 165 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::setIGAddBeginCallback().

void NL3D::CInstanceGroupUser::setPos ( const NLMISC::CVector pos  )  [private, virtual]

Set the position of the instance group Take care if the instance group is a cluster system, you must not move it outside its father cluster which is assigned at addToScene moment.

Implements NL3D::UInstanceGroup.

Definition at line 386 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::setPos().

void NL3D::CInstanceGroupUser::setRotQuat ( const NLMISC::CQuat q  )  [private, virtual]

Set the rotation of the instance group.

Implements NL3D::UInstanceGroup.

Definition at line 392 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::setRotQuat().

void NL3D::CInstanceGroupUser::setTransformNameCallback ( ITransformName pTN  )  [private, virtual]

Set up the callback used at loading and instanciating of the instanceGroup.

Parameters:
pTN is the transformName class that hold the callback

Implements NL3D::UInstanceGroup.

Definition at line 151 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::setTransformNameCallback().

void NL3D::CInstanceGroupUser::stopAddToSceneAsync (  )  [private, virtual]
void NL3D::CInstanceGroupUser::unfreezeHRC (  )  [private, virtual]

see UTransform::unfreezeHRC(). Do it for all instances (not clusters), and for the root of the IG.

Implements NL3D::UInstanceGroup.

Definition at line 417 of file instance_group_user.cpp.

References _InstanceGroup, and NL3D::CInstanceGroup::unfreezeHRC().


Friends And Related Function Documentation

friend class CSceneUser [friend]

Definition at line 139 of file instance_group_user.h.

friend class CTransformUser [friend]

Definition at line 138 of file instance_group_user.h.


Member Data Documentation

Definition at line 126 of file instance_group_user.h.

Referenced by addToSceneAsync(), CInstanceGroupUser(), and getAddToSceneState().

Definition at line 128 of file instance_group_user.h.

Referenced by addToSceneAsync().

Definition at line 127 of file instance_group_user.h.

Referenced by addToSceneAsync().

std::map<std::string,CTransformShape*> NL3D::CInstanceGroupUser::_InstanceMap [private]

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

Generated on Thu Jan 7 08:30:04 2010 for NeL by  doxygen 1.6.1