Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OgreMeshSerializer.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://ogre.sourceforge.net/
00006 
00007 Copyright © 2000-2002 The OGRE Team
00008 Also see acknowledgements in Readme.html
00009 
00010 This program is free software; you can redistribute it and/or modify it under
00011 the terms of the GNU Lesser General Public License as published by the Free Software
00012 Foundation; either version 2 of the License, or (at your option) any later
00013 version.
00014 
00015 This program is distributed in the hope that it will be useful, but WITHOUT
00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public License along with
00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00022 http://www.gnu.org/copyleft/lesser.txt.
00023 -----------------------------------------------------------------------------
00024 */
00025 
00026 #ifndef __MeshSerializer_H__
00027 #define __MeshSerializer_H__
00028 
00029 #include "OgrePrerequisites.h"
00030 #include "OgreSerializer.h"
00031 #include "OgreMaterial.h"
00032 #include "OgreString.h"
00033 #include "OgreMesh.h"
00034 
00035 namespace Ogre {
00036 
00060     class _OgreExport MeshSerializer : public Serializer
00061     {
00062     public:
00063         MeshSerializer();
00064         virtual ~MeshSerializer();
00065 
00066 
00075         void exportMesh(const Mesh* pMesh, const String& filename, bool includeMaterials = false);
00076 
00084         void importMesh(DataChunk& chunk, Mesh* pDest);
00085 
00091         void importLegacyOof(DataChunk& chunk, Mesh* pDest);
00092 
00093     private:
00094         typedef std::map<String, Material*> MaterialMap;
00095         MaterialMap mMaterialList;
00096         Mesh* mpMesh;
00097 
00098         // Internal methods
00099         void writeMaterial(const Material* m);
00100         void writeTextureLayer(const Material::TextureLayer* pTex);
00101         void writeMesh(const Mesh* pMesh);
00102         void writeSubMesh(const SubMesh* s);
00103         void writeGeometry(const GeometryData* pGeom);
00104         void writeSkeletonLink(const String& skelName);
00105         void writeMeshBoneAssignment(const VertexBoneAssignment* assign);
00106         void writeSubMeshBoneAssignment(const VertexBoneAssignment* assign);
00107         void writeLodInfo(const Mesh* pMesh);
00108         void writeLodSummary(unsigned short numLevels, bool manual);
00109         void writeLodUsageManual(const Mesh::MeshLodUsage& usage);
00110         void writeLodUsageGenerated(const Mesh* pMesh, const Mesh::MeshLodUsage& usage, unsigned short lodNum);
00111 
00112         unsigned long calcMaterialSize(const Material* pMat);
00113         unsigned long calcTextureLayerSize(const Material::TextureLayer* pTex);
00114         unsigned long calcMeshSize(const Mesh* pMesh);
00115         unsigned long calcSubMeshSize(const SubMesh* pSub);
00116         unsigned long calcGeometrySize(const GeometryData* pGeom);
00117         unsigned long calcSkeletonLinkSize(const String& skelName);
00118         unsigned long calcBoneAssignmentSize(void);
00119 
00120         void readMaterial(DataChunk& chunk);
00121         void readTextureLayer(DataChunk& chunk, Material* pMat);
00122         void readMesh(DataChunk& chunk);
00123         void readSubMesh(DataChunk& chunk);
00124         void readGeometry(DataChunk& chunk, GeometryData* dest);
00125         void readSkeletonLink(DataChunk &chunk);
00126         void readMeshBoneAssignment(DataChunk& chunk);
00127         void readSubMeshBoneAssignment(DataChunk& chunk, SubMesh* sub);
00128         void readMeshLodInfo(DataChunk& chunk);
00129         void readMeshLodUsageManual(DataChunk& chunk, unsigned short lodNum, Mesh::MeshLodUsage& usage);
00130         void readMeshLodUsageGenerated(DataChunk& chunk, unsigned short lodNum, Mesh::MeshLodUsage& usage);
00131 
00132 
00133 
00134 
00135     };
00136 
00137 }
00138 
00139 
00140 #endif

Copyright © 2002 by The OGRE Team