From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a02673.html | 2757 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2757 insertions(+) create mode 100644 docs/doxygen/nel/a02673.html (limited to 'docs/doxygen/nel/a02673.html') diff --git a/docs/doxygen/nel/a02673.html b/docs/doxygen/nel/a02673.html new file mode 100644 index 00000000..f7244732 --- /dev/null +++ b/docs/doxygen/nel/a02673.html @@ -0,0 +1,2757 @@ + + +NeL: NL3D::CInstanceGroupUser class Reference + + + +
+

NL3D::CInstanceGroupUser Class Reference

#include <instance_group_user.h> +

+

Inheritance diagram for NL3D::CInstanceGroupUser: +

+ +NL3D::UInstanceGroup + +

Detailed Description

+Implementation of the user interface managing instance groups.

+

Author:
Cyril 'Hulud' Corvazier

+Nevrax France

+
Date:
2001
+ +

+ +

+Definition at line 55 of file instance_group_user.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Types

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

Public Member Functions

 CInstanceGroupUser ()
CInstanceGroupgetInternalIG ()
bool init (const std::string &instanceGroup)
virtual ~CInstanceGroupUser ()

Static Public Member Functions

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

Private Member Functions

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

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

TState getAddToSceneState ()
const UInstancegetByName (std::string &name) const
UInstancegetByName (std::string &name)
virtual float getCoarseMeshDist (uint instance) const
virtual float getDistMax (uint instance) const
bool getDynamicPortal (std::string &name)
void getDynamicPortals (std::vector< std::string > &names)
virtual UInstancegetInstance (uint instanceNb)
virtual const UInstancegetInstance (uint instanceNb) const
virtual void getInstanceMatrix (uint instanceNb, NLMISC::CMatrix &dest) const
const std::string & getInstanceName (uint instanceNb) const
const NLMISC::CVectorgetInstancePos (uint instanceNb) const
const NLMISC::CQuatgetInstanceRot (uint instanceNb) const
const NLMISC::CVectorgetInstanceScale (uint instanceNb) const
uint getNumInstance () const
UInstanceGroupgetParentCluster () const
NLMISC::CVector getPos ()
NLMISC::CQuat getRotQuat ()
const std::string & getShapeName (uint instanceNb) const
bool getStaticLightSetup (uint retrieverIdentifier, sint surfaceId, const NLMISC::CVector &localPos, std::vector< CPointLightInfluence > &pointLightList, uint8 &sunContribution, NLMISC::CRGBA &localAmbient)
bool linkToParentCluster (UInstanceGroup *father)
void removeFromScene (class UScene &scene)
void removeInstancesUser ()
void setAddRemoveInstanceCallback (IAddRemoveInstance *callback)
 set a callback to know when an instance has been added / removed from scene

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

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


Private Attributes

TState _AddToSceneState
UDriver_AddToSceneTempDriver
UScene_AddToSceneTempScene
CInstanceGroup _InstanceGroup
std::map< std::string, CInstanceUser * > _InstanceMap
std::vector< CInstanceUser * > _Instances

Friends

class CSceneUser
class CTransformUser
+


Member Enumeration Documentation

+

+ + + + +
+ + +
enum NL3D::UInstanceGroup::TState [inherited] +
+
+ + + + + +
+   + + +

+

Enumeration values:
+ + + + + +
StateNotAdded  +
StateAdding  +
StateAdded  +
StateError  +
+
+ +

+Definition at line 109 of file u_instance_group.h. +

+

+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NL3D::CInstanceGroupUser::CInstanceGroupUser  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 91 of file instance_group_user.cpp. +

+References _AddToSceneState, _InstanceGroup, NL3D_MEM_IG, and NL3D::CInstanceGroup::setUserInterface(). +

+

00092 {
+00093         NL3D_MEM_IG
+00094         _AddToSceneState = StateNotAdded;
+00095 
+00096         // set user info for possible get
+00097         _InstanceGroup.setUserInterface(this);
+00098 }
+
+

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

+ +

+Definition at line 101 of file instance_group_user.cpp. +

+References removeInstancesUser(). +

+

