# 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  

coarse_mesh_build.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_COARSE_MESH_BUILD_H
00027 #define NL_COARSE_MESH_BUILD_H
00028 
00029 #include "nel/misc/types_nl.h"
00030 
00031 #include <vector>
00032 #include <map>
00033 
00034 namespace NLMISC
00035 {
00036 class CBitmap;
00037 }
00038 
00039 namespace NL3D 
00040 {
00041 
00042 class CMeshGeom;
00043 class CMeshBase;
00044 class ITexture;
00045 
00062 class CCoarseMeshBuild
00063 {
00064 public:
00065 
00067         class CCoarseMeshDesc
00068         {
00069         public:
00070                 // Constructor
00071                 CCoarseMeshDesc (CMeshGeom *meshGeom, const CMeshBase *baseMesh)
00072                 {
00073                         MeshGeom=meshGeom;
00074                         MeshBase=baseMesh;
00075                 }
00076 
00081                 CMeshGeom                       *MeshGeom;
00082 
00087                 const CMeshBase         *MeshBase;
00088         };
00089 
00091         class CStats
00092         {
00093         public:
00098                 float   TextureUsed;
00099         };
00100 
00110         bool            build (const std::vector<CCoarseMeshDesc>& coarseMeshes, NLMISC::CBitmap& bitmap, CStats& stats, float mulArea);
00111 
00112 private:
00113 
00114         class CBitmapDesc
00115         {
00116         public:
00117                 // Coordinates of the bitmap in the global bitmap
00118                 float           U;
00119                 float           V;
00120 
00121                 // Coordinates ratio
00122                 float           FactorU;
00123                 float           FactorV;
00124 
00125                 // Pointer on the texture
00126                 ITexture        *Texture;
00127 
00128                 // Pointer on the texture
00129                 std::string     Name;
00130         };
00131 
00132         typedef std::map<std::string, CBitmapDesc>      MapBitmapDesc;
00133 
00134         // Expand the border of a bitmap.
00135         void            expand (NLMISC::CBitmap& bitmap);
00136 
00137         // Build the bitmap. Return false if the bitmap size is too small
00138         bool            buildBitmap (const std::vector<CCoarseMeshDesc>& coarseMeshes, NLMISC::CBitmap& bitmap, CStats& stats, MapBitmapDesc& desc, float mulArea);
00139 
00140         // Remap the coordinate
00141         void            remapCoordinates (const std::vector<CCoarseMeshDesc>& coarseMeshes, const MapBitmapDesc& desc);
00142 };
00143 
00144 
00145 } // NL3D
00146 
00147 
00148 #endif // NL_COARSE_MESH_BUILD_H
00149 
00150 /* End of coarse_mesh_build.h */