|
Public Member Functions |
| MaterialScriptCompiler (void) |
| ~MaterialScriptCompiler (void) |
virtual const String & | getClientBNFGrammer (void) const |
| gets BNF Grammer for Compositor script.
|
virtual const String & | getClientGrammerName (void) const |
| get the name of the BNF grammer.
|
void | parseScript (DataStreamPtr &stream, const String &groupName, const bool allowOverride=false) |
| Compile a material script from a data stream using a specific resource group name.
|
bool | compile (const String &source, const String &sourceName) |
| compile the source - performs 2 passes.
|
Protected Types |
typedef void(MaterialScriptCompiler::* | MSC_Action )(void) |
typedef std::map< size_t,
MSC_Action > | TokenActionMap |
typedef TokenActionMap::iterator | TokenActionIterator |
enum | TokenID {
ID_UNKOWN = 0,
ID_VERTEX_PROGRAM,
ID_FRAGMENT_PROGRAM,
ID_CLONE,
ID_VERTEXCOLOUR,
ID_COLOUR_BLEND,
ID_DEST_COLOUR,
ID_SRC_COLOUR,
ID_ONE_MINUS_DEST_COLOUR,
ID_ONE_MINUS_SRC_COLOUR,
ID_DEST_ALPHA,
ID_SRC_ALPHA,
ID_ONE_MINUS_DEST_ALPHA,
ID_ONE_MINUS_SRC_ALPHA,
ID_ALWAYS_FAIL,
ID_ALWAYS_PASS,
ID_LESS_EQUAL,
ID_LESS,
ID_EQUAL,
ID_NOT_EQUAL,
ID_GREATER_EQUAL,
ID_GREATER,
ID_CLOCKWISE,
ID_ANTICLOCKWISE,
ID_CULL_BACK,
ID_CULL_FRONT,
ID_FLAT,
ID_GOURAUD,
ID_PHONG,
ID_SOLID,
ID_WIREFRAME,
ID_POINTS,
ID_EXP,
ID_EXP2,
ID_ONCE,
ID_ONCE_PER_LIGHT,
ID_PER_LIGHT,
ID_PER_N_LIGHTS,
ID_DIRECTIONAL,
ID_SPOT,
ID_1D,
ID_2D,
ID_3D,
ID_CUBIC,
ID_UNLIMITED,
ID_ALPHA,
ID_SEPARATE_UV,
ID_COMBINED_UVW,
ID_WRAP,
ID_CLAMP,
ID_MIRROR,
ID_BORDER,
ID_BILINEAR,
ID_TRILINEAR,
ID_ANISOTROPIC,
ID_REPLACE,
ID_SOURCE1,
ID_SOURCE2,
ID_MODULATE_X2,
ID_MODULATE_X4,
ID_ADD_SIGNED,
ID_ADD_SMOOTH,
ID_SUBTRACT,
ID_BLEND_DIFFUSE_COLOUR,
ID_BLEND_DIFFUSE_ALPHA,
ID_BLEND_TEXTURE_ALPHA,
ID_BLEND_CURRENT_ALPHA,
ID_BLEND_MANUAL,
ID_DOTPRODUCT,
ID_SRC_CURRENT,
ID_SRC_TEXTURE,
ID_SRC_DIFFUSE,
ID_SRC_SPECULAR,
ID_SRC_MANUAL,
ID_SPHERICAL,
ID_PLANAR,
ID_CUBIC_REFLECTION,
ID_CUBIC_NORMAL,
ID_SCROLL_X,
ID_SCROLL_Y,
ID_SCALE_X,
ID_SCALE_Y,
ID_SINE,
ID_TRIANGLE,
ID_SQUARE,
ID_SAWTOOTH,
ID_INVERSE_SAWTOOTH,
ID_ROTATE,
ID_NAMED,
ID_SHADOW,
ID_ON,
ID_OFF,
ID_TRUE,
ID_FALSE,
ID_NONE,
ID_POINT,
ID_LINEAR,
ID_ADD,
ID_MODULATE,
ID_ALPHA_BLEND,
ID_ONE,
ID_ZERO,
ID_VERTEX,
ID_FRAGMENT,
ID_AUTOTOKENSTART
} |
enum | MaterialScriptSection {
MSS_NONE,
MSS_MATERIAL,
MSS_TECHNIQUE,
MSS_PASS,
MSS_TEXTUREUNIT,
MSS_PROGRAM_REF,
MSS_PROGRAM,
MSS_DEFAULT_PARAMETERS,
MSS_TEXTURESOURCE
} |
| Enum to identify material sections. More...
|
typedef std::vector< TokenRule > | TokenRuleContainer |
typedef TokenRuleContainer::iterator | TokenRuleIterator |
typedef std::vector< LexemeTokenDef > | LexemeTokenDefContainer |
typedef LexemeTokenDefContainer::iterator | LexemeTokenDefIterator |
typedef std::map< std::string,
size_t > | LexemeTokenMap |
typedef LexemeTokenMap::iterator | TokenKeyIterator |
typedef std::vector< TokenInst > | TokenInstContainer |
typedef TokenInstContainer::iterator | TokenInstIterator |
typedef std::map< size_t,
String > | LabelContainer |
| storage container for string labels defined in source container uses Token index as a key associated with a label
|
enum | OperationType {
otUNKNOWN,
otRULE,
otAND,
otOR,
otOPTIONAL,
otREPEAT,
otDATA,
otNOT_TEST,
otINSERT_TOKEN,
otEND
} |
enum | SystemRuleToken { _no_token_ = SystemTokenBase,
_character_,
_value_,
_no_space_skip_
} |
enum | BNF_ID {
BNF_UNKOWN = 0,
BNF_SYNTAX,
BNF_RULE,
BNF_IDENTIFIER,
BNF_IDENTIFIER_RIGHT,
BNF_IDENTIFIER_CHARACTERS,
BNF_ID_BEGIN,
BNF_ID_END,
BNF_CONSTANT_BEGIN,
BNF_SET_RULE,
BNF_EXPRESSION,
BNF_AND_TERM,
BNF_OR_TERM,
BNF_TERM,
BNF_TERM_ID,
BNF_CONSTANT,
BNF_OR,
BNF_TERMINAL_SYMBOL,
BNF_TERMINAL_START,
BNF_REPEAT_EXPRESSION,
BNF_REPEAT_BEGIN,
BNF_REPEAT_END,
BNF_SET,
BNF_SET_BEGIN,
BNF_SET_END,
BNF_NOT_TEST,
BNF_NOT_TEST_BEGIN,
BNF_CONDITIONAL_TOKEN_INSERT,
BNF_OPTIONAL_EXPRESSION,
BNF_NOT_EXPRESSION,
BNF_NOT_CHK,
BNF_OPTIONAL_BEGIN,
BNF_OPTIONAL_END,
BNF_NO_TOKEN_START,
BNF_SINGLEQUOTE,
BNF_SINGLE_QUOTE_EXC,
BNF_SET_END_EXC,
BNF_ANY_CHARACTER,
BNF_SPECIAL_CHARACTERS1,
BNF_SPECIAL_CHARACTERS2,
BNF_WHITE_SPACE_CHK,
BNF_LETTER,
BNF_LETTER_DIGIT,
BNF_DIGIT,
BNF_WHITE_SPACE,
BNF_ALPHA_SET,
BNF_NUMBER_SET,
BNF_SPECIAL_CHARACTER_SET1,
BNF_SPECIAL_CHARACTER_SET2,
BNF_SPECIAL_CHARACTER_SET3,
BNF_NOT_CHARS,
BNF_AUTOTOKENSTART
} |
Protected Member Functions |
virtual void | executeTokenAction (const size_t tokenID) |
| Execute an Action associated with a token.
|
virtual size_t | getAutoTokenIDStart () const |
| Get the start position of auto generated token IDs.
|
virtual void | setupTokenDefinitions (void) |
| Associate all the lexemes used in a material script with their corresponding tokens and actions.
|
void | addLexemeTokenAction (const String &lexeme, const size_t token, const MSC_Action action=0) |
void | addLexemeAction (const String &lexeme, const MSC_Action action) |
| Associate all the lexemes used in a material script with their corresponding actions and have token IDs auto-generated.
|
void | logParseError (const String &error) |
ColourValue | _parseColourValue (void) |
CompareFunction | convertCompareFunction (void) |
void | parseOpenBrace (void) |
void | parseCloseBrace (void) |
void | parseMaterial (void) |
void | parseLodDistances (void) |
void | parseReceiveShadows (void) |
void | parseTransparencyCastsShadows (void) |
void | parseSetTextureAlias (void) |
void | parseTechnique (void) |
void | parseScheme (void) |
void | parseLodIndex (void) |
void | parsePass (void) |
void | parseAmbient (void) |
void | parseDiffuse (void) |
void | parseSpecular (void) |
void | parseEmissive (void) |
void | parseSceneBlend (void) |
SceneBlendFactor | convertBlendFactor (void) |
void | parseDepthCheck (void) |
void | parseDepthWrite (void) |
void | parseDepthFunc (void) |
void | parseDepthBias (void) |
void | parseAlphaRejection (void) |
void | parseCullHardware (void) |
void | parseCullSoftware (void) |
void | parseLighting (void) |
void | parseShading (void) |
void | parsePolygonMode (void) |
void | parseFogOverride (void) |
void | parseMaxLights (void) |
void | parseStartLight (void) |
void | parseIteration (void) |
void | parseIterationLightTypes (void) |
void | parseColourWrite (void) |
void | parsePointSize (void) |
void | parsePointSprites (void) |
void | parsePointSizeMin (void) |
void | parsePointSizeMax (void) |
void | parsePointSizeAttenuation (void) |
void | parseTextureUnit (void) |
void | parseTextureAlias (void) |
void | parseTexture (void) |
void | parseAnimTexture (void) |
void | parseCubicTexture (void) |
void | parseTexCoord (void) |
TextureUnitState::TextureAddressingMode | convTexAddressMode (void) |
void | parseTexAddressMode (void) |
void | parseTexBorderColour (void) |
void | parseFiltering (void) |
FilterOptions | convertFiltering () |
void | parseMaxAnisotropy (void) |
void | parseMipMapBias (void) |
void | parseColourOp (void) |
void | parseColourOpEx (void) |
LayerBlendOperationEx | convertBlendOpEx (void) |
LayerBlendSource | convertBlendSource (void) |
void | parseColourOpMultipassFallback (void) |
void | parseAlphaOpEx (void) |
void | parseEnvMap (void) |
void | parseScroll (void) |
void | parseScrollAnim (void) |
void | parseRotate (void) |
void | parseRotateAnim (void) |
void | parseScale (void) |
void | parseWaveXform (void) |
void | parseTransform (void) |
void | parseTextureCustomParameter (void) |
void | parseBindingType (void) |
void | parseContentType (void) |
void | parseGPUProgram (void) |
void | parseProgramSource (void) |
void | parseProgramSyntax (void) |
void | parseProgramCustomParameter (void) |
void | parseDefaultParams (void) |
void | parseProgramSkeletalAnimation (void) |
void | parseProgramMorphAnimation (void) |
void | parseProgramPoseAnimation (void) |
void | parseProgramVertexTextureFetch (void) |
void | parseVertexProgramRef (void) |
void | parseFragmentProgramRef (void) |
void | parseShadowCasterVertexProgramRef (void) |
void | parseShadowReceiverVertexProgramRef (void) |
void | parseShadowReceiverFragmentProgramRef (void) |
void | parseParamIndexed (void) |
void | parseParamIndexedAuto (void) |
void | parseParamNamed (void) |
void | parseParamNamedAuto (void) |
void | processManualProgramParam (bool isNamed, const String commandName, size_t index=0, const String ¶mName=StringUtil::BLANK) |
void | processAutoProgramParam (bool isNamed, const String commandName, size_t index, const String ¶mName=StringUtil::BLANK) |
void | finishProgramDefinition (void) |
bool | doPass1 () |
| perform pass 1 of compile process scans source for lexemes that can be tokenized and then performs general semantic and context verification on each lexeme before it is tokenized.
|
bool | doPass2 () |
| performs Pass 2 of compile process which is execution of the tokens
|
const TokenInst & | getNextToken (const size_t expectedTokenID=0) const |
| Gets the next token from the instruction que.
|
const TokenInst & | getCurrentToken (const size_t expectedTokenID=0) const |
| Gets the current token from the instruction que.
|
bool | testNextTokenID (const size_t expectedTokenID) const |
| If a next token instruction exist then test if its token ID matches.
|
bool | testCurrentTokenID (const size_t expectedTokenID) const |
| If a current token instruction exist then test if its token ID matches.
|
void | skipToken (void) const |
| skip to the next token in the pass2 queue.
|
void | replaceToken (void) |
| go back to the previous token in the pass2 queue.
|
float | getNextTokenValue (void) const |
| Gets the next token's associated floating point value in the instruction que that was parsed from the text source.
|
float | getCurrentTokenValue (void) const |
| Gets the current token's associated floating point value in the instruction que that was parsed from the text source.
|
const String & | getNextTokenLabel (void) const |
| Gets the next token's associated text label in the instruction que that was parsed from the text source.
|
const String & | getCurrentTokenLabel (void) const |
| Gets the next token's associated text label in the instruction que that was parsed from the text source.
|
size_t | getNextTokenID (void) const |
| Get the next token's ID value.
|
size_t | getCurrentTokenID (void) const |
| Get the current token's ID value.
|
const String & | getNextTokenLexeme (void) const |
| Get the next token's lexeme string.
|
const String & | getCurrentTokenLexeme (void) const |
| Get the current token's lexeme string.
|
size_t | getPass2TokenQueCount (void) const |
| Gets the number of tokens waiting in the instruction que that need to be processed by an token action in pass 2.
|
size_t | getRemainingTokensForAction (void) const |
| Get the number of tokens not processed by action token.
|
void | setPass2TokenQuePosition (size_t pos, const bool activateAction=false) |
| Manualy set the Pass2 Token que position.
|
size_t | getPass2TokenQuePosition (void) const |
| Get the current position in the Pass2 Token Que.
|
bool | setNextActionQuePosition (size_t pos, const bool search=false) |
| Set the position of the next token action in the Pass2 Token Que.
|
size_t | addLexemeToken (const String &lexeme, const size_t token, const bool hasAction=false, const bool caseSensitive=false) |
| Add a lexeme token association.
|
void | setClientBNFGrammer (void) |
| Sets up the parser rules for the client based on the BNF Grammer text passed in.
|
void | findEOL () |
| find the eol charater
|
bool | isFloatValue (float &fvalue, size_t &charsize) const |
| check to see if the text at the present position in the source is a numerical constant
|
bool | isCharacterLabel (const size_t rulepathIDX) |
| Check if source at current position is supposed to be a user defined character label.
|
bool | isLexemeMatch (const String &lexeme, const bool caseSensitive) const |
| check to see if the text is in the lexeme text library
|
bool | isEndOfSource () const |
| Check if pass 1 has parsed to the end of the source.
|
bool | positionToNextLexeme () |
| position to the next possible valid sysmbol
|
bool | processRulePath (size_t rulepathIDX) |
| process input source text using rulepath to determine allowed tokens
|
void | setActiveContexts (const uint contexts) |
| setup ActiveContexts - should be called by subclass to setup initial language contexts
|
void | skipComments () |
| comment specifiers are hard coded
|
void | skipEOL () |
| find end of line marker and move past it
|
void | skipWhiteSpace () |
| skip all the white space which includes spaces and tabs
|
bool | ValidateToken (const size_t rulepathIDX, const size_t activeRuleID) |
| check if current position in source has the lexeme text equivalent to the TokenID
|
void | verifyTokenRuleLinks (const String &grammerName) |
| scan through all the rules and initialize token definition with index to rules for non-terminal tokens.
|
void | checkTokenActionTrigger (void) |
| Checks the last token instruction and if it has an action then it triggers the action of the previously found token having an action.
|
String | getBNFGrammerTextFromRulePath (size_t ruleID, const size_t level=0) |
| Get the text representation of the rule path.
|
Protected Attributes |
MaterialScriptContext | mScriptContext |
TokenState * | mClientTokenState |
TokenState * | mActiveTokenState |
| Active token que, definitions, rules currntly being used by parser.
|
size_t | mPass2TokenQuePosition |
| the location within the token instruction container where pass 2 is
|
size_t | mPreviousActionQuePosition |
| the que position of the previous token that had an action.
|
size_t | mNextActionQuePosition |
| the que position for the next token that has an action.
|
const String * | mSource |
| pointer to the source to be compiled
|
String | mSourceName |
| name of the source to be compiled
|
size_t | mEndOfSource |
size_t | mCurrentLine |
size_t | mCharPos |
| current line number in source being tokenized
|
size_t | mErrorCharPos |
| position in current line in source being tokenized
|
std::map< size_t, float > | mConstants |
| storage container for constants defined in source container uses Token index as a key associated with a float constant
|
LabelContainer | mLabels |
bool | mLabelIsActive |
| flag indicates when a label is being parsed.
|
size_t | mActiveLabelKey |
| the key of the active label being built during pass 1.
|
String * | mActiveLabel |
| The active label that is receiving characters during pass 1.
|
bool | mNoSpaceSkip |
| flag being true indicates that spaces are not to be skipped automatically gets set to false when mLabelIsActive goes to false
|
bool | mNoTerminalToken |
| if flag is true then next terminal token is not added to token que if found but does effect rule path flow
|
size_t | mInsertTokenID |
| TokenID to insert if next rule finds a terminal token if zero then no token inserted.
|
uint | mActiveContexts |
| Active Contexts pattern used in pass 1 to determine which tokens are valid for a certain context.
|
Static Protected Attributes |
static TokenActionMap | mTokenActionMap |
| Map of Token value as key to an Action.
|
static const size_t | SystemTokenBase = 1000 |
Classes |
struct | MaterialScriptContext |
| Struct for holding the script context while parsing. More...
|
struct | MaterialScriptProgramDefinition |
| Struct for holding a program definition which is in progress. More...
|