Go to the documentation of this file.
28 #ifndef __MaterialSerializer_H__
29 #define __MaterialSerializer_H__
136 { (void)ser; (void)event; (void)skip; (void)mat; }
147 { (void)ser; (void)event; (void)skip; (void)tech; }
158 { (void)ser; (void)event; (void)skip; (void)pass; }
212 bool parseScriptLine(
String& line);
218 void finishProgramDefinition(
void);
244 void writeTechnique(
const Technique* pTech);
245 void writePass(
const Pass* pPass);
246 void writeVertexProgramRef(
const Pass* pPass);
247 void writeShadowCasterVertexProgramRef(
const Pass* pPass);
248 void writeShadowCasterFragmentProgramRef(
const Pass* pPass);
249 void writeShadowReceiverVertexProgramRef(
const Pass* pPass);
250 void writeShadowReceiverFragmentProgramRef(
const Pass* pPass);
251 void writeFragmentProgramRef(
const Pass* pPass);
253 void writeGpuPrograms(
void);
255 const unsigned short level = 4,
const bool useMainBuffer =
true);
257 const unsigned short level = 4,
const bool useMainBuffer =
true);
259 const unsigned short level = 4,
const bool useMainBuffer =
true);
260 void writeGpuProgramParameter(
264 bool isFloat,
bool isDouble,
size_t physicalIndex,
size_t physicalSize,
266 const unsigned short level,
const bool useMainBuffer);
273 void writeColourValue(
const ColourValue &colour,
bool writeAlpha =
false);
331 void queueForExport(
const MaterialPtr& pMat,
bool clearQueued =
false,
332 bool exportDefaults =
false,
const String& materialName =
"");
342 void exportQueued(
const String& filename,
const bool includeProgDef =
false,
const String& programFilename =
"");
354 void exportMaterial(
const MaterialPtr& pMat,
const String& filename,
bool exportDefaults =
false,
355 const bool includeProgDef =
false,
const String& programFilename =
"",
356 const String& materialName =
"");
358 const String &getQueuedAsString()
const;
369 void addListener(Listener* listener);
374 void removeListener(Listener* listener);
385 void beginSection(
unsigned short level,
const bool useMainBuffer =
true)
387 String& buffer = (useMainBuffer ? mBuffer : mGpuProgramBuffer);
389 for (
unsigned short i = 0; i < level; ++i)
395 void endSection(
unsigned short level,
const bool useMainBuffer =
true)
397 String& buffer = (useMainBuffer ? mBuffer : mGpuProgramBuffer);
399 for (
unsigned short i = 0; i < level; ++i)
408 String& buffer = (useMainBuffer ? mBuffer : mGpuProgramBuffer);
410 for (
unsigned short i = 0; i < level; ++i)
419 String& buffer = (useMainBuffer ? mBuffer : mGpuProgramBuffer);
420 buffer += (
" " + val);
425 if (val.find_first_of(
" \t") != String::npos)
426 return (
"\"" + val +
"\"");
433 String& buffer = (useMainBuffer ? mBuffer : mGpuProgramBuffer);
435 for (
unsigned short i = 0; i < level; ++i)
439 buffer +=
"// " + comment;
vector< std::pair< String, String > >::type customParameters
Class representing the state of a single texture unit during a Pass of a Technique,...
AttribParserList mTechniqueAttribParsers
Parsers for the technique section of a script.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
virtual void passEventRaised(MaterialSerializer *ser, SerializeEvent event, bool &skip, const Pass *pass)
Called when pass section event raised.
bool isFragmentProgramShadowCaster
When referencing, are we in context of shadow caster.
vector< String >::type StringVector
virtual void techniqueEventRaised(MaterialSerializer *ser, SerializeEvent event, bool &skip, const Technique *tech)
Called when technique section event raised.
set< String >::type GpuProgramDefinitionContainer
AttribParserList mMaterialAttribParsers
Parsers for the material section of a script.
LayerBlendSource
List of valid sources of values for blending operations used in TextureUnitState::setColourOperation ...
Structure recording the use of an automatic parameter.
AttribParserList mTextureUnitAttribParsers
Parsers for the texture unit section of a script.
void writeComment(unsigned short level, const String &comment, const bool useMainBuffer=true)
Class encapsulates rendering properties of an object.
bool usesVertexTextureFetch
Class that allows listening in on the various stages of material serialization process.
AttribParserList mProgramAttribParsers
Parsers for the program definition section of a script.
void writeValue(const String &val, const bool useMainBuffer=true)
MaterialScriptSection section
virtual ~MaterialSerializer()
default destructor
bool isVertexProgramShadowReceiver
When referencing, are we in context of shadow caster.
bool(* ATTRIBUTE_PARSER)(String ¶ms, MaterialScriptContext &context)
Function def for material attribute parser; return value determines if the next line should be {.
Class defining a single pass of a Technique (of a Material), i.e.
Class representing an approach to rendering this particular Material.
bool isVertexProgramShadowCaster
Used when referencing a program, not when defining it.
MaterialScriptContext mScriptContext
GpuProgramDefinitionContainer mGpuProgramDefinitionContainer
CompareFunction
Comparison functions used for the depth/stencil buffer operations and others.
AttribParserList mProgramDefaultParamAttribParsers
Parsers for the program definition section of a script.
GpuProgramType
Enumerates the types of programs which can run on the GPU.
GpuProgramDefinitionContainer::iterator GpuProgramDefIterator
Struct for holding a program definition which is in progress.
AttribParserList mRootAttribParsers
Parsers for the root of the material script.
void beginSection(unsigned short level, const bool useMainBuffer=true)
multimap< TextureUnitState::TextureEffectType, TextureUnitState::TextureEffect >::type EffectMap
SceneBlendFactor
Blending factors for manually blending objects with the scene.
virtual void materialEventRaised(MaterialSerializer *ser, SerializeEvent event, bool &skip, const Material *mat)
Called when material section event raised.
AttribParserList mProgramRefAttribParsers
Parsers for the program reference section of a script.
map< String, ATTRIBUTE_PARSER >::type AttribParserList
Keyword-mapped attribute parsers.
String quoteWord(const String &val)
Class for serializing Materials to / from a .material script.
map< String, String >::type AliasTextureNamePairList
Alias / Texture name pair (first = alias, second = texture name)
ListenerList::iterator ListenerListIterator
FilterOptions
Filtering options for textures / mipmaps.
ushort numAnimationParametrics
Collects together the program parameters used for a GpuProgram.
size_t lineNo
Error reporting state.
int techLev
This is used while defining a program.
MaterialScriptSection
Enum to identify material sections.
bool supportsSkeletalAnimation
vector< Listener * >::type ListenerList
Listeners list of this Serializer.
void endSection(unsigned short level, const bool useMainBuffer=true)
GpuProgramParametersSharedPtr programParams
When referencing, are we in context of shadow caster.
AttribParserList mPassAttribParsers
Parsers for the pass section of a script.
ushort supportsPoseAnimation
std::multimap< K, V, P, A > type
virtual void textureUnitStateEventRaised(MaterialSerializer *ser, SerializeEvent event, bool &skip, const TextureUnitState *textureUnit)
Called when texture unit state section event raised.
Class representing colour.
StringVector defaultParamLines
void writeAttribute(unsigned short level, const String &att, const bool useMainBuffer=true)
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.
Struct for holding the script context while parsing.
MaterialScriptProgramDefinition * programDef
LayerBlendOperationEx
Expert list of valid texture blending operations, for use with TextureUnitState::setColourOperationEx...
bool supportsMorphAnimation
TextureUnitState * textureUnit
ListenerList::const_iterator ListenerListConstIterator
bool isFragmentProgramShadowReceiver
When referencing, are we in context of shadow caster.
AliasTextureNamePairList textureAliases
Internal structure defining a texture effect.
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.