1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4     (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 
29 #ifndef __SCRIPTCOMPILER_H_
30 #define __SCRIPTCOMPILER_H_
31 
32 #include "OgreSharedPtr.h"
33 #include "OgreSingleton.h"
34 #include "OgreScriptLoader.h"
35 #include "OgreGpuProgram.h"
36 #include "OgreAny.h"
37 #include "Threading/OgreThreadHeaders.h"
38 #include "OgreHeaderPrefix.h"
39 
40 namespace Ogre
41 {
42     /** \addtogroup Core
43     *  @{
44     */
45     /** \addtogroup General
46     *  @{
47     */
48     /** These enums hold the types of the concrete parsed nodes */
49     enum ConcreteNodeType
50     {
51         CNT_VARIABLE,
52         CNT_VARIABLE_ASSIGN,
53         CNT_WORD,
54         CNT_IMPORT,
55         CNT_QUOTE,
56         CNT_LBRACE,
57         CNT_RBRACE,
58         CNT_COLON
59     };
60 
61     /** The ConcreteNode is the struct that holds an un-conditioned sub-tree of parsed input */
62     struct ConcreteNode;
63     typedef SharedPtr<ConcreteNode> ConcreteNodePtr;
64     typedef std::list<ConcreteNodePtr> ConcreteNodeList;
65     typedef SharedPtr<ConcreteNodeList> ConcreteNodeListPtr;
66     struct ConcreteNode : public ScriptCompilerAlloc
67     {
68         String token, file;
69         unsigned int line;
70         ConcreteNodeType type;
71         ConcreteNodeList children;
72         ConcreteNode *parent;
73     };
74 
75     /** This enum holds the types of the possible abstract nodes */
76     enum AbstractNodeType
77     {
78         ANT_UNKNOWN,
79         ANT_ATOM,
80         ANT_OBJECT,
81         ANT_PROPERTY,
82         ANT_IMPORT,
83         ANT_VARIABLE_SET,
84         ANT_VARIABLE_ACCESS
85     };
86     class AbstractNode;
87     typedef SharedPtr<AbstractNode> AbstractNodePtr;
88     typedef std::list<AbstractNodePtr> AbstractNodeList;
89     typedef SharedPtr<AbstractNodeList> AbstractNodeListPtr;
90 
91     class _OgreExport AbstractNode : public AbstractNodeAlloc
92     {
93     public:
94         String file;
95         unsigned int line;
96         AbstractNodeType type;
97         AbstractNode *parent;
98         Any context; // A holder for translation context data
99     public:
100         AbstractNode(AbstractNode *ptr);
~AbstractNode()101         virtual ~AbstractNode(){}
102         /// Returns a new AbstractNode which is a replica of this one.
103         virtual AbstractNode *clone() const = 0;
104         /// Returns a string value depending on the type of the AbstractNode.
105         virtual const String& getValue() const = 0;
106     };
107 
108     /** This is an abstract node which cannot be broken down further */
109     class _OgreExport AtomAbstractNode : public AbstractNode
110     {
111     public:
112         String value;
113         uint32 id;
114     public:
115         AtomAbstractNode(AbstractNode *ptr);
116         AbstractNode *clone() const;
getValue()117         const String& getValue() const { return value; }
118     };
119 
120     /** This specific abstract node represents a script object */
121     class _OgreExport ObjectAbstractNode : public AbstractNode
122     {
123     private:
124         std::map<String,String> mEnv;
125     public:
126         String name, cls;
127         std::vector<String> bases;
128         uint32 id;
129         bool abstract;
130         AbstractNodeList children;
131         AbstractNodeList values;
132         AbstractNodeList overrides; // For use when processing object inheritance and overriding
133     public:
134         ObjectAbstractNode(AbstractNode *ptr);
135         AbstractNode *clone() const;
getValue()136         const String& getValue() const { return cls; }
137 
138         void addVariable(const String &name);
139         void setVariable(const String &name, const String &value);
140         std::pair<bool,String> getVariable(const String &name) const;
141         const std::map<String,String> &getVariables() const;
142     };
143 
144     /** This abstract node represents a script property */
145     class _OgreExport PropertyAbstractNode : public AbstractNode
146     {
147     public:
148         String name;
149         uint32 id;
150         AbstractNodeList values;
151     public:
152         PropertyAbstractNode(AbstractNode *ptr);
153         AbstractNode *clone() const;
getValue()154         const String& getValue() const { return name; }
155     };
156 
157     /** This abstract node represents an import statement */
158     class _OgreExport ImportAbstractNode : public AbstractNode
159     {
160     public:
161         String target, source;
162     public:
163         ImportAbstractNode();
164         AbstractNode *clone() const;
getValue()165         const String& getValue() const { return target; }
166     };
167 
168     /** This abstract node represents a variable assignment */
169     class _OgreExport VariableAccessAbstractNode : public AbstractNode
170     {
171     public:
172         String name;
173     public:
174         VariableAccessAbstractNode(AbstractNode *ptr);
175         AbstractNode *clone() const;
getValue()176         const String& getValue() const { return name; }
177     };
178 
179     class ScriptCompilerEvent;
180     class ScriptCompilerListener;
181 
182     /** This is the main class for the compiler. It calls the parser
183         and processes the CST into an AST and then uses translators
184         to translate the AST into the final resources.
185     */
186     class _OgreExport ScriptCompiler : public ScriptCompilerAlloc
187     {
188     public: // Externally accessible types
189         //typedef std::map<String,uint32> IdMap;
190         typedef std::unordered_map<String,uint32> IdMap;
191 
192         // These are the built-in error codes
193         enum{
194             CE_STRINGEXPECTED,
195             CE_NUMBEREXPECTED,
196             CE_FEWERPARAMETERSEXPECTED,
197             CE_VARIABLEEXPECTED,
198             CE_UNDEFINEDVARIABLE,
199             CE_OBJECTNAMEEXPECTED,
200             CE_OBJECTALLOCATIONERROR,
201             CE_INVALIDPARAMETERS,
202             CE_DUPLICATEOVERRIDE,
203             CE_UNEXPECTEDTOKEN,
204             CE_OBJECTBASENOTFOUND,
205             CE_UNSUPPORTEDBYRENDERSYSTEM, //!< @deprecated do not use
206             CE_REFERENCETOANONEXISTINGOBJECT,
207             CE_DEPRECATEDSYMBOL
208         };
209         static String formatErrorCode(uint32 code);
210     public:
211         ScriptCompiler();
~ScriptCompiler()212         virtual ~ScriptCompiler() {}
213 
214         /// Takes in a string of script code and compiles it into resources
215         /**
216          * @param str The script code
217          * @param source The source of the script code (e.g. a script file)
218          * @param group The resource group to place the compiled resources into
219          */
220         bool compile(const String &str, const String &source, const String &group);
221         /// Compiles resources from the given concrete node list
222         bool compile(const ConcreteNodeListPtr &nodes, const String &group);
223         /// Generates the AST from the given string script
224         AbstractNodeListPtr _generateAST(const String &str, const String &source, bool doImports = false, bool doObjects = false, bool doVariables = false);
225         /// Compiles the given abstract syntax tree
226         bool _compile(AbstractNodeListPtr nodes, const String &group, bool doImports = true, bool doObjects = true, bool doVariables = true);
227         /// Adds the given error to the compiler's list of errors
228         void addError(uint32 code, const String &file, int line, const String &msg = "");
229         /// Sets the listener used by the compiler
230         void setListener(ScriptCompilerListener *listener);
231         /// Returns the currently set listener
232         ScriptCompilerListener *getListener();
233         /// Returns the resource group currently set for this compiler
234         const String &getResourceGroup() const;
235         /// Adds a name exclusion to the map
236         /**
237          * Name exclusions identify object types which cannot accept
238          * names. This means that excluded types will always have empty names.
239          * All values in the object header are stored as object values.
240          */
241         //void addNameExclusion(const String &type);
242         /// Removes a name exclusion
243         //void removeNameExclusion(const String &type);
244         /// Internal method for firing the handleEvent method
245         bool _fireEvent(ScriptCompilerEvent *evt, void *retval);
246 
247 		/// Adds a custom word id which can be used for custom script translators
248 		/**
249 		@param
250 		word The word to be registered.
251 
252 		@return
253 		The word id for the registered word.
254 
255 		@note
256 		If the word is already registered, the already registered id is returned.
257 		*/
258 		uint32 registerCustomWordId(const String &word);
259 
260     private: // Tree processing
261         AbstractNodeListPtr convertToAST(const ConcreteNodeList &nodes);
262         /// This built-in function processes import nodes
263         void processImports(AbstractNodeList &nodes);
264         /// Loads the requested script and converts it to an AST
265         AbstractNodeListPtr loadImportPath(const String &name);
266         /// Returns the abstract nodes from the given tree which represent the target
267         AbstractNodeList locateTarget(const AbstractNodeList& nodes, const String &target);
268         /// Handles object inheritance and variable expansion
269         void processObjects(AbstractNodeList& nodes, const AbstractNodeList &top);
270         /// Handles processing the variables
271         void processVariables(AbstractNodeList& nodes);
272         /// This function overlays the given object on the destination object following inheritance rules
273         void overlayObject(const AbstractNode &source, ObjectAbstractNode& dest);
274         /// Returns true if the given class is name excluded
275         bool isNameExcluded(const ObjectAbstractNode& node, AbstractNode *parent);
276         /// This function sets up the initial values in word id map
277         void initWordMap();
278     private:
279         friend String getPropertyName(const ScriptCompiler *compiler, uint32 id);
280         // Resource group
281         String mGroup;
282         // The word -> id conversion table
283         IdMap mIds;
284 
285 		// The largest registered id
286 		uint32 mLargestRegisteredWordId;
287 
288         // This is an environment map
289         typedef std::map<String,String> Environment;
290         Environment mEnv;
291 
292         typedef std::map<String,AbstractNodeListPtr> ImportCacheMap;
293         ImportCacheMap mImports; // The set of imported scripts to avoid circular dependencies
294         typedef std::multimap<String,String> ImportRequestMap;
295         ImportRequestMap mImportRequests; // This holds the target objects for each script to be imported
296 
297         // This stores the imports of the scripts, so they are separated and can be treated specially
298         AbstractNodeList mImportTable;
299 
300         // Error list
301         // The container for errors
302         struct Error
303         {
304             String file, message;
305             int line;
306             uint32 code;
307         };
308         typedef std::list<Error> ErrorList;
309         ErrorList mErrors;
310 
311         // The listener
312         ScriptCompilerListener *mListener;
313     private: // Internal helper classes and processors
314         class AbstractTreeBuilder
315         {
316         private:
317             AbstractNodeListPtr mNodes;
318             AbstractNode *mCurrent;
319             ScriptCompiler *mCompiler;
320         public:
321             AbstractTreeBuilder(ScriptCompiler *compiler);
322             const AbstractNodeListPtr &getResult() const;
323             void visit(ConcreteNode *node);
324             static void visit(AbstractTreeBuilder *visitor, const ConcreteNodeList &nodes);
325         };
326         friend class AbstractTreeBuilder;
327     public: // Public translator definitions
328         // This enum are built-in word id values
329         enum
330         {
331             ID_ON = 1,
332             ID_OFF = 2,
333             ID_TRUE = 1,
334             ID_FALSE = 2,
335             ID_YES = 1,
336             ID_NO = 2
337         };
338     };
339 
340     /**
341      * This struct is a base class for events which can be thrown by the compilers and caught by
342      * subscribers. There are a set number of standard events which are used by Ogre's core.
343      * New event types may be derived for more custom compiler processing.
344      */
345     class ScriptCompilerEvent
346     {
347     public:
348         String mType;
349 
ScriptCompilerEvent(const String & type)350         ScriptCompilerEvent(const String &type):mType(type){}
~ScriptCompilerEvent()351         virtual ~ScriptCompilerEvent(){}
352     private: // Non-copyable
353         ScriptCompilerEvent(const ScriptCompilerEvent&);
354         ScriptCompilerEvent &operator = (const ScriptCompilerEvent&);
355     };
356 
357     /** This is a listener for the compiler. The compiler can be customized with
358         this listener. It lets you listen in on events occurring during compilation,
359         hook them, and change the behavior.
360     */
361     class _OgreExport ScriptCompilerListener
362     {
363     public:
364         ScriptCompilerListener();
~ScriptCompilerListener()365         virtual ~ScriptCompilerListener() {}
366 
367         /// Returns the concrete node list from the given file
368         virtual ConcreteNodeListPtr importFile(ScriptCompiler *compiler, const String &name);
369         /// Allows for responding to and overriding behavior before a CST is translated into an AST
370         virtual void preConversion(ScriptCompiler *compiler, ConcreteNodeListPtr nodes);
371         /// Allows vetoing of continued compilation after the entire AST conversion process finishes
372         /**
373          @remarks   Once the script is turned completely into an AST, including import
374                     and override handling, this function allows a listener to exit
375                     the compilation process.
376          @return True continues compilation, false aborts
377          */
378         virtual bool postConversion(ScriptCompiler *compiler, const AbstractNodeListPtr&);
379         /// Called when an error occurred
380         virtual void handleError(ScriptCompiler *compiler, uint32 code, const String &file, int line, const String &msg);
381         /// Called when an event occurs during translation, return true if handled
382         /**
383          @remarks   This function is called from the translators when an event occurs that
384                     that can be responded to. Often this is overriding names, or it can be a request for
385                     custom resource creation.
386          @arg compiler A reference to the compiler
387          @arg evt The event object holding information about the event to be processed
388          @arg retval A possible return value from handlers
389          @return True if the handler processed the event
390         */
391         virtual bool handleEvent(ScriptCompiler *compiler, ScriptCompilerEvent *evt, void *retval);
392     };
393 
394     class ScriptTranslator;
395     class ScriptTranslatorManager;
396 
397     /** Manages threaded compilation of scripts. This script loader forwards
398         scripts compilations to a specific compiler instance.
399     */
400     class _OgreExport ScriptCompilerManager : public Singleton<ScriptCompilerManager>, public ScriptLoader, public ScriptCompilerAlloc
401     {
402     private:
403             OGRE_AUTO_MUTEX;
404 
405         // A list of patterns loaded by this compiler manager
406         StringVector mScriptPatterns;
407 
408         // Stores a map from object types to the translators that handle them
409         std::vector<ScriptTranslatorManager*> mManagers;
410 
411         // A pointer to the built-in ScriptTranslatorManager
412         ScriptTranslatorManager *mBuiltinTranslatorManager;
413 
414         // the specific compiler instance used
415         ScriptCompiler mScriptCompiler;
416     public:
417         ScriptCompilerManager();
418         virtual ~ScriptCompilerManager();
419 
420         /// Sets the listener used for compiler instances
421         void setListener(ScriptCompilerListener *listener);
422         /// Returns the currently set listener used for compiler instances
423         ScriptCompilerListener *getListener();
424 
425         /// Adds the given translator manager to the list of managers
426         void addTranslatorManager(ScriptTranslatorManager *man);
427         /// Removes the given translator manager from the list of managers
428         void removeTranslatorManager(ScriptTranslatorManager *man);
429         /// Clears all translator managers
430         void clearTranslatorManagers();
431         /// Retrieves a ScriptTranslator from the supported managers
432         ScriptTranslator *getTranslator(const AbstractNodePtr &node);
433 
434 		/// Adds a custom word id which can be used for custom script translators
435 		/**
436 		@param
437 		word The word to be registered.
438 
439 		@return
440 		The word id for the registered word.
441 
442 		@note
443 		If the word is already registered, the already registered id is returned.
444 		*/
445 		uint32 registerCustomWordId(const String &word);
446 
447         /// Adds a script extension that can be handled (e.g. *.material, *.pu, etc.)
448         void addScriptPattern(const String &pattern);
449         /// @copydoc ScriptLoader::getScriptPatterns
450         const StringVector& getScriptPatterns(void) const;
451         /// @copydoc ScriptLoader::parseScript
452         void parseScript(DataStreamPtr& stream, const String& groupName);
453         /// @copydoc ScriptLoader::getLoadingOrder
454         Real getLoadingOrder(void) const;
455 
456         /// @copydoc Singleton::getSingleton()
457         static ScriptCompilerManager& getSingleton(void);
458         /// @copydoc Singleton::getSingleton()
459         static ScriptCompilerManager* getSingletonPtr(void);
460     };
461 
462     // Standard event types
463     class _OgreExport PreApplyTextureAliasesScriptCompilerEvent : public ScriptCompilerEvent
464     {
465     public:
466         Material *mMaterial;
467         AliasTextureNamePairList *mAliases;
468         static String eventType;
469 
PreApplyTextureAliasesScriptCompilerEvent(Material * material,AliasTextureNamePairList * aliases)470         PreApplyTextureAliasesScriptCompilerEvent(Material *material, AliasTextureNamePairList *aliases)
471             :ScriptCompilerEvent(eventType), mMaterial(material), mAliases(aliases){}
472     };
473 
474     class _OgreExport ProcessResourceNameScriptCompilerEvent : public ScriptCompilerEvent
475     {
476     public:
477         enum ResourceType
478         {
479             TEXTURE,
480             MATERIAL,
481             GPU_PROGRAM,
482             COMPOSITOR
483         };
484         ResourceType mResourceType;
485         String mName;
486         static String eventType;
487 
ProcessResourceNameScriptCompilerEvent(ResourceType resourceType,const String & name)488         ProcessResourceNameScriptCompilerEvent(ResourceType resourceType, const String &name)
489             :ScriptCompilerEvent(eventType), mResourceType(resourceType), mName(name){}
490     };
491 
492     class _OgreExport ProcessNameExclusionScriptCompilerEvent : public ScriptCompilerEvent
493     {
494     public:
495         String mClass;
496         AbstractNode *mParent;
497         static String eventType;
498 
ProcessNameExclusionScriptCompilerEvent(const String & cls,AbstractNode * parent)499         ProcessNameExclusionScriptCompilerEvent(const String &cls, AbstractNode *parent)
500             :ScriptCompilerEvent(eventType), mClass(cls), mParent(parent){}
501     };
502 
503     class _OgreExport CreateMaterialScriptCompilerEvent : public ScriptCompilerEvent
504     {
505     public:
506         String mFile, mName, mResourceGroup;
507         static String eventType;
508 
CreateMaterialScriptCompilerEvent(const String & file,const String & name,const String & resourceGroup)509         CreateMaterialScriptCompilerEvent(const String &file, const String &name, const String &resourceGroup)
510             :ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup){}
511     };
512 
513     class _OgreExport CreateGpuProgramScriptCompilerEvent : public ScriptCompilerEvent
514     {
515     public:
516         String mFile, mName, mResourceGroup, mSource, mSyntax;
517         GpuProgramType mProgramType;
518         static String eventType;
519 
CreateGpuProgramScriptCompilerEvent(const String & file,const String & name,const String & resourceGroup,const String & source,const String & syntax,GpuProgramType programType)520         CreateGpuProgramScriptCompilerEvent(const String &file, const String &name, const String &resourceGroup, const String &source,
521             const String &syntax, GpuProgramType programType)
522             :ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup), mSource(source),
523              mSyntax(syntax), mProgramType(programType)
524         {}
525     };
526 
527     class _OgreExport CreateHighLevelGpuProgramScriptCompilerEvent : public ScriptCompilerEvent
528     {
529     public:
530         String mFile, mName, mResourceGroup, mSource, mLanguage;
531         GpuProgramType mProgramType;
532         static String eventType;
533 
CreateHighLevelGpuProgramScriptCompilerEvent(const String & file,const String & name,const String & resourceGroup,const String & source,const String & language,GpuProgramType programType)534         CreateHighLevelGpuProgramScriptCompilerEvent(const String &file, const String &name, const String &resourceGroup, const String &source,
535             const String &language, GpuProgramType programType)
536             :ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup), mSource(source),
537              mLanguage(language), mProgramType(programType)
538         {}
539     };
540 
541     class _OgreExport CreateGpuSharedParametersScriptCompilerEvent : public ScriptCompilerEvent
542     {
543     public:
544         String mFile, mName, mResourceGroup;
545         static String eventType;
546 
CreateGpuSharedParametersScriptCompilerEvent(const String & file,const String & name,const String & resourceGroup)547         CreateGpuSharedParametersScriptCompilerEvent(const String &file, const String &name, const String &resourceGroup)
548             :ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup){}
549     };
550 
551     class _OgreExport CreateParticleSystemScriptCompilerEvent : public ScriptCompilerEvent
552     {
553     public:
554         String mFile, mName, mResourceGroup;
555         static String eventType;
556 
CreateParticleSystemScriptCompilerEvent(const String & file,const String & name,const String & resourceGroup)557         CreateParticleSystemScriptCompilerEvent(const String &file, const String &name, const String &resourceGroup)
558             :ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup){}
559     };
560 
561     class _OgreExport CreateCompositorScriptCompilerEvent : public ScriptCompilerEvent
562     {
563     public:
564         String mFile, mName, mResourceGroup;
565         static String eventType;
566 
CreateCompositorScriptCompilerEvent(const String & file,const String & name,const String & resourceGroup)567         CreateCompositorScriptCompilerEvent(const String &file, const String &name, const String &resourceGroup)
568             :ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup){}
569     };
570 
571     /// This enum defines the integer ids for keywords this compiler handles
572     enum
573     {
574         ID_MATERIAL = 3,
575         ID_VERTEX_PROGRAM,
576         ID_GEOMETRY_PROGRAM,
577         ID_FRAGMENT_PROGRAM,
578         ID_TECHNIQUE,
579         ID_PASS,
580         ID_TEXTURE_UNIT,
581         ID_VERTEX_PROGRAM_REF,
582         ID_GEOMETRY_PROGRAM_REF,
583         ID_FRAGMENT_PROGRAM_REF,
584         ID_SHADOW_CASTER_VERTEX_PROGRAM_REF,
585         ID_SHADOW_CASTER_FRAGMENT_PROGRAM_REF,
586         ID_SHADOW_RECEIVER_VERTEX_PROGRAM_REF,
587         ID_SHADOW_RECEIVER_FRAGMENT_PROGRAM_REF,
588         ID_SHADOW_CASTER_MATERIAL,
589         ID_SHADOW_RECEIVER_MATERIAL,
590 
591         ID_LOD_VALUES,
592         ID_LOD_STRATEGY,
593         ID_LOD_DISTANCES,
594         ID_RECEIVE_SHADOWS,
595         ID_TRANSPARENCY_CASTS_SHADOWS,
596         ID_SET_TEXTURE_ALIAS,
597 
598         ID_SOURCE,
599         ID_SYNTAX,
600         ID_DEFAULT_PARAMS,
601         ID_PARAM_INDEXED,
602         ID_PARAM_NAMED,
603         ID_PARAM_INDEXED_AUTO,
604         ID_PARAM_NAMED_AUTO,
605 
606         ID_SCHEME,
607         ID_LOD_INDEX,
608         ID_GPU_VENDOR_RULE,
609         ID_GPU_DEVICE_RULE,
610         ID_INCLUDE,
611         ID_EXCLUDE,
612 
613         ID_AMBIENT,
614         ID_DIFFUSE,
615         ID_SPECULAR,
616         ID_EMISSIVE,
617             ID_VERTEXCOLOUR,
618         ID_SCENE_BLEND,
619             ID_COLOUR_BLEND,
620             ID_ONE,
621             ID_ZERO,
622             ID_DEST_COLOUR,
623             ID_SRC_COLOUR,
624             ID_ONE_MINUS_DEST_COLOUR,
625             ID_ONE_MINUS_SRC_COLOUR,
626             ID_DEST_ALPHA,
627             ID_SRC_ALPHA,
628             ID_ONE_MINUS_DEST_ALPHA,
629             ID_ONE_MINUS_SRC_ALPHA,
630         ID_SEPARATE_SCENE_BLEND,
631         ID_SCENE_BLEND_OP,
632             ID_REVERSE_SUBTRACT,
633             ID_MIN,
634             ID_MAX,
635         ID_SEPARATE_SCENE_BLEND_OP,
636         ID_DEPTH_CHECK,
637         ID_DEPTH_WRITE,
638         ID_DEPTH_FUNC,
639         ID_DEPTH_BIAS,
640         ID_ITERATION_DEPTH_BIAS,
641             ID_ALWAYS_FAIL,
642             ID_ALWAYS_PASS,
643             ID_LESS_EQUAL,
644             ID_LESS,
645             ID_EQUAL,
646             ID_NOT_EQUAL,
647             ID_GREATER_EQUAL,
648             ID_GREATER,
649         ID_ALPHA_REJECTION,
650         ID_ALPHA_TO_COVERAGE,
651         ID_LIGHT_SCISSOR,
652         ID_LIGHT_CLIP_PLANES,
653         ID_TRANSPARENT_SORTING,
654         ID_ILLUMINATION_STAGE,
655             ID_DECAL,
656         ID_CULL_HARDWARE,
657             ID_CLOCKWISE,
658             ID_ANTICLOCKWISE,
659         ID_CULL_SOFTWARE,
660             ID_BACK,
661             ID_FRONT,
662         ID_NORMALISE_NORMALS,
663         ID_LIGHTING,
664         ID_SHADING,
665             ID_FLAT,
666             ID_GOURAUD,
667             ID_PHONG,
668         ID_POLYGON_MODE,
669             ID_SOLID,
670             ID_WIREFRAME,
671             ID_POINTS,
672         ID_POLYGON_MODE_OVERRIDEABLE,
673         ID_FOG_OVERRIDE,
674             ID_NONE,
675             ID_LINEAR,
676             ID_EXP,
677             ID_EXP2,
678         ID_COLOUR_WRITE,
679         ID_MAX_LIGHTS,
680         ID_START_LIGHT,
681         ID_ITERATION,
682             ID_ONCE,
683             ID_ONCE_PER_LIGHT,
684             ID_PER_LIGHT,
685             ID_PER_N_LIGHTS,
686             ID_POINT,
687             ID_SPOT,
688             ID_DIRECTIONAL,
689         ID_LIGHT_MASK,
690         ID_POINT_SIZE,
691         ID_POINT_SPRITES,
692         ID_POINT_SIZE_ATTENUATION,
693         ID_POINT_SIZE_MIN,
694         ID_POINT_SIZE_MAX,
695 
696         ID_TEXTURE_ALIAS,
697         ID_TEXTURE,
698             ID_1D,
699             ID_2D,
700             ID_3D,
701             ID_CUBIC,
702             ID_2DARRAY,
703             ID_UNLIMITED,
704             ID_ALPHA,
705             ID_GAMMA,
706         ID_ANIM_TEXTURE,
707         ID_CUBIC_TEXTURE,
708             ID_SEPARATE_UV,
709             ID_COMBINED_UVW,
710         ID_TEX_COORD_SET,
711         ID_TEX_ADDRESS_MODE,
712             ID_WRAP,
713             ID_CLAMP,
714             ID_BORDER,
715             ID_MIRROR,
716         ID_TEX_BORDER_COLOUR,
717         ID_FILTERING,
718             ID_BILINEAR,
719             ID_TRILINEAR,
720             ID_ANISOTROPIC,
721         ID_CMPTEST,
722             ID_ON,
723             ID_OFF,
724         ID_CMPFUNC,
725         ID_MAX_ANISOTROPY,
726         ID_MIPMAP_BIAS,
727         ID_COLOUR_OP,
728             ID_REPLACE,
729             ID_ADD,
730             ID_MODULATE,
731             ID_ALPHA_BLEND,
732         ID_COLOUR_OP_EX,
733             ID_SOURCE1,
734             ID_SOURCE2,
735             ID_MODULATE_X2,
736             ID_MODULATE_X4,
737             ID_ADD_SIGNED,
738             ID_ADD_SMOOTH,
739             ID_SUBTRACT,
740             ID_BLEND_DIFFUSE_COLOUR,
741             ID_BLEND_DIFFUSE_ALPHA,
742             ID_BLEND_TEXTURE_ALPHA,
743             ID_BLEND_CURRENT_ALPHA,
744             ID_BLEND_MANUAL,
745             ID_DOT_PRODUCT,
746             ID_SRC_CURRENT,
747             ID_SRC_TEXTURE,
748             ID_SRC_DIFFUSE,
749             ID_SRC_SPECULAR,
750             ID_SRC_MANUAL,
751         ID_COLOUR_OP_MULTIPASS_FALLBACK,
752         ID_ALPHA_OP_EX,
753         ID_ENV_MAP,
754             ID_SPHERICAL,
755             ID_PLANAR,
756             ID_CUBIC_REFLECTION,
757             ID_CUBIC_NORMAL,
758         ID_SCROLL,
759         ID_SCROLL_ANIM,
760         ID_ROTATE,
761         ID_ROTATE_ANIM,
762         ID_SCALE,
763         ID_WAVE_XFORM,
764             ID_SCROLL_X,
765             ID_SCROLL_Y,
766             ID_SCALE_X,
767             ID_SCALE_Y,
768             ID_SINE,
769             ID_TRIANGLE,
770             ID_SQUARE,
771             ID_SAWTOOTH,
772             ID_INVERSE_SAWTOOTH,
773         ID_TRANSFORM,
774         ID_BINDING_TYPE,
775             ID_VERTEX,
776             ID_FRAGMENT,
777         ID_CONTENT_TYPE,
778             ID_NAMED,
779             ID_SHADOW,
780         ID_TEXTURE_SOURCE,
781         ID_SHARED_PARAMS,
782         ID_SHARED_PARAM_NAMED,
783         ID_SHARED_PARAMS_REF,
784 
785         ID_PARTICLE_SYSTEM,
786         ID_EMITTER,
787         ID_AFFECTOR,
788 
789         ID_COMPOSITOR,
790             ID_TARGET,
791             ID_TARGET_OUTPUT,
792 
793             ID_INPUT,
794                 ID_PREVIOUS,
795                 ID_TARGET_WIDTH,
796                 ID_TARGET_HEIGHT,
797                 ID_TARGET_WIDTH_SCALED,
798                 ID_TARGET_HEIGHT_SCALED,
799             ID_COMPOSITOR_LOGIC,
800             ID_TEXTURE_REF,
801             ID_SCOPE_LOCAL,
802             ID_SCOPE_CHAIN,
803             ID_SCOPE_GLOBAL,
804             ID_POOLED,
805             //ID_GAMMA, - already registered for material
806             ID_NO_FSAA,
807             ID_DEPTH_POOL,
808             ID_ONLY_INITIAL,
809             ID_VISIBILITY_MASK,
810             ID_LOD_BIAS,
811             ID_MATERIAL_SCHEME,
812             ID_SHADOWS_ENABLED,
813 
814             ID_CLEAR,
815             ID_STENCIL,
816             ID_RENDER_SCENE,
817             ID_RENDER_QUAD,
818             ID_IDENTIFIER,
819             ID_FIRST_RENDER_QUEUE,
820             ID_LAST_RENDER_QUEUE,
821             ID_QUAD_NORMALS,
822                 ID_CAMERA_FAR_CORNERS_VIEW_SPACE,
823                 ID_CAMERA_FAR_CORNERS_WORLD_SPACE,
824 
825             ID_BUFFERS,
826                 ID_COLOUR,
827                 ID_DEPTH,
828             ID_COLOUR_VALUE,
829             ID_DEPTH_VALUE,
830             ID_STENCIL_VALUE,
831 
832             ID_CHECK,
833             ID_COMP_FUNC,
834             ID_REF_VALUE,
835             ID_MASK,
836             ID_FAIL_OP,
837                 ID_KEEP,
838                 ID_INCREMENT,
839                 ID_DECREMENT,
840                 ID_INCREMENT_WRAP,
841                 ID_DECREMENT_WRAP,
842                 ID_INVERT,
843             ID_DEPTH_FAIL_OP,
844             ID_PASS_OP,
845             ID_TWO_SIDED,
846             ID_READ_BACK_AS_TEXTURE,
847         // Suport for shader model 5.0
848         // More program IDs
849         ID_TESSELLATION_HULL_PROGRAM,
850         ID_TESSELLATION_DOMAIN_PROGRAM,
851         ID_COMPUTE_PROGRAM,
852         ID_TESSELLATION_HULL_PROGRAM_REF,
853         ID_TESSELLATION_DOMAIN_PROGRAM_REF,
854         ID_COMPUTE_PROGRAM_REF,
855         // More binding IDs
856         ID_GEOMETRY,
857         ID_TESSELLATION_HULL,
858         ID_TESSELLATION_DOMAIN,
859         ID_COMPUTE,
860 
861         // Support for subroutine
862         ID_SUBROUTINE,
863 
864         // added during 1.11. re-sort for 1.12
865         ID_LINE_WIDTH,
866         ID_SAMPLER,
867         ID_SAMPLER_REF,
868         ID_THREAD_GROUPS,
869         ID_RENDER_CUSTOM,
870 
871         ID_END_BUILTIN_IDS
872     };
873     /** @} */
874     /** @} */
875 }
876 
877 #include "OgreHeaderSuffix.h"
878 
879 #endif
880