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/a02910.html | 4118 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 4118 insertions(+) create mode 100644 docs/doxygen/nel/a02910.html (limited to 'docs/doxygen/nel/a02910.html') diff --git a/docs/doxygen/nel/a02910.html b/docs/doxygen/nel/a02910.html new file mode 100644 index 00000000..70008f71 --- /dev/null +++ b/docs/doxygen/nel/a02910.html @@ -0,0 +1,4118 @@ + + +NeL: NL3D::CMeshMultiLod class Reference + + + +
+

NL3D::CMeshMultiLod Class Reference

#include <mesh_multi_lod.h> +

+

Inheritance diagram for NL3D::CMeshMultiLod: +

+ +NL3D::CMeshBase +NL3D::IShape +NLMISC::CRefCount +NLMISC::IStreamable +NLMISC::IClassable + +

Detailed Description

+Mesh with several LOD meshes.

+This mesh handle several meshes of any kind of shape (MRM, standard, coarse meshes..) At run time, it chooses what LOD meshes it must render according to its settings.

+

Author:
Cyril 'Hulud' Corvazier

+Nevrax France

+
Date:
2001
+ +

+ +

+Definition at line 52 of file mesh_multi_lod.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Types

Structures for building a mesh.
typedef std::map< std::string,
+ CLightInfoMapListV7 > 
TLightInfoMapV7
typedef std::vector< CLightMapInfoList > TLightMapInfo
Structures for building a mesh.
typedef std::map< std::string,
+ CLightInfoMapListV7 > 
TLightInfoMapV7
typedef std::vector< CLightMapInfoList > TLightMapInfo
Structures for building a mesh.
typedef std::map< std::string,
+ CLightInfoMapListV7 > 
TLightInfoMapV7
typedef std::vector< CLightMapInfoList > TLightMapInfo
Structures for building a mesh.
typedef std::map< std::string,
+ CLightInfoMapListV7 > 
TLightInfoMapV7
typedef std::vector< CLightMapInfoList > TLightMapInfo
Structures for building a mesh.
typedef std::map< std::string,
+ CLightInfoMapListV7 > 
TLightInfoMapV7
typedef std::vector< CLightMapInfoList > TLightMapInfo

Public Member Functions

void changeMRMDistanceSetup (float distanceFinest, float distanceMiddle, float distanceCoarsest)
void flushTextures (IDriver &driver, uint selectedTexture)
 Flush textures.

virtual std::string getClassName ()=0
float getDistMax () const
const IMeshGeomgetMeshGeom (uint slot) const
 Geometry accessor.

uint getNumSlotMesh () const
 Get slot mesh count.

virtual float getNumTriangles (float distance)
 should not be called direclty as the intance of this shape will use 'getNumTrianglesWithCoarsestDist' themselves to get the correct distance.

float getNumTrianglesWithCoarsestDist (float distance, float coarsestMeshDist) const
const sintgetRefCount () const
IMeshGeomgetSlotMesh (uint i, bool &coarseMesh)
 Get a slot mesh.

bool isLightable () const
 Is this mesh lightable? true if one of his materials is not a lightmap. NB: result stored in file.

bool isStatic () const
 Is static mesh ?

void serialMeshBase (NLMISC::IStream &f) throw (NLMISC::EStream)
 serial the base Part of this mesh.

void setDistMax (float distMax)
virtual bool useLightingLocalAttenuation () const
 tells if the shape wants LocalAttenuation for RealTime lighting. Default is false

animated material mgt. do it after CMesh::build(), or CMeshMRM::build()
CMaterialBasegetAnimatedMaterial (uint id)
 return NULL if this material is NOT animated. (or if material do not exist)

void setAnimatedMaterial (uint id, const std::string &matName)
 setup a material as animated. Material must exist or else no-op.

Automatic animation
bool getAutoAnim () const
void setAutoAnim (bool on=true)
access default tracks.
CTrackDefaultRGBAgetDefaultLMFactor ()
CTrackDefaultVectorgetDefaultPivot ()
CTrackDefaultVectorgetDefaultPos ()
CTrackDefaultVectorgetDefaultRotEuler ()
CTrackDefaultQuatgetDefaultRotQuat ()
CTrackDefaultVectorgetDefaultScale ()
LodCharacterTexture
const CLodCharacterTexturegetLodCharacterTexture () const
 get the lod texture info. see CSkeletonModel Lod system. NULL per default. NB: serialised

void resetLodCharacterTexture ()
 reset the lod texture info. see CSkeletonModel Lod system.

void setupLodCharacterTexture (CLodCharacterTexture &lodText)
 setup the lod texture info. see CSkeletonModel Lod system

Material accessors
const CMaterialgetMaterial (uint id) const
 Get a material, const version.

CMaterialgetMaterial (uint id)
 Get a material.

uint getNbMaterial () const
 Get the number of materials in the mesh.

animated material mgt. do it after CMesh::build(), or CMeshMRM::build()
CMaterialBasegetAnimatedMaterial (uint id)
 return NULL if this material is NOT animated. (or if material do not exist)

void setAnimatedMaterial (uint id, const std::string &matName)
 setup a material as animated. Material must exist or else no-op.

Automatic animation
bool getAutoAnim () const
void setAutoAnim (bool on=true)
access default tracks.
CTrackDefaultRGBAgetDefaultLMFactor ()
CTrackDefaultVectorgetDefaultPivot ()
CTrackDefaultVectorgetDefaultPos ()
CTrackDefaultVectorgetDefaultRotEuler ()
CTrackDefaultQuatgetDefaultRotQuat ()
CTrackDefaultVectorgetDefaultScale ()
LodCharacterTexture
const CLodCharacterTexturegetLodCharacterTexture () const
 get the lod texture info. see CSkeletonModel Lod system. NULL per default. NB: serialised

void resetLodCharacterTexture ()
 reset the lod texture info. see CSkeletonModel Lod system.

void setupLodCharacterTexture (CLodCharacterTexture &lodText)
 setup the lod texture info. see CSkeletonModel Lod system

Material accessors
const CMaterialgetMaterial (uint id) const
 Get a material, const version.

CMaterialgetMaterial (uint id)
 Get a material.

uint getNbMaterial () const
 Get the number of materials in the mesh.

animated material mgt. do it after CMesh::build(), or CMeshMRM::build()
CMaterialBasegetAnimatedMaterial (uint id)
 return NULL if this material is NOT animated. (or if material do not exist)

void setAnimatedMaterial (uint id, const std::string &matName)
 setup a material as animated. Material must exist or else no-op.

Automatic animation
bool getAutoAnim () const
void setAutoAnim (bool on=true)
access default tracks.
CTrackDefaultRGBAgetDefaultLMFactor ()
CTrackDefaultVectorgetDefaultPivot ()
CTrackDefaultVectorgetDefaultPos ()
CTrackDefaultVectorgetDefaultRotEuler ()
CTrackDefaultQuatgetDefaultRotQuat ()
CTrackDefaultVectorgetDefaultScale ()
LodCharacterTexture
const CLodCharacterTexturegetLodCharacterTexture () const
 get the lod texture info. see CSkeletonModel Lod system. NULL per default. NB: serialised

void resetLodCharacterTexture ()
 reset the lod texture info. see CSkeletonModel Lod system.

void setupLodCharacterTexture (CLodCharacterTexture &lodText)
 setup the lod texture info. see CSkeletonModel Lod system

Material accessors
const CMaterialgetMaterial (uint id) const
 Get a material, const version.

CMaterialgetMaterial (uint id)
 Get a material.

uint getNbMaterial () const
 Get the number of materials in the mesh.

animated material mgt. do it after CMesh::build(), or CMeshMRM::build()
CMaterialBasegetAnimatedMaterial (uint id)
 return NULL if this material is NOT animated. (or if material do not exist)

void setAnimatedMaterial (uint id, const std::string &matName)
 setup a material as animated. Material must exist or else no-op.

Automatic animation
bool getAutoAnim () const
void setAutoAnim (bool on=true)
access default tracks.
CTrackDefaultRGBAgetDefaultLMFactor ()
CTrackDefaultVectorgetDefaultPivot ()
CTrackDefaultVectorgetDefaultPos ()
CTrackDefaultVectorgetDefaultRotEuler ()
CTrackDefaultQuatgetDefaultRotQuat ()
CTrackDefaultVectorgetDefaultScale ()
LodCharacterTexture
const CLodCharacterTexturegetLodCharacterTexture () const
 get the lod texture info. see CSkeletonModel Lod system. NULL per default. NB: serialised

void resetLodCharacterTexture ()
 reset the lod texture info. see CSkeletonModel Lod system.

void setupLodCharacterTexture (CLodCharacterTexture &lodText)
 setup the lod texture info. see CSkeletonModel Lod system

Material accessors
const CMaterialgetMaterial (uint id) const
 Get a material, const version.

CMaterialgetMaterial (uint id)
 Get a material.

uint getNbMaterial () const
 Get the number of materials in the mesh.

Structures for building a multi lod mesh.
void build (CMeshMultiLodBuild &mbuild)
 Build a mesh from material info, and a builded MeshGeom. WARNING: This has a side effect of deleting AnimatedMaterials.

From IShape
virtual bool clip (const std::vector< CPlane > &pyramid, const CMatrix &worldMatrix)
 clip this mesh in a driver.

virtual CTransformShapecreateInstance (CScene &scene)
 Create a CMeshInstance, which contains materials.

virtual void getAABBox (NLMISC::CAABBox &bbox) const
 Get bbox.

 NLMISC_DECLARE_CLASS (CMeshMultiLod)
 Declare name of the shape.

virtual void profileSceneRender (CRenderTrav *rdrTrav, CTransformShape *trans, bool opaquePass)
 profiling

virtual void render (IDriver *drv, CTransformShape *trans, bool passOpaque)
 render() this mesh in a driver.

virtual void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 serial this mesh.

animated material mgt. do it after CMesh::build(), or CMeshMRM::build()
CMaterialBasegetAnimatedMaterial (uint id)
 return NULL if this material is NOT animated. (or if material do not exist)

void setAnimatedMaterial (uint id, const std::string &matName)
 setup a material as animated. Material must exist or else no-op.

Automatic animation
bool getAutoAnim () const
void setAutoAnim (bool on=true)
access default tracks.
CTrackDefaultRGBAgetDefaultLMFactor ()
CTrackDefaultVectorgetDefaultPivot ()
CTrackDefaultVectorgetDefaultPos ()
CTrackDefaultVectorgetDefaultRotEuler ()
CTrackDefaultQuatgetDefaultRotQuat ()
CTrackDefaultVectorgetDefaultScale ()
LodCharacterTexture
const CLodCharacterTexturegetLodCharacterTexture () const
 get the lod texture info. see CSkeletonModel Lod system. NULL per default. NB: serialised

void resetLodCharacterTexture ()
 reset the lod texture info. see CSkeletonModel Lod system.

void setupLodCharacterTexture (CLodCharacterTexture &lodText)
 setup the lod texture info. see CSkeletonModel Lod system

Material accessors
const CMaterialgetMaterial (uint id) const
 Get a material, const version.

CMaterialgetMaterial (uint id)
 Get a material.

uint getNbMaterial () const
 Get the number of materials in the mesh.

Mesh Block Render Interface
virtual IMeshGeomsupportMeshBlockRendering (CTransformShape *trans, float &polygonCount) const

Data Fields

TLightMapInfo _LightInfos
sint crefs
CPtrInfo * pinfo

Static Public Attributes

CPtrInfo NullPtrInfo

Protected Types

typedef std::map< uint32,
+ CMaterialBase
TAnimatedMaterialMap
 Animated Material mgt.


Protected Member Functions

void applyMaterialUsageOptim (const std::vector< bool > &materialUsed, std::vector< sint > &remap)
void buildMeshBase (CMeshBaseBuild &m)
 Just copy informations from a CMeshBaseBuild.

void instanciateMeshBase (CMeshBaseInstance *mi, CScene *ownerScene)
 instanciate MeshBase part to an instance (a CMeshBaseInstance).


Protected Attributes

TAnimatedMaterialMap _AnimatedMaterials
std::vector< CMorphBase_AnimatedMorph
bool _AutoAnim
CTrackDefaultRGBA _DefaultLMFactor
CTrackDefaultVector _DefaultPivot
CTrackDefaultVector _DefaultPos
 Transform default tracks. Those default tracks are instancied, ie, CInstanceMesh will have the same and can't specialize it.

CTrackDefaultVector _DefaultRotEuler
CTrackDefaultQuat _DefaultRotQuat
CTrackDefaultVector _DefaultScale
float _DistMax
 Default to -1.

bool _IsLightable
 Is this mesh lightable??

std::vector< CMaterial_Materials
 The Materials.

bool _UseLightingLocalAttenuation
 Is this mesh Use Lighting Local Attenuation ??


Private Member Functions

void clear ()
 Clear the mesh.

void compileCoarseMeshes ()
 compile Coarse Meshs when builded/loaded.

void compileDistMax ()
 copileDistMax when builded/loaded.

void instanciateCoarseMeshSpace (CMeshMultiLodInstance *mi)
 called at createInstance() time

void profileMeshGeom (uint slot, CRenderTrav *rdrTrav, CMeshMultiLodInstance *trans, float numPoylgons, uint32 rdrFlags)
 Profile the MeshGeom of a slot, even if coarseMesh.

void renderCoarseMesh (uint slot, IDriver *drv, CMeshMultiLodInstance *trans, CCoarseMeshManager *manager)
 Render the CoarseMesh of a slot. must be a coarseMesh, and shoudl be called only in passOpaque.

void renderMeshGeom (uint slot, IDriver *drv, CMeshMultiLodInstance *trans, float numPoylgons, uint32 rdrFlags, float alpha, CCoarseMeshManager *manager)
 Render the MeshGeom of a slot, even if coarseMesh.


Private Attributes

std::vector< CMeshSlot_MeshVector
 Vector of meshes.

bool _StaticLod
 Static or dynamic load ? Yoyo: no more used, but leave for possible usage later...


Friends

class CMeshMultiLodInstance
struct CPtrInfo
+


Member Typedef Documentation

+

+ + + + +
+ + +
typedef std::map<uint32, CMaterialBase> NL3D::CMeshBase::TAnimatedMaterialMap [protected, inherited] +
+
+ + + + + +
+   + + +

+Animated Material mgt. +

+ +

+Definition at line 239 of file mesh_base.h.

+

+ + + + +
+ + +
typedef std::map< std::string, CLightInfoMapListV7 > NL3D::CMeshBase::TLightInfoMapV7 [inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 76 of file mesh_base.h. +

+Referenced by NL3D::CMeshBase::serialMeshBase().

+

+ + + + +
+ + +
typedef std::vector< CLightMapInfoList > NL3D::CMeshBase::TLightMapInfo [inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 111 of file mesh_base.h.

+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CMeshBase::applyMaterialUsageOptim const std::vector< bool > &  materialUsed,
std::vector< sint > &  remap
[protected, inherited]
+
+ + + + + +
+   + + +

+delete any material not used, and build remap table (old to new). _AnimatedMaterials are reseted resetLodCharacterTexture(); is called +

+Definition at line 333 of file mesh_base.cpp. +

+References NL3D::CMeshBase::_AnimatedMaterials, NL3D::CMeshBase::_LightInfos, count, nlassert, NL3D::CMeshBase::resetLodCharacterTexture(), sint, NL3D::CMeshBase::CLightMapInfoList::StageList, and uint. +

+

00334 {
+00335         nlassert(_Materials.size()==materialUsed.size());
+00336 
+00337         // security reset
+00338         resetLodCharacterTexture();
+00339         _AnimatedMaterials.clear();
+00340 
+00341         // init all ids to "Not Used"
+00342         remap.clear();
+00343         remap.resize(_Materials.size(), -1);
+00344 
+00345         // remove unused materials and build remap
+00346         vector<CMaterial>::iterator             itMat= _Materials.begin();
+00347         uint                                                    dstIdx= 0;
+00348         uint i;
+00349         for(i=0;i<materialUsed.size();i++)
+00350         {
+00351                 // if used, still use it, and remap.
+00352                 if(materialUsed[i])
+00353                 {
+00354                         remap[i]= dstIdx;
+00355                         itMat++;
+00356                         dstIdx++;
+00357                 }
+00358                 // remove from the array
+00359                 else
+00360                 {
+00361                         itMat= _Materials.erase(itMat);
+00362                 }
+00363         }
+00364 
+00365         // apply the remap to LightMaps infos
+00366         const uint count = _LightInfos.size ();
+00367         for (i=0; i<count; i++)
+00368         {
+00369                 CLightMapInfoList &mapInfoList = _LightInfos[i];
+00370                 std::list<CMeshBase::CLightMapInfoList::CMatStage>::iterator ite = mapInfoList.StageList.begin ();
+00371                 while (ite != mapInfoList.StageList.end ())
+00372                 {
+00373                         sint    newId= remap[ite->MatId];
+00374                         // If material used
+00375                         if(newId>=0)
+00376                         {
+00377                                 // apply remap on the material id
+00378                                 ite->MatId= newId;
+00379                                 ite++;
+00380                         }
+00381                         else
+00382                         {
+00383                                 // remove it from list of light infos
+00384                                 ite= mapInfoList.StageList.erase(ite);
+00385                         }
+00386                 }
+00387         }
+00388 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CMeshMultiLod::build CMeshMultiLodBuild mbuild  ) 
+
+ + + + + +
+   + + +

+Build a mesh from material info, and a builded MeshGeom. WARNING: This has a side effect of deleting AnimatedMaterials. +

+ +

+Definition at line 52 of file mesh_multi_lod.cpp. +

+References _MeshVector, _StaticLod, NL3D::CMeshMultiLod::CMeshMultiLodBuild::BaseMesh, clear(), compileCoarseMeshes(), compileDistMax(), NL3D::CMeshMultiLod::CMeshMultiLodBuild::LodMeshes, NL3D::CMeshMultiLod::CMeshSlot::MeshGeom, nlassert, NL3D::CMeshMultiLod::CMeshMultiLodBuild::StaticLod, and uint. +

+

00053 {
+00054         // Clear the mesh
+00055         clear ();
+00056 
+00057         // Build the base mesh
+00058         CMeshBase::buildMeshBase (mbuild.BaseMesh);
+00059 
+00060         // Static flag
+00061         _StaticLod=mbuild.StaticLod;
+00062 
+00063         // Resize the array
+00064         _MeshVector.resize (mbuild.LodMeshes.size());
+00065 
+00066         // For each slots
+00067         for (uint slot=0; slot<mbuild.LodMeshes.size(); slot++)
+00068         {
+00069                 // Dist max
+00070                 _MeshVector[slot].DistMax=mbuild.LodMeshes[slot].DistMax;
+00071 
+00072                 // BlendLength
+00073                 _MeshVector[slot].BlendLength=mbuild.LodMeshes[slot].BlendLength;
+00074 
+00075                 // Flags
+00076                 _MeshVector[slot].Flags=0;
+00077 
+00078                 // Blend in ?
+00079                 if (mbuild.LodMeshes[slot].Flags & CMeshMultiLodBuild::CBuildSlot::BlendIn)
+00080                         _MeshVector[slot].Flags|=CMeshSlot::BlendIn;
+00081 
+00082                 // Blend out ?
+00083                 if (mbuild.LodMeshes[slot].Flags & CMeshMultiLodBuild::CBuildSlot::BlendOut)
+00084                         _MeshVector[slot].Flags|=CMeshSlot::BlendOut;
+00085 
+00086                 // Coarse mesh ?
+00087                 if (mbuild.LodMeshes[slot].Flags & CMeshMultiLodBuild::CBuildSlot::CoarseMesh)
+00088                 {
+00089                         // Flag
+00090                         _MeshVector[slot].Flags|=CMeshSlot::CoarseMesh;
+00091                 }
+00092 
+00093                 // Is opaque
+00094                 if (mbuild.LodMeshes[slot].Flags & CMeshMultiLodBuild::CBuildSlot::IsOpaque)
+00095                         _MeshVector[slot].Flags|=CMeshSlot::IsOpaque;
+00096 
+00097                 // Is transparent
+00098                 if (mbuild.LodMeshes[slot].Flags & CMeshMultiLodBuild::CBuildSlot::IsTransparent)
+00099                         _MeshVector[slot].Flags|=CMeshSlot::IsTransparent;
+00100 
+00101                 // MeshGeom
+00102                 nlassert (mbuild.LodMeshes[slot].MeshGeom);
+00103 
+00104                 // Valid pointer ?
+00105                 if (_MeshVector[slot].Flags&CMeshSlot::CoarseMesh)
+00106                 {
+00107                         // If it is a coarse mesh, it must be a CMeshGeom.
+00108                         if (dynamic_cast<CMeshGeom*>(mbuild.LodMeshes[slot].MeshGeom)==NULL)
+00109                         {
+00110                                 // If it is a coarse mesh, it must be a CMeshGeom.
+00111                                 _MeshVector[slot].MeshGeom = NULL;
+00112                                 delete mbuild.LodMeshes[slot].MeshGeom;
+00113                         }
+00114                         else
+00115                                 // Ok, no prb
+00116                                 _MeshVector[slot].MeshGeom = mbuild.LodMeshes[slot].MeshGeom;
+00117                 }
+00118                 else
+00119                         // Ok, no prb
+00120                         _MeshVector[slot].MeshGeom = mbuild.LodMeshes[slot].MeshGeom;   
+00121         }
+00122 
+00123         // Sort the slot by the distance...
+00124         for (int i=mbuild.LodMeshes.size()-1; i>0; i--)
+00125         for (int j=0; j<i; j++)
+00126         {
+00127                 // Bad sort ?
+00128                 if (_MeshVector[j].DistMax>_MeshVector[j+1].DistMax)
+00129                 {
+00130                         // Exchange slots
+00131                         CMeshSlot tmp=_MeshVector[j];
+00132                         _MeshVector[j]=_MeshVector[j+1];
+00133                         _MeshVector[j+1]=tmp;
+00134                         tmp.MeshGeom=NULL;
+00135                 }
+00136         }
+00137 
+00138         // Calc start and end polygon count
+00139         for (uint k=0; k<mbuild.LodMeshes.size(); k++)
+00140         {
+00141                 // Get start distance
+00142                 float startDist;
+00143                 if (k==0)
+00144                         startDist=0;
+00145                 else 
+00146                         startDist=_MeshVector[k-1].DistMax;
+00147 
+00148                 // Get start poly count
+00149                 float startPolyCount;
+00150                 startPolyCount=_MeshVector[k].MeshGeom->getNumTriangles (startDist);
+00151 
+00152                 // Get end distance
+00153                 float endDist=_MeshVector[k].DistMax;
+00154 
+00155                 // Get end poly count
+00156                 if (k==mbuild.LodMeshes.size()-1)
+00157                 {
+00158                         _MeshVector[k].EndPolygonCount=_MeshVector[k].MeshGeom->getNumTriangles (endDist);
+00159                         if (startPolyCount==_MeshVector[k].EndPolygonCount)
+00160                                 _MeshVector[k].EndPolygonCount=startPolyCount/2;
+00161                 }
+00162                 else 
+00163                         _MeshVector[k].EndPolygonCount=_MeshVector[k+1].MeshGeom->getNumTriangles (endDist);
+00164 
+00165                 // Calc A
+00166                 if (endDist==startDist)
+00167                         _MeshVector[k].A=0;
+00168                 else
+00169                         _MeshVector[k].A=(_MeshVector[k].EndPolygonCount-startPolyCount)/(endDist-startDist);
+00170 
+00171                 // Calc A
+00172                 _MeshVector[k].B=_MeshVector[k].EndPolygonCount-_MeshVector[k].A*endDist;
+00173         }
+00174 
+00175         // End: compile some stuff
+00176         compileDistMax();
+00177         compileCoarseMeshes();
+00178 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CMeshBase::buildMeshBase CMeshBaseBuild m  )  [protected, inherited]
+
+ + + + + +
+   + + +

+Just copy informations from a CMeshBaseBuild. +

+Copy default position values +

+Definition at line 226 of file mesh_base.cpp. +

+References NL3D::CMeshBase::_AnimatedMaterials, NL3D::CMeshBase::_AnimatedMorph, NL3D::CMeshBase::_DefaultPivot, NL3D::CMeshBase::_DefaultRotEuler, NL3D::CMeshBase::_DefaultRotQuat, NL3D::CMeshBase::_DefaultScale, NL3D::CMeshBase::_LightInfos, NL3D::CMeshBase::_UseLightingLocalAttenuation, NL3D::CMeshBase::CMeshBaseBuild::BSNames, NL3D::CMeshBase::computeIsLightable(), NL3D::CMeshBase::CMeshBaseBuild::DefaultBSFactors, NL3D::CMeshBase::CMeshBaseBuild::DefaultPivot, NL3D::CMeshBase::CMeshBaseBuild::DefaultPos, NL3D::CMeshBase::CMeshBaseBuild::DefaultRotEuler, NL3D::CMeshBase::CMeshBaseBuild::DefaultRotQuat, NL3D::CMeshBase::CMeshBaseBuild::DefaultScale, NL3D::CMeshBase::CMeshBaseBuild::LightInfoMap, NL3D::CMeshBase::CMeshBaseBuild::Materials, NL3D::CTrackDefaultBlendable< CQuat >::setValue(), NL3D::CTrackDefaultBlendable< CVector >::setValue(), uint32, and NL3D::CMeshBase::CMeshBaseBuild::UseLightingLocalAttenuation. +

+

00227 {
+00228         // Copy light information
+00229         _LightInfos = m.LightInfoMap;
+00230 
+00231         // copy the materials.
+00232         _Materials= m.Materials;
+00233 
+00234         // clear the animated materials.
+00235         _AnimatedMaterials.clear();
+00236 
+00238         _DefaultPos.setValue (m.DefaultPos);
+00239         _DefaultPivot.setValue (m.DefaultPivot);
+00240         _DefaultRotEuler.setValue (m.DefaultRotEuler);
+00241         _DefaultRotQuat.setValue (m.DefaultRotQuat);
+00242         _DefaultScale.setValue (m.DefaultScale);
+00243 
+00244         _AnimatedMorph  .resize(m.DefaultBSFactors.size());
+00245         for (uint32 i = 0; i < m.DefaultBSFactors.size(); ++i)
+00246         {
+00247                 _AnimatedMorph[i].DefaultFactor.setValue (m.DefaultBSFactors[i]);
+00248                 _AnimatedMorph[i].Name = m.BSNames[i];
+00249         }
+00250 
+00251         // update _IsLightable flag.
+00252         computeIsLightable();
+00253         // copy _UseLightingLocalAttenuation
+00254         _UseLightingLocalAttenuation= m.UseLightingLocalAttenuation;
+00255 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CMeshMultiLod::changeMRMDistanceSetup float  distanceFinest,
float  distanceMiddle,
float  distanceCoarsest
+
+ + + + + +
+   + + +

+Change MRM Distance setup of the Lod 0 only. No op if the lod0 is not a CMeshMRMGeom NB: no-op if distanceFinest<0, distanceMiddle<=distanceFinest or if distanceCoarsest<=distanceMiddle.

Parameters:
+ + + + +
distanceFinest The MRM has its max faces when dist<=distanceFinest.
distanceMiddle The MRM has 50% of its faces at dist==distanceMiddle.
distanceCoarsest The MRM has faces/Divisor (ie near 0) when dist>=distanceCoarsest.
+
+ +

+Definition at line 609 of file mesh_multi_lod.cpp. +

+References _MeshVector, NL3D::CMeshMRMGeom::changeMRMDistanceSetup(), and getNumSlotMesh(). +

+Referenced by NL3D::CMeshMultiLodInstance::changeMRMDistanceSetup(). +

+

00610 {
+00611         // no-op if empty.
+00612         if(getNumSlotMesh ()==0)
+00613                 return;
+00614 
+00615         // If not NULL
+00616         if(_MeshVector[0].MeshGeom==NULL)
+00617                 return;
+00618 
+00619         // verify it is a CMeshMRMGeom. else no-op.
+00620         CMeshMRMGeom    *mgeom= dynamic_cast<CMeshMRMGeom*>(_MeshVector[0].MeshGeom);
+00621         if(mgeom==NULL)
+00622                 return;
+00623         
+00624         // ok, setup.
+00625         mgeom->changeMRMDistanceSetup(distanceFinest, distanceMiddle, distanceCoarsest);
+00626 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CMeshMultiLod::clear  )  [private]
+
+ + + + + +
+   + + +

+Clear the mesh. +

+ +

+Definition at line 403 of file mesh_multi_lod.cpp. +

+References _MeshVector. +

+Referenced by build(). +

+

00404 {
+00405         _MeshVector.clear ();
+00406 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NL3D::CMeshMultiLod::clip const std::vector< CPlane > &  pyramid,
const CMatrix worldMatrix
[virtual]
+
+ + + + + +
+   + + +

+clip this mesh in a driver. +

+ +

+Reimplemented from NL3D::IShape. +

+Definition at line 211 of file mesh_multi_lod.cpp. +

+References _MeshVector, NL3D::IMeshGeom::clip(), NL3D::CMeshMultiLod::CMeshSlot::MeshGeom, and uint. +

+

00212 {
+00213         // Look for the biggest mesh
+00214         uint meshCount=_MeshVector.size();
+00215         for (uint i=0; i<meshCount; i++)
+00216         {
+00217                 // Ref on slot
+00218                 CMeshSlot &slot=_MeshVector[i];
+00219 
+00220                 // Is mesh present ?
+00221                 if (slot.MeshGeom)
+00222                 {
+00223                         // Clip this mesh
+00224                         return slot.MeshGeom->clip (pyramid, worldMatrix);
+00225                 }
+00226         }
+00227         return true;
+00228 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CMeshMultiLod::compileCoarseMeshes  )  [private]
+
+ + + + + +
+   + + +

+compile Coarse Meshs when builded/loaded. +

+ +

+Definition at line 765 of file mesh_multi_lod.cpp. +

+References _MeshVector, NL3D::CMeshMultiLod::CMeshSlot::CoarseNumTris, NL3D::CMeshMultiLod::CMeshSlot::CoarseTriangles, NL3D::CMeshMultiLod::CMeshSlot::Flags, NL3D::CMeshGeom::getNbMatrixBlock(), NL3D::CMeshGeom::getNbRdrPass(), NL3D::CPrimitiveBlock::getNumTri(), NL3D::CMeshGeom::getRdrPassPrimitiveBlock(), NL3D::CPrimitiveBlock::getTriPointer(), NL3D::CMeshMultiLod::CMeshSlot::MeshGeom, uint, and uint32. +

+Referenced by build(). +

+

00766 {
+00767         // For All Slots that are CoarseMeshes.
+00768         for(uint i=0;i<_MeshVector.size();i++)
+00769         {
+00770                 CMeshSlot       &slotRef= _MeshVector[i];
+00771                 if( slotRef.Flags & CMeshSlot::CoarseMesh )
+00772                 {
+00773                         // reset
+00774                         slotRef.CoarseNumTris= 0;
+00775 
+00776                         // Get a pointer on the geom mesh
+00777                         CMeshGeom *meshGeom= safe_cast<CMeshGeom*>(slotRef.MeshGeom);
+00778 
+00779                         // For All RdrPass of the 1st matrix block
+00780                         if( meshGeom->getNbMatrixBlock()>0 )
+00781                         {
+00782                                 // 1st count
+00783                                 for(uint i=0;i<meshGeom->getNbRdrPass(0);i++)
+00784                                 {
+00785                                         slotRef.CoarseNumTris+= meshGeom->getRdrPassPrimitiveBlock(0, i).getNumTri();
+00786                                 }
+00787 
+00788                                 // 2snd allocate and fill
+00789                                 if( slotRef.CoarseNumTris )
+00790                                 {
+00791                                         slotRef.CoarseTriangles.resize(slotRef.CoarseNumTris * 3);
+00792                                         uint32  *dstPtr= &slotRef.CoarseTriangles[0];
+00793                                         for(uint i=0;i<meshGeom->getNbRdrPass(0);i++)
+00794                                         {
+00795                                                 const CPrimitiveBlock   &pb= meshGeom->getRdrPassPrimitiveBlock(0, i);
+00796                                                 uint    numTris= pb.getNumTri();
+00797                                                 memcpy(dstPtr, pb.getTriPointer(), numTris*3*sizeof(uint32));
+00798                                                 dstPtr+= numTris*3;
+00799                                         }
+00800                                 }
+00801                         }
+00802                 }
+00803         }
+00804 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CMeshMultiLod::compileDistMax  )  [private]
+
+ + + + + +
+   + + +

+copileDistMax when builded/loaded. +

+ +

+Definition at line 587 of file mesh_multi_lod.cpp. +

+References _MeshVector. +

+Referenced by build(). +

+

00588 {
+00589         // Last element
+00590         std::vector<CMeshSlot>::const_iterator ite=_MeshVector.end();
+00591         ite--;
+00592         if (ite!=_MeshVector.end())
+00593                 IShape::_DistMax= ite->DistMax;
+00594         else
+00595                 IShape::_DistMax= -1;
+00596 }
+
+

+ + + + +
+ + + + + + + + + + +
CTransformShape * NL3D::CMeshMultiLod::createInstance CScene scene  )  [virtual]
+
+ + + + + +
+   + + +

+Create a CMeshInstance, which contains materials. +

+ +

+Reimplemented from NL3D::IShape. +

+Definition at line 182 of file mesh_multi_lod.cpp. +

+References NL3D::CMeshMultiLodInstance::_LastLodMatrixDate, _MeshVector, NL3D::CScene::createModel(), NL3D::CMeshMultiLodInstance::initRenderFilterType(), instanciateCoarseMeshSpace(), NL3D::CTransformShape::Shape, and uint. +

+

00183 {
+00184         // Create a CMeshInstance, an instance of a multi lod mesh.
+00185         CMeshMultiLodInstance *mi=(CMeshMultiLodInstance*)scene.createModel(NL3D::MeshMultiLodInstanceId);
+00186         mi->Shape= this;
+00187         mi->_LastLodMatrixDate=0;
+00188 
+00189         // instanciate the material part of the Mesh, ie the CMeshBase.
+00190         CMeshBase::instanciateMeshBase(mi, &scene);
+00191 
+00192         // Create the necessary space for Coarse Instanciation
+00193         instanciateCoarseMeshSpace(mi);
+00194 
+00195         // For all lods, do some instance init for MeshGeom
+00196         for(uint i=0; i<_MeshVector.size(); i++)
+00197         {
+00198                 if(_MeshVector[i].MeshGeom)
+00199                         _MeshVector[i].MeshGeom->initInstance(mi);
+00200         }
+00201 
+00202         // init the Filter type
+00203         mi->initRenderFilterType();
+00204 
+00205 
+00206         return mi;
+00207 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CMeshBase::flushTextures IDriver driver,
uint  selectedTexture
[virtual, inherited]
+
+ + + + + +
+   + + +

+Flush textures. +

+Flush material textures +

+Implements NL3D::IShape. +

+Definition at line 392 of file mesh_base.cpp. +

+References uint. +

+

00393 {
+00394         // Mat count
+00395         uint matCount=_Materials.size();
+00396 
+00397         // Flush each material textures
+00398         for (uint mat=0; mat<matCount; mat++)
+00399         {
+00401                 _Materials[mat].flushTextures (driver, selectedTexture);
+00402         }
+00403 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CMeshMultiLod::getAABBox NLMISC::CAABBox bbox  )  const [virtual]
+
+ + + + + +
+   + + +

+Get bbox. +

+ +

+Reimplemented from NL3D::IShape. +

+Definition at line 383 of file mesh_multi_lod.cpp. +

+References _MeshVector, count, and uint. +

+

00384 {
+00385         // Get count
+00386         uint count=_MeshVector.size();
+00387         for (uint slot=0; slot<count; slot++)
+00388         {
+00389                 // Shape ?
+00390                 if (_MeshVector[slot].MeshGeom)
+00391                 {
+00392                         // Get the bounding box
+00393                         bbox=_MeshVector[slot].MeshGeom->getBoundingBox().getAABBox();
+00394 
+00395                         // ok
+00396                         break;
+00397                 }
+00398         }
+00399 }
+
+

+ + + + +
+ + + + + + + + + + +
CMaterialBase * NL3D::CMeshBase::getAnimatedMaterial uint  id  )  [inherited]
+
+ + + + + +
+   + + +

+return NULL if this material is NOT animated. (or if material do not exist) +

+ +

+Definition at line 90 of file mesh_base.cpp. +

+References NL3D::CMeshBase::_AnimatedMaterials, and uint. +

+

00091 {
+00092         TAnimatedMaterialMap::iterator  it;
+00093         it= _AnimatedMaterials.find(id);
+00094         if(it!=_AnimatedMaterials.end())
+00095                 return &it->second;
+00096         else
+00097                 return NULL;
+00098 }
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::CMeshBase::getAutoAnim  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 212 of file mesh_base.h. +

+References NL3D::CMeshBase::_AutoAnim. +

+Referenced by NL3D::CScene::createInstance(), and NL3D::CMeshBaseInstance::traverseHrc(). +

+

00212 { return _AutoAnim; }
+
+

+ + + + +
+ + + + + + + + + +
virtual std::string NLMISC::IClassable::getClassName  )  [pure virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implemented in NLAIAGENT::CNumericIndex, NLAIC::IPointerGestion, NLAIC::CIdentType, and CAutomataDesc. +

+Referenced by NLMISC::CClassRegistry::checkObject(), and NL3D::GetTextureSize().

+

+ + + + +
+ + + + + + + + + +
CTrackDefaultRGBA* NL3D::CMeshBase::getDefaultLMFactor  )  [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 166 of file mesh_base.h. +

+References NL3D::CMeshBase::_DefaultLMFactor. +

+

00166 {return &_DefaultLMFactor;}
+
+

+ + + + +
+ + + + + + + + + +
CTrackDefaultVector* NL3D::CMeshBase::getDefaultPivot  )  [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 162 of file mesh_base.h. +

+References NL3D::CMeshBase::_DefaultPivot. +

+Referenced by NL3D::CMeshBaseInstance::getDefaultTrack(). +

+

00162 {return &_DefaultPivot;}
+
+

+ + + + +
+ + + + + + + + + +
CTrackDefaultVector* NL3D::CMeshBase::getDefaultPos  )  [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 161 of file mesh_base.h. +

+Referenced by NL3D::CMeshBaseInstance::getDefaultTrack(). +

+

00161 {return &_DefaultPos;}
+
+

+ + + + +
+ + + + + + + + + +
CTrackDefaultVector* NL3D::CMeshBase::getDefaultRotEuler  )  [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 163 of file mesh_base.h. +

+References NL3D::CMeshBase::_DefaultRotEuler. +

+Referenced by NL3D::CMeshBaseInstance::getDefaultTrack(). +

+

00163 {return &_DefaultRotEuler;}
+
+

+ + + + +
+ + + + + + + + + +
CTrackDefaultQuat* NL3D::CMeshBase::getDefaultRotQuat  )  [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 164 of file mesh_base.h. +

+References NL3D::CMeshBase::_DefaultRotQuat. +

+Referenced by NL3D::CMeshBaseInstance::getDefaultTrack(). +

+

00164 {return &_DefaultRotQuat;}
+
+

+ + + + +
+ + + + + + + + + +
CTrackDefaultVector* NL3D::CMeshBase::getDefaultScale  )  [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 165 of file mesh_base.h. +

+References NL3D::CMeshBase::_DefaultScale. +

+Referenced by NL3D::CMeshBaseInstance::getDefaultTrack(). +

+

00165 {return &_DefaultScale;}
+
+

+ + + + +
+ + + + + + + + + +
float NL3D::IShape::getDistMax  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+return the DistMax where the shape is no more displayed. Default is to return -1, meaning DistMax = infinite. +

+Definition at line 112 of file shape.h. +

+

00112 {return _DistMax;}
+
+

+ + + + +
+ + + + + + + + + +
const CLodCharacterTexture* NL3D::CMeshBase::getLodCharacterTexture  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+get the lod texture info. see CSkeletonModel Lod system. NULL per default. NB: serialised +

+ +

+Definition at line 223 of file mesh_base.h. +

+References NL3D::CMeshBase::_LodCharacterTexture. +

+Referenced by NL3D::CSkeletonModel::computeLodTexture(). +

+

00223 {return _LodCharacterTexture;}
+
+

+ + + + +
+ + + + + + + + + + +
const CMaterial& NL3D::CMeshBase::getMaterial uint  id  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+Get a material, const version. +

+ +

+Definition at line 184 of file mesh_base.h. +

+References uint. +

+

00185         {
+00186                 return _Materials[id];
+00187         }
+
+

+ + + + +
+ + + + + + + + + + +
CMaterial& NL3D::CMeshBase::getMaterial uint  id  )  [inline, inherited]
+
+ + + + + +
+   + + +

+Get a material. +

+ +

+Definition at line 179 of file mesh_base.h. +

+References uint. +

+Referenced by NL3D::CZoneLighter::addTriangles(), NL3D::CCoarseMeshBuild::buildBitmap(), NL3D::CPSConstraintMesh::CMeshDisplayShare::buildRdrPassSet(), NL3D::CheckForLightableFacesInMesh(), NL3D::CheckForOpaqueAndTransparentFacesInMesh(), NL3D::CShapeBank::processWaitingShapes(), NL3D::CCoarseMeshBuild::remapCoordinates(), NL3D::CAsyncFileManager3D::CMeshLoad::run(), and NL3D::CMeshBaseInstance::selectTextureSet(). +

+

00180         {
+00181                 return _Materials[id];
+00182         }
+
+

+ + + + +
+ + + + + + + + + + +
const IMeshGeom & NL3D::CMeshMultiLod::getMeshGeom uint  slot  )  const
+
+ + + + + +
+   + + +

+Geometry accessor. +

+ +

+Definition at line 599 of file mesh_multi_lod.cpp. +

+References _MeshVector, getNumSlotMesh(), nlassert, and uint. +

+Referenced by NL3D::CZoneLighter::addTriangles(), NL3D::CInstanceLighter::addTriangles(), and NL3D::UShape::getMeshTriangles(). +

+

00600 {
+00601         // Checks
+00602         nlassert (slot<getNumSlotMesh ());
+00603 
+00604         return *_MeshVector[slot].MeshGeom;
+00605 }
+
+

+ + + + +
+ + + + + + + + + +
uint NL3D::CMeshBase::getNbMaterial  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+Get the number of materials in the mesh. +

+ +

+Definition at line 173 of file mesh_base.h. +

+References uint. +

+Referenced by NL3D::CShapeBank::processWaitingShapes(), NL3D::CAsyncFileManager3D::CMeshLoad::run(), and NL3D::CMeshBaseInstance::selectTextureSet(). +

+

00174         {
+00175                 return _Materials.size();
+00176         }
+
+

+ + + + +
+ + + + + + + + + +
uint NL3D::CMeshMultiLod::getNumSlotMesh  )  const [inline]
+
+ + + + + +
+   + + +

+Get slot mesh count. +

+ +

+Definition at line 144 of file mesh_multi_lod.h. +

+References _MeshVector, and uint. +

+Referenced by changeMRMDistanceSetup(), getMeshGeom(), NL3D::UShape::getMeshTriangles(), and NL3D::CMeshMultiLodInstance::initRenderFilterType(). +

+

00145         {
+00146                 return _MeshVector.size();
+00147         }
+
+

+ + + + +
+ + + + + + + + + + +
virtual float NL3D::CMeshMultiLod::getNumTriangles float  distance  )  [inline, virtual]
+
+ + + + + +
+   + + +

+should not be called direclty as the intance of this shape will use 'getNumTrianglesWithCoarsestDist' themselves to get the correct distance. +

+ +

+Implements NL3D::IShape. +

+Definition at line 180 of file mesh_multi_lod.h. +

+References getNumTrianglesWithCoarsestDist(). +

+

00181         {
+00182                 return getNumTrianglesWithCoarsestDist(distance, -1);
+00183         }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
float NL3D::CMeshMultiLod::getNumTrianglesWithCoarsestDist float  distance,
float  coarsestMeshDist
const
+
+ + + + + +
+   + + +

+ +

+Definition at line 320 of file mesh_multi_lod.cpp. +

+References _MeshVector, NL3D::CMeshMultiLod::CMeshSlot::A, NL3D::CMeshMultiLod::CMeshSlot::B, NL3D::CMeshMultiLod::CMeshSlot::MeshGeom, and uint. +

+Referenced by NL3D::CMeshMultiLodInstance::getNumTriangles(), and getNumTriangles(). +

+

