# 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 (c) 2000-2005 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 _OgrePrivate MeshSerializerImpl : public Serializer
    00047     {
    00048     public:
    00049         MeshSerializerImpl();
    00050         virtual ~MeshSerializerImpl();
    00058         void exportMesh(const Mesh* pMesh, const String& filename);
    00059
    00067         void importMesh(DataStreamPtr& stream, Mesh* pDest);
    00068
    00069     protected:
    00070
    00071         bool mIsSkeletallyAnimated;
    00072
    00073         // Internal methods
    00074         virtual void writeSubMeshNameTable(const Mesh* pMesh);
    00075         virtual void writeMesh(const Mesh* pMesh);
    00076         virtual void writeSubMesh(const SubMesh* s);
    00077         virtual void writeSubMeshOperation(const SubMesh* s);
    00078         virtual void writeGeometry(const VertexData* pGeom);
    00079         virtual void writeSkeletonLink(const String& skelName);
    00080         virtual void writeMeshBoneAssignment(const VertexBoneAssignment& assign);
    00081         virtual void writeSubMeshBoneAssignment(const VertexBoneAssignment& assign);
    00082         virtual void writeLodInfo(const Mesh* pMesh);
    00083         virtual void writeLodSummary(unsigned short numLevels, bool manual);
    00084         virtual void writeLodUsageManual(const MeshLodUsage& usage);
    00085         virtual void writeLodUsageGenerated(const Mesh* pMesh, const MeshLodUsage& usage, unsigned short lodNum);
    00086         virtual void writeBoundsInfo(const Mesh* pMesh);
    00087         virtual void writeEdgeList(const Mesh* pMesh);
    00088
    00089         virtual size_t calcMeshSize(const Mesh* pMesh);
    00090         virtual size_t calcSubMeshSize(const SubMesh* pSub);
    00091         virtual size_t calcGeometrySize(const VertexData* pGeom);
    00092         virtual size_t calcSkeletonLinkSize(const String& skelName);
    00093         virtual size_t calcBoneAssignmentSize(void);
    00094         virtual size_t calcSubMeshOperationSize(const SubMesh* pSub);
    00095         virtual size_t calcSubMeshNameTableSize(const Mesh* pMesh);
    00096         virtual size_t calcEdgeListSize(const Mesh* pMesh);
    00097         virtual size_t calcEdgeListLodSize(const EdgeData* data, bool isManual);
    00098         virtual size_t calcEdgeGroupSize(const EdgeData::EdgeGroup& group);
    00099
    00100         virtual void readTextureLayer(DataStreamPtr& stream, Mesh* pMesh, MaterialPtr& pMat);
    00101         virtual void readSubMeshNameTable(DataStreamPtr& stream, Mesh* pMesh);
    00102         virtual void readMesh(DataStreamPtr& stream, Mesh* pMesh);
    00103         virtual void readSubMesh(DataStreamPtr& stream, Mesh* pMesh);
    00104         virtual void readSubMeshOperation(DataStreamPtr& stream, Mesh* pMesh, SubMesh* sub);
    00105         virtual void readGeometry(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest);
    00106         virtual void readGeometryVertexDeclaration(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest);
    00107         virtual void readGeometryVertexElement(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest);
    00108         virtual void readGeometryVertexBuffer(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest);
    00109
    00110         virtual void readSkeletonLink(DataStreamPtr& stream, Mesh* pMesh);
    00111         virtual void readMeshBoneAssignment(DataStreamPtr& stream, Mesh* pMesh);
    00112         virtual void readSubMeshBoneAssignment(DataStreamPtr& stream, Mesh* pMesh,
    00113             SubMesh* sub);
    00114         virtual void readMeshLodInfo(DataStreamPtr& stream, Mesh* pMesh);
    00115         virtual void readMeshLodUsageManual(DataStreamPtr& stream, Mesh* pMesh,
    00116             unsigned short lodNum, MeshLodUsage& usage);
    00117         virtual void readMeshLodUsageGenerated(DataStreamPtr& stream, Mesh* pMesh,
    00118             unsigned short lodNum, MeshLodUsage& usage);
    00119         virtual void readBoundsInfo(DataStreamPtr& stream, Mesh* pMesh);
    00120         virtual void readEdgeList(DataStreamPtr& stream, Mesh* pMesh);
    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 _OgrePrivate MeshSerializerImpl_v1_2 : public MeshSerializerImpl
    00138     {
    00139     public:
    00140         MeshSerializerImpl_v1_2();
    00141         ~MeshSerializerImpl_v1_2();
    00142     protected:
    00143         virtual void readMesh(DataStreamPtr& stream, Mesh* pMesh);
    00144         virtual void readGeometry(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest);
    00145         virtual void readGeometryPositions(unsigned short bindIdx, DataStreamPtr& stream,
    00146             Mesh* pMesh, VertexData* dest);
    00147         virtual void readGeometryNormals(unsigned short bindIdx, DataStreamPtr& stream,
    00148             Mesh* pMesh, VertexData* dest);
    00149         virtual void readGeometryColours(unsigned short bindIdx, DataStreamPtr& stream,
    00150             Mesh* pMesh, VertexData* dest);
    00151         virtual void readGeometryTexCoords(unsigned short bindIdx, DataStreamPtr& stream,
    00152             Mesh* pMesh, VertexData* dest, unsigned short set);
    00153     };
    00154
    00156     class _OgrePrivate MeshSerializerImpl_v1_1 : public MeshSerializerImpl_v1_2
    00157     {
    00158     public:
    00159         MeshSerializerImpl_v1_1();
    00160         ~MeshSerializerImpl_v1_1();
    00161     protected:
    00162         void readGeometryTexCoords(unsigned short bindIdx, DataStreamPtr& stream,
    00163             Mesh* pMesh, VertexData* dest, unsigned short set);
    00164     };
    00165
    00166
    00167 }
    00168
    00169 #endif

Copyright © 2000-2005 by The OGRE Team
Last modified Sun Nov 20 12:36:02 2005