OGRE-Next  2.3
Object-Oriented Graphics Rendering Engine
Ogre::MaterialSerializer Class Reference

Class for serializing Materials to / from a .material script. More...

#include <OgreMaterialSerializer.h>

+ Inheritance diagram for Ogre::MaterialSerializer:

Classes

class  Listener
 Class that allows listening in on the various stages of material serialization process. More...
 

Public Types

enum  SerializeEvent { MSE_PRE_WRITE , MSE_WRITE_BEGIN , MSE_WRITE_END , MSE_POST_WRITE }
 

Public Member Functions

 MaterialSerializer ()
 default constructor More...
 
virtual ~MaterialSerializer ()
 default destructor More...
 
void addListener (Listener *listener)
 Register a listener to this Serializer. More...
 
void beginSection (unsigned short level, const bool useMainBuffer=true)
 
void clearQueue ()
 Clears the internal buffer. More...
 
void endSection (unsigned short level, const bool useMainBuffer=true)
 
void exportMaterial (const MaterialPtr &pMat, const String &filename, bool exportDefaults=false, const bool includeProgDef=false, const String &programFilename="", const String &materialName="")
 Exports a single in-memory Material to the named material script file. More...
 
void exportQueued (const String &filename, const bool includeProgDef=false, const String &programFilename="")
 Exports queued material(s) to a named material script file. More...
 
const StringgetQueuedAsString () const
 Returns a string representing the parsed material(s) More...
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete (void *ptr, void *)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
void * operator new (size_t sz)
 
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 *ptr)
 placement operator new More...
 
void * operator new[] (size_t sz)
 
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info More...
 
void queueForExport (const MaterialPtr &pMat, bool clearQueued=false, bool exportDefaults=false, const String &materialName="")
 Queue an in-memory Material to the internal buffer for export. More...
 
String quoteWord (const String &val)
 
void removeListener (Listener *listener)
 Remove a listener from this Serializer. More...
 
void writeAttribute (unsigned short level, const String &att, const bool useMainBuffer=true)
 
void writeComment (unsigned short level, const String &comment, const bool useMainBuffer=true)
 
void writeValue (const String &val, const bool useMainBuffer=true)
 

Detailed Description

Class for serializing Materials to / from a .material script.

Member Enumeration Documentation

◆ SerializeEvent

Enumerator
MSE_PRE_WRITE 
MSE_WRITE_BEGIN 
MSE_WRITE_END 
MSE_POST_WRITE 

Constructor & Destructor Documentation

◆ MaterialSerializer()

Ogre::MaterialSerializer::MaterialSerializer ( )

default constructor

◆ ~MaterialSerializer()

virtual Ogre::MaterialSerializer::~MaterialSerializer ( )
inlinevirtual

default destructor

Member Function Documentation

◆ addListener()

void Ogre::MaterialSerializer::addListener ( Listener listener)

Register a listener to this Serializer.

See also
MaterialSerializer::Listener

◆ beginSection()

void Ogre::MaterialSerializer::beginSection ( unsigned short  level,
const bool  useMainBuffer = true 
)
inline

◆ clearQueue()

void Ogre::MaterialSerializer::clearQueue ( )

Clears the internal buffer.

◆ endSection()

void Ogre::MaterialSerializer::endSection ( unsigned short  level,
const bool  useMainBuffer = true 
)
inline

◆ exportMaterial()

void Ogre::MaterialSerializer::exportMaterial ( const MaterialPtr pMat,
const String filename,
bool  exportDefaults = false,
const bool  includeProgDef = false,
const String programFilename = "",
const String materialName = "" 
)

Exports a single in-memory Material to the named material script file.

Parameters
exportDefaultsif true then exports all values including defaults
includeProgDefif true includes Gpu shader program definitions in the export material script otherwise if false then program definitions will be exported to a separate file with name programFilename if programFilename is not empty
programFilenamethe file name of the vertex / fragment program script to be exported. This is only used if includeProgDef is false.
materialNameAllow exporting the given material under a different name. In case of empty string the original material name will be used.

◆ exportQueued()

void Ogre::MaterialSerializer::exportQueued ( const String filename,
const bool  includeProgDef = false,
const String programFilename = "" 
)

Exports queued material(s) to a named material script file.

Parameters
filenamethe file name of the material script to be exported
includeProgDefIf true, vertex program and fragment program definitions will be written at the top of the material script
programFilenamethe file name of the vertex / fragment program script to be exported. This is only used if there are program definitions to be exported and includeProgDef is false when calling queueForExport.

◆ getQueuedAsString()

const String& Ogre::MaterialSerializer::getQueuedAsString ( ) const

Returns a string representing the parsed material(s)

◆ 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,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator delete() [3/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
void *   
)
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)
inlineinherited

◆ operator new() [2/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() [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)
inlineinherited

◆ operator new[]() [2/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

◆ queueForExport()

void Ogre::MaterialSerializer::queueForExport ( const MaterialPtr pMat,
bool  clearQueued = false,
bool  exportDefaults = false,
const String materialName = "" 
)

Queue an in-memory Material to the internal buffer for export.

Parameters
pMatMaterial pointer
clearQueuedIf true, any materials already queued will be removed
exportDefaultsIf true, attributes which are defaulted will be included in the script exported, otherwise they will be omitted
materialNameAllow exporting the given material under a different name. In case of empty string the original material name will be used.

◆ quoteWord()

String Ogre::MaterialSerializer::quoteWord ( const String val)
inline

◆ removeListener()

void Ogre::MaterialSerializer::removeListener ( Listener listener)

Remove a listener from this Serializer.

See also
MaterialSerializer::Listener

◆ writeAttribute()

void Ogre::MaterialSerializer::writeAttribute ( unsigned short  level,
const String att,
const bool  useMainBuffer = true 
)
inline

◆ writeComment()

void Ogre::MaterialSerializer::writeComment ( unsigned short  level,
const String comment,
const bool  useMainBuffer = true 
)
inline

◆ writeValue()

void Ogre::MaterialSerializer::writeValue ( const String val,
const bool  useMainBuffer = true 
)
inline

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