00102 {
+00103         // ensure all instances proxys are deleted
+00104         removeInstancesUser();
+00105 }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CInstanceGroupUser::addToScene class CScene scene,
IDriver driver,
uint  selectedTexture
[private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 186 of file instance_group_user.cpp. +

+References _InstanceGroup, _InstanceMap, NL3D::CInstanceGroup::_Instances, NL3D::CInstanceGroup::addToScene(), NL3D::CInstanceGroup::getInstanceName(), NL3D_MEM_IG, uint, and uint32. +

+

00187 {
+00188         NL3D_MEM_IG
+00189         if (!_InstanceGroup.addToScene (scene, driver, selectedTexture))
+00190                 return;
+00191         // Fill in the vector and the map accelerating search of instance by names
+00192         _Instances.resize(_InstanceGroup._Instances.size(), NULL);
+00193         for( uint32 i = 0; i < _InstanceGroup._Instances.size(); ++i)
+00194         {
+00195                 CInstanceUser *pIU = NULL;
+00196                 string stmp;
+00197                 if (_InstanceGroup._Instances[i] != NULL)
+00198                 {
+00199                         // create but don't want to delete from scene, since added/removed with _InstanceGroup
+00200                         pIU = new CInstanceUser (NULL, _InstanceGroup._Instances[i], false);
+00201                         _Instances[i]= pIU;
+00202                         // insert in map (may fail if double name)
+00203                         stmp = _InstanceGroup.getInstanceName (i);
+00204                         _InstanceMap.insert (map<string,CInstanceUser*>::value_type(stmp, pIU));
+00205                 }
+00206         }
+00207 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
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 167 of file instance_group_user.cpp. +

+References NL3D_MEM_IG, and uint. +

+

00168 {
+00169         NL3D_MEM_IG
+00170         // Get driver pointer
+00171         IDriver *cDriver= driver ? NLMISC::safe_cast<CDriverUser*>(driver)->getDriver() : NULL;
+00172 
+00173         // Add to the scene
+00174         addToScene (((CSceneUser*)&scene)->getScene(), cDriver, selectedTexture);
+00175 }
+
+

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

+ +

+Implements NL3D::UInstanceGroup. +

+Definition at line 210 of file instance_group_user.cpp. +

+References _AddToSceneState, _AddToSceneTempDriver, _AddToSceneTempScene, _InstanceGroup, NL3D::CInstanceGroup::addToSceneAsync(), NL3D_MEM_IG, and uint. +

+

00211 {
+00212         NL3D_MEM_IG
+00213         IDriver *cDriver= driver ? NLMISC::safe_cast<CDriverUser*>(driver)->getDriver() : NULL;
+00214         // Add to the scene
+00215         _InstanceGroup.addToSceneAsync (((CSceneUser*)&scene)->getScene(), cDriver, selectedTexture);
+00216         _AddToSceneState = StateAdding;
+00217         _AddToSceneTempScene = &scene;
+00218         _AddToSceneTempDriver = driver;
+00219 }
+
+

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

+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, inherited]
+
+ + + + + +
+   + + +

+ +

+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 }
+
+

+ + + + +
+ + + + + + + + + + +
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 362 of file instance_group_user.cpp. +

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

+

00363 {
+00364         NL3D_MEM_IG
+00365         _InstanceGroup.createRoot (((CSceneUser*)&scene)->getScene());
+00366 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
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 563 of file instance_group_user.cpp. +

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

+

00564 {
+00565         if(!drv)
+00566                 return;
+00567         CTextContext    *pTxtCtx= NULL;
+00568         if(txtCtx)
+00569                 pTxtCtx= &((CTextContextUser*)txtCtx)->getTextContext();
+00570         _InstanceGroup.displayDebugClusters(((CDriverUser*)drv)->getDriver(), pTxtCtx);
+00571 
+00572         // restore the matrix context cause of font rendering
+00573         ((CDriverUser*)drv)->restoreMatrixContext();
+00574 }
+
+

+ + + + +
+ + + + + + + + + +
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 439 of file instance_group_user.cpp. +

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

+

00440 {
+00441         NL3D_MEM_IG
+00442         _InstanceGroup.freezeHRC();
+00443 }
+
+

+ + + + +
+ + + + + + + + + +
UInstanceGroup::TState NL3D::CInstanceGroupUser::getAddToSceneState  )  [private, virtual]
+
+ + + + + +
+   + + +

+ +

+Implements NL3D::UInstanceGroup. +

+Definition at line 229 of file instance_group_user.cpp. +

