# Ogre::MeshSerializer Class Reference

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

`#include <OgreMeshSerializer.h>`

Inheritance diagram for Ogre::MeshSerializer:

List of all members.

## Public Member Functions

| MeshSerializer ()
virtual | ~MeshSerializer ()
void | exportMesh (const Mesh *pMesh, const String &filename)
| Exports a mesh to the file specified.
void | importMesh (DataStreamPtr &stream, Mesh *pDest)
| Imports Mesh and (optionally) Material data from a .mesh file DataStream.

## Protected Types

typedef std::map< String, MeshSerializerImpl * > | MeshSerializerImplMap

## Protected Member Functions

virtual void | writeFileHeader (void)
virtual void | writeChunkHeader (uint16 id, uint32 size)
void | writeFloats (const float *const pfloat, size_t count)
void | writeFloats (const double *const pfloat, size_t count)
void | writeShorts (const uint16 *const pShort, size_t count)
void | writeInts (const uint32 *const pInt, size_t count)
void | writeBools (const bool *const pLong, size_t count)
void | writeObject (const Vector3 &vec)
void | writeObject (const Quaternion &q)
void | writeString (const String &string)
void | writeData (const void *const buf, size_t size, size_t count)
virtual void | readFileHeader (DataStreamPtr &stream)
virtual unsigned short | readChunk (DataStreamPtr &stream)
void | readBools (DataStreamPtr &stream, bool *pDest, size_t count)
void | readFloats (DataStreamPtr &stream, float *pDest, size_t count)
void | readFloats (DataStreamPtr &stream, double *pDest, size_t count)
void | readShorts (DataStreamPtr &stream, uint16 *pDest, size_t count)
void | readInts (DataStreamPtr &stream, uint32 *pDest, size_t count)
void | readObject (DataStreamPtr &stream, Vector3 &pDest)
void | readObject (DataStreamPtr &stream, Quaternion &pDest)
String | readString (DataStreamPtr &stream)
String | readString (DataStreamPtr &stream, size_t numChars)
virtual void | flipToLittleEndian (void *pData, size_t size, size_t count=1)
virtual void | flipFromLittleEndian (void *pData, size_t size, size_t count=1)
virtual void | flipEndian (void *pData, size_t size, size_t count)
virtual void | flipEndian (void *pData, size_t size)

## Protected Attributes

MeshSerializerImplMap | mImplementations
uint32 | mCurrentstreamLen
FILE * | mpfFile
String | mVersion

## Static Protected Attributes

String | msCurrentVersion

## 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 instatiated 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.

Definition at line 58 of file OgreMeshSerializer.h.

## Member Typedef Documentation

typedef std::map<String, MeshSerializerImpl* > Ogre::MeshSerializer::MeshSerializerImplMap `[protected]`

| Definition at line 85 of file OgreMeshSerializer.h.

## Constructor & Destructor Documentation

Ogre::MeshSerializer::MeshSerializer | ( |  | ) |

virtual Ogre::MeshSerializer::~MeshSerializer | ( |  | ) | `[virtual]`

## Member Function Documentation

void Ogre::MeshSerializer::exportMesh | ( | const Mesh * | pMesh,
|  | const String & | filename
| ) |

Exports a mesh to the file specified.

Remarks:
  This method takes an externally created Mesh object, and exports both it and optionally the Materials it uses to a .mesh file.

Parameters:

  pMesh | Pointer to the Mesh to export
  filename | The destination filename

virtual void Ogre::Serializer::flipEndian | ( | void * | pData,
|  | size_t | size
| ) | `[protected, virtual, inherited]`

virtual void Ogre::Serializer::flipEndian | ( | void * | pData,
|  | size_t | size,
|  | size_t | count
| ) | `[protected, virtual, inherited]`

virtual void Ogre::Serializer::flipFromLittleEndian | ( | void * | pData,
|  | size_t | size,
|  | size_t | count = 1
| ) | `[protected, virtual, inherited]`

virtual void Ogre::Serializer::flipToLittleEndian | ( | void * | pData,
|  | size_t | size,
|  | size_t | count = 1
| ) | `[protected, virtual, inherited]`

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:

  stream | The DataStream holding the .mesh data. Must be initialised (pos at the start of the buffer).
  pDest | Pointer to the Mesh object which will receive the data. Should be blank already.

