00001 00005 /* Copyright, 2000 Nevrax Ltd. 00006 * 00007 * This file is part of NEVRAX NEL. 00008 * NEVRAX NEL is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2, or (at your option) 00011 * any later version. 00012 00013 * NEVRAX NEL is distributed in the hope that it will be useful, but 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * General Public License for more details. 00017 00018 * You should have received a copy of the GNU General Public License 00019 * along with NEVRAX NEL; see the file COPYING. If not, write to the 00020 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 00021 * MA 02111-1307, USA. 00022 */ 00023 00024 #ifndef NL_TRANSFORM_SHAPE_H 00025 #define NL_TRANSFORM_SHAPE_H 00026 00027 #include "nel/misc/types_nl.h" 00028 #include "nel/misc/matrix.h" 00029 #include "nel/3d/transform.h" 00030 #include "nel/3d/shape.h" 00031 #include "nel/3d/load_balancing_trav.h" 00032 #include <vector> 00033 #include "nel/3d/fast_ptr_list.h" 00034 00035 00036 namespace NL3D 00037 { 00038 00039 00040 using NLMISC::CSmartPtr; 00041 using NLMISC::CPlane; 00042 00043 00044 class CRenderTrav; 00045 class CMRMLevelDetail; 00046 class CMaterial; 00047 class CQuadGridClipCluster; 00048 00049 00050 // *************************************************************************** 00051 // ClassIds. 00052 const NLMISC::CClassId TransformShapeId=NLMISC::CClassId(0x1e6115e6, 0x63502517); 00053 00054 00055 // *************************************************************************** 00062 class CTransformShape : public CTransform 00063 { 00064 public: 00066 static void registerBasic(); 00067 00068 public: 00070 CSmartPtr<IShape> Shape; 00071 00072 00075 virtual void getAABBox(NLMISC::CAABBox &bbox) const; 00076 00079 virtual uint getNumMaterial () const; 00080 00083 virtual const CMaterial *getMaterial (uint materialId) const; 00084 00087 virtual CMaterial *getMaterial (uint materialId); 00088 00090 // @{ 00091 00099 virtual float getNumTriangles (float distance); 00100 00105 float getNumTrianglesAfterLoadBalancing() {return _NumTrianglesAfterLoadBalancing;} 00106 00108 virtual const CMRMLevelDetail *getMRMLevelDetail() const {return NULL;} 00109 00110 // @} 00111 00112 00114 // @{ 00116 void changeLightSetup(CRenderTrav *rdrTrav); 00117 // @} 00118 00120 virtual bool canStartStop() { return false; } 00121 // For instance that have a start/stop caps 00122 virtual void start() {} 00123 // For instance that have a start/stop caps 00124 virtual void stop() {} 00125 // For instance that have a start/stop caps 00126 virtual bool isStarted() const { return false; } 00127 00128 // Get the model distmax. At startup it is setupped with the shape value 00129 float getDistMax() const { return _DistMax; } 00130 // Set the model distmax. 00131 void setDistMax(float distMax) { _DistMax = distMax; } 00132 00133 00135 bool isLinkToQuadCluster() const {return _QuadClusterListNode.isLinked();} 00136 00137 00139 // @{ 00140 virtual bool clip(); 00141 virtual void traverseLoadBalancing(); 00142 virtual void traverseRender(); 00143 virtual void profileRender(); 00144 // @} 00145 00146 // Lighting: get the center of the AABBox of the model by default 00147 virtual void getLightHotSpotInWorld(CVector &modelPos, float &modelRadius) const; 00148 // return the contribution of lights (for traverseRender()). 00149 CLightContribution &getLightContribution() { return _LightContribution;} 00150 00151 00152 protected: 00154 CTransformShape(); 00156 virtual ~CTransformShape() {} 00157 00161 void setupCurrentLightContribution(CLightContribution *lightContrib, bool useLocalAtt); 00162 00164 virtual void unlinkFromQuadCluster(); 00165 00166 private: 00167 static CTransform *creator() {return new CTransformShape;} 00168 00169 float _NumTrianglesAfterLoadBalancing; 00170 00171 00172 private: 00173 /* The Activated lightContribution, and localAttenuation setup for this instance. 00174 This may be our lightContribution, or our ancestore skeleton contribution. 00175 */ 00176 CLightContribution *_CurrentLightContribution; 00177 // true If this instance use localAttenuation. 00178 bool _CurrentUseLocalAttenuation; 00179 private: 00180 friend class CQuadGridClipCluster; 00181 friend class CQuadGridClipClusterListDist; 00182 00183 // The max dist for this model. 00184 float _DistMax; 00185 00186 00188 // @{ 00189 // Link to QuadGridCluster 00190 CFastPtrListNode _QuadClusterListNode; 00191 // @} 00192 00194 // @{ 00195 // The number of face computed in Pass0. 00196 float _FaceCount; 00197 00198 void traverseLoadBalancingPass0(); 00199 void traverseLoadBalancingPass1(); 00200 // @} 00201 00202 }; 00203 00204 00205 00206 } // NL3D 00207 00208 00209 #endif // NL_TRANSFORM_SHAPE_H 00210 00211 /* End of transform_shape.h */
1.6.1