+References _AddToSceneState, _InstanceGroup, _InstanceMap, NL3D::CInstanceGroup::_Instances, NL3D::CInstanceGroup::getAddToSceneState(), NL3D::CInstanceGroup::getInstanceName(), NL3D_MEM_IG, and uint32. +

+

00230 {
+00231         NL3D_MEM_IG
+00232         UInstanceGroup::TState newState = (UInstanceGroup::TState)_InstanceGroup.getAddToSceneState ();
+00233         if ((_AddToSceneState == StateAdding) && (newState == StateAdded))
+00234         {
+00235                 // Fill in the vector and the map accelerating search of instance by names
+00236                 _Instances.resize(_InstanceGroup._Instances.size(), NULL);
+00237                 for( uint32 i = 0; i < _InstanceGroup._Instances.size(); ++i)
+00238                 {
+00239                         CInstanceUser *pIU = NULL;
+00240                         string stmp;
+00241                         if (_InstanceGroup._Instances[i] != NULL)
+00242                         {
+00243                                 // create but don't want to delete from scene, since added/removed with _InstanceGroup
+00244                                 pIU = new CInstanceUser (NULL, _InstanceGroup._Instances[i], false);
+00245                                 _Instances[i]= pIU;
+00246                                 // insert in map (may fail if double name)
+00247                                 stmp = _InstanceGroup.getInstanceName (i);
+00248                                 _InstanceMap.insert (map<string,CInstanceUser*>::value_type(stmp, pIU));
+00249                         }
+00250                 }
+00251                 _AddToSceneState = StateAdded;
+00252         }
+00253         return newState;
+00254 }
+
+

+ + + + +
+ + + + + + + + + + +
const UInstance * NL3D::CInstanceGroupUser::getByName std::string &  name  )  const [private, virtual]
+
+ + + + + +
+   + + +

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

+Implements NL3D::UInstanceGroup. +

+Definition at line 343 of file instance_group_user.cpp. +

+References _InstanceMap, and NL3D_MEM_IG. +

+

00344 {
+00345         NL3D_MEM_IG
+00346         map<string,CInstanceUser*>::const_iterator it = _InstanceMap.find (name);
+00347         if (it != _InstanceMap.end())
+00348                 return it->second;
+00349         else
+00350                 return NULL;
+00351 }
+
+

+ + + + +
+ + + + + + + + + + +
UInstance * NL3D::CInstanceGroupUser::getByName std::string &  name  )  [private, virtual]
+
+ + + + + +
+   + + +

+Return the instance at a given position +

+Implements NL3D::UInstanceGroup. +

+Definition at line 331 of file instance_group_user.cpp. +

+References _InstanceMap, and NL3D_MEM_IG. +

+

00332 {
+00333         NL3D_MEM_IG
+00334         map<string,CInstanceUser*>::iterator it = _InstanceMap.find (name);
+00335         if (it != _InstanceMap.end())
+00336                 return it->second;
+00337         else
+00338                 return NULL;
+00339 }
+
+

+ + + + +
+ + + + + + + + + + +
float NL3D::CInstanceGroupUser::getCoarseMeshDist uint  instance  )  const [private, virtual]
+
+ + + + + +
+   + + +

+ +

+Implements NL3D::UInstanceGroup. +

+Definition at line 502 of file instance_group_user.cpp. +

+References _InstanceGroup, NL3D::CInstanceGroup::_Instances, NL3D::CMeshMultiLodInstance::getCoarseMeshDist(), NL3D::CInstanceGroup::getNumInstance(), nlwarning, and uint. +

+

00503 {
+00504         if (instance > _InstanceGroup.getNumInstance())
+00505         {
+00506                 nlwarning("getCoarseMeshDist::getDistMax : instance index %d is invalid", instance);
+00507                 return -1.f;
+00508         }
+00509         if (_InstanceGroup._Instances[instance]) 
+00510         {
+00511                 CMeshMultiLodInstance *mmli = dynamic_cast<CMeshMultiLodInstance *>(_InstanceGroup._Instances[instance]);
+00512                 if (mmli) return mmli->getCoarseMeshDist();
+00513                 else return -1.f;
+00514         }               
+00515         else return -1.f;
+00516 }
+
+

+ + + + +
+ + + + + + + + + + +
float NL3D::CInstanceGroupUser::getDistMax uint  instance  )  const [private, virtual]
+
+ + + + + +
+   + + +