void Ogre::Serializer::readBools | ( | DataStreamPtr & | stream,
|  | bool * | pDest,
|  | size_t | count
| ) | `[protected, inherited]`

virtual unsigned short Ogre::Serializer::readChunk | ( | DataStreamPtr & | stream | ) | `[protected, virtual, inherited]`

virtual void Ogre::Serializer::readFileHeader | ( | DataStreamPtr & | stream | ) | `[protected, virtual, inherited]`

void Ogre::Serializer::readFloats | ( | DataStreamPtr & | stream,
|  | double * | pDest,
|  | size_t | count
| ) | `[protected, inherited]`

void Ogre::Serializer::readFloats | ( | DataStreamPtr & | stream,
|  | float * | pDest,
|  | size_t | count
| ) | `[protected, inherited]`

void Ogre::Serializer::readInts | ( | DataStreamPtr & | stream,
|  | uint32 * | pDest,
|  | size_t | count
| ) | `[protected, inherited]`

void Ogre::Serializer::readObject | ( | DataStreamPtr & | stream,
|  | Quaternion & | pDest
| ) | `[protected, inherited]`

void Ogre::Serializer::readObject | ( | DataStreamPtr & | stream,
|  | Vector3 & | pDest
| ) | `[protected, inherited]`

void Ogre::Serializer::readShorts | ( | DataStreamPtr & | stream,
|  | uint16 * | pDest,
|  | size_t | count
| ) | `[protected, inherited]`

String Ogre::Serializer::readString | ( | DataStreamPtr & | stream,
|  | size_t | numChars
| ) | `[protected, inherited]`

String Ogre::Serializer::readString | ( | DataStreamPtr & | stream | ) | `[protected, inherited]`

void Ogre::Serializer::writeBools | ( | const bool *const | pLong,
|  | size_t | count
| ) | `[protected, inherited]`

virtual void Ogre::Serializer::writeChunkHeader | ( | uint16 | id,
|  | uint32 | size
| ) | `[protected, virtual, inherited]`

void Ogre::Serializer::writeData | ( | const void *const | buf,
|  | size_t | size,
|  | size_t | count
| ) | `[protected, inherited]`

virtual void Ogre::Serializer::writeFileHeader | ( | void |  | ) | `[protected, virtual, inherited]`

void Ogre::Serializer::writeFloats | ( | const double *const | pfloat,
|  | size_t | count
| ) | `[protected, inherited]`

void Ogre::Serializer::writeFloats | ( | const float *const | pfloat,
|  | size_t | count
| ) | `[protected, inherited]`

void Ogre::Serializer::writeInts | ( | const uint32 *const | pInt,
|  | size_t | count
| ) | `[protected, inherited]`

void Ogre::Serializer::writeObject | ( | const Quaternion & | q | ) | `[protected, inherited]`

void Ogre::Serializer::writeObject | ( | const Vector3 & | vec | ) | `[protected, inherited]`

void Ogre::Serializer::writeShorts | ( | const uint16 *const | pShort,
|  | size_t | count
| ) | `[protected, inherited]`

void Ogre::Serializer::writeString | ( | const String & | string | ) | `[protected, inherited]`

## Member Data Documentation

uint32 Ogre::Serializer::mCurrentstreamLen `[protected, inherited]`

| Definition at line 49 of file OgreSerializer.h.

MeshSerializerImplMap Ogre::MeshSerializer::mImplementations `[protected]`

| Definition at line 86 of file OgreMeshSerializer.h.

FILE* Ogre::Serializer::mpfFile `[protected, inherited]`

| Definition at line 50 of file OgreSerializer.h.

String Ogre::MeshSerializer::msCurrentVersion `[static, protected]`

| Definition at line 83 of file OgreMeshSerializer.h.

String Ogre::Serializer::mVersion `[protected, inherited]`

| Definition at line 51 of file OgreSerializer.h.

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

- OgreMeshSerializer.h

Copyright © 2000-2005 by The OGRE Team
Last modified Sun Nov 20 12:37:26 2005