- Main Page
- Namespaces
- Classes
- Files
- Directories
- 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 (c) 2000-2006 Torus Knot Software Ltd
    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 You may alternatively use this source under the terms of a specific version of
    00025 the OGRE Unrestricted License provided you have obtained such a license from
    00026 Torus Knot Software Ltd.
    00027 -----------------------------------------------------------------------------
    00028 */
    00029
    00030 #ifndef __MeshSerializerImpl_H__
    00031 #define __MeshSerializerImpl_H__
    00032
    00033 #include "OgrePrerequisites.h"
    00034 #include "OgreString.h"
    00035 #include "OgreSerializer.h"
    00036 #include "OgreMaterial.h"
    00037 #include "OgreMesh.h"
    00038 #include "OgreEdgeListBuilder.h"
    00039
    00040 namespace Ogre {
    00041
    00042
    00050     class _OgrePrivate MeshSerializerImpl : public Serializer
    00051     {
    00052     public:
    00053         MeshSerializerImpl();
    00054         virtual ~MeshSerializerImpl();
    00063         void exportMesh(const Mesh* pMesh, const String& filename,
    00064             Endian endianMode = ENDIAN_NATIVE);
    00065
    00073         void importMesh(DataStreamPtr& stream, Mesh* pDest);
    00074
    00075     protected:
    00076
    00077         // Internal methods
    00078         virtual void writeSubMeshNameTable(const Mesh* pMesh);
    00079         virtual void writeMesh(const Mesh* pMesh);
    00080         virtual void writeSubMesh(const SubMesh* s);
    00081         virtual void writeSubMeshOperation(const SubMesh* s);
    00082         virtual void writeSubMeshTextureAliases(const SubMesh* s);
    00083         virtual void writeGeometry(const VertexData* pGeom);
    00084         virtual void writeSkeletonLink(const String& skelName);
    00085         virtual void writeMeshBoneAssignment(const VertexBoneAssignment& assign);
    00086         virtual void writeSubMeshBoneAssignment(const VertexBoneAssignment& assign);
    00087         virtual void writeLodInfo(const Mesh* pMesh);
    00088         virtual void writeLodSummary(unsigned short numLevels, bool manual);
    00089         virtual void writeLodUsageManual(const MeshLodUsage& usage);
    00090         virtual void writeLodUsageGenerated(const Mesh* pMesh, const MeshLodUsage& usage, unsigned short lodNum);
    00091         virtual void writeBoundsInfo(const Mesh* pMesh);
    00092         virtual void writeEdgeList(const Mesh* pMesh);
    00093         virtual void writeAnimations(const Mesh* pMesh);
    00094         virtual void writeAnimation(const Animation* anim);
    00095         virtual void writePoses(const Mesh* pMesh);
    00096         virtual void writePose(const Pose* pose);
    00097         virtual void writeAnimationTrack(const VertexAnimationTrack* track);
    00098         virtual void writeMorphKeyframe(const VertexMorphKeyFrame* kf, size_t vertexCount);
    00099         virtual void writePoseKeyframe(const VertexPoseKeyFrame* kf);
    00100         virtual void writePoseKeyframePoseRef(const VertexPoseKeyFrame::PoseRef& poseRef);
    00101         virtual void writeExtremes(const Mesh *pMesh);
    00102         virtual void writeSubMeshExtremes(unsigned short idx, const SubMesh* s);
    00103
    00104         virtual size_t calcMeshSize(const Mesh* pMesh);
    00105         virtual size_t calcSubMeshSize(const SubMesh* pSub);
    00106         virtual size_t calcGeometrySize(const VertexData* pGeom);
    00107         virtual size_t calcSkeletonLinkSize(const String& skelName);
    00108         virtual size_t calcBoneAssignmentSize(void);
    00109         virtual size_t calcSubMeshOperationSize(const SubMesh* pSub);
    00110         virtual size_t calcSubMeshNameTableSize(const Mesh* pMesh);
    00111         virtual size_t calcEdgeListSize(const Mesh* pMesh);
    00112         virtual size_t calcEdgeListLodSize(const EdgeData* data, bool isManual);
    00113         virtual size_t calcEdgeGroupSize(const EdgeData::EdgeGroup& group);
    00114         virtual size_t calcPosesSize(const Mesh* pMesh);
    00115         virtual size_t calcPoseSize(const Pose* pose);
    00116         virtual size_t calcAnimationsSize(const Mesh* pMesh);
    00117         virtual size_t calcAnimationSize(const Animation* anim);
    00118         virtual size_t calcAnimationTrackSize(const VertexAnimationTrack* track);
    00119         virtual size_t calcMorphKeyframeSize(const VertexMorphKeyFrame* kf, size_t vertexCount);
    00120         virtual size_t calcPoseKeyframeSize(const VertexPoseKeyFrame* kf);
    00121         virtual size_t calcPoseKeyframePoseRefSize(void);
    00122         virtual size_t calcPoseVertexSize(void);
    00123         virtual size_t calcSubMeshTextureAliasesSize(const SubMesh* pSub);
    00124
    00125
    00126         virtual void readTextureLayer(DataStreamPtr& stream, Mesh* pMesh, MaterialPtr& pMat);
    00127         virtual void readSubMeshNameTable(DataStreamPtr& stream, Mesh* pMesh);
    00128         virtual void readMesh(DataStreamPtr& stream, Mesh* pMesh);
    00129         virtual void readSubMesh(DataStreamPtr& stream, Mesh* pMesh);
    00130         virtual void readSubMeshOperation(DataStreamPtr& stream, Mesh* pMesh, SubMesh* sub);
    00131         virtual void readSubMeshTextureAlias(DataStreamPtr& stream, Mesh* pMesh, SubMesh* sub);
    00132         virtual void readGeometry(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest);
    00133         virtual void readGeometryVertexDeclaration(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest);
    00134         virtual void readGeometryVertexElement(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest);
    00135         virtual void readGeometryVertexBuffer(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest);
    00136
    00137         virtual void readSkeletonLink(DataStreamPtr& stream, Mesh* pMesh);
    00138         virtual void readMeshBoneAssignment(DataStreamPtr& stream, Mesh* pMesh);
    00139         virtual void readSubMeshBoneAssignment(DataStreamPtr& stream, Mesh* pMesh,
    00140             SubMesh* sub);
    00141         virtual void readMeshLodInfo(DataStreamPtr& stream, Mesh* pMesh);
    00142         virtual void readMeshLodUsageManual(DataStreamPtr& stream, Mesh* pMesh,
    00143             unsigned short lodNum, MeshLodUsage& usage);
    00144         virtual void readMeshLodUsageGenerated(DataStreamPtr& stream, Mesh* pMesh,
    00145             unsigned short lodNum, MeshLodUsage& usage);
    00146         virtual void readBoundsInfo(DataStreamPtr& stream, Mesh* pMesh);
    00147         virtual void readEdgeList(DataStreamPtr& stream, Mesh* pMesh);
    00148         virtual void readEdgeListLodInfo(DataStreamPtr& stream, EdgeData* edgeData);
    00149         virtual void readPoses(DataStreamPtr& stream, Mesh* pMesh);
    00150         virtual void readPose(DataStreamPtr& stream, Mesh* pMesh);
    00151         virtual void readAnimations(DataStreamPtr& stream, Mesh* pMesh);
    00152         virtual void readAnimation(DataStreamPtr& stream, Mesh* pMesh);
    00153         virtual void readAnimationTrack(DataStreamPtr& stream, Animation* anim,
    00154             Mesh* pMesh);
    00155         virtual void readMorphKeyFrame(DataStreamPtr& stream, VertexAnimationTrack* track);
    00156         virtual void readPoseKeyFrame(DataStreamPtr& stream, VertexAnimationTrack* track);
    00157         virtual void readExtremes(DataStreamPtr& stream, Mesh *pMesh);
    00158
    00159
    00161         virtual void flipFromLittleEndian(void* pData, size_t vertexCount, size_t vertexSize, const VertexDeclaration::VertexElementList& elems);
    00163         virtual void flipToLittleEndian(void* pData, size_t vertexCount, size_t vertexSize, const VertexDeclaration::VertexElementList& elems);
    00166         virtual void flipEndian(void* pData, size_t vertexCount, size_t vertexSize, const VertexDeclaration::VertexElementList& elems);
    00167
    00168
    00169
    00170     };
    00171
    00173     class _OgrePrivate MeshSerializerImpl_v1_3 : public MeshSerializerImpl
    00174     {
    00175     public:
    00176         MeshSerializerImpl_v1_3();
    00177         ~MeshSerializerImpl_v1_3();
    00178     protected:
    00179         virtual void readEdgeListLodInfo(DataStreamPtr& stream, EdgeData* edgeData);
    00180
    00182         virtual void reorganiseTriangles(EdgeData* edgeData);
    00183     };
    00184
    00186     class _OgrePrivate MeshSerializerImpl_v1_2 : public MeshSerializerImpl_v1_3
    00187     {
    00188     public:
    00189         MeshSerializerImpl_v1_2();
    00190         ~MeshSerializerImpl_v1_2();
    00191     protected:
    00192         virtual void readMesh(DataStreamPtr& stream, Mesh* pMesh);
    00193         virtual void readGeometry(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest);
    00194         virtual void readGeometryPositions(unsigned short bindIdx, DataStreamPtr& stream,
    00195             Mesh* pMesh, VertexData* dest);
    00196         virtual void readGeometryNormals(unsigned short bindIdx, DataStreamPtr& stream,
    00197             Mesh* pMesh, VertexData* dest);
    00198         virtual void readGeometryColours(unsigned short bindIdx, DataStreamPtr& stream,
    00199             Mesh* pMesh, VertexData* dest);
    00200         virtual void readGeometryTexCoords(unsigned short bindIdx, DataStreamPtr& stream,
    00201             Mesh* pMesh, VertexData* dest, unsigned short set);
    00202     };
    00203
    00205     class _OgrePrivate MeshSerializerImpl_v1_1 : public MeshSerializerImpl_v1_2
    00206     {
    00207     public:
    00208         MeshSerializerImpl_v1_1();
    00209         ~MeshSerializerImpl_v1_1();
    00210     protected:
    00211         void readGeometryTexCoords(unsigned short bindIdx, DataStreamPtr& stream,
    00212             Mesh* pMesh, VertexData* dest, unsigned short set);
    00213     };
    00214
    00215
    00216 }
    00217
    00218 #endif

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Mon Jun 16 12:48:53 2008