+ +

+Implements NL3D::UInstanceGroup. +

+Definition at line 475 of file instance_group_user.cpp. +

+References _InstanceGroup, NL3D::CInstanceGroup::_Instances, NL3D::CInstanceGroup::getNumInstance(), nlwarning, and uint. +

+

00476 {
+00477         if (instance > _InstanceGroup.getNumInstance())
+00478         {
+00479                 nlwarning("CInstanceGroupUser::getDistMax : instance index %d is invalid", instance);
+00480                 return -1.f;
+00481         }
+00482         if (_InstanceGroup._Instances[instance]) return _InstanceGroup._Instances[instance]->getDistMax();
+00483         else return -1.f;
+00484 }
+
+

+ + + + +
+ + + + + + + + + + +
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 403 of file instance_group_user.cpp. +

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

+

00404 {
+00405         NL3D_MEM_IG
+00406         return _InstanceGroup.getDynamicPortal (name);
+00407 }
+
+

+ + + + +
+ + + + + + + + + + +
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 389 of file instance_group_user.cpp. +

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

+

00390 {
+00391         NL3D_MEM_IG
+00392         _InstanceGroup.getDynamicPortals (names);
+00393 }
+
+

+ + + + +
+ + + + + + + + + + +
UInstance * NL3D::CInstanceGroupUser::getInstance uint  instanceNb  )  [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 528 of file instance_group_user.cpp. +

+References uint. +

+

00529 {
+00530         if(instanceNb<_Instances.size())
+00531                 return _Instances[instanceNb];
+00532         else
+00533                 return NULL;
+00534 }
+
+

+ + + + +
+ + + + + + + + + + +
const 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 519 of file instance_group_user.cpp. +

+References uint. +

+

00520 {
+00521         if(instanceNb<_Instances.size())
+00522                 return _Instances[instanceNb];
+00523         else
+00524                 return NULL;
+00525 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
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 178 of file instance_group_user.cpp. +

+References _InstanceGroup, NL3D::CInstanceGroup::getInstanceMatrix(), NL3D_MEM_IG, and uint. +

+

00179 {
+00180         NL3D_MEM_IG
+00181         _InstanceGroup.getInstanceMatrix(instanceNb, dest);     
+00182 }
+
+

+ + + + +
+ + + + + + + + + + +
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 285 of file instance_group_user.cpp. +

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

+

00286 {
+00287         NL3D_MEM_IG
+00288         // Check args
+00289         if (instanceNb>=_InstanceGroup.getNumInstance ())
+00290                 nlerror("getInstanceName*(): bad instance Id");
+00291         
+00292         return _InstanceGroup.getInstanceName (instanceNb);
+00293 }
+
+

+ + + + +
+ + + + + + + + + + +
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 296 of file instance_group_user.cpp. +

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

+

00297 {
+00298         NL3D_MEM_IG
+00299         // Check args
+00300         if (instanceNb>=_InstanceGroup.getNumInstance ())
+00301                 nlerror("getInstancePos*(): bad instance Id");
+00302         
+00303         return _InstanceGroup.getInstancePos (instanceNb);
+00304 }
+
+

+ + + + +
+ + + + + + + + + + +
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 307 of file instance_group_user.cpp. +

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

+

00308 {
+00309         NL3D_MEM_IG
+00310         // Check args
+00311         if (instanceNb>=_InstanceGroup.getNumInstance ())
+00312                 nlerror("getInstanceRot*(): bad instance Id");
+00313         
+00314         return _InstanceGroup.getInstanceRot (instanceNb);
+00315 }
+
+

+ + + + +
+ + + + + + + + + + +
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 318 of file instance_group_user.cpp. +

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

+

00319 {
+00320         NL3D_MEM_IG
+00321         // Check args
+00322         if (instanceNb>=_InstanceGroup.getNumInstance ())
+00323                 nlerror("getInstanceScale*(): bad instance Id");
+00324         
+00325         return _InstanceGroup.getInstanceScale (instanceNb);
+00326 }
+
+

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

+ +

+Definition at line 142 of file instance_group_user.h. +

+References _InstanceGroup, and NL3D_MEM_IG. +

+

00143         {
+00144                 NL3D_MEM_IG
+00145                 return _InstanceGroup;
+00146         }
+
+

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

+Return the count of shape instance in this group. +

+Implements NL3D::UInstanceGroup. +

+Definition at line 266 of file instance_group_user.cpp. +

+References _InstanceGroup, NL3D::CInstanceGroup::getNumInstance(), NL3D_MEM_IG, and uint. +

+

00267 {
+00268         NL3D_MEM_IG
+00269         return _InstanceGroup.getNumInstance ();
+00270 }
+
+

+ + + + +
+ + + + + + + + + +
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 552 of file instance_group_user.cpp. +

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

+

00553 {
+00554         CInstanceGroup  *parent= _InstanceGroup.getParentClusterSystem();
+00555         if(parent)
+00556                 // NB: return NULL if this is the GlobalInstanceGroup.
+00557                 return parent->getUserInterface();
+00558         else
+00559                 return NULL;
+00560 }
+
+

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

+Get the position +

+Implements NL3D::UInstanceGroup. +

+Definition at line 424 of file instance_group_user.cpp. +

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

+

00425 {
+00426         NL3D_MEM_IG
+00427         return _InstanceGroup.getPos ();
+00428 }
+
+

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

+Get the rotation +

+Implements NL3D::UInstanceGroup. +

+Definition at line 431 of file instance_group_user.cpp. +

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

+

00432 {
+00433         NL3D_MEM_IG
+00434         return _InstanceGroup.getRotQuat();
+00435 }
+
+

+ + + + +
+ + + + + + + + + + +
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 274 of file instance_group_user.cpp. +

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

+

00275 {
+00276         NL3D_MEM_IG
+00277         // Check args
+00278         if (instanceNb>=_InstanceGroup.getNumInstance ())
+00279                 nlerror("getShapeName*(): bad instance Id");
+00280         
+00281         return _InstanceGroup.getShapeName (instanceNb);
+00282 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NL3D::CInstanceGroupUser::getStaticLightSetup 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 454 of file instance_group_user.cpp. +

+References _InstanceGroup, NL3D::CInstanceGroup::getStaticLightSetup(), NL3D_MEM_IG, sint, uint, and uint8. +

+

00457 {
+00458         NL3D_MEM_IG
+00459         return _InstanceGroup.getStaticLightSetup(retrieverIdentifier, surfaceId, localPos, pointLightList, 
+00460                 sunContribution, localAmbient);
+00461 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NL3D::CInstanceGroupUser::init const std::string &  instanceGroup  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 108 of file instance_group_user.cpp. +

+References _InstanceGroup, file, NL3D_MEM_IG, and NL3D::CInstanceGroup::serial(). +

+

00109 {
+00110         NL3D_MEM_IG
+00111         // Create a file
+00112         CIFile file;
+00113         std::string path = CPath::lookup (instanceGroup, false);
+00114         if (!path.empty() && file.open (path))
+00115         {
+00116                 // Serialize this class
+00117                 try
+00118                 {
+00119                         // Read the class
+00120                         _InstanceGroup.serial (file);
+00121                 }
+00122                 catch (EStream& e)
+00123                 {
+00124                         // Avoid visual warning
+00125                         EStream ee=e;
+00126 
+00127                         // Serial problem
+00128                         return false;
+00129                 }
+00130         }
+00131         else
+00132         {
+00133                 // Failed.
+00134                 return false;
+00135         }
+00136 
+00137         // Ok
+00138         return true;
+00139 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NL3D::CInstanceGroupUser::linkToParentCluster UInstanceGroup father  )  [private, virtual]
+
+ + + + + +
+   + + +

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

Returns:
true if the link succeeded
+ +

+Implements NL3D::UInstanceGroup. +

+Definition at line 376 of file instance_group_user.cpp. +

+References _InstanceGroup, NL3D::CInstanceGroup::linkToParent(), NL3D_MEM_IG, and nlwarning. +

+

00377 {
+00378         NL3D_MEM_IG
+00379         if (father)
+00380                 return _InstanceGroup.linkToParent(&(NLMISC::safe_cast<CInstanceGroupUser *>(father)->_InstanceGroup));
+00381         else
+00382         {
+00383                 nlwarning("Trying to link a cluster system to a NULL parent cluster");
+00384                 return false;
+00385         }
+00386 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CInstanceGroupUser::removeFromScene class UScene scene  )  [private, virtual]
+
+ + + + + +
+   + + +

+remove this instance group from the given scene +

+Implements NL3D::UInstanceGroup. +

+Definition at line 257 of file instance_group_user.cpp. +

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

+

00258 {
+00259         NL3D_MEM_IG
+00260         _InstanceGroup.removeFromScene (((CSceneUser*)&scene)->getScene());
+00261         // Remove all instance user object in the array/map
+00262         removeInstancesUser();
+00263 }
+
+

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

+ +

+Definition at line 537 of file instance_group_user.cpp. +

+References _InstanceMap, and uint. +

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

+

00538 {
+00539         // delete all instances in the instance array
+00540         for(uint i=0;i<_Instances.size();i++)
+00541         {
+00542                 if(_Instances[i])
+00543                         delete _Instances[i];
+00544         }
+00545 
+00546         // clear the array and the map
+00547         _Instances.clear();
+00548         _InstanceMap.clear();
+00549 }
+
+

+ + + + +
+ + + + + + + + + + +
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 150 of file instance_group_user.cpp. +

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

+

00151 {
+00152         NL3D_MEM_IG
+00153         _InstanceGroup.setAddRemoveInstanceCallback(callback);
+00154 }
+
+

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

+Control a blendshape +

+Implements NL3D::UInstanceGroup. +

+Definition at line 354 of file instance_group_user.cpp. +

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

+

00355 {
+00356         NL3D_MEM_IG
+00357         _InstanceGroup.setBlendShapeFactor (bsName, rFactor);
+00358 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CInstanceGroupUser::setClusterSystemForInstances UInstanceGroup pClusterSystem  )  [private, virtual]
+
+ + + + + +
+   + + +

+All the instances must be checked against the following cluster system +

+Implements NL3D::UInstanceGroup. +

+Definition at line 369 of file instance_group_user.cpp. +

+References _InstanceGroup, NL3D_MEM_IG, and NL3D::CInstanceGroup::setClusterSystemForInstances(). +

+

00370 {
+00371         NL3D_MEM_IG
+00372         _InstanceGroup.setClusterSystemForInstances (&((CInstanceGroupUser*)pClusterSystem)->_InstanceGroup);
+00373 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CInstanceGroupUser::setCoarseMeshDist uint  instance,
float  dist
[private, virtual]
+
+ + + + + +
+   + + +

+ +

+Implements NL3D::UInstanceGroup. +

+Definition at line 487 of file instance_group_user.cpp. +

+References _InstanceGroup, NL3D::CInstanceGroup::_Instances, NL3D::CInstanceGroup::getNumInstance(), nlwarning, NL3D::CMeshMultiLodInstance::setCoarseMeshDist(), and uint. +

+

00488 {
+00489         if (instance > _InstanceGroup.getNumInstance())
+00490         {
+00491                 nlwarning("CInstanceGroupUser::setCoarseMeshDist : instance index %d is invalid", instance);
+00492                 return;
+00493         }
+00494         if (_InstanceGroup._Instances[instance]) 
+00495         {       
+00496                 CMeshMultiLodInstance *mmli = dynamic_cast<CMeshMultiLodInstance *>(_InstanceGroup._Instances[instance]);
+00497                 if (mmli) mmli->setCoarseMeshDist(dist);
+00498         }
+00499 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CInstanceGroupUser::setDistMax uint  instance,
float  dist
[private, virtual]
+
+ + + + + +
+   + + +

+ +

+Implements NL3D::UInstanceGroup. +

+Definition at line 464 of file instance_group_user.cpp. +

+References _InstanceGroup, NL3D::CInstanceGroup::_Instances, NL3D::CInstanceGroup::getNumInstance(), nlwarning, and uint. +

+

00465 {
+00466         if (instance > _InstanceGroup.getNumInstance())
+00467         {
+00468                 nlwarning("CInstanceGroupUser::setDistMax : instance index %d is invalid", instance);
+00469                 return;
+00470         }
+00471         if (_InstanceGroup._Instances[instance]) _InstanceGroup._Instances[instance]->setDistMax(dist); 
+00472 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
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 396 of file instance_group_user.cpp. +

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

+

00397 {
+00398         NL3D_MEM_IG
+00399         _InstanceGroup.setDynamicPortal (name, opened);
+00400 }
+
+

+ + + + +
+ + + + + + + + + + +
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 158 of file instance_group_user.cpp. +

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

+

00159 {
+00160         NL3D_MEM_IG
+00161         _InstanceGroup.setIGAddBeginCallback(callback);
+00162 }
+
+

+ + + + +
+ + + + + + + + + + +
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 410 of file instance_group_user.cpp. +

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

+

00411 {
+00412         NL3D_MEM_IG
+00413         _InstanceGroup.setPos (pos);
+00414 }
+
+

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

+Set the rotation of the instance group +

+Implements NL3D::UInstanceGroup. +

+Definition at line 417 of file instance_group_user.cpp. +

+References _InstanceGroup, NL3D_MEM_IG, q, and NL3D::CInstanceGroup::setRotQuat(). +

+

00418 {
+00419         NL3D_MEM_IG
+00420         _InstanceGroup.setRotQuat (q);
+00421 }
+
+

+ + + + +
+ + + + + + + + + + +
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 142 of file instance_group_user.cpp. +

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

+

00143 {
+00144         NL3D_MEM_IG
+00145         _InstanceGroup.setTransformNameCallback (pTN);
+00146 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CInstanceGroupUser::stopAddToSceneAsync  )  [private, virtual]
+
+ + + + + +
+   + + +

+ +

+Implements NL3D::UInstanceGroup. +

+Definition at line 222 of file instance_group_user.cpp. +

+References _InstanceGroup, NL3D_MEM_IG, and NL3D::CInstanceGroup::stopAddToSceneAsync(). +

+

00223 {
+00224         NL3D_MEM_IG
+00225         _InstanceGroup.stopAddToSceneAsync ();
+00226 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::UInstanceGroup::stopCreateInstanceGroupAsync UInstanceGroup **  pIG  )  [static, inherited]
+
+ + + + + +
+   + + +

+ +

+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 }
+
+

+ + + + +
+ + + + + + + + + +
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 446 of file instance_group_user.cpp. +

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

+

00447 {
+00448         NL3D_MEM_IG
+00449         _InstanceGroup.unfreezeHRC();
+00450 }
+
+


Friends And Related Function Documentation

+

+ + + + +
+ + +
friend class CSceneUser [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 136 of file instance_group_user.h.

+

+ + + + +
+ + +
friend class CTransformUser [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 135 of file instance_group_user.h.

+


Field Documentation

+

+ + + + +
+ + +
TState NL3D::CInstanceGroupUser::_AddToSceneState [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 126 of file instance_group_user.h. +

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

+

+ + + + +
+ + +
UDriver* NL3D::CInstanceGroupUser::_AddToSceneTempDriver [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 128 of file instance_group_user.h. +

+Referenced by addToSceneAsync().

+

+ + + + +
+ + +
UScene* NL3D::CInstanceGroupUser::_AddToSceneTempScene [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 127 of file instance_group_user.h. +

+Referenced by addToSceneAsync().

+

+ + + + +
+ + +
CInstanceGroup NL3D::CInstanceGroupUser::_InstanceGroup [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 121 of file instance_group_user.h. +

+Referenced by addToScene(), addToSceneAsync(), CInstanceGroupUser(), createRoot(), displayDebugClusters(), NL3D::CSceneUser::findCameraClusterSystemFromRay(), freezeHRC(), getAddToSceneState(), getCoarseMeshDist(), getDistMax(), getDynamicPortal(), getDynamicPortals(), getInstanceMatrix(), getInstanceName(), getInstancePos(), getInstanceRot(), getInstanceScale(), getInternalIG(), getNumInstance(), getParentCluster(), getPos(), getRotQuat(), getShapeName(), getStaticLightSetup(), init(), linkToParentCluster(), removeFromScene(), setAddRemoveInstanceCallback(), setBlendShapeFactor(), setClusterSystemForInstances(), setCoarseMeshDist(), setDistMax(), setDynamicPortal(), setIGAddBeginCallback(), setPos(), setRotQuat(), NL3D::CSceneUser::setToGlobalInstanceGroup(), setTransformNameCallback(), stopAddToSceneAsync(), and unfreezeHRC().

+

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

+ +

+Definition at line 124 of file instance_group_user.h. +

+Referenced by addToScene(), getAddToSceneState(), getByName(), and removeInstancesUser().

+

+ + + + +
+ + +
std::vector<CInstanceUser*> NL3D::CInstanceGroupUser::_Instances [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 123 of file instance_group_user.h.

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 06:47:32 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1