28 #ifndef __MaterialSerializer_H__
29 #define __MaterialSerializer_H__
134 { (void)ser; (void)event; (void)skip; (void)mat; }
145 { (void)ser; (void)event; (void)skip; (void)tech; }
156 { (void)ser; (void)event; (void)skip; (void)pass; }
210 bool parseScriptLine(
String& line);
216 void finishProgramDefinition(
void);
242 void writeTechnique(
const Technique* pTech);
243 void writePass(
const Pass* pPass);
244 void writeVertexProgramRef(
const Pass* pPass);
245 void writeShadowCasterVertexProgramRef(
const Pass* pPass);
246 void writeShadowReceiverVertexProgramRef(
const Pass* pPass);
247 void writeShadowReceiverFragmentProgramRef(
const Pass* pPass);
248 void writeFragmentProgramRef(
const Pass* pPass);
250 void writeGpuPrograms(
void);
252 const unsigned short level = 4,
const bool useMainBuffer =
true);
254 const unsigned short level = 4,
const bool useMainBuffer =
true);
256 const unsigned short level = 4,
const bool useMainBuffer =
true);
257 void writeGpuProgramParameter(
261 bool isFloat,
size_t physicalIndex,
size_t physicalSize,
263 const unsigned short level,
const bool useMainBuffer);
270 void writeColourValue(
const ColourValue &colour,
bool writeAlpha =
false);
328 void queueForExport(
const MaterialPtr& pMat,
bool clearQueued =
false,
329 bool exportDefaults =
false,
const String& materialName =
"");
339 void exportQueued(
const String& filename,
const bool includeProgDef =
false,
const String& programFilename =
"");
351 void exportMaterial(
const MaterialPtr& pMat,
const String& filename,
bool exportDefaults =
false,
352 const bool includeProgDef =
false,
const String& programFilename =
"",
353 const String& materialName =
"");
355 const String &getQueuedAsString()
const;
366 void addListener(Listener* listener);
371 void removeListener(Listener* listener);
382 void beginSection(
unsigned short level,
const bool useMainBuffer =
true)
384 String& buffer = (useMainBuffer ? mBuffer : mGpuProgramBuffer);
386 for (
unsigned short i = 0; i < level; ++i)
392 void endSection(
unsigned short level,
const bool useMainBuffer =
true)
394 String& buffer = (useMainBuffer ? mBuffer : mGpuProgramBuffer);
396 for (
unsigned short i = 0; i < level; ++i)
405 String& buffer = (useMainBuffer ? mBuffer : mGpuProgramBuffer);
407 for (
unsigned short i = 0; i < level; ++i)
416 String& buffer = (useMainBuffer ? mBuffer : mGpuProgramBuffer);
417 buffer += (
" " + val);
422 String& buffer = (useMainBuffer ? mBuffer : mGpuProgramBuffer);
424 for (
unsigned short i = 0; i < level; ++i)
428 buffer +=
"// " + comment;
void writeAttribute(unsigned short level, const String &att, const bool useMainBuffer=true)
bool isVertexProgramShadowReceiver
AttribParserList mMaterialAttribParsers
Parsers for the material section of a script.
virtual ~MaterialSerializer()
default destructor
MaterialScriptSection
Enum to identify material sections.
void gpuProgramRefEventRaised(MaterialSerializer *ser, SerializeEvent event, bool &skip, const String &attrib, const GpuProgramPtr &program, const GpuProgramParametersSharedPtr ¶ms, GpuProgramParameters *defaultParams)
Called when GPU program reference section event raised.
std::multimap< K, V, P, A > type
AliasTextureNamePairList textureAliases
Struct for holding a program definition which is in progress.
void writeValue(const String &val, const bool useMainBuffer=true)
ListenerList::const_iterator ListenerListConstIterator
Specialisation of SharedPtr to allow SharedPtr to be assigned to GpuProgramPtr.
AttribParserList mProgramRefAttribParsers
Parsers for the program reference section of a script.
Class that allows listening in on the various stages of material serialization process.
virtual void textureUnitStateEventRaised(MaterialSerializer *ser, SerializeEvent event, bool &skip, const TextureUnitState *textureUnit)
Called when texture unit state section event raised.
Class representing colour.
ushort numAnimationParametrics
GpuProgramType
Enumerates the types of programs which can run on the GPU.
Internal structure defining a texture effect.
set< String >::type GpuProgramDefinitionContainer
Class encapsulates rendering properties of an object.
vector< Listener * >::type ListenerList
Listeners list of this Serializer.
vector< std::pair< String, String > >::type customParameters
Class representing an approach to rendering this particular Material.
SceneBlendFactor
Blending factors for manually blending objects with the scene.
MaterialScriptProgramDefinition * programDef
MaterialScriptContext mScriptContext
Class defining a single pass of a Technique (of a Material), i.e.
void writeComment(unsigned short level, const String &comment, const bool useMainBuffer=true)
bool(* ATTRIBUTE_PARSER)(String ¶ms, MaterialScriptContext &context)
Function def for material attribute parser; return value determines if the next line should be {...
Class for serializing Materials to / from a .material script.
Structure recording the use of an automatic parameter.
Struct for holding the script context while parsing.
MaterialScriptSection section
virtual void techniqueEventRaised(MaterialSerializer *ser, SerializeEvent event, bool &skip, const Technique *tech)
Called when technique section event raised.
TextureUnitState * textureUnit
StringVector defaultParamLines
virtual void passEventRaised(MaterialSerializer *ser, SerializeEvent event, bool &skip, const Pass *pass)
Called when pass section event raised.
AttribParserList mProgramAttribParsers
Parsers for the program definition section of a script.
AttribParserList mTextureUnitAttribParsers
Parsers for the texture unit section of a script.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Collects together the program parameters used for a GpuProgram.
map< String, ATTRIBUTE_PARSER >::type AttribParserList
Keyword-mapped attribute parsers.
bool usesVertexTextureFetch
ListenerList::iterator ListenerListIterator
vector< String >::type StringVector
GpuProgramDefinitionContainer mGpuProgramDefinitionContainer
bool supportsSkeletalAnimation
bool supportsMorphAnimation
LayerBlendSource
List of valid sources of values for blending operations used in TextureUnitState::setColourOperation ...
AttribParserList mPassAttribParsers
Parsers for the pass section of a script.
multimap< TextureUnitState::TextureEffectType, TextureUnitState::TextureEffect >::type EffectMap
GpuProgramDefinitionContainer::iterator GpuProgramDefIterator
void beginSection(unsigned short level, const bool useMainBuffer=true)
virtual void materialEventRaised(MaterialSerializer *ser, SerializeEvent event, bool &skip, const Material *mat)
Called when material section event raised.
AttribParserList mRootAttribParsers
Parsers for the root of the material script.
bool isFragmentProgramShadowReceiver
AttribParserList mProgramDefaultParamAttribParsers
Parsers for the program definition section of a script.
bool isProgramShadowCaster
LayerBlendOperationEx
Expert list of valid texture blending operations, for use with TextureUnitState::setColourOperationEx...
Specialisation of SharedPtr to allow SharedPtr to be assigned to MaterialPtr.
FilterOptions
Filtering options for textures / mipmaps.
map< String, String >::type AliasTextureNamePairList
Alias / Texture name pair (first = alias, second = texture name)
GpuProgramParametersSharedPtr programParams
CompareFunction
Comparison functions used for the depth/stencil buffer operations and others.
Class representing the state of a single texture unit during a Pass of a Technique, of a Material.
void endSection(unsigned short level, const bool useMainBuffer=true)
AttribParserList mTechniqueAttribParsers
Parsers for the technique section of a script.
ushort supportsPoseAnimation