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

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

#include <OgreMesh2Serializer.h>

+ Inheritance diagram for Ogre::MeshSerializer:

Public Member Functions

 MeshSerializer (VaoManager *vaoManager)
 
virtual ~MeshSerializer ()
 
void exportMesh (const Mesh *pMesh, const String &filename, Endian endianMode=ENDIAN_NATIVE)
 Exports a mesh to the file specified, in the latest format. More...
 
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, DataStreamPtr stream, Endian endianMode=ENDIAN_NATIVE)
 Exports a mesh to the stream specified, in the latest format. More...
 
void exportMesh (const Mesh *pMesh, DataStreamPtr stream, MeshVersion version, Endian endianMode=ENDIAN_NATIVE)
 Exports a mesh to the stream specified, in a specific version format. More...
 
MeshSerializerListenergetListener ()
 Returns the current listener. More...
 
void importMesh (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 ()
 
virtual ~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.

Remarks
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 ( VaoManager vaoManager)

◆ ~MeshSerializer()

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

Member Function Documentation

◆ exportMesh() [1/4]

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

Exports a mesh to the file specified, in the latest format.

Remarks
This method takes an externally created Mesh object, and exports it to a .mesh file in the latest format version available.
Parameters
pMeshPointer to the Mesh to export
filenameThe destination filename
endianModeThe endian mode of the written file

◆ exportMesh() [2/4]

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.

Remarks
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() [3/4]

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

Exports a mesh to the stream specified, in the latest format.

Remarks
This method takes an externally created Mesh object, and exports it to a .mesh file in the latest format version.
Parameters
pMeshPointer to the Mesh to export
streamWriteable stream
endianModeThe endian mode of the written file

◆ exportMesh() [4/4]

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

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

Remarks
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
streamWriteable stream
versionMesh version to write
endianModeThe endian mode of the written file

◆ getListener()

MeshSerializerListener* Ogre::MeshSerializer::getListener ( )

Returns the current listener.

◆ importMesh()

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

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

Remarks
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.


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