# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

mesh_multi_lod_instance.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2001 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef NL_MESH_MULTI_LOD_INSTANCE_H
00027 #define NL_MESH_MULTI_LOD_INSTANCE_H
00028 
00029 #include "nel/misc/types_nl.h"
00030 #include "nel/misc/class_id.h"
00031 
00032 #include "3d/mesh_base_instance.h"
00033 
00034 
00035 namespace NL3D 
00036 {
00037 
00038 // ***************************************************************************
00039 // ClassIds.
00040 const NLMISC::CClassId          MeshMultiLodInstanceId=NLMISC::CClassId(0x1ade6ef8, 0x75c5a84);
00041 
00042 
00043 // ***************************************************************************
00051 class CMeshMultiLodInstance : public CMeshBaseInstance
00052 {
00053 public:
00054         
00056         CMeshMultiLodInstance ();
00057 
00059         ~CMeshMultiLodInstance ();
00060 
00063         virtual void            changeMRMDistanceSetup(float distanceFinest, float distanceMiddle, float distanceCoarsest);
00064 
00065 
00068         void                            deleteCoarseInstances();
00069 
00070 
00071         enum
00072         {
00073                 Lod0Blend               =       0x1,
00074                 Coarse0Loaded   =       0x2,
00075                 Coarse1Loaded   =       0x4,
00076         };
00077 
00079         static  void    registerBasic();
00080 
00082         uint64                  _LastLodMatrixDate[2];
00083 
00085         sint64                  _LastLodLightingDate[2];
00086 
00087 
00088         // return the contribution of lights (for Coarse Mesh render).
00089         const CLightContribution        &getLightContribution() {return _LightContribution;}
00090 
00091         // Override the shape coarse mesh distance (-1 if not overriden)
00092         void                     setCoarseMeshDist(float dist) { _CoarseMeshDistance = dist; }
00093         float            getCoarseMeshDist() const { return _CoarseMeshDistance; }
00094 
00095         // From CTransformShape
00096         virtual float                           getNumTriangles (float distance);
00097 
00098 private:
00099 
00101         uint    Lod0;
00102         uint    Lod1;
00103 
00105         uint    Flags;
00106 
00108         uint64  CoarseMeshId[2];
00109 
00111         float   PolygonCountLod0;
00112         float   PolygonCountLod1;
00113 
00115         float   BlendFactor;
00116 
00118         float   _CoarseMeshDistance;
00119 
00120         static IModel   *creator() {return new CMeshMultiLodInstance;}
00121         friend  class CMeshMultiLod;
00122         friend  class CMeshMultiLodBalancingObs;
00123 
00125         CRGBA                   getCoarseMeshLighting();
00126 };
00127 
00128 
00129 // ***************************************************************************
00140 class   CMeshMultiLodClipObs : public CTransformShapeClipObs
00141 {
00142 public:
00143 
00145         virtual bool    clip(IBaseClipObs *caller);
00146 
00147         // override method. If distMaxClip, then must delete coarse Instances.
00148         virtual void    forceClip(TClipReason clipReason);
00149 
00150 
00151         static IObs     *creator() {return new CMeshMultiLodClipObs;}
00152 };
00153 
00154 
00155 // ***************************************************************************
00166 class   CMeshMultiLodBalancingObs : public CTransformShapeLoadBalancingObs
00167 {
00168 public:
00169 
00174         virtual void    traverse(IObs *caller);
00175 
00176         static IObs     *creator() {return new CMeshMultiLodBalancingObs;}
00177 
00178 
00179 protected:
00180 };
00181 
00182 
00183 } // NL3D
00184 
00185 
00186 #endif // NL_MESH_MULTI_LOD_INSTANCE_H
00187 
00188 /* End of mesh_multi_lod_instance.h */