00321 {
+00322         // Look in the table for good distances..
+00323         uint meshCount=_MeshVector.size();
+00324         
+00325         // At least on mesh
+00326         if (meshCount>0)
+00327         {       
+00328                 
+00329                 if (coarsestMeshDist != -1)
+00330                 {
+00331                         if (coarsestMeshDist != 0)
+00332                         {
+00333                                 // rescale distance to new coarse mesh distance..
+00334                                 distance *= _MeshVector[meshCount - 1].DistMax / coarsestMeshDist;
+00335                         }
+00336                 }               
+00337 
+00338                 uint i=0;               
+00339                 // Look for good i
+00340                 while ( _MeshVector[i].DistMax < distance)
+00341                 {
+00342                         if (i==meshCount-1)
+00343                                 // Abort if last one
+00344                                 break;
+00345                         i++;
+00346                 }
+00347 
+00348                 // Ref on slot
+00349                 const CMeshSlot &slot=_MeshVector[i];
+00350 
+00351                 // Is mesh present ?
+00352                 if (slot.MeshGeom)
+00353                 {
+00354                         // Get the polygon count with the distance
+00355                         float polyCount=slot.A * distance + slot.B;
+00356 
+00357                         /*// Get the perfect polygon count in this slot for the asked distance
+00358                         float goodPolyCount=slot.MeshGeom->getNumTriangles (distance);
+00359 
+00360                         // Get the next slot perfect polygon count
+00361                         float realEndPolyCount;
+00362 
+00363                         // Last slot ?
+00364                         if ( (i<meshCount-1) && _MeshVector[i+1].MeshGeom )
+00365                                 // Take end number polygon count in the next slot
+00366                                 realEndPolyCount=_MeshVector[i+1].MeshGeom->getNumTriangles (slot.DistMax);
+00367                         else
+00368                                 // Take end number polygon count in the this slot
+00369                                 realEndPolyCount=slot.EndPolygonCount;
+00370 
+00371                         // Return blended polygon count to have a continous decreasing function
+00372                         return (goodPolyCount-slot.BeginPolygonCount) * (realEndPolyCount-slot.BeginPolygonCount) / 
+00373                                 (slot.EndPolygonCount-slot.BeginPolygonCount) + slot.BeginPolygonCount;*/
+00374                         return polyCount;
+00375                 }
+00376         }
+00377 
+00378         return 0;
+00379 }
+
+

+ + + + +
+ + + + + + + + + +
const sint& NLMISC::CRefCount::getRefCount  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 70 of file smart_ptr.h. +

+References NLMISC::CRefCount::crefs, and sint. +

+

00071         {
+00072                 return  crefs;
+00073         }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
IMeshGeom* NL3D::CMeshMultiLod::getSlotMesh uint  i,
bool &  coarseMesh
[inline]
+
+ + + + + +
+   + + +

+Get a slot mesh. +

+ +

+Definition at line 150 of file mesh_multi_lod.h. +

+References _MeshVector, and uint. +

+Referenced by NL3D::CMeshMultiLodInstance::initRenderFilterType(). +

+

00151         {
+00152                 // Coarse mesh ?
+00153                 coarseMesh=(_MeshVector[i].Flags&CMeshSlot::CoarseMesh)!=0;
+00154 
+00155                 // Return the mesh pointer
+00156                 return _MeshVector[i].MeshGeom;
+00157         }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CMeshMultiLod::instanciateCoarseMeshSpace CMeshMultiLodInstance mi  )  [private]
+
+ + + + + +
+   + + +

+called at createInstance() time +

+ +

+Definition at line 740 of file mesh_multi_lod.cpp. +

+References NL3D::CMeshMultiLodInstance::_CoarseMeshVB, _MeshVector, NL3D::CMeshMultiLod::CMeshSlot::Flags, NL3D::CScene::getCoarseMeshManager(), NL3D::CVertexBuffer::getNumVertices(), NL3D::CTransform::getOwnerScene(), NL3D::CMeshGeom::getVertexBuffer(), NL3D::CCoarseMeshManager::getVertexSize(), NL3D::CMeshMultiLod::CMeshSlot::MeshGeom, and uint. +

+Referenced by createInstance(). +

+

00741 {
+00742         CCoarseMeshManager      *manager= mi->getOwnerScene()->getCoarseMeshManager();
+00743 
+00744         if(manager)
+00745         {
+00746                 // For all MeshSlots that have a CoarseMesh, count max Coarse NumVertices;
+00747                 uint    numVertices= 0;
+00748                 for(uint i=0;i<_MeshVector.size();i++)
+00749                 {
+00750                         CMeshSlot       &slotRef= _MeshVector[i];
+00751                         if( slotRef.Flags & CMeshSlot::CoarseMesh )
+00752                         {
+00753                                 // Get a pointer on the geom mesh
+00754                                 CMeshGeom *meshGeom= safe_cast<CMeshGeom*>(slotRef.MeshGeom);
+00755                                 numVertices= max(numVertices, (uint)meshGeom->getVertexBuffer().getNumVertices() );
+00756                         }
+00757                 }
+00758 
+00759                 // Then allocate vertex space for dest manager vertex size.
+00760                 mi->_CoarseMeshVB.resize( numVertices*manager->getVertexSize() );
+00761         }
+00762 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CMeshBase::instanciateMeshBase CMeshBaseInstance mi,
CScene ownerScene
[protected, inherited]
+
+ + + + + +
+   + + +

+instanciate MeshBase part to an instance (a CMeshBaseInstance). +

+ +

+Definition at line 261 of file mesh_base.cpp. +

+References NL3D::CMeshBase::_AnimatedMaterials, NL3D::CMeshBaseInstance::_AnimatedMaterials, NL3D::CMeshBase::_AnimatedMorph, NL3D::CMeshBaseInstance::_AnimatedMorphFactor, NL3D::CMeshBase::_DefaultPivot, NL3D::CMeshBase::_DefaultRotQuat, NL3D::CMeshBase::_DefaultScale, NL3D::CMeshBaseInstance::AsyncTextures, NL3D::CAnimatedValueQuat, NL3D::CAnimatedValueVector, NL3D::CTrackDefaultBlendable< CQuat >::getValue(), NL3D::CTrackDefaultBlendable< CVector >::getValue(), NL3D::CMeshBaseInstance::Materials, nlassert, NL3D::CMeshBaseInstance::selectTextureSet(), NL3D::IAnimatable::setFather(), NL3D::CTransform::setIsBigLightable(), NL3D::CTransform::setIsLightable(), NL3D::CAnimatedMaterial::setMaterial(), NL3D::CTransform::setOpacity(), NL3D::CTransform::setTransparency(), and uint32. +

+

00262 {
+00263         uint32 i;
+00264 
+00265 
+00266         // setup animated blendShapes
+00267         //===========================
+00268         mi->_AnimatedMorphFactor.reserve(_AnimatedMorph.size());
+00269         for(i = 0; i < _AnimatedMorph.size(); ++i)
+00270         {
+00271                 CAnimatedMorph am(&_AnimatedMorph[i]);
+00272                 mi->_AnimatedMorphFactor.push_back (am);
+00273         }
+00274         
+00275         // setup materials.
+00276         //=================
+00277         // Copy material. Textures are referenced only
+00278         mi->Materials= _Materials;
+00279 
+00280         // Instanciate selectable textures (use default set)
+00281         mi->selectTextureSet(0);
+00282 
+00283         // prepare possible AsyncTextures
+00284         mi->AsyncTextures.resize(_Materials.size());
+00285 
+00286         // setup animated materials.
+00287         //==========================
+00288         TAnimatedMaterialMap::iterator  it;
+00289         mi->_AnimatedMaterials.reserve(_AnimatedMaterials.size());
+00290         for(it= _AnimatedMaterials.begin(); it!= _AnimatedMaterials.end(); it++)
+00291         {
+00292                 CAnimatedMaterial       aniMat(&it->second);
+00293 
+00294                 // set the target instance material.
+00295                 nlassert(it->first < mi->Materials.size());
+00296                 aniMat.setMaterial(&mi->Materials[it->first]);
+00297 
+00298                 // Must set the Animatable father of the animated material (the mesh_base_instance!).
+00299                 aniMat.setFather(mi, CMeshBaseInstance::OwnerBit);
+00300 
+00301                 // Append this animated material.
+00302                 mi->_AnimatedMaterials.push_back(aniMat);
+00303         }
+00304 
+00305         // Misc
+00306         //==========================
+00307         
+00308         // Setup position with the default value
+00309         mi->ITransformable::setPos( ((CAnimatedValueVector&)_DefaultPos.getValue()).Value  );
+00310         mi->ITransformable::setRotQuat( ((CAnimatedValueQuat&)_DefaultRotQuat.getValue()).Value  );
+00311         mi->ITransformable::setScale( ((CAnimatedValueVector&)_DefaultScale.getValue()).Value  );
+00312         mi->ITransformable::setPivot( ((CAnimatedValueVector&)_DefaultPivot.getValue()).Value  );
+00313 
+00314         // Check materials for transparency
+00315         mi->setTransparency( false );
+00316         mi->setOpacity( false );
+00317         for( i = 0; i < mi->Materials.size(); ++i )
+00318         if( mi->Materials[i].getBlend() )
+00319                 mi->setTransparency( true );
+00320         else
+00321                 mi->setOpacity( true );
+00322 
+00323         // if the mesh is lightable, then the instance is
+00324         mi->setIsLightable(this->isLightable());
+00325 
+00326         // a mesh is considered big for lightable if it uses localAttenuation
+00327         mi->setIsBigLightable(this->useLightingLocalAttenuation());
+00328 
+00329 }
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::CMeshBase::isLightable  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+Is this mesh lightable? true if one of his materials is not a lightmap. NB: result stored in file. +

+ +

+Definition at line 198 of file mesh_base.h. +

+References NL3D::CMeshBase::_IsLightable. +

+Referenced by NL3D::CInstanceLighter::light(). +

+

00198 {return _IsLightable;}
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::CMeshMultiLod::isStatic  )  const [inline]
+
+ + + + + +
+   + + +

+Is static mesh ? +

+ +

+Definition at line 160 of file mesh_multi_lod.h. +

+References _StaticLod. +

+

00161         {
+00162                 return _StaticLod;
+00163         }
+
+

+ + + + +
+ + + + + + + + + + +
NL3D::CMeshMultiLod::NLMISC_DECLARE_CLASS CMeshMultiLod   ) 
+
+ + + + + +
+   + + +

+Declare name of the shape. +

+

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CMeshMultiLod::profileMeshGeom uint  slot,
CRenderTrav rdrTrav,
CMeshMultiLodInstance trans,
float  numPoylgons,
uint32  rdrFlags
[private]
+
+ + + + + +
+   + + +

+Profile the MeshGeom of a slot, even if coarseMesh. +

+ +

+Definition at line 661 of file mesh_multi_lod.cpp. +

+References _MeshVector, NL3D::CMeshMultiLod::CMeshSlot::Flags, NL3D::CMeshMultiLod::CMeshSlot::MeshGeom, NL3D::IMeshGeom::profileSceneRender(), uint, and uint32. +

+Referenced by profileSceneRender(). +

+

