diff --git a/Components/RTShaderSystem/src/OgreShaderScriptTranslator.cpp b/Components/RTShaderSystem/src/OgreShaderScriptTranslator.cpp index 0bbc39999d8..4d3766e0000 100644 --- a/Components/RTShaderSystem/src/OgreShaderScriptTranslator.cpp +++ b/Components/RTShaderSystem/src/OgreShaderScriptTranslator.cpp @@ -42,11 +42,11 @@ void SGScriptTranslator::translate(ScriptCompiler* compiler, const AbstractNodeP ObjectAbstractNode* parent = static_cast(obj->parent); // Translate section within a pass context. - if (parent->id == ID_PASS) + if (parent->name == "pass") { translatePass(compiler, node); } - if (parent->id == ID_TEXTURE_UNIT) + if (parent->name == "texture_unit") { translateTextureUnit(compiler, node); } diff --git a/OgreMain/include/OgreScriptCompiler.h b/OgreMain/include/OgreScriptCompiler.h index 129d29097d2..89e67524dc0 100644 --- a/OgreMain/include/OgreScriptCompiler.h +++ b/OgreMain/include/OgreScriptCompiler.h @@ -45,32 +45,11 @@ namespace Ogre /** \addtogroup Script * @{ */ - /** These enums hold the types of the concrete parsed nodes */ - enum ConcreteNodeType - { - CNT_VARIABLE, - CNT_VARIABLE_ASSIGN, - CNT_WORD, - CNT_IMPORT, - CNT_QUOTE, - CNT_LBRACE, - CNT_RBRACE, - CNT_COLON - }; - /** The ConcreteNode is the struct that holds an un-conditioned sub-tree of parsed input */ struct ConcreteNode; typedef SharedPtr ConcreteNodePtr; typedef std::list ConcreteNodeList; typedef SharedPtr ConcreteNodeListPtr; - struct ConcreteNode : public ScriptCompilerAlloc - { - String token, file; - unsigned int line; - ConcreteNodeType type; - ConcreteNodeList children; - ConcreteNode *parent; - }; /** This enum holds the types of the possible abstract nodes */ enum AbstractNodeType @@ -161,28 +140,6 @@ namespace Ogre const String& getValue() const override { return name; } }; - /** This abstract node represents an import statement */ - class _OgreExport ImportAbstractNode : public AbstractNode - { - public: - String target, source; - public: - ImportAbstractNode(); - AbstractNode *clone() const override; - const String& getValue() const override { return target; } - }; - - /** This abstract node represents a variable assignment */ - class _OgreExport VariableAccessAbstractNode : public AbstractNode - { - public: - String name; - public: - VariableAccessAbstractNode(AbstractNode *ptr); - AbstractNode *clone() const override; - const String& getValue() const override { return name; } - }; - class ScriptCompilerEvent; class ScriptCompilerListener; @@ -192,6 +149,7 @@ namespace Ogre */ class _OgreExport ScriptCompiler : public ScriptCompilerAlloc { + friend class ScriptCompilerManager; public: // Externally accessible types //typedef std::map IdMap; typedef std::unordered_map IdMap; @@ -217,15 +175,6 @@ namespace Ogre ScriptCompiler(); virtual ~ScriptCompiler() {} - /// Takes in a string of script code and compiles it into resources - /** - * @param str The script code - * @param source The source of the script code (e.g. a script file) - * @param group The resource group to place the compiled resources into - */ - bool compile(const String &str, const String &source, const String &group); - /// Compiles resources from the given concrete node list - bool compile(const ConcreteNodeListPtr &nodes, const String &group); /// Adds the given error to the compiler's list of errors void addError(uint32 code, const String &file, int line, const String &msg = ""); /// Sets the listener used by the compiler @@ -237,20 +186,18 @@ namespace Ogre /// Internal method for firing the handleEvent method bool _fireEvent(ScriptCompilerEvent *evt, void *retval); - /// Adds a custom word id which can be used for custom script translators - /** - @param - word The word to be registered. - - @return - The word id for the registered word. - - @note - If the word is already registered, the already registered id is returned. - */ - uint32 registerCustomWordId(const String &word); - private: // Tree processing + /// Takes in a string of script code and compiles it into resources + /** + * @param str The script code + * @param source The source of the script code (e.g. a script file) + * @param group The resource group to place the compiled resources into + */ + bool compile(const String &str, const String &source, const String &group); + /// Compiles resources from the given concrete node list + bool compile(const ConcreteNodeListPtr &nodes, const String &group); + /// Adds a custom word id which can be used for custom script translators + uint32 registerCustomWordId(const String &word); AbstractNodeListPtr convertToAST(const ConcreteNodeList &nodes); /// This built-in function processes import nodes void processImports(AbstractNodeList &nodes); @@ -317,17 +264,6 @@ namespace Ogre static void visit(AbstractTreeBuilder *visitor, const ConcreteNodeList &nodes); }; friend class AbstractTreeBuilder; - public: // Public translator definitions - // This enum are built-in word id values - enum - { - ID_ON = 1, - ID_OFF = 2, - ID_TRUE = 1, - ID_FALSE = 2, - ID_YES = 1, - ID_NO = 2 - }; }; /** @@ -538,304 +474,6 @@ namespace Ogre :ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup){} }; - /// This enum defines the integer ids for keywords this compiler handles - enum - { - ID_MATERIAL = 3, - ID_VERTEX_PROGRAM, - ID_GEOMETRY_PROGRAM, - ID_FRAGMENT_PROGRAM, - ID_TECHNIQUE, - ID_PASS, - ID_TEXTURE_UNIT, - ID_VERTEX_PROGRAM_REF, - ID_GEOMETRY_PROGRAM_REF, - ID_FRAGMENT_PROGRAM_REF, - ID_SHADOW_CASTER_VERTEX_PROGRAM_REF, - ID_SHADOW_CASTER_FRAGMENT_PROGRAM_REF, - ID_SHADOW_RECEIVER_VERTEX_PROGRAM_REF, - ID_SHADOW_RECEIVER_FRAGMENT_PROGRAM_REF, - ID_SHADOW_CASTER_MATERIAL, - ID_SHADOW_RECEIVER_MATERIAL, - - ID_LOD_VALUES, - ID_LOD_STRATEGY, - ID_LOD_DISTANCES, - ID_RECEIVE_SHADOWS, - ID_TRANSPARENCY_CASTS_SHADOWS, - ID_SET_TEXTURE_ALIAS, - - ID_SOURCE, - ID_SYNTAX, - ID_DEFAULT_PARAMS, - ID_PARAM_INDEXED, - ID_PARAM_NAMED, - ID_PARAM_INDEXED_AUTO, - ID_PARAM_NAMED_AUTO, - - ID_SCHEME, - ID_LOD_INDEX, - ID_GPU_VENDOR_RULE, - ID_GPU_DEVICE_RULE, - ID_INCLUDE, - ID_EXCLUDE, - - ID_AMBIENT, - ID_DIFFUSE, - ID_SPECULAR, - ID_EMISSIVE, - ID_VERTEXCOLOUR, - ID_SCENE_BLEND, - ID_COLOUR_BLEND, - ID_ONE, - ID_ZERO, - 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_SEPARATE_SCENE_BLEND, - ID_SCENE_BLEND_OP, - ID_REVERSE_SUBTRACT, - ID_MIN, - ID_MAX, - ID_SEPARATE_SCENE_BLEND_OP, - ID_DEPTH_CHECK, - ID_DEPTH_WRITE, - ID_DEPTH_FUNC, - ID_DEPTH_BIAS, - ID_ITERATION_DEPTH_BIAS, - ID_ALWAYS_FAIL, - ID_ALWAYS_PASS, - ID_LESS_EQUAL, - ID_LESS, - ID_EQUAL, - ID_NOT_EQUAL, - ID_GREATER_EQUAL, - ID_GREATER, - ID_ALPHA_REJECTION, - ID_ALPHA_TO_COVERAGE, - ID_LIGHT_SCISSOR, - ID_LIGHT_CLIP_PLANES, - ID_TRANSPARENT_SORTING, - ID_ILLUMINATION_STAGE, - ID_DECAL, - ID_CULL_HARDWARE, - ID_CLOCKWISE, - ID_ANTICLOCKWISE, - ID_CULL_SOFTWARE, - ID_BACK, - ID_FRONT, - ID_LIGHTING, - ID_SHADING, - ID_FLAT, - ID_GOURAUD, - ID_PHONG, - ID_POLYGON_MODE, - ID_SOLID, - ID_WIREFRAME, - ID_POINTS, - ID_POLYGON_MODE_OVERRIDEABLE, - ID_FOG_OVERRIDE, - ID_NONE, - ID_LINEAR, - ID_EXP, - ID_EXP2, - ID_COLOUR_WRITE, - ID_MAX_LIGHTS, - ID_START_LIGHT, - ID_ITERATION, - ID_ONCE, - ID_ONCE_PER_LIGHT, - ID_PER_LIGHT, - ID_PER_N_LIGHTS, - ID_POINT, - ID_SPOT, - ID_DIRECTIONAL, - ID_LIGHT_MASK, - ID_POINT_SIZE, - ID_POINT_SPRITES, - ID_POINT_SIZE_ATTENUATION, - ID_POINT_SIZE_MIN, - ID_POINT_SIZE_MAX, - - ID_TEXTURE_ALIAS, - ID_TEXTURE, - ID_1D, - ID_2D, - ID_3D, - ID_CUBIC, - ID_2DARRAY, - ID_UNLIMITED, - ID_ALPHA, - ID_GAMMA, - ID_ANIM_TEXTURE, - ID_CUBIC_TEXTURE, - ID_SEPARATE_UV, - ID_COMBINED_UVW, - ID_TEX_COORD_SET, - ID_TEX_ADDRESS_MODE, - ID_WRAP, - ID_CLAMP, - ID_BORDER, - ID_MIRROR, - ID_TEX_BORDER_COLOUR, - ID_FILTERING, - ID_BILINEAR, - ID_TRILINEAR, - ID_ANISOTROPIC, - ID_CMPTEST, - ID_ON, - ID_OFF, - ID_CMPFUNC, - ID_MAX_ANISOTROPY, - ID_MIPMAP_BIAS, - ID_COLOUR_OP, - ID_REPLACE, - ID_ADD, - ID_MODULATE, - ID_ALPHA_BLEND, - ID_COLOUR_OP_EX, - 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_DOT_PRODUCT, - ID_SRC_CURRENT, - ID_SRC_TEXTURE, - ID_SRC_DIFFUSE, - ID_SRC_SPECULAR, - ID_SRC_MANUAL, - ID_COLOUR_OP_MULTIPASS_FALLBACK, - ID_ALPHA_OP_EX, - ID_ENV_MAP, - ID_SPHERICAL, - ID_PLANAR, - ID_CUBIC_REFLECTION, - ID_CUBIC_NORMAL, - ID_SCROLL, - ID_SCROLL_ANIM, - ID_ROTATE, - ID_ROTATE_ANIM, - ID_SCALE, - ID_WAVE_XFORM, - ID_SCROLL_X, - ID_SCROLL_Y, - ID_SCALE_X, - ID_SCALE_Y, - ID_SINE, - ID_TRIANGLE, - ID_SQUARE, - ID_SAWTOOTH, - ID_INVERSE_SAWTOOTH, - ID_TRANSFORM, - ID_CONTENT_TYPE, - ID_NAMED, - ID_SHADOW, - ID_TEXTURE_SOURCE, - ID_SHARED_PARAMS, - ID_SHARED_PARAM_NAMED, - ID_SHARED_PARAMS_REF, - - ID_PARTICLE_SYSTEM, - ID_EMITTER, - ID_AFFECTOR, - - ID_COMPOSITOR, - ID_TARGET, - ID_TARGET_OUTPUT, - - ID_INPUT, - ID_PREVIOUS, - ID_TARGET_WIDTH, - ID_TARGET_HEIGHT, - ID_TARGET_WIDTH_SCALED, - ID_TARGET_HEIGHT_SCALED, - ID_COMPOSITOR_LOGIC, - ID_TEXTURE_REF, - ID_SCOPE_LOCAL, - ID_SCOPE_CHAIN, - ID_SCOPE_GLOBAL, - ID_POOLED, - //ID_GAMMA, - already registered for material - ID_NO_FSAA, - ID_DEPTH_POOL, - ID_ONLY_INITIAL, - ID_VISIBILITY_MASK, - ID_LOD_BIAS, - ID_MATERIAL_SCHEME, - ID_SHADOWS_ENABLED, - - ID_CLEAR, - ID_STENCIL, - ID_RENDER_SCENE, - ID_RENDER_QUAD, - ID_IDENTIFIER, - ID_FIRST_RENDER_QUEUE, - ID_LAST_RENDER_QUEUE, - ID_QUAD_NORMALS, - ID_CAMERA_FAR_CORNERS_VIEW_SPACE, - ID_CAMERA_FAR_CORNERS_WORLD_SPACE, - - ID_BUFFERS, - ID_COLOUR, - ID_DEPTH, - ID_COLOUR_VALUE, - ID_DEPTH_VALUE, - ID_STENCIL_VALUE, - - ID_CHECK, - ID_COMP_FUNC, - ID_REF_VALUE, - ID_MASK, - ID_FAIL_OP, - ID_KEEP, - ID_INCREMENT, - ID_DECREMENT, - ID_INCREMENT_WRAP, - ID_DECREMENT_WRAP, - ID_INVERT, - ID_DEPTH_FAIL_OP, - ID_PASS_OP, - ID_TWO_SIDED, - // Support for shader model 5.0 - // More program IDs - ID_TESSELLATION_HULL_PROGRAM, - ID_TESSELLATION_DOMAIN_PROGRAM, - ID_COMPUTE_PROGRAM, - ID_TESSELLATION_HULL_PROGRAM_REF, - ID_TESSELLATION_DOMAIN_PROGRAM_REF, - ID_COMPUTE_PROGRAM_REF, - // More binding IDs - ID_GEOMETRY, - ID_TESSELLATION_HULL, - ID_TESSELLATION_DOMAIN, - ID_COMPUTE, - - // added during 1.11. re-sort for 1.12 - ID_LINE_WIDTH, - ID_SAMPLER, - ID_SAMPLER_REF, - ID_THREAD_GROUPS, - ID_RENDER_CUSTOM, - ID_AUTO, - ID_CAMERA, - ID_ALIGN_TO_FACE, - ID_UNORDERED_ACCESS_MIP, - - ID_END_BUILTIN_IDS - }; /** @} */ /** @} */ } diff --git a/OgreMain/src/OgreScriptCompiler.cpp b/OgreMain/src/OgreScriptCompiler.cpp index 7e679d47dcf..244f8da2331 100644 --- a/OgreMain/src/OgreScriptCompiler.cpp +++ b/OgreMain/src/OgreScriptCompiler.cpp @@ -30,11 +30,34 @@ THE SOFTWARE. #include "OgreScriptParser.h" #include "OgreBuiltinScriptTranslators.h" #include "OgreComponents.h" +#include "OgreScriptIDs.h" #define DEBUG_AST 0 namespace Ogre { + /** This abstract node represents an import statement */ + class ImportAbstractNode : public AbstractNode + { + public: + String target, source; + public: + ImportAbstractNode(); + AbstractNode *clone() const override; + const String& getValue() const override { return target; } + }; + + /** This abstract node represents a variable assignment */ + class VariableAccessAbstractNode : public AbstractNode + { + public: + String name; + public: + VariableAccessAbstractNode(AbstractNode *ptr); + AbstractNode *clone() const override; + const String& getValue() const override { return name; } + }; + // AbstractNode AbstractNode::AbstractNode(AbstractNode *ptr) :line(0), type(ANT_UNKNOWN), parent(ptr) diff --git a/OgreMain/src/OgreScriptIDs.h b/OgreMain/src/OgreScriptIDs.h new file mode 100644 index 00000000000..172f3840249 --- /dev/null +++ b/OgreMain/src/OgreScriptIDs.h @@ -0,0 +1,307 @@ +// This enum are built-in word id values +enum +{ + ID_ON = 1, + ID_OFF = 2, + ID_TRUE = 1, + ID_FALSE = 2, + ID_YES = 1, + ID_NO = 2 +}; + +/// This enum defines the integer ids for keywords this compiler handles +enum +{ + ID_MATERIAL = 3, + ID_VERTEX_PROGRAM, + ID_GEOMETRY_PROGRAM, + ID_FRAGMENT_PROGRAM, + ID_TECHNIQUE, + ID_PASS, + ID_TEXTURE_UNIT, + ID_VERTEX_PROGRAM_REF, + ID_GEOMETRY_PROGRAM_REF, + ID_FRAGMENT_PROGRAM_REF, + ID_SHADOW_CASTER_VERTEX_PROGRAM_REF, + ID_SHADOW_CASTER_FRAGMENT_PROGRAM_REF, + ID_SHADOW_RECEIVER_VERTEX_PROGRAM_REF, + ID_SHADOW_RECEIVER_FRAGMENT_PROGRAM_REF, + ID_SHADOW_CASTER_MATERIAL, + ID_SHADOW_RECEIVER_MATERIAL, + + ID_LOD_VALUES, + ID_LOD_STRATEGY, + ID_LOD_DISTANCES, + ID_RECEIVE_SHADOWS, + ID_TRANSPARENCY_CASTS_SHADOWS, + ID_SET_TEXTURE_ALIAS, + + ID_SOURCE, + ID_SYNTAX, + ID_DEFAULT_PARAMS, + ID_PARAM_INDEXED, + ID_PARAM_NAMED, + ID_PARAM_INDEXED_AUTO, + ID_PARAM_NAMED_AUTO, + + ID_SCHEME, + ID_LOD_INDEX, + ID_GPU_VENDOR_RULE, + ID_GPU_DEVICE_RULE, + ID_INCLUDE, + ID_EXCLUDE, + + ID_AMBIENT, + ID_DIFFUSE, + ID_SPECULAR, + ID_EMISSIVE, + ID_VERTEXCOLOUR, + ID_SCENE_BLEND, + ID_COLOUR_BLEND, + ID_ONE, + ID_ZERO, + 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_SEPARATE_SCENE_BLEND, + ID_SCENE_BLEND_OP, + ID_REVERSE_SUBTRACT, + ID_MIN, + ID_MAX, + ID_SEPARATE_SCENE_BLEND_OP, + ID_DEPTH_CHECK, + ID_DEPTH_WRITE, + ID_DEPTH_FUNC, + ID_DEPTH_BIAS, + ID_ITERATION_DEPTH_BIAS, + ID_ALWAYS_FAIL, + ID_ALWAYS_PASS, + ID_LESS_EQUAL, + ID_LESS, + ID_EQUAL, + ID_NOT_EQUAL, + ID_GREATER_EQUAL, + ID_GREATER, + ID_ALPHA_REJECTION, + ID_ALPHA_TO_COVERAGE, + ID_LIGHT_SCISSOR, + ID_LIGHT_CLIP_PLANES, + ID_TRANSPARENT_SORTING, + ID_ILLUMINATION_STAGE, + ID_DECAL, + ID_CULL_HARDWARE, + ID_CLOCKWISE, + ID_ANTICLOCKWISE, + ID_CULL_SOFTWARE, + ID_BACK, + ID_FRONT, + ID_LIGHTING, + ID_SHADING, + ID_FLAT, + ID_GOURAUD, + ID_PHONG, + ID_POLYGON_MODE, + ID_SOLID, + ID_WIREFRAME, + ID_POINTS, + ID_POLYGON_MODE_OVERRIDEABLE, + ID_FOG_OVERRIDE, + ID_NONE, + ID_LINEAR, + ID_EXP, + ID_EXP2, + ID_COLOUR_WRITE, + ID_MAX_LIGHTS, + ID_START_LIGHT, + ID_ITERATION, + ID_ONCE, + ID_ONCE_PER_LIGHT, + ID_PER_LIGHT, + ID_PER_N_LIGHTS, + ID_POINT, + ID_SPOT, + ID_DIRECTIONAL, + ID_LIGHT_MASK, + ID_POINT_SIZE, + ID_POINT_SPRITES, + ID_POINT_SIZE_ATTENUATION, + ID_POINT_SIZE_MIN, + ID_POINT_SIZE_MAX, + + ID_TEXTURE_ALIAS, + ID_TEXTURE, + ID_1D, + ID_2D, + ID_3D, + ID_CUBIC, + ID_2DARRAY, + ID_UNLIMITED, + ID_ALPHA, + ID_GAMMA, + ID_ANIM_TEXTURE, + ID_CUBIC_TEXTURE, + ID_SEPARATE_UV, + ID_COMBINED_UVW, + ID_TEX_COORD_SET, + ID_TEX_ADDRESS_MODE, + ID_WRAP, + ID_CLAMP, + ID_BORDER, + ID_MIRROR, + ID_TEX_BORDER_COLOUR, + ID_FILTERING, + ID_BILINEAR, + ID_TRILINEAR, + ID_ANISOTROPIC, + ID_CMPTEST, + ID_CMPFUNC, + ID_MAX_ANISOTROPY, + ID_MIPMAP_BIAS, + ID_COLOUR_OP, + ID_REPLACE, + ID_ADD, + ID_MODULATE, + ID_ALPHA_BLEND, + ID_COLOUR_OP_EX, + 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_DOT_PRODUCT, + ID_SRC_CURRENT, + ID_SRC_TEXTURE, + ID_SRC_DIFFUSE, + ID_SRC_SPECULAR, + ID_SRC_MANUAL, + ID_COLOUR_OP_MULTIPASS_FALLBACK, + ID_ALPHA_OP_EX, + ID_ENV_MAP, + ID_SPHERICAL, + ID_PLANAR, + ID_CUBIC_REFLECTION, + ID_CUBIC_NORMAL, + ID_SCROLL, + ID_SCROLL_ANIM, + ID_ROTATE, + ID_ROTATE_ANIM, + ID_SCALE, + ID_WAVE_XFORM, + ID_SCROLL_X, + ID_SCROLL_Y, + ID_SCALE_X, + ID_SCALE_Y, + ID_SINE, + ID_TRIANGLE, + ID_SQUARE, + ID_SAWTOOTH, + ID_INVERSE_SAWTOOTH, + ID_TRANSFORM, + ID_CONTENT_TYPE, + ID_NAMED, + ID_SHADOW, + ID_TEXTURE_SOURCE, + ID_SHARED_PARAMS, + ID_SHARED_PARAM_NAMED, + ID_SHARED_PARAMS_REF, + + ID_PARTICLE_SYSTEM, + ID_EMITTER, + ID_AFFECTOR, + + ID_COMPOSITOR, + ID_TARGET, + ID_TARGET_OUTPUT, + + ID_INPUT, + ID_PREVIOUS, + ID_TARGET_WIDTH, + ID_TARGET_HEIGHT, + ID_TARGET_WIDTH_SCALED, + ID_TARGET_HEIGHT_SCALED, + ID_COMPOSITOR_LOGIC, + ID_TEXTURE_REF, + ID_SCOPE_LOCAL, + ID_SCOPE_CHAIN, + ID_SCOPE_GLOBAL, + ID_POOLED, + //ID_GAMMA, - already registered for material + ID_NO_FSAA, + ID_DEPTH_POOL, + ID_ONLY_INITIAL, + ID_VISIBILITY_MASK, + ID_LOD_BIAS, + ID_MATERIAL_SCHEME, + ID_SHADOWS_ENABLED, + + ID_CLEAR, + ID_STENCIL, + ID_RENDER_SCENE, + ID_RENDER_QUAD, + ID_IDENTIFIER, + ID_FIRST_RENDER_QUEUE, + ID_LAST_RENDER_QUEUE, + ID_QUAD_NORMALS, + ID_CAMERA_FAR_CORNERS_VIEW_SPACE, + ID_CAMERA_FAR_CORNERS_WORLD_SPACE, + + ID_BUFFERS, + ID_COLOUR, + ID_DEPTH, + ID_COLOUR_VALUE, + ID_DEPTH_VALUE, + ID_STENCIL_VALUE, + + ID_CHECK, + ID_COMP_FUNC, + ID_REF_VALUE, + ID_MASK, + ID_FAIL_OP, + ID_KEEP, + ID_INCREMENT, + ID_DECREMENT, + ID_INCREMENT_WRAP, + ID_DECREMENT_WRAP, + ID_INVERT, + ID_DEPTH_FAIL_OP, + ID_PASS_OP, + ID_TWO_SIDED, + // Support for shader model 5.0 + // More program IDs + ID_TESSELLATION_HULL_PROGRAM, + ID_TESSELLATION_DOMAIN_PROGRAM, + ID_COMPUTE_PROGRAM, + ID_TESSELLATION_HULL_PROGRAM_REF, + ID_TESSELLATION_DOMAIN_PROGRAM_REF, + ID_COMPUTE_PROGRAM_REF, + // More binding IDs + ID_GEOMETRY, + ID_TESSELLATION_HULL, + ID_TESSELLATION_DOMAIN, + ID_COMPUTE, + + // added during 1.11. re-sort for 1.12 + ID_LINE_WIDTH, + ID_SAMPLER, + ID_SAMPLER_REF, + ID_THREAD_GROUPS, + ID_RENDER_CUSTOM, + ID_AUTO, + ID_CAMERA, + ID_ALIGN_TO_FACE, + ID_UNORDERED_ACCESS_MIP, + + ID_END_BUILTIN_IDS +}; \ No newline at end of file diff --git a/OgreMain/src/OgreScriptParser.h b/OgreMain/src/OgreScriptParser.h index c9c5a6e7ed2..715fc068e07 100644 --- a/OgreMain/src/OgreScriptParser.h +++ b/OgreMain/src/OgreScriptParser.h @@ -41,6 +41,29 @@ namespace Ogre { * @{ */ + /** These enums hold the types of the concrete parsed nodes */ + enum ConcreteNodeType + { + CNT_VARIABLE, + CNT_VARIABLE_ASSIGN, + CNT_WORD, + CNT_IMPORT, + CNT_QUOTE, + CNT_LBRACE, + CNT_RBRACE, + CNT_COLON + }; + + /** The ConcreteNode is the struct that holds an un-conditioned sub-tree of parsed input */ + struct ConcreteNode : public ScriptCompilerAlloc + { + String token, file; + unsigned int line; + ConcreteNodeType type; + ConcreteNodeList children; + ConcreteNode *parent; + }; + class _OgrePrivate ScriptParser : public ScriptCompilerAlloc { public: diff --git a/OgreMain/src/OgreScriptTranslator.cpp b/OgreMain/src/OgreScriptTranslator.cpp index a4e61850bac..4f709457a22 100644 --- a/OgreMain/src/OgreScriptTranslator.cpp +++ b/OgreMain/src/OgreScriptTranslator.cpp @@ -45,6 +45,7 @@ THE SOFTWARE. #include "OgreParticleSystem.h" #include "OgreHighLevelGpuProgram.h" #include "OgreGpuProgramUsage.h" +#include "OgreScriptIDs.h" namespace Ogre{ static void applyTextureAliases(ScriptCompiler *compiler, const Material* mat, const NameValuePairList& aliasList) @@ -3091,7 +3092,7 @@ namespace Ogre{ AtomAbstractNode *atom = (AtomAbstractNode*)prop->values.front().get(); switch(atom->id) { - case ScriptCompiler::ID_OFF: + case ID_OFF: mUnit->setEnvironmentMap(false); break; case ID_SPHERICAL: