NL3D::UInstanceGroup Class Reference

#include <u_instance_group.h>

Inheritance diagram for NL3D::UInstanceGroup:

NL3D::CInstanceGroupUser

Detailed Description

Game interface for managing group instance.

Author:
Cyril 'Hulud' Corvazier

Nevrax France

Date:
2001

Definition at line 104 of file u_instance_group.h.

Public Types

enum  TState { StateNotAdded = 0, StateAdding, StateAdded, StateError }

Public Member Functions

virtual void addToScene (class UScene &scene, UDriver *driver=NULL, uint selectedTexture=0)=0
virtual void addToSceneAsync (class UScene &scene, UDriver *driver=NULL, uint selectedTexture=0)=0
virtual void createRoot (class UScene &scene)=0
virtual void displayDebugClusters (UDriver *drv, class UTextContext *txtCtx)=0
 For debug purpose, display clusters as poly/lines. The matrixs and frustum should have been setuped.

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

virtual TState getAddToSceneState ()=0
virtual const UInstancegetByName (std::string &name) const=0
virtual UInstancegetByName (std::string &name)=0
virtual bool getDynamicPortal (std::string &name)=0
virtual void getDynamicPortals (std::vector< std::string > &names)=0
virtual UInstancegetInstance (uint instanceNb)=0
virtual const UInstancegetInstance (uint instanceNb) const=0
virtual void getInstanceMatrix (uint instanceNb, NLMISC::CMatrix &dest) const=0
virtual const std::string & getInstanceName (uint instanceNb) const=0
virtual const NLMISC::CVectorgetInstancePos (uint instanceNb) const=0
virtual const NLMISC::CQuatgetInstanceRot (uint instanceNb) const=0
virtual const NLMISC::CVectorgetInstanceScale (uint instanceNb) const=0
virtual uint getNumInstance () const=0
virtual UInstanceGroupgetParentCluster () const=0
virtual NLMISC::CVector getPos ()=0
virtual NLMISC::CQuat getRotQuat ()=0
virtual const std::string & getShapeName (uint instanceNb) const=0
virtual bool linkToParentCluster (UInstanceGroup *father)=0
virtual void removeFromScene (class UScene &scene)=0
virtual void setAddRemoveInstanceCallback (IAddRemoveInstance *callback)=0
 set a callback to know when an instance has been added / removed from scene

virtual void setBlendShapeFactor (const std::string &bsName, float rFactor)=0
virtual void setClusterSystemForInstances (class UInstanceGroup *pClusterSystem)=0
virtual void setDynamicPortal (std::string &name, bool opened)=0
virtual void setIGAddBeginCallback (IIGAddBegin *callback)=0
 Set a callback to know when an instance group is being created, and how many instances it contains.

virtual void setPos (const NLMISC::CVector &pos)=0
virtual void setRotQuat (const NLMISC::CQuat &q)=0
virtual void setTransformNameCallback (ITransformName *pTN)=0
virtual void stopAddToSceneAsync ()=0
virtual void unfreezeHRC ()=0
 see UTransform::unfreezeHRC(). Do it for all instances (not clusters), and for the root of the IG.

virtual ~UInstanceGroup ()
Distances
virtual float getCoarseMeshDist (uint instance) const=0
virtual float getDistMax (uint instance) const=0
virtual void setCoarseMeshDist (uint instance, float dist)=0
virtual void setDistMax (uint instance, float dist)=0
PointLight part
virtual bool getStaticLightSetup (uint retrieverIdentifier, sint surfaceId, const NLMISC::CVector &localPos, std::vector< CPointLightInfluence > &pointLightList, uint8 &sunContribution, NLMISC::CRGBA &localAmbient)=0

Static Public Member Functions

UInstanceGroupcreateInstanceGroup (const std::string &instanceGroup)
void createInstanceGroupAsync (const std::string &instanceGroup, UInstanceGroup **pIG)
void stopCreateInstanceGroupAsync (UInstanceGroup **pIG)


Member Enumeration Documentation

enum NL3D::UInstanceGroup::TState
 

Enumeration values:
StateNotAdded 
StateAdding 
StateAdded 
StateError 

Definition at line 109 of file u_instance_group.h.


Constructor & Destructor Documentation

virtual NL3D::UInstanceGroup::~UInstanceGroup  )  [inline, virtual]
 

Instance group

Definition at line 114 of file u_instance_group.h.

00114 {};


Member Function Documentation

virtual void NL3D::UInstanceGroup::addToScene class UScene scene,
UDriver driver = NULL,
uint  selectedTexture = 0
[pure 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.

Implemented in NL3D::CInstanceGroupUser.

virtual void NL3D::UInstanceGroup::addToSceneAsync class UScene scene,
UDriver driver = NULL,
uint  selectedTexture = 0
[pure virtual]
 

Implemented in NL3D::CInstanceGroupUser.

UInstanceGroup * NL3D::UInstanceGroup::createInstanceGroup const std::string &  instanceGroup  )  [static]
 

