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

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

#include <OgreMeshSerializer.h>

+ Inheritance diagram for Ogre::v1::MeshSerializer:

Public Types

enum  Endian { ENDIAN_NATIVE, ENDIAN_BIG, ENDIAN_LITTLE }
 The endianness of written files. More...
 

Public Member Functions

 MeshSerializer ()
 
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 operator delete (void *ptr)
 
void operator delete (void *ptr, void *)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
void * operator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info More...
 
void * operator new (size_t sz)
 
void * operator new (size_t sz, void *ptr)
 placement operator new More...
 
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info More...
 
void * operator new[] (size_t sz)
 
void setListener (MeshSerializerListener *listener)
 Sets the listener for this serializer. 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.

Member Enumeration Documentation

◆ Endian

enum Ogre::Serializer::Endian
inherited

The endianness of written files.

Enumerator
ENDIAN_NATIVE 

Use the platform native endian.

ENDIAN_BIG 

Use big endian (0x1000 is serialised as 0x10 0x00)

ENDIAN_LITTLE 

Use little endian (0x1000 is serialised as 0x00 0x10)

Constructor & Destructor Documentation

◆ MeshSerializer()

Ogre::v1::MeshSerializer::MeshSerializer ( )

◆ ~MeshSerializer()

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

Member Function Documentation

◆ exportMesh() [1/4]

void Ogre::v1::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::v1::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::v1::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::v1::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::v1::MeshSerializer::getListener ( )

Returns the current listener.

◆ importMesh()

void Ogre::v1::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.

◆ operator delete() [1/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr)
inlineinherited

◆ operator delete() [2/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
void *   
)
inlineinherited

◆ operator delete() [3/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator delete[]() [1/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr)
inlineinherited

◆ operator delete[]() [2/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator new() [1/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

operator new, with debug line info

◆ operator new() [2/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inlineinherited

◆ operator new() [3/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
void *  ptr 
)
inlineinherited

placement operator new

◆ operator new[]() [1/2]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

array operator new, with debug line info

◆ operator new[]() [2/2]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz)
inlineinherited

◆ setListener()

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

Sets the listener for this serializer.


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