OGRE  master
Object-Oriented Graphics Rendering Engine
Ogre::MeshSerializer Class Reference

Class for serialising mesh data to/from an OGRE .mesh file. More...

#include <OgreMeshSerializer.h>

+ Inheritance diagram for Ogre::MeshSerializer:

Public Member Functions

 MeshSerializer ()
 
virtual ~MeshSerializer ()
 
void exportMesh (const Mesh *pMesh, const String &filename, MeshVersion version, Endian endianMode=ENDIAN_NATIVE)
 Exports a mesh to the file specified, in a specific version format. More...
 
void exportMesh (const Mesh *pMesh, const String &filename, Endian endianMode=ENDIAN_NATIVE)
 
void exportMesh (const MeshPtr &pMesh, const String &filename, Endian endianMode=ENDIAN_NATIVE)
 
void exportMesh (const Mesh *pMesh, const DataStreamPtr &stream, Endian endianMode=ENDIAN_NATIVE)
 
void exportMesh (const Mesh *pMesh, DataStreamPtr stream, MeshVersion version, Endian endianMode=ENDIAN_NATIVE)
 
MeshSerializerListenergetListener ()
 Returns the current listener. More...
 
void importMesh (const DataStreamPtr &stream, Mesh *pDest)
 Imports Mesh and (optionally) Material data from a .mesh file DataStream. More...
 
void setListener (MeshSerializerListener *listener)
 Sets the listener for this serializer. More...
 
- Public Member Functions inherited from Ogre::Serializer
 Serializer ()
 
 ~Serializer ()
 

Additional Inherited Members

- Public Types inherited from Ogre::Serializer
enum  Endian { ENDIAN_NATIVE, ENDIAN_BIG, ENDIAN_LITTLE }
 The endianness of written files. More...
 

Detailed Description

Class for serialising mesh data to/from an OGRE .mesh file.

This class allows exporters to write OGRE .mesh files easily, and allows the OGRE engine to import .mesh files into instantiated OGRE Meshes. Note that a .mesh file can include not only the Mesh, but also definitions of any Materials it uses (although this is optional, the .mesh can rely on the Material being loaded from another source, especially useful if you want to take advantage of OGRE's advanced Material properties which may not be available in your modeller).

To export a Mesh:
  1. Use the MaterialManager methods to create any dependent Material objects, if you want to export them with the Mesh.
  2. Create a Mesh object and populate it using it's methods.
  3. Call the exportMesh method
It's important to realise that this exporter uses OGRE terminology. In this context, 'Mesh' means a top-level mesh structure which can actually contain many SubMeshes, each of which has only one Material. Modelling packages may refer to these differently, for example in Milkshape, it says 'Model' instead of 'Mesh' and 'Mesh' instead of 'SubMesh', but the theory is the same.

Constructor & Destructor Documentation

◆ MeshSerializer()

Ogre::MeshSerializer::MeshSerializer ( )

◆ ~MeshSerializer()

virtual Ogre::MeshSerializer::~MeshSerializer ( )
virtual

Member Function Documentation

◆ exportMesh() [1/5]

void Ogre::MeshSerializer::exportMesh ( const Mesh pMesh,
const String filename,
MeshVersion  version,
Endian  endianMode = ENDIAN_NATIVE 
)

Exports a mesh to the file specified, in a specific version format.

This method takes an externally created Mesh object, and exports it to a .mesh file in the specified format version. Note that picking a format version other that the latest will cause some information to be lost.

Parameters
pMeshPointer to the Mesh to export
filenameThe destination filename
versionMesh version to write
endianModeThe endian mode of the written file

◆ exportMesh() [2/5]

void Ogre::MeshSerializer::exportMesh ( const Mesh pMesh,
const String filename,
Endian  endianMode = ENDIAN_NATIVE 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References Ogre::MESH_VERSION_LATEST.

◆ exportMesh() [3/5]

void Ogre::MeshSerializer::exportMesh ( const MeshPtr pMesh,
const String filename,
Endian  endianMode = ENDIAN_NATIVE 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References Ogre::MESH_VERSION_LATEST.

◆ exportMesh() [4/5]

void Ogre::MeshSerializer::exportMesh ( const Mesh pMesh,
const DataStreamPtr stream,
Endian  endianMode = ENDIAN_NATIVE 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References Ogre::MESH_VERSION_LATEST.

◆ exportMesh() [5/5]

void Ogre::MeshSerializer::exportMesh ( const Mesh pMesh,
DataStreamPtr  stream,
MeshVersion  version,
Endian  endianMode = ENDIAN_NATIVE 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ importMesh()

void Ogre::MeshSerializer::importMesh ( const DataStreamPtr stream,
Mesh pDest 
)

Imports Mesh and (optionally) Material data from a .mesh file DataStream.

This method imports data from a DataStream opened from a .mesh file and places it's contents into the Mesh object which is passed in.

Parameters
streamThe DataStream holding the .mesh data. Must be initialised (pos at the start of the buffer).
pDestPointer to the Mesh object which will receive the data. Should be blank already.

◆ setListener()

void Ogre::MeshSerializer::setListener ( MeshSerializerListener listener)

Sets the listener for this serializer.

◆ getListener()

MeshSerializerListener* Ogre::MeshSerializer::getListener ( )

Returns the current listener.


The documentation for this class was generated from the following file: