# 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_geom.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_GEOM_H
00027 #define NL_MESH_GEOM_H
00028 
00029 
00030 #include "nel/misc/types_nl.h"
00031 #include "nel/misc/stream.h"
00032 #include "nel/misc/plane.h"
00033 #include "nel/misc/matrix.h"
00034 
00035 
00036 namespace NLMISC
00037 {
00038         class CAABBoxExt;
00039 }
00040 
00041 namespace NL3D 
00042 {
00043 
00044 
00045 class IDriver;
00046 class CTransformShape;
00047 class CMeshBaseInstance;
00048 class CMeshBlockManager;
00049 class CScene;
00050 class CRenderTrav;
00051 using NLMISC::CPlane;
00052 using NLMISC::CMatrix;
00053 
00054 
00055 // ***************************************************************************
00059 class CMeshGeomRenderContext
00060 {
00061 public:
00062         IDriver                 *Driver;
00063         CScene                  *Scene;
00064         CRenderTrav             *RenderTrav;
00065         // true if the mesh is rendered through a VBHeap currently activated in driver.
00066         bool                    RenderThroughVBHeap;
00067 };
00068 
00069 
00070 // ***************************************************************************
00077 class IMeshGeom : public NLMISC::IStreamable
00078 {
00079 public:
00080 
00082         enum    TRenderFlag
00083         {
00084                 RenderOpaqueMaterial= 1,                // set when the mesh geom must render opaque material
00085                 RenderTransparentMaterial= 2,   // set when the mesh geom must render transparent material
00086                 RenderPassOpaque=4,                             // set when the current traversal rdrPass is the opaque pass
00087                 RenderGlobalAlpha= 8,                   // set when the caller wants to draw material with global alpha
00088                 RenderGADisableZWrite= 16,              // only when globalAlpha is used. set if must disable ZWrite
00089         };
00090 
00091 public:
00092 
00094         IMeshGeom();
00096         virtual ~IMeshGeom();
00097 
00098 
00101         virtual void    initInstance(CMeshBaseInstance *mbi) =0;
00102 
00103 
00110         virtual bool    clip(const std::vector<CPlane>  &pyramid, const CMatrix &worldMatrix) {return true;}
00111 
00115         virtual void    render(IDriver *drv, CTransformShape *trans, float polygonCount, uint32 rdrFlags, float globalAlpha) =0;
00116 
00121         virtual void    renderSkin(CTransformShape *trans, float alphaMRM) =0;
00122 
00123 
00125         // @{
00126 
00134         virtual float   getNumTriangles (float distance) =0;
00135 
00138         virtual const NLMISC::CAABBoxExt& getBoundingBox() const =0;
00139 
00140         // @}
00141 
00142 
00144 
00148         // @{
00149 
00153         virtual bool    supportMeshBlockRendering () const =0;
00154 
00158         virtual bool    sortPerMaterial() const =0;
00159 
00163         virtual uint    getNumRdrPasses() const =0;
00164 
00168         virtual void    beginMesh(CMeshGeomRenderContext &rdrCtx) =0;
00169 
00173         virtual void    activeInstance(CMeshGeomRenderContext &rdrCtx, CMeshBaseInstance *inst, float polygonCount) =0;
00174 
00178         virtual void    renderPass(CMeshGeomRenderContext &rdrCtx, CMeshBaseInstance *inst, float polygonCount, uint rdrPass) =0;
00179 
00183         virtual void    endMesh(CMeshGeomRenderContext &rdrCtx) =0;
00184 
00188         virtual bool    getVBHeapInfo(uint &vertexFormat, uint &numVertices) {return false;}
00189 
00195         virtual void    computeMeshVBHeap(void *dst, uint indexStart)  {}
00196 
00197         // @}
00198 
00199 
00200 // *****************
00201 private:
00202 
00204         // @{
00205         friend class CMeshBlockManager;
00206 
00208         sint32                          _RootInstanceId;
00209 
00211         CMeshBlockManager       *_MeshBlockManager;
00213         uint                            _MeshVBHeapId;
00215         uint                            _MeshVBHeapIndexStart;
00216 
00217         // @}
00218 
00219 };
00220 
00221 
00222 } // NL3D
00223 
00224 
00225 #endif // NL_MESH_GEOM_H
00226 
00227 /* End of mesh_geom.h */