This is the static function create a stand alone instance group.

Definition at line 45 of file instance_group_user.cpp.

References NL3D_MEM_IG.

00046 {
00047         NL3D_MEM_IG
00048         // Create the instance group
00049         CInstanceGroupUser *user=new CInstanceGroupUser;
00050 
00051         // Init the class
00052         if (!user->init (instanceGroup))
00053         {
00054                 // Prb, erase it
00055                 delete user;
00056 
00057                 // Return error code
00058                 return NULL;
00059         }
00060 
00061         // return the good value
00062         return user;
00063 }

void NL3D::UInstanceGroup::createInstanceGroupAsync const std::string &  instanceGroup,
UInstanceGroup **  pIG
[static]
 

Definition at line 67 of file instance_group_user.cpp.

References NL3D_MEM_IG.

00068 {
00069         NL3D_MEM_IG
00070         CAsyncFileManager3D::getInstance().loadIGUser (instanceGroup, pIG);
00071 }

virtual void NL3D::UInstanceGroup::createRoot class UScene scene  )  [pure 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.

Implemented in NL3D::CInstanceGroupUser.

virtual void NL3D::UInstanceGroup::displayDebugClusters UDriver drv,
class UTextContext txtCtx
[pure virtual]
 

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

Implemented in NL3D::CInstanceGroupUser.

virtual void NL3D::UInstanceGroup::freezeHRC  )  [pure virtual]
 

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

Implemented in NL3D::CInstanceGroupUser.

virtual TState NL3D::UInstanceGroup::getAddToSceneState  )  [pure virtual]
 

Implemented in NL3D::CInstanceGroupUser.

Referenced by NL3D::CSceneUser::stopCreatingAndAddingIG().

virtual const UInstance* NL3D::UInstanceGroup::getByName std::string &  name  )  const [pure virtual]
 

Return the instance at a given position (const version)

Implemented in NL3D::CInstanceGroupUser.

virtual UInstance* NL3D::UInstanceGroup::getByName std::string &  name  )  [pure virtual]
 

Return the instance at a given position

Implemented in NL3D::CInstanceGroupUser.

virtual float NL3D::UInstanceGroup::getCoarseMeshDist uint  instance  )  const [pure virtual]
 

Implemented in NL3D::CInstanceGroupUser.

virtual float NL3D::UInstanceGroup::getDistMax uint  instance  )  const [pure virtual]
 

Implemented in NL3D::CInstanceGroupUser.

virtual bool NL3D::UInstanceGroup::getDynamicPortal std::string &  name  )  [pure virtual]
 

Get the state of a dynamic portal

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

Implemented in NL3D::CInstanceGroupUser.

virtual void NL3D::UInstanceGroup::getDynamicPortals std::vector< std::string > &  names  )  [pure virtual]
 

Get all dynamic portals in the instance group

Returns:
a vector of portal names

Implemented in NL3D::CInstanceGroupUser.

virtual UInstance* NL3D::UInstanceGroup::getInstance uint  instanceNb  )  [pure 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.

Implemented in NL3D::CInstanceGroupUser.

virtual const UInstance* NL3D::UInstanceGroup::getInstance uint  instanceNb  )  const [pure 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.

Implemented in NL3D::CInstanceGroupUser.

virtual void NL3D::UInstanceGroup::getInstanceMatrix uint  instanceNb,
NLMISC::CMatrix dest
const [pure virtual]
 

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

Implemented in NL3D::CInstanceGroupUser.

virtual const std::string& NL3D::UInstanceGroup::getInstanceName uint  instanceNb  )  const [pure virtual]
 

Return the name of an instance of the group.

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

Implemented in NL3D::CInstanceGroupUser.

virtual const NLMISC::CVector& NL3D::UInstanceGroup::getInstancePos uint  instanceNb  )  const [pure virtual]
 

Return the position of an instance of the group.

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

Implemented in NL3D::CInstanceGroupUser.

virtual const NLMISC::CQuat& NL3D::UInstanceGroup::getInstanceRot uint  instanceNb  )  const [pure virtual]
 

Return the rotation of an instance of the group.

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

Implemented in NL3D::CInstanceGroupUser.

virtual const NLMISC::CVector& NL3D::UInstanceGroup::getInstanceScale uint  instanceNb  )  const [pure virtual]
 

Return the scale of an instance of the group.

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

Implemented in NL3D::CInstanceGroupUser.

virtual uint NL3D::UInstanceGroup::getNumInstance  )  const [pure virtual]
 

Return the count of shape instance in this group.

Implemented in NL3D::CInstanceGroupUser.

virtual UInstanceGroup* NL3D::UInstanceGroup::getParentCluster  )  const [pure virtual]
 

