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

# OgreMeshSerializerImpl.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://www.ogre3d.org/
    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 __MeshSerializerImpl_H__
    00027 #define __MeshSerializerImpl_H__
    00028
    00029 #include "OgrePrerequisites.h"
    00030 #include "OgreString.h"
    00031 #include "OgreSerializer.h"
    00032 #include "OgreMaterial.h"
    00033 #include "OgreMesh.h"
    00034 #include "OgreEdgeListBuilder.h"
    00035
    00036 namespace Ogre {
    00037
    00038
    00046     class MeshSerializerImpl : public Serializer
    00047     {
    00048     public:
    00049         MeshSerializerImpl();
    00050         virtual ~MeshSerializerImpl();
    00058         void exportMesh(const Mesh* pMesh, const String& filename);
    00059
    00067         void importMesh(DataChunk& chunk, Mesh* pDest);
    00068
    00069     protected:
    00070
    00071         typedef std::map<String, Material*> MaterialMap;
    00072         MaterialMap mMaterialList;
    00073         Mesh* mpMesh;
    00074         bool mIsSkeletallyAnimated;
    00075
    00076         // Internal methods
    00077         virtual void writeSubMeshNameTable(const Mesh* pMesh);
    00078         virtual void writeMesh(const Mesh* pMesh);
    00079         virtual void writeSubMesh(const SubMesh* s);
    00080         virtual void writeSubMeshOperation(const SubMesh* s);
    00081         virtual void writeGeometry(const VertexData* pGeom);
    00082         virtual void writeSkeletonLink(const String& skelName);
    00083         virtual void writeMeshBoneAssignment(const VertexBoneAssignment* assign);
    00084         virtual void writeSubMeshBoneAssignment(const VertexBoneAssignment* assign);
    00085         virtual void writeLodInfo(const Mesh* pMesh);
    00086         virtual void writeLodSummary(unsigned short numLevels, bool manual);
    00087         virtual void writeLodUsageManual(const Mesh::MeshLodUsage& usage);
    00088         virtual void writeLodUsageGenerated(const Mesh* pMesh, const Mesh::MeshLodUsage& usage, unsigned short lodNum);
    00089         virtual void writeBoundsInfo(const Mesh* pMesh);
    00090         virtual void writeEdgeList(const Mesh* pMesh);
    00091
    00092         virtual unsigned long calcMeshSize(const Mesh* pMesh);
    00093         virtual unsigned long calcSubMeshSize(const SubMesh* pSub);
    00094         virtual unsigned long calcGeometrySize(const VertexData* pGeom);
    00095         virtual unsigned long calcSkeletonLinkSize(const String& skelName);
    00096         virtual unsigned long calcBoneAssignmentSize(void);
    00097         virtual unsigned long calcSubMeshOperationSize(const SubMesh* pSub);
    00098         virtual unsigned long calcSubMeshNameTableSize(const Mesh *pMesh);
    00099         virtual unsigned long calcEdgeListSize(const Mesh *pMesh);
    00100         virtual unsigned long calcEdgeListLodSize(const EdgeData* data, bool isManual);
    00101         virtual unsigned long calcEdgeGroupSize(const EdgeData::EdgeGroup& group);
    00102
    00103         virtual void readTextureLayer(DataChunk& chunk, Material* pMat);
    00104         virtual void readSubMeshNameTable(DataChunk& chunk);
    00105         virtual void readMesh(DataChunk& chunk);
    00106         virtual void readSubMesh(DataChunk& chunk);
    00107         virtual void readSubMeshOperation(DataChunk& chunk, SubMesh* sub);
    00108         virtual void readGeometry(DataChunk& chunk, VertexData* dest);
    00109         virtual void readGeometryVertexDeclaration(DataChunk& chunk, VertexData* dest);
    00110         virtual void readGeometryVertexElement(DataChunk& chunk, VertexData* dest);
    00111         virtual void readGeometryVertexBuffer(DataChunk& chunk, VertexData* dest);
    00112
    00113         virtual void readSkeletonLink(DataChunk &chunk);
    00114         virtual void readMeshBoneAssignment(DataChunk& chunk);
    00115         virtual void readSubMeshBoneAssignment(DataChunk& chunk, SubMesh* sub);
    00116         virtual void readMeshLodInfo(DataChunk& chunk);
    00117         virtual void readMeshLodUsageManual(DataChunk& chunk, unsigned short lodNum, Mesh::MeshLodUsage& usage);
    00118         virtual void readMeshLodUsageGenerated(DataChunk& chunk, unsigned short lodNum, Mesh::MeshLodUsage& usage);
    00119         virtual void readBoundsInfo(DataChunk& chunk);
    00120         virtual void readEdgeList(DataChunk& chunk);
    00121
    00122
    00123
    00125         virtual void flipFromLittleEndian(void* pData, size_t vertexCount, size_t vertexSize, const VertexDeclaration::VertexElementList& elems);
    00127         virtual void flipToLittleEndian(void* pData, size_t vertexCount, size_t vertexSize, const VertexDeclaration::VertexElementList& elems);
    00130         virtual void flipEndian(void* pData, size_t vertexCount, size_t vertexSize, const VertexDeclaration::VertexElementList& elems);
    00131
    00132
    00133
    00134     };
    00135
    00137     class MeshSerializerImpl_v1_2 : public MeshSerializerImpl
    00138     {
    00139     public:
    00140         MeshSerializerImpl_v1_2();
    00141         ~MeshSerializerImpl_v1_2();
    00142     protected:
    00143         virtual void readMesh(DataChunk& chunk);
    00144         virtual void readGeometry(DataChunk& chunk, VertexData* dest);
    00145         virtual void readGeometryPositions(unsigned short bindIdx, DataChunk& chunk, VertexData* dest);
    00146         virtual void readGeometryNormals(unsigned short bindIdx, DataChunk& chunk, VertexData* dest);
    00147         virtual void readGeometryColours(unsigned short bindIdx, DataChunk& chunk, VertexData* dest);
    00148         virtual void readGeometryTexCoords(unsigned short bindIdx, DataChunk& chunk, VertexData* dest, unsigned short set);
    00149     };
    00150
    00152     class MeshSerializerImpl_v1_1 : public MeshSerializerImpl_v1_2
    00153     {
    00154     public:
    00155         MeshSerializerImpl_v1_1();
    00156         ~MeshSerializerImpl_v1_1();
    00157     protected:
    00158         void readGeometryTexCoords(unsigned short bindIdx, DataChunk& chunk, VertexData* dest, unsigned short set);
    00159     };
    00160
    00161
    00162 }
    00163
    00164 #endif

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:48:35 2004