transform_user.cpp File Reference


Detailed Description

Id
transform_user.cpp,v 1.18 2004/03/12 16:27:52 berenguier Exp

Definition in file transform_user.cpp.

#include "std3d.h"
#include "3d/transform_user.h"
#include "3d/instance_group_user.h"
#include "nel/misc/hierarchical_timer.h"
#include "scene_group.h"

Go to the source code of this file.

Defines

#define NL3D_HAUTO_SET_CLUSTER_SYSTEM   H_AUTO_USE( NL3D_Transform_Set_Cluster_System )

Functions

 H_AUTO_DECL (NL3D_Transform_Set_Cluster_System) namespace NL3D


Define Documentation

#define NL3D_HAUTO_SET_CLUSTER_SYSTEM   H_AUTO_USE( NL3D_Transform_Set_Cluster_System )
 

Referenced by H_AUTO_DECL().


Function Documentation

H_AUTO_DECL NL3D_Transform_Set_Cluster_System   ) 
 

Definition at line 33 of file transform_user.cpp.

References NL3D_HAUTO_SET_CLUSTER_SYSTEM, NL3D_MEM_TRANSFORM, nlassert, nlerror, nlwarning, num, and uint.

00038 {
00039 
00040 // ***************************************************************************
00041 void CTransformUser::setClusterSystem (UInstanceGroup *pIG)
00042 {
00043         NL3D_HAUTO_SET_CLUSTER_SYSTEM
00044 
00045         nlassert(_Transform) ; // object invalid now ...
00046         if (_Transform->getForceClipRoot())
00047         {
00048                 nlwarning("Transform has been flagged to be glued to the root, and thus can't be clusterized. See UTransform::setForceClipRoot(bool).");
00049                 return;
00050         }
00051         if ((pIG == NULL) || (pIG == (UInstanceGroup*)-1))
00052         {
00053                 if (pIG == NULL)
00054                         _Transform->setClusterSystem (NULL);
00055                 else
00056                         _Transform->setClusterSystem ((CInstanceGroup*)-1);
00057         }
00058         else
00059                 _Transform->setClusterSystem (&((CInstanceGroupUser*)pIG)->_InstanceGroup);
00060 }
00061 
00062 // ***************************************************************************
00063 UInstanceGroup *CTransformUser::getClusterSystem ()
00064 {
00065         nlassert(_Transform) ; // object invalid now ...
00066         CInstanceGroup  *ig= _Transform->getClusterSystem();
00067         if(ig==((CInstanceGroup*)-1))
00068                 return ((UInstanceGroup*)-1);
00069         else if(ig==NULL)
00070                 return NULL;
00071         else
00072                 return ig->getUserInterface();
00073 }
00074 
00075 // ***************************************************************************
00076 void                    CTransformUser::getLastParentClusters(std::vector<CCluster*> &clusters) const
00077 {
00078         // look in the list of parent of the transform object and extract the CCluster parents
00079         if (_Scene == NULL)
00080                 return;
00081 
00082         CClipTrav       &clipTrav= _Scene->getClipTrav();
00083 
00084         uint    num= _Transform->clipGetNumParents();
00085         for(uint i=0;i<num;i++)
00086         {
00087                 CCluster *pcluster = dynamic_cast<CCluster*>(_Transform->clipGetParent(i));
00088                 if (pcluster != NULL)
00089                         clusters.push_back(pcluster);
00090         }
00091 
00092         // If the object is link to a QuadCluster, add the RootCluster to the list
00093         CTransformShape *trShp= dynamic_cast<CTransformShape*>( _Transform );
00094         if( trShp && trShp->isLinkToQuadCluster() )
00095                 clusters.push_back(clipTrav.RootCluster);
00096 }
00097 
00098 
00099 // ***************************************************************************
00100 void                    CTransformUser::freezeHRC()
00101 {
00102         nlassert(_Transform) ; // object invalid now ...
00103         _Transform->freezeHRC();
00104 }
00105 
00106 // ***************************************************************************
00107 void                    CTransformUser::unfreezeHRC()
00108 {
00109         nlassert(_Transform) ; // object invalid now ...
00110         CTransform *node = _Transform;
00111         while (node)
00112         {
00113                 node->unfreezeHRC();
00114                 node = node->hrcGetParent();
00115         }
00116 }
00117 
00118 
00119 // ***************************************************************************
00120 void                    CTransformUser::setLoadBalancingGroup(const std::string &group)
00121 {
00122         _Transform->setLoadBalancingGroup(group);
00123 }
00124 // ***************************************************************************
00125 const std::string       &CTransformUser::getLoadBalancingGroup() const
00126 {
00127         return _Transform->getLoadBalancingGroup();
00128 }
00129 
00130 // ***************************************************************************
00131 void                    CTransformUser::setMeanColor(NLMISC::CRGBA color)
00132 {
00133         _Transform->setMeanColor(color);
00134 }
00135 // ***************************************************************************
00136 NLMISC::CRGBA   CTransformUser::getMeanColor() const
00137 {
00138         return _Transform->getMeanColor();
00139 }
00140 
00141 // ***************************************************************************
00142 const CMatrix   &CTransformUser::getLastWorldMatrixComputed() const
00143 {
00144         return _Transform->getWorldMatrix();
00145 }
00146 
00147 // ***************************************************************************
00148 void                    CTransformUser::enableCastShadowMap(bool state)
00149 {
00150         _Transform->enableCastShadowMap(state);
00151 }
00152 
00153 // ***************************************************************************
00154 bool                    CTransformUser::canCastShadowMap() const
00155 {
00156         return _Transform->canCastShadowMap();
00157 }
00158 
00159 // ***************************************************************************
00160 void                    CTransformUser::enableReceiveShadowMap(bool state)
00161 {
00162         _Transform->enableReceiveShadowMap(state);
00163 }
00164 
00165 // ***************************************************************************
00166 bool                    CTransformUser::canReceiveShadowMap() const
00167 {
00168         return _Transform->canReceiveShadowMap();
00169 }
00170 
00171 // ***************************************************************************
00172 void                    CTransformUser::parent(UTransform *newFather)
00173 {
00174         NL3D_MEM_TRANSFORM
00175         nlassert(_Transform) ; // object invalid now ...
00176         if (_Transform->getForceClipRoot())
00177         {
00178                 nlwarning("Transform has been flagged to be glued to the root, can't change parent. See UTransform::setForceClipRoot(bool).");
00179                 return;
00180         }
00181         if(newFather)
00182         {
00183                 // link me to other.
00184                 CTransformUser  *other= dynamic_cast<CTransformUser*>(newFather);
00185                 if(other->_Scene!=_Scene)
00186                         nlerror("Try to parent 2 object from 2 differnet scenes!!");
00187                 other->_Transform->hrcLinkSon( _Transform );
00188         }
00189         else
00190         {
00191                 // link me to Root.
00192                 _Scene->getRoot()->hrcLinkSon( _Transform );
00193         }
00194 }
00195 
00196 
00197 } // NL3D


Generated on Tue Mar 16 06:43:27 2004 for NeL by doxygen 1.3.6