00662 {
+00663         // Ref
+00664         CMeshSlot &slotRef=_MeshVector[slot];
+00665 
+00666         // MeshGeom exist?
+00667         if (slotRef.MeshGeom)
+00668         {
+00669                 // NB Here, the meshGeom may still be a coarseMesh, but rendered through CMeshGeom
+00670                 if(slotRef.Flags&CMeshSlot::CoarseMesh)
+00671                 {
+00672                         // Render only for opaque material
+00673                         if(rdrFlags & IMeshGeom::RenderOpaqueMaterial)
+00674                         {
+00675                                 slotRef.MeshGeom->profileSceneRender(rdrTrav, trans, numPoylgons, rdrFlags);
+00676                         }
+00677                 }
+00678                 else
+00679                 {
+00680                         slotRef.MeshGeom->profileSceneRender(rdrTrav, trans, numPoylgons, rdrFlags);
+00681                 }
+00682         }
+00683 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CMeshMultiLod::profileSceneRender CRenderTrav rdrTrav,
CTransformShape trans,
bool  opaquePass
[virtual]
+
+ + + + + +
+   + + +

+profiling +

+ +

+Reimplemented from NL3D::IShape. +

+Definition at line 687 of file mesh_multi_lod.cpp. +

+References _MeshVector, NL3D::CMeshMultiLodInstance::Flags, NL3D::CMeshMultiLodInstance::Lod0, NL3D::CMeshMultiLodInstance::Lod1, nlassert, NL3D::CMeshMultiLodInstance::PolygonCountLod0, NL3D::CMeshMultiLodInstance::PolygonCountLod1, profileMeshGeom(), and uint32. +

+

00688 {
+00689         // Render good meshes
+00690         CMeshMultiLodInstance *instance=safe_cast<CMeshMultiLodInstance*>(trans);
+00691 
+00692 
+00693         // Second lod ?
+00694         if ( (instance->Lod1!=0xffffffff) && (passOpaque==false) )
+00695         {
+00696                 // build rdrFlags to rdr both transparent and opaque materials, 
+00697                 // use globalAlphaBlend, and disable ZWrite for Lod1
+00698                 uint32  rdrFlags= IMeshGeom::RenderOpaqueMaterial | IMeshGeom::RenderTransparentMaterial |
+00699                         IMeshGeom::RenderGlobalAlpha | IMeshGeom::RenderGADisableZWrite;
+00700                 // NB: very important to render Lod1 first, because Lod0 is still rendered with ZWrite enabled.
+00701                 profileMeshGeom (instance->Lod1, rdrTrav, instance, instance->PolygonCountLod1, rdrFlags);
+00702         }
+00703 
+00704 
+00705         // Have an opaque pass ?
+00706         if ( (instance->Flags&CMeshMultiLodInstance::Lod0Blend) == 0)
+00707         {
+00708                 // Is this slot a CoarseMesh?
+00709                 if ( _MeshVector[instance->Lod0].Flags&CMeshSlot::CoarseMesh )
+00710                 {
+00711                 }
+00712                 else
+00713                 {
+00714                         // build rdrFlags the normal way (as CMesh::render() for example)
+00715                         uint32  mask= (0-(uint32)passOpaque);
+00716                         uint32  rdrFlags;
+00717                         // select rdrFlags, without ifs.
+00718                         rdrFlags=       mask & (IMeshGeom::RenderOpaqueMaterial | IMeshGeom::RenderPassOpaque);
+00719                         rdrFlags|=      ~mask & (IMeshGeom::RenderTransparentMaterial);
+00720                         // Only render the normal way the first lod
+00721                         profileMeshGeom (instance->Lod0, rdrTrav, instance, instance->PolygonCountLod0, rdrFlags);
+00722                 }
+00723         }
+00724         else
+00725         {
+00726                 // Should not be in opaque
+00727                 nlassert (passOpaque==false);
+00728 
+00729                 // build rdrFlags to rdr both transparent and opaque materials, 
+00730                 // use globalAlphaBlend, BUT Don't disable ZWrite for Lod0
+00731                 uint32  rdrFlags= IMeshGeom::RenderOpaqueMaterial | IMeshGeom::RenderTransparentMaterial |
+00732                         IMeshGeom::RenderGlobalAlpha;
+00733 
+00734                 // Render first lod in blend mode. Don't disable ZWrite for Lod0
+00735                 profileMeshGeom (instance->Lod0, rdrTrav, instance, instance->PolygonCountLod0, rdrFlags);
+00736         }
+00737 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CMeshMultiLod::render IDriver drv,
CTransformShape trans,
bool  passOpaque
[virtual]
+
+ + + + + +
+   + + +

+render() this mesh in a driver. +

+ +

+Implements NL3D::IShape. +

+Definition at line 232 of file mesh_multi_lod.cpp. +

+References _MeshVector, NL3D::CMeshMultiLodInstance::BlendFactor, NL3D::CMeshMultiLodInstance::Flags, NL3D::CScene::getCoarseMeshManager(), NL3D::CTransform::getOwnerScene(), NL3D::CMeshMultiLodInstance::Lod0, NL3D::CMeshMultiLodInstance::Lod1, nlassert, NL3D::CMeshMultiLodInstance::PolygonCountLod0, NL3D::CMeshMultiLodInstance::PolygonCountLod1, renderCoarseMesh(), renderMeshGeom(), and uint32. +

+

00233 {
+00234         // Render good meshes
+00235         CMeshMultiLodInstance *instance=safe_cast<CMeshMultiLodInstance*>(trans);
+00236 
+00237         // Static or dynamic coarse mesh ?
+00238         CCoarseMeshManager *manager;
+00239         // Get the coarse mesh manager
+00240         manager=instance->getOwnerScene()->getCoarseMeshManager();
+00241 
+00242         // *** Render Lods
+00243 
+00244         // Second lod ?
+00245         if ( (instance->Lod1!=0xffffffff) && (passOpaque==false) )
+00246         {
+00247                 // build rdrFlags to rdr both transparent and opaque materials, 
+00248                 // use globalAlphaBlend, and disable ZWrite for Lod1
+00249                 uint32  rdrFlags= IMeshGeom::RenderOpaqueMaterial | IMeshGeom::RenderTransparentMaterial |
+00250                         IMeshGeom::RenderGlobalAlpha | IMeshGeom::RenderGADisableZWrite;
+00251                 // NB: very important to render Lod1 first, because Lod0 is still rendered with ZWrite enabled.
+00252                 renderMeshGeom (instance->Lod1, drv, instance, instance->PolygonCountLod1, rdrFlags, 1.f-instance->BlendFactor, manager);
+00253         }
+00254 
+00255 
+00256         // Have an opaque pass ?
+00257         if ( (instance->Flags&CMeshMultiLodInstance::Lod0Blend) == 0)
+00258         {
+00259                 // Is this slot a CoarseMesh?
+00260                 if ( _MeshVector[instance->Lod0].Flags&CMeshSlot::CoarseMesh )
+00261                 {
+00262                         // render as a CoarseMesh the lod 0, only in opaque pass
+00263                         if(passOpaque)
+00264                                 renderCoarseMesh (instance->Lod0, drv, instance, manager);
+00265                 }
+00266                 else
+00267                 {
+00268                         // build rdrFlags the normal way (as CMesh::render() for example)
+00269                         uint32  mask= (0-(uint32)passOpaque);
+00270                         uint32  rdrFlags;
+00271                         // select rdrFlags, without ifs.
+00272                         rdrFlags=       mask & (IMeshGeom::RenderOpaqueMaterial | IMeshGeom::RenderPassOpaque);
+00273                         rdrFlags|=      ~mask & (IMeshGeom::RenderTransparentMaterial);
+00274                         // Only render the normal way the first lod
+00275                         renderMeshGeom (instance->Lod0, drv, instance, instance->PolygonCountLod0, rdrFlags, 1, manager);
+00276                 }
+00277         }
+00278         else
+00279         {
+00280                 // Should not be in opaque
+00281                 nlassert (passOpaque==false);
+00282 
+00283                 // build rdrFlags to rdr both transparent and opaque materials, 
+00284                 // use globalAlphaBlend, BUT Don't disable ZWrite for Lod0
+00285                 uint32  rdrFlags= IMeshGeom::RenderOpaqueMaterial | IMeshGeom::RenderTransparentMaterial |
+00286                         IMeshGeom::RenderGlobalAlpha;
+00287 
+00288                 // Render first lod in blend mode. Don't disable ZWrite for Lod0
+00289                 renderMeshGeom (instance->Lod0, drv, instance, instance->PolygonCountLod0, rdrFlags, instance->BlendFactor, manager);
+00290         }
+00291 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CMeshMultiLod::renderCoarseMesh uint  slot,
IDriver drv,
CMeshMultiLodInstance trans,
CCoarseMeshManager manager
[private]
+
+ + + + + +
+   + + +

+Render the CoarseMesh of a slot. must be a coarseMesh, and shoudl be called only in passOpaque. +

+ +

+Definition at line 496 of file mesh_multi_lod.cpp. +

+References NL3D::CMeshMultiLodInstance::_CoarseMeshVB, NL3D::CMeshMultiLodInstance::_LastCoarseMesh, NL3D::CMeshMultiLodInstance::_LastCoarseMeshNumVertices, NL3D::CMeshMultiLodInstance::_LastLodLightingDate, NL3D::CMeshMultiLodInstance::_LastLodMatrixDate, _MeshVector, NL3D::CCoarseMeshManager::addMesh(), NL3D::CMeshMultiLod::CMeshSlot::CoarseNumTris, NL3D::CMeshMultiLod::CMeshSlot::CoarseTriangles, NL3D::CHrcTrav::CurrentDate, NL3D::CMeshMultiLod::CMeshSlot::Flags, NL3D::CCoarseMeshManager::flushRender(), NL3D::CMeshMultiLodInstance::getCoarseMeshLighting(), NL3D::CScene::getCoarseMeshLightingUpdate(), NL3D::CCoarseMeshManager::getColorOff(), NL3D::CScene::getFilterRenderFlags(), NL3D::CScene::getHrcTrav(), NL3D::ITransformable::getMatrix(), NL3D::CVertexBuffer::getNumVertices(), NL3D::CTransform::getOwnerScene(), NL3D::CCoarseMeshManager::getUVOff(), NL3D::CMeshGeom::getVertexBuffer(), NL3D::CCoarseMeshManager::getVertexSize(), NL3D::CMeshMultiLod::CMeshSlot::MeshGeom, nlassert, NL3D::CMeshMultiLodInstance::setColorCoarseMesh(), NL3D::CMeshMultiLodInstance::setPosCoarseMesh(), NL3D::CMeshMultiLodInstance::setUVCoarseMesh(), sint64, and uint. +

+Referenced by render(). +

+

00497 {
+00498         // if the manager is NULL, quit.
+00499         if(manager==NULL)
+00500                 return;
+00501 
+00502         // get the scene
+00503         CScene  *scene= trans->getOwnerScene();
+00504         if(!scene)
+00505                 return;
+00506 
+00507         // If filtered...
+00508         if( (scene->getFilterRenderFlags() & UScene::FilterCoarseMesh)==0 )
+00509                 return;
+00510 
+00511         // Ref
+00512         CMeshSlot &slotRef=_MeshVector[slot];
+00513 
+00514         // the slot must be a Coarse mesh
+00515         nlassert(slotRef.Flags&CMeshSlot::CoarseMesh);
+00516 
+00517         // Get a pointer on the geom mesh
+00518         CMeshGeom *meshGeom= safe_cast<CMeshGeom*>(slotRef.MeshGeom);
+00519 
+00520         // ** If not the same as Before (or if NULL before...)
+00521         if ( trans->_LastCoarseMesh!=meshGeom )
+00522         {
+00523                 uint    numVerts= meshGeom->getVertexBuffer().getNumVertices();
+00524                 uint    numTris= slotRef.CoarseNumTris;
+00525                 // If empty meshGeom, erase cache (each frame, ugly but error mgt here...)
+00526                 if( numTris==0 || numVerts==0 )
+00527                         trans->_LastCoarseMesh= NULL;
+00528                 else
+00529                 {
+00530                         // Cache
+00531                         trans->_LastCoarseMesh= meshGeom;
+00532                         trans->_LastCoarseMeshNumVertices= numVerts;
+00533 
+00534                         // Check setuped size.
+00535                         nlassert( trans->_CoarseMeshVB.size() >= numVerts*manager->getVertexSize() );
+00536 
+00537                         // Fill only UVs here. (Pos updated in Matrix pass. Color in Lighting Pass)
+00538                         trans->setUVCoarseMesh( *meshGeom, manager->getVertexSize(), manager->getUVOff() );
+00539 
+00540                         // Dirt the matrix
+00541                         trans->_LastLodMatrixDate=0;
+00542                         // Dirt the lighting. NB: period maximum is 255. Hence the -256, to ensure lighting compute now
+00543                         trans->_LastLodLightingDate= -0x100;
+00544                 }
+00545         }
+00546 
+00547         // ** If setuped, update and render
+00548         if( trans->_LastCoarseMesh )
+00549         {
+00550                 // Matrix has changed ?
+00551                 if ( trans->ITransformable::compareMatrixDate (trans->_LastLodMatrixDate) )
+00552                 {
+00553                         // Get date
+00554                         trans->_LastLodMatrixDate = trans->ITransformable::getMatrixDate();
+00555 
+00556                         // Set matrix
+00557                         trans->setPosCoarseMesh ( *meshGeom, trans->getMatrix(), manager->getVertexSize() );
+00558                 }
+00559 
+00560                 // Lighting: test if must update lighting, according to date of HrcTrav (num of CScene::render() call).
+00561                 sint64  currentDate= scene->getHrcTrav().CurrentDate;
+00562                 if( trans->_LastLodLightingDate < currentDate - scene->getCoarseMeshLightingUpdate() )
+00563                 {
+00564                         // reset the date.
+00565                         trans->_LastLodLightingDate= currentDate;
+00566 
+00567                         // get average sun color
+00568                         CRGBA   sunContrib= trans->getCoarseMeshLighting();
+00569 
+00570                         // Set color
+00571                         trans->setColorCoarseMesh ( sunContrib, manager->getVertexSize(), manager->getColorOff() );
+00572                 }
+00573 
+00574                 // Add dynamic to the manager
+00575                 if( !manager->addMesh(trans->_LastCoarseMeshNumVertices, &trans->_CoarseMeshVB[0], slotRef.CoarseNumTris, &slotRef.CoarseTriangles[0] ) )
+00576                 {
+00577                         // If failure, flush the manager
+00578                         manager->flushRender(drv);
+00579                         // then try to re-add. No-op if fails this time..
+00580                         manager->addMesh(trans->_LastCoarseMeshNumVertices, &trans->_CoarseMeshVB[0], slotRef.CoarseNumTris, &slotRef.CoarseTriangles[0]  );
+00581                 }
+00582         }
+00583 
+00584 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CMeshMultiLod::renderMeshGeom uint  slot,
IDriver drv,
CMeshMultiLodInstance trans,
float  numPoylgons,
uint32  rdrFlags,
float  alpha,
CCoarseMeshManager manager
[private]
+
+ + + + + +
+   + + +

+Render the MeshGeom of a slot, even if coarseMesh. +

+ +

+Definition at line 446 of file mesh_multi_lod.cpp. +

+References _MeshVector, alpha, NL3D::CMeshMultiLod::CMeshSlot::Flags, NL3D::CMeshMultiLodInstance::getCoarseMeshLighting(), NL3D::CCoarseMeshManager::getMaterial(), NL3D::CTransform::getWorldMatrix(), NL3D::CMeshMultiLod::CMeshSlot::MeshGeom, NL3D::CMeshBlender::prepareRenderForGlobalAlphaCoarseMesh(), NL3D::IMeshGeom::render(), NL3D::CMeshGeom::renderSimpleWithMaterial(), NL3D::CMeshBlender::restoreRenderCoarseMesh(), uint, and uint32. +

+Referenced by render(). +

+

00447 {
+00448         // Ref
+00449         CMeshSlot &slotRef=_MeshVector[slot];
+00450 
+00451         // MeshGeom exist?
+00452         if (slotRef.MeshGeom)
+00453         {
+00454                 // NB Here, the meshGeom may still be a coarseMesh, but rendered through CMeshGeom
+00455                 if(slotRef.Flags&CMeshSlot::CoarseMesh)
+00456                 {
+00457                         // Render only for opaque material
+00458                         if(manager && (rdrFlags & IMeshGeom::RenderOpaqueMaterial) )
+00459                         {
+00460                                 bool    gaDisableZWrite= (rdrFlags & IMeshGeom::RenderGADisableZWrite)?true:false;
+00461 
+00462                                 // Render the CoarseMesh with the manager material
+00463                                 CMaterial       &material= manager->getMaterial();
+00464 
+00465                                 // modulate material for alphaBlend transition
+00466                                 // ----------
+00467                                 // get average sun color for this coarseMesh
+00468                                 CRGBA   newCol= trans->getCoarseMeshLighting();
+00469 
+00470                                 // Use a CMeshBlender to modify material and driver.
+00471                                 CMeshBlender    blender;
+00472                                 blender.prepareRenderForGlobalAlphaCoarseMesh(material, drv, newCol, alpha, gaDisableZWrite);
+00473                                 
+00474 
+00475                                 // render simple the coarseMesh
+00476                                 CMeshGeom *meshGeom= safe_cast<CMeshGeom*>(slotRef.MeshGeom);
+00477                                 meshGeom->renderSimpleWithMaterial(drv, trans->getWorldMatrix(), material);
+00478 
+00479 
+00480                                 // resetup standard CoarseMeshMaterial material values
+00481                                 // ----------
+00482                                 // blender restore
+00483                                 blender.restoreRenderCoarseMesh(material, drv, gaDisableZWrite);
+00484                         }
+00485                 }
+00486                 else
+00487                 {
+00488                         // Render the geom mesh
+00489                         // Disable ZWrite only if in transition and for rendering Lod1
+00490                         slotRef.MeshGeom->render (drv, trans, numPoylgons, rdrFlags, alpha);
+00491                 }
+00492         }
+00493 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CMeshBase::resetLodCharacterTexture  )  [inherited]
+
+ + + + + +
+   + + +

+reset the lod texture info. see CSkeletonModel Lod system. +

+ +

+Definition at line 436 of file mesh_base.cpp. +

+References NL3D::CMeshBase::_LodCharacterTexture. +

+Referenced by NL3D::CMeshBase::applyMaterialUsageOptim(), NL3D::CMeshBase::setupLodCharacterTexture(), and NL3D::CMeshBase::~CMeshBase(). +

+

00437 {
+00438         if(_LodCharacterTexture)
+00439         {
+00440                 delete _LodCharacterTexture;
+00441                 _LodCharacterTexture= NULL;
+00442         }
+00443 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CMeshMultiLod::serial NLMISC::IStream f  )  throw (NLMISC::EStream) [virtual]
+
+ + + + + +
+   + + +

+serial this mesh. +

+ +

+Implements NLMISC::IStreamable. +

+Definition at line 295 of file mesh_multi_lod.cpp. +

+

00296 {
+00297         // Serial a version number
+00298         (void)f.serialVersion (0);
+00299 
+00300         // serial Materials infos contained in CMeshBase.
+00301         CMeshBase::serialMeshBase(f);
+00302 
+00303         // Static lod flag
+00304         f.serial (_StaticLod);
+00305 
+00306         // Serial the values
+00307         f.serialCont (_MeshVector);
+00308 
+00309 
+00310         // if reading, compile some stuff
+00311         if (f.isReading())
+00312         {
+00313                 compileDistMax();
+00314                 compileCoarseMeshes();
+00315         }
+00316 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CMeshBase::serialMeshBase NLMISC::IStream f  )  throw (NLMISC::EStream) [inherited]
+
+ + + + + +
+   + + +

+serial the base Part of this mesh. +

+ +

+Definition at line 149 of file mesh_base.cpp. +

+References NL3D::CMeshBase::_AnimatedMaterials, NL3D::CMeshBase::_AnimatedMorph, NL3D::CMeshBase::_AutoAnim, NL3D::CMeshBase::_DefaultPivot, NL3D::CMeshBase::_DefaultRotEuler, NL3D::CMeshBase::_DefaultRotQuat, NL3D::CMeshBase::_DefaultScale, NL3D::CMeshBase::_IsLightable, NL3D::CMeshBase::_LightInfos, NL3D::CMeshBase::_LodCharacterTexture, NL3D::CMeshBase::_UseLightingLocalAttenuation, NL3D::CMeshBase::computeIsLightable(), sint, and NL3D::CMeshBase::TLightInfoMapV7. +

+

00150 {
+00151         /*
+00152         Version 8:
+00153                 - new format for CLightMapInfoList
+00154         Version 7:
+00155                 - _LodCharacterTexture
+00156         Version 6:
+00157                 - _DistMax
+00158         Version 5:
+00159                 - _AutoAnim
+00160         Version 4:
+00161                 - _UseLightingLocalAttenuation
+00162         Version 3:
+00163                 - _IsLightable
+00164         Version 2:
+00165                 - Added Blend Shapes factors
+00166         Version 1:
+00167                 - Cut in version because of badly coded ITexture* serialisation. throw an exception if 
+00168                         find a version < 1.
+00169         Version 0:
+00170                 - 1st version.
+00171         */
+00172         sint ver = f.serialVersion(8);
+00173 
+00174         if (ver >= 2)
+00175         {
+00176                 f.serialCont (_AnimatedMorph);
+00177         }
+00178 
+00179         if(ver<1)
+00180                 throw NLMISC::EStream(f, "Mesh in Stream is too old (MeshBase version < 1)");
+00181 
+00182         f.serial (_DefaultPos);
+00183         f.serial (_DefaultPivot);
+00184         f.serial (_DefaultRotEuler);
+00185         f.serial (_DefaultRotQuat);
+00186         f.serial (_DefaultScale);
+00187 
+00188         f.serialCont(_Materials);
+00189         f.serialCont(_AnimatedMaterials);
+00190 
+00191         if(ver >= 8)
+00192                 f.serialCont(_LightInfos);
+00193         else
+00194         {
+00195                 TLightInfoMapV7 temp;
+00196                 f.serialCont(temp);
+00197         }
+00198 
+00199         if(ver>=3)
+00200                 // read/write _IsLightable flag.
+00201                 f.serial(_IsLightable);
+00202         else if( f.isReading() )
+00203                 // update _IsLightable flag.
+00204                 computeIsLightable();
+00205 
+00206         if(ver>=4)
+00207                 f.serial(_UseLightingLocalAttenuation);
+00208         else if( f.isReading() )
+00209                 _UseLightingLocalAttenuation= false;
+00210 
+00211         if (ver >= 5)
+00212         {
+00213                 f.serial(_AutoAnim);
+00214         }
+00215 
+00216         if(ver >= 6)
+00217                 f.serial(_DistMax);
+00218 
+00219         if(ver >= 7)
+00220                 f.serialPtr(_LodCharacterTexture);
+00221 
+00222 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NL3D::CMeshBase::setAnimatedMaterial uint  id,
const std::string &  matName
[inherited]
+
+ + + + + +
+   + + +

+setup a material as animated. Material must exist or else no-op. +

+ +

+Definition at line 77 of file mesh_base.cpp. +

+References NL3D::CMeshBase::_AnimatedMaterials, nlassert, and uint. +

+

00078 {
+00079         nlassert(!matName.empty());
+00080         if(id<_Materials.size())
+00081         {
+00082                 // add / replace animated material.
+00083                 _AnimatedMaterials[id].Name= matName;
+00084                 // copy Material default.
+00085                 _AnimatedMaterials[id].copyFromMaterial(&_Materials[id]);
+00086         }
+00087 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CMeshBase::setAutoAnim bool  on = true  )  [inline, inherited]
+
+ + + + + +
+   + + +

+Tells that the model instanciated from this shape should be automatically animated. If so the scene will search for an automatic anim that has the same name than this shape and will bind it. This state is serialized. NB: This is a clue to scene::createInstance, a call to createInstance of this object won't make the animation binding. +

+Definition at line 210 of file mesh_base.h. +

+References NL3D::CMeshBase::_AutoAnim. +

+

00210 { _AutoAnim = on; }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::IShape::setDistMax float  distMax  )  [inherited]
+
+ + + + + +
+   + + +

+setup the DistMax where the shape is no more displayed. Take effect only for the next created instances. setting <0 means -1 and so means DistMax = infinite. +

+Definition at line 66 of file shape.cpp. +

+Referenced by NL3D::CFlareShape::CFlareShape(). +

+

00067 {
+00068         _DistMax= distMax;
+00069         // normalize infinite setup.
+00070         if(distMax<0)
+00071                 _DistMax= -1;
+00072 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CMeshBase::setupLodCharacterTexture CLodCharacterTexture lodText  )  [inherited]
+
+ + + + + +
+   + + +

+setup the lod texture info. see CSkeletonModel Lod system +

+ +

+Definition at line 446 of file mesh_base.cpp. +

+References NL3D::CMeshBase::_LodCharacterTexture, and NL3D::CMeshBase::resetLodCharacterTexture(). +

+

00447 {
+00448         // delete old
+00449         resetLodCharacterTexture();
+00450         // seutp new
+00451         _LodCharacterTexture= new CLodCharacterTexture;
+00452         *_LodCharacterTexture= lodText;
+00453 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
IMeshGeom * NL3D::CMeshMultiLod::supportMeshBlockRendering CTransformShape trans,
float &  polygonCount
const [virtual]
+
+ + + + + +
+   + + +

+return !NULL if this shape can support MeshBlock rendering for a special instance. NB: Mesh Block render cannot occurs if the Mesh is Skinned/MeshMorphed. NB: Mesh Block render can occurs only in Opaque pass NB: Mesh block render can occurs only for CMeshBase meshes.

Parameters:
+ + + +
trans the instance to take into account (meshMultiLod may return NULL in blend transition).
polygonCount the number of polygons to render for the meshGeom returned
+
+
Returns:
the meshgeom to render per block if OK, else NULL (default)
+ +

+Reimplemented from NL3D::IShape. +

+Definition at line 630 of file mesh_multi_lod.cpp. +

+References _MeshVector, NL3D::CMeshMultiLodInstance::Flags, NL3D::CMeshMultiLodInstance::Lod0, NL3D::CMeshMultiLodInstance::PolygonCountLod0, NL3D::IMeshGeom::supportMeshBlockRendering(), and uint. +

+

00631 {
+00632         IMeshGeom       *ret= NULL;
+00633 
+00634         // get the instance
+00635         CMeshMultiLodInstance *instance=safe_cast<CMeshMultiLodInstance*>(trans);
+00636 
+00637         // Must not be in blend transition.
+00638         if ( (instance->Flags&CMeshMultiLodInstance::Lod0Blend) == 0)
+00639         {
+00640                 uint    slot= instance->Lod0;
+00641                 // The slot must not be a CoarseMesh
+00642                 if ( (_MeshVector[slot].Flags&CMeshSlot::CoarseMesh)==0 )
+00643                 {
+00644                         // MeshGeom exist?
+00645                         ret= _MeshVector[slot].MeshGeom;
+00646                 }
+00647         }
+00648 
+00649         // Ok if meshGeom is ok.
+00650         if( ret && ret->supportMeshBlockRendering() )
+00651         {
+00652                 polygonCount= instance->PolygonCountLod0;
+00653                 return ret;
+00654         }
+00655         else
+00656                 return NULL;
+00657 }
+
+

+ + + + +
+ + + + + + + + + +
bool NL3D::CMeshBase::useLightingLocalAttenuation  )  const [virtual, inherited]
+
+ + + + + +
+   + + +

+tells if the shape wants LocalAttenuation for RealTime lighting. Default is false +

+ +

+Reimplemented from NL3D::IShape. +

+Definition at line 429 of file mesh_base.cpp. +

+References NL3D::CMeshBase::_UseLightingLocalAttenuation. +

+

00430 {
+00431         return _UseLightingLocalAttenuation;
+00432 }
+
+


Friends And Related Function Documentation

+

+ + + + +
+ + +
friend class CMeshMultiLodInstance [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 276 of file mesh_multi_lod.h.

+

+ + + + +
+ + +
friend struct CPtrInfo [friend, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 67 of file smart_ptr.h.

+


Field Documentation

+

+ + + + +
+ + +
TAnimatedMaterialMap NL3D::CMeshBase::_AnimatedMaterials [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 240 of file mesh_base.h. +

+Referenced by NL3D::CMeshBase::applyMaterialUsageOptim(), NL3D::CMeshBase::buildMeshBase(), NL3D::CMeshBase::getAnimatedMaterial(), NL3D::CMeshBase::instanciateMeshBase(), NL3D::CMeshBase::serialMeshBase(), and NL3D::CMeshBase::setAnimatedMaterial().

+

+ + + + +
+ + +
std::vector<CMorphBase> NL3D::CMeshBase::_AnimatedMorph [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 251 of file mesh_base.h. +

+Referenced by NL3D::CMeshBase::buildMeshBase(), NL3D::CMeshBase::instanciateMeshBase(), and NL3D::CMeshBase::serialMeshBase().

+

+ + + + +
+ + +
bool NL3D::CMeshBase::_AutoAnim [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 258 of file mesh_base.h. +

+Referenced by NL3D::CMeshBase::CMeshBase(), NL3D::CMeshBase::getAutoAnim(), NL3D::CMeshBase::serialMeshBase(), and NL3D::CMeshBase::setAutoAnim().

+

+ + + + +
+ + +
CTrackDefaultRGBA NL3D::CMeshBase::_DefaultLMFactor [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 249 of file mesh_base.h. +

+Referenced by NL3D::CMeshBase::CMeshBase(), and NL3D::CMeshBase::getDefaultLMFactor().

+

+ + + + +
+ + +
CTrackDefaultVector NL3D::CMeshBase::_DefaultPivot [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 245 of file mesh_base.h. +

+Referenced by NL3D::CMeshBase::buildMeshBase(), NL3D::CMeshBase::CMeshBase(), NL3D::CMeshBase::getDefaultPivot(), NL3D::CMeshBase::instanciateMeshBase(), and NL3D::CMeshBase::serialMeshBase().

+

+ + + + +
+ + +
CTrackDefaultVector NL3D::CMeshBase::_DefaultPos [protected, inherited] +
+
+ + + + + +
+   + + +

+Transform default tracks. Those default tracks are instancied, ie, CInstanceMesh will have the same and can't specialize it. +

+ +

+Definition at line 244 of file mesh_base.h.

+

+ + + + +
+ + +
CTrackDefaultVector NL3D::CMeshBase::_DefaultRotEuler [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 246 of file mesh_base.h. +

+Referenced by NL3D::CMeshBase::buildMeshBase(), NL3D::CMeshBase::CMeshBase(), NL3D::CMeshBase::getDefaultRotEuler(), and NL3D::CMeshBase::serialMeshBase().

+

+ + + + +
+ + +
CTrackDefaultQuat NL3D::CMeshBase::_DefaultRotQuat [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 247 of file mesh_base.h. +

+Referenced by NL3D::CMeshBase::buildMeshBase(), NL3D::CMeshBase::CMeshBase(), NL3D::CMeshBase::getDefaultRotQuat(), NL3D::CMeshBase::instanciateMeshBase(), and NL3D::CMeshBase::serialMeshBase().

+

+ + + + +
+ + +
CTrackDefaultVector NL3D::CMeshBase::_DefaultScale [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 248 of file mesh_base.h. +

+Referenced by NL3D::CMeshBase::buildMeshBase(), NL3D::CMeshBase::CMeshBase(), NL3D::CMeshBase::getDefaultScale(), NL3D::CMeshBase::instanciateMeshBase(), and NL3D::CMeshBase::serialMeshBase().

+

+ + + + +
+ + +
float NL3D::IShape::_DistMax [protected, inherited] +
+
+ + + + + +
+   + + +

+Default to -1. +

+ +

+Definition at line 165 of file shape.h.

+

+ + + + +
+ + +
bool NL3D::CMeshBase::_IsLightable [protected, inherited] +
+
+ + + + + +
+   + + +

+Is this mesh lightable?? +

+ +

+Definition at line 254 of file mesh_base.h. +

+Referenced by NL3D::CMeshBase::computeIsLightable(), NL3D::CMeshBase::isLightable(), and NL3D::CMeshBase::serialMeshBase().

+

+ + + + +
+ + +
TLightMapInfo NL3D::CMeshBase::_LightInfos [inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 234 of file mesh_base.h. +

+Referenced by NL3D::CMeshBase::applyMaterialUsageOptim(), NL3D::CMeshBase::buildMeshBase(), NL3D::UShape::cameraCollisionable(), NL3D::CMeshBaseInstance::getLightMapName(), NL3D::CMeshBaseInstance::getNbLightMap(), NL3D::CMeshBaseInstance::initAnimatedLightIndex(), NL3D::CMeshBase::serialMeshBase(), and NL3D::CMeshBaseInstance::traverseAnimDetail().

+

+ + + + +
+ + +
std::vector<CMaterial> NL3D::CMeshBase::_Materials [protected, inherited] +
+
+ + + + + +
+   + + +

+The Materials. +

+ +

+Definition at line 230 of file mesh_base.h.

+

+ + + + +
+ + +
std::vector<CMeshSlot> NL3D::CMeshMultiLod::_MeshVector [private] +
+
+ + + + + +
+   + + +

+Vector of meshes. +

+ +

+Definition at line 253 of file mesh_multi_lod.h. +

+Referenced by build(), changeMRMDistanceSetup(), clear(), clip(), compileCoarseMeshes(), compileDistMax(), createInstance(), getAABBox(), getMeshGeom(), getNumSlotMesh(), getNumTrianglesWithCoarsestDist(), getSlotMesh(), instanciateCoarseMeshSpace(), profileMeshGeom(), profileSceneRender(), render(), renderCoarseMesh(), renderMeshGeom(), supportMeshBlockRendering(), and NL3D::CMeshMultiLodInstance::traverseLoadBalancing().

+

+ + + + +
+ + +
bool NL3D::CMeshMultiLod::_StaticLod [private] +
+
+ + + + + +
+   + + +

+Static or dynamic load ? Yoyo: no more used, but leave for possible usage later... +

+ +

+Definition at line 250 of file mesh_multi_lod.h. +

+Referenced by build(), and isStatic().

+

+ + + + +
+ + +
bool NL3D::CMeshBase::_UseLightingLocalAttenuation [protected, inherited] +
+
+ + + + + +
+   + + +

+Is this mesh Use Lighting Local Attenuation ?? +

+ +

+Definition at line 256 of file mesh_base.h. +

+Referenced by NL3D::CMeshBase::buildMeshBase(), NL3D::CMeshBase::CMeshBase(), NL3D::CMeshBase::serialMeshBase(), and NL3D::CMeshBase::useLightingLocalAttenuation().

+

+ + + + +
+ + +
sint NLMISC::CRefCount::crefs [mutable, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 79 of file smart_ptr.h. +

+Referenced by NLMISC::CRefCount::CRefCount(), NLMISC::CRefCount::getRefCount(), and NLMISC::CRefCount::~CRefCount().

+

+ + + + +
+ + +
CRefCount::CPtrInfo NLMISC::CRefCount::NullPtrInfo [static, inherited] +
+
+ + + + + +
+   + + +

+ +

+Referenced by NLMISC::CRefCount::CRefCount().

+

+ + + + +
+ + +
CPtrInfo* NLMISC::CRefCount::pinfo [mutable, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 80 of file smart_ptr.h. +

+Referenced by NLMISC::CRefCount::CRefCount(), and NLMISC::CRefCount::~CRefCount().

+


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