return the parent cluster system of this IG. NULL if this is the GlobalInstanceGroup.

Returns:
true if the link succeeded

Implemented in NL3D::CInstanceGroupUser.

virtual NLMISC::CVector NL3D::UInstanceGroup::getPos  )  [pure virtual]
 

Get the position

Implemented in NL3D::CInstanceGroupUser.

virtual NLMISC::CQuat NL3D::UInstanceGroup::getRotQuat  )  [pure virtual]
 

Get the rotation

Implemented in NL3D::CInstanceGroupUser.

virtual const std::string& NL3D::UInstanceGroup::getShapeName uint  instanceNb  )  const [pure 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.

Implemented in NL3D::CInstanceGroupUser.

virtual bool NL3D::UInstanceGroup::getStaticLightSetup uint  retrieverIdentifier,
sint  surfaceId,
const NLMISC::CVector localPos,
std::vector< CPointLightInfluence > &  pointLightList,
uint8 sunContribution,
NLMISC::CRGBA localAmbient
[pure 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);

Implemented in NL3D::CInstanceGroupUser.

virtual bool NL3D::UInstanceGroup::linkToParentCluster UInstanceGroup father  )  [pure virtual]
 

Link this ig clusters as sons of clusters of 'ig' that conatains them.

Returns:
true if the link succeeded

Implemented in NL3D::CInstanceGroupUser.

virtual void NL3D::UInstanceGroup::removeFromScene class UScene scene  )  [pure virtual]
 

remove this instance group from the given scene

Implemented in NL3D::CInstanceGroupUser.

Referenced by NL3D::CSceneUser::stopCreatingAndAddingIG().

virtual void NL3D::UInstanceGroup::setAddRemoveInstanceCallback IAddRemoveInstance callback  )  [pure virtual]
 

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

Implemented in NL3D::CInstanceGroupUser.

virtual void NL3D::UInstanceGroup::setBlendShapeFactor const std::string &  bsName,
float  rFactor
[pure virtual]
 

Control a blendshape

Implemented in NL3D::CInstanceGroupUser.

virtual void NL3D::UInstanceGroup::setClusterSystemForInstances class UInstanceGroup pClusterSystem  )  [pure virtual]
 

All the instances must be checked against the following cluster system

Implemented in NL3D::CInstanceGroupUser.

virtual void NL3D::UInstanceGroup::setCoarseMeshDist uint  instance,
float  dist
[pure virtual]
 

Implemented in NL3D::CInstanceGroupUser.

virtual void NL3D::UInstanceGroup::setDistMax uint  instance,
float  dist
[pure virtual]
 

Implemented in NL3D::CInstanceGroupUser.

virtual void NL3D::UInstanceGroup::setDynamicPortal std::string &  name,
bool  opened
[pure 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)

Implemented in NL3D::CInstanceGroupUser.

virtual void NL3D::UInstanceGroup::setIGAddBeginCallback IIGAddBegin callback  )  [pure virtual]
 

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

Implemented in NL3D::CInstanceGroupUser.

virtual void NL3D::UInstanceGroup::setPos const NLMISC::CVector pos  )  [pure 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.

Implemented in NL3D::CInstanceGroupUser.

virtual void NL3D::UInstanceGroup::setRotQuat const NLMISC::CQuat q  )  [pure virtual]
 

Set the rotation of the instance group

Implemented in NL3D::CInstanceGroupUser.

virtual void NL3D::UInstanceGroup::setTransformNameCallback ITransformName pTN  )  [pure virtual]
 

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

Parameters:
pTN is the transformName class that hold the callback

Implemented in NL3D::CInstanceGroupUser.

virtual void NL3D::UInstanceGroup::stopAddToSceneAsync  )  [pure virtual]
 

Implemented in NL3D::CInstanceGroupUser.

Referenced by NL3D::CSceneUser::stopCreatingAndAddingIG().

void NL3D::UInstanceGroup::stopCreateInstanceGroupAsync UInstanceGroup **  pIG  )  [static]
 

Definition at line 75 of file instance_group_user.cpp.

References NL3D_MEM_IG, and NLMISC::nlSleep().

00076 {
00077         NL3D_MEM_IG
00078         // Theorically should stop the async file manager but the async file manager can only be stopped
00079         // between tasks (a file reading) so that is no sense to do anything here
00080         while (*ppIG == NULL)
00081         {
00082                 nlSleep (2);
00083         }
00084         if (*ppIG != (UInstanceGroup*)-1)
00085         {
00086                 delete *ppIG;
00087         }
00088 }

virtual void NL3D::UInstanceGroup::unfreezeHRC  )  [pure virtual]
 

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

Implemented in NL3D::CInstanceGroupUser.


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 08:45:26 2004 for NeL by doxygen 1.3.6