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/mrm__builder_8h-source.html | 266 +++++++++++++++++++++++++++ 1 file changed, 266 insertions(+) create mode 100644 docs/doxygen/nel/mrm__builder_8h-source.html (limited to 'docs/doxygen/nel/mrm__builder_8h-source.html') diff --git a/docs/doxygen/nel/mrm__builder_8h-source.html b/docs/doxygen/nel/mrm__builder_8h-source.html new file mode 100644 index 00000000..1ee58ba6 --- /dev/null +++ b/docs/doxygen/nel/mrm__builder_8h-source.html @@ -0,0 +1,266 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# 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  
+

mrm_builder.h

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2000 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_MRM_BUILDER_H
+00027 #define NL_MRM_BUILDER_H
+00028 
+00029 #include "nel/misc/types_nl.h"
+00030 #include "nel/misc/uv.h"
+00031 #include "3d/mrm_mesh.h"
+00032 #include "3d/mrm_internal.h"
+00033 #include "3d/mrm_parameters.h"
+00034 #include "3d/mesh.h"
+00035 #include "3d/mesh_mrm.h"
+00036 #include <map>
+00037 
+00038 
+00039 namespace NL3D 
+00040 {
+00041 
+00042 
+00043 
+00044 // ***************************************************************************
+00051 class CMRMBuilder
+00052 {
+00053 public:
+00054 
+00056         CMRMBuilder();
+00057 
+00058 
+00059 
+00065         void    compileMRM( const CMesh::CMeshBuild &mbuild, std::vector<CMesh::CMeshBuild*> &bsList,
+00066                                                 const CMRMParameters &params, CMeshMRMGeom::CMeshBuildMRM &mrmMesh,
+00067                                                 uint numMaxMaterial);
+00068 
+00069 
+00070 
+00071 // ****************************
+00072 private:
+00073 // Mesh Level Part.
+00074 
+00076         // @{
+00077         // The vertices of the MRMMesh.
+00078         std::vector<CMRMVertex>         TmpVertices;
+00079         // The attributes of the MRMMesh.
+00080         std::vector<CMRMAttribute>      TmpAttributes[NL3D_MRM_MAX_ATTRIB];
+00081         // The number of used attributes of the MRMMesh.
+00082         sint                                            NumAttributes;
+00083         // The faces of the MRMMesh.
+00084         std::vector<CMRMFaceBuild>      TmpFaces;
+00085         // Ordered list of Edge collapse.
+00086         TEdgeMap                                        EdgeCollapses;
+00087 
+00088         // Say if the current build must compute skinning information.
+00089         bool                                            _Skinned;
+00091         CMRMParameters::TSkinReduction  _SkinReduction;
+00092 
+00093         // @}
+00094 
+00095 
+00097         // @{
+00098         bool    vertexHasOneWedge(sint numvertex);
+00099         bool    vertexHasOneMaterial(sint numvertex);
+00100         bool    vertexContinue(sint numvertex);
+00101         bool    vertexClosed(sint numvertex);
+00102         float   getDeltaFaceNormals(sint numvertex);    // return a positive value of Sum(|DeltaNormals|) / NNormals.
+00103         bool    edgeContinue(const CMRMEdge &edge);
+00104         bool    edgeNearUniqueMatFace(const CMRMEdge &edge);
+00105         float   computeEdgeCost(const CMRMEdge &edge);
+00106         // @}
+00107 
+00108 
+00110         // @{
+00111         bool    faceShareWedges(CMRMFaceBuild *face, sint attribId, sint numVertex1, sint numVertex2);
+00112         void    insertFaceIntoEdgeList(CMRMFaceBuild &tmpf);
+00113         void    removeFaceFromEdgeList(CMRMFaceBuild &f);
+00114         sint    collapseEdge(const CMRMEdge &edge);     // return num of deleted faces.
+00115         sint    followVertex(sint i);
+00116         sint    followWedge(sint attribId, sint i);
+00117         CMesh::CSkinWeight      collapseSkinWeight(const CMesh::CSkinWeight &sw1, const CMesh::CSkinWeight &sw2, float InterValue) const;
+00118         // @}
+00119 
+00120 
+00122         // @{
+00123         void    init(const CMRMMesh &baseMesh);
+00124         void    collapseEdges(sint nWantedFaces);
+00125         void    makeLODMesh(CMRMMeshGeom &lodMesh);
+00126         void    saveCoarserMesh(CMRMMesh &coarserMesh);
+00128         void    makeFromMesh(const CMRMMesh &baseMesh, CMRMMeshGeom &lodMesh, CMRMMesh &coarserMesh, sint nWantedFaces);
+00129         // @}
+00130 
+00131 
+00132         void    computeBsVerticesAttributes(std::vector<CMRMMesh> &srcBsMeshs, std::vector<CMRMMesh> &srcBsMeshsMod);
+00133         void    makeCoarserBS (std::vector<CMRMBlendShape> &csBsMeshs);
+00134 
+00135 
+00136 private:
+00137 // MRM Level Part.
+00138 
+00140         // @{
+00141         // Our comparator of CMRMWedgeGeom.
+00142         struct  CGeomPred
+00143         {
+00144                 bool    operator()(const CMRMWedgeGeom &a, const CMRMWedgeGeom &b) const
+00145                 {
+00146                         if(a.Start!=b.Start)
+00147                                 return a.Start<b.Start;
+00148                         return a.End<b.End;
+00149                 }
+00150         };
+00151 
+00152         // The map of geomorph. for one LOD only;
+00153         typedef std::map<CMRMWedgeGeom, sint, CGeomPred>                TGeomMap;
+00154         TGeomMap                        _GeomMap;
+00155         // @}
+00156 
+00157 
+00159         // @{
+00162         void buildBlendShapes (CMRMMesh &baseMesh, std::vector<CMesh::CMeshBuild*> &bsList, uint32 VertexFlags);
+00163 
+00170         void    buildAllLods(   const CMRMMesh &baseMesh, std::vector<CMRMMeshGeom> &lodMeshs, 
+00171                                                         uint nWantedLods= 10, uint divisor= 50 );
+00172 
+00176         void    buildFinalMRM(std::vector<CMRMMeshGeom> &lodMeshs, CMRMMeshFinal &finalMRM);
+00177 
+00178         // @}
+00179 
+00180 
+00181 
+00182 private:
+00183 // Interface to MeshBuild Part.
+00184 
+00186         // @{
+00187 
+00188 
+00190         struct  CAttributeKey
+00191         {
+00192                 sint            VertexId;
+00193                 CVectorH        Attribute;
+00194 
+00195                 bool    operator<(const CAttributeKey &o) const
+00196                 {
+00197                         if(VertexId!=o.VertexId)
+00198                                 return VertexId<o.VertexId;
+00199                         return Attribute<o.Attribute;
+00200                 }
+00201         };
+00202         typedef std::map<CAttributeKey, sint>           TAttributeMap;
+00203         TAttributeMap           _AttributeMap[NL3D_MRM_MAX_ATTRIB];
+00204         sint                    findInsertAttributeInBaseMesh(CMRMMesh &baseMesh, sint attId, sint vertexId, const CVectorH &att);
+00205         sint                    findInsertNormalInBaseMesh(CMRMMesh &baseMesh, sint attId, sint vertexId, const CVector &normal);
+00206         sint                    findInsertColorInBaseMesh(CMRMMesh &baseMesh, sint attId, sint vertexId, CRGBA col);
+00207         sint                    findInsertUvwInBaseMesh(CMRMMesh &baseMesh, sint attId, sint vertexId, const NLMISC::CUVW &uvw);
+00208         CRGBA                   attToColor(const CVectorH &att) const;
+00209         NLMISC::CUVW    attToUvw(const CVectorH &att) const;
+00210 
+00211 
+00215         uint32                  buildMrmBaseMesh(const CMesh::CMeshBuild &mbuild, CMRMMesh &baseMesh);
+00216 
+00221         void                    buildMeshBuildMrm(const CMRMMeshFinal &finalMRM, CMeshMRMGeom::CMeshBuildMRM &mbuild, uint32 vbFlags, uint32 nbMats, const CMesh::CMeshBuild &mb);
+00222 
+00223 
+00224         void                    normalizeBaseMeshSkin(CMRMMesh &baseMesh) const;
+00225         CMesh::CSkinWeight      normalizeSkinWeight(const CMesh::CSkinWeight &sw) const;
+00226 
+00227         // @}
+00228 
+00229 };
+00230 
+00231 
+00232 } // NL3D
+00233 
+00234 
+00235 #endif // NL_MRM_BUILDER_H
+00236 
+00237 /* End of mrm_builder.h */
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1