OgreMeshSerializer.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __MeshSerializer_H__
#define __MeshSerializer_H__
#include "OgrePrerequisites.h"
#include "OgreSerializer.h"
#include "OgreMeshSerializerImpl.h"
#include "OgreHeaderPrefix.h"
namespace Ogre {
class MeshSerializerListener;
enum MeshVersion
{
MESH_VERSION_LATEST,
MESH_VERSION_1_8,
MESH_VERSION_1_7,
MESH_VERSION_1_4,
MESH_VERSION_1_0,
MESH_VERSION_LEGACY
};
class _OgreExport MeshSerializer : public Serializer
{
public:
MeshSerializer();
virtual ~MeshSerializer();
void exportMesh(const Mesh* pMesh, const String& filename,
Endian endianMode = ENDIAN_NATIVE);
void exportMesh(const Mesh* pMesh, const String& filename,
MeshVersion version,
Endian endianMode = ENDIAN_NATIVE);
void exportMesh(const Mesh* pMesh, DataStreamPtr stream,
Endian endianMode = ENDIAN_NATIVE);
void exportMesh(const Mesh* pMesh, DataStreamPtr stream,
MeshVersion version,
Endian endianMode = ENDIAN_NATIVE);
void importMesh(DataStreamPtr& stream, Mesh* pDest);
void setListener(MeshSerializerListener *listener);
MeshSerializerListener *getListener();
protected:
class MeshVersionData : public SerializerAlloc
{
public:
MeshVersion version;
String versionString;
MeshSerializerImpl* impl;
MeshVersionData(MeshVersion _ver, const String& _string, MeshSerializerImpl* _impl)
: version(_ver), versionString(_string), impl(_impl) {}
~MeshVersionData() { OGRE_DELETE impl; }
};
typedef vector<MeshVersionData*>::type MeshVersionDataList;
MeshVersionDataList mVersionData;
MeshSerializerListener *mListener;
};
class MeshSerializerListener
{
public:
virtual ~MeshSerializerListener() {}
virtual void processMaterialName(Mesh *mesh, String *name) = 0;
virtual void processSkeletonName(Mesh *mesh, String *name) = 0;
virtual void processMeshCompleted(Mesh *mesh) = 0;
};
}
#include "OgreHeaderSuffix.h"
#endif
Ogre::Serializer
Generic class for serialising data to / from binary stream-based files.
Definition: OgreSerializer.h:50
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::MeshSerializerListener
Definition: OgreMeshSerializer.h:192
OGRE_DELETE
#define OGRE_DELETE
Definition: OgreMemoryAllocatorConfig.h:474
Ogre::MESH_VERSION_LEGACY
Legacy versions, DO NOT USE for writing.
Definition: OgreMeshSerializer.h:57
Ogre::Serializer::Endian
Endian
The endianness of written files.
Definition: OgreSerializer.h:57
Ogre::MESH_VERSION_1_0
OGRE version v1.0+.
Definition: OgreMeshSerializer.h:54
Ogre::MeshSerializer::mVersionData
MeshVersionDataList mVersionData
Definition: OgreMeshSerializer.h:179
Ogre::MESH_VERSION_1_7
OGRE version v1.7+.
Definition: OgreMeshSerializer.h:50
OgreMeshSerializerImpl.h
Ogre::MeshSerializer
Class for serialising mesh data to/from an OGRE .mesh file.
Definition: OgreMeshSerializer.h:89
OgrePrerequisites.h
Ogre::MeshVersion
MeshVersion
Mesh compatibility versions.
Definition: OgreMeshSerializer.h:42
Ogre::MESH_VERSION_LATEST
Latest version available.
Definition: OgreMeshSerializer.h:45
Ogre::MeshSerializer::MeshVersionData
Definition: OgreMeshSerializer.h:164
Ogre::Mesh
Resource holding data about 3D mesh.
Definition: OgreMesh.h:93
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::MeshSerializer::MeshVersionData::MeshVersionData
MeshVersionData(MeshVersion _ver, const String &_string, MeshSerializerImpl *_impl)
Definition: OgreMeshSerializer.h:171
Ogre::MESH_VERSION_1_8
OGRE version v1.8+.
Definition: OgreMeshSerializer.h:48
OgreHeaderSuffix.h
Ogre::MeshSerializer::MeshVersionData::versionString
String versionString
Definition: OgreMeshSerializer.h:168
Ogre::MeshSerializer::MeshVersionDataList
vector< MeshVersionData * >::type MeshVersionDataList
Definition: OgreMeshSerializer.h:178
Ogre::MeshSerializer::MeshVersionData::impl
MeshSerializerImpl * impl
Definition: OgreMeshSerializer.h:169
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::MeshSerializerImpl
Internal implementation of Mesh reading / writing for the latest version of the .mesh format...
Definition: OgreMeshSerializerImpl.h:61
OgreSerializer.h
Ogre::SharedPtr< DataStream >
Ogre::vector
Definition: OgrePrerequisites.h:491
OgreHeaderPrefix.h
Ogre::MeshSerializer::mListener
MeshSerializerListener * mListener
Definition: OgreMeshSerializer.h:181
Ogre::MeshSerializer::MeshVersionData::~MeshVersionData
~MeshVersionData()
Definition: OgreMeshSerializer.h:174
Ogre::MeshSerializer::MeshVersionData::version
MeshVersion version
Definition: OgreMeshSerializer.h:167
Ogre::MeshSerializerListener::~MeshSerializerListener
virtual ~MeshSerializerListener()
Definition: OgreMeshSerializer.h:195
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:58
Ogre::MESH_VERSION_1_4
OGRE version v1.4+.
Definition: OgreMeshSerializer.h:52

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.