source: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/OgreRenderTechnique.h @ 836

Revision 836, 2.5 KB checked in by szirmay, 18 years ago (diff)
Line 
1#pragma once
2#include "RenderTechnique.h"
3#include "OgreRenderable.h"
4#include "OgreSharedRuns.h"
5
6class OgreTechniqueGroup;
7
8/**
9        @brief Class of RenderTechniques used in an OGRE environment.   
10*/
11class OgreRenderTechnique : virtual public RenderTechnique
12{
13        public:
14                /**
15                        @brief Constructor.
16
17                        @param the pass to operate on
18                        @param parentRenderable the object to operate on
19                        @param parentTechniqueGroup the TechniqueGroup this RenderedTechnique is attached to
20                */
21                OgreRenderTechnique(
22                                                Pass* pass,
23                                                OgreRenderable* parentRenderable,
24                                                OgreTechniqueGroup* parentTechniqueGroup);
25                ~OgreRenderTechnique( );
26
27                //inherited
28                virtual OgreRenderTechnique* asOgreRenderTechnique(){return this;}
29                               
30        protected:
31                /**
32                        @brief a OgreRenderable pointer to the renderable this technique operates on.
33                */
34                OgreRenderable* parentOgreRenderable;
35                /**
36                        @brief a OgreTechniqueGroup pointer to the TechniqueGroup this technique is attached to.
37                */
38                OgreTechniqueGroup* parentOgreTechniqueGroup;
39                /**
40                        @brief a pointer to the pass this technique operates on.
41                */
42                Pass* pass;             
43};
44
45/**
46        @brief Base abstract class for creating RenderTechnique instances.
47*/
48class RenderTechniqueFactory
49{
50protected:
51       
52        /**
53                @brief function for parsing RenderTechnique attributes
54
55                @param params attribute value stored in a String
56        */
57        typedef void (*ILLUM_ATTRIBUTE_PARSER)(String& params, RenderTechniqueFactory* factory);
58        /**
59                @brief Keyword-mapped attribute parsers.
60        */
61        typedef std::map<String, ILLUM_ATTRIBUTE_PARSER> AttribParserList;
62       
63        /**
64                @brief map of parser functions
65        */
66        AttribParserList attributeParsers;
67        /**
68                @brief factoryname
69        */
70        String typeName;
71
72public:
73        /**
74                @brief Returns if this factory can create a RenderTechnique of the given type.
75
76                @param type RenderTechnique type
77        */
78        bool isType(String type)
79        {
80                return typeName == type;
81        }
82       
83        /**
84                @brief Creates a RenderTechnique of the factory type.
85
86                @param params containes constructor parameters as NameValuePairList
87                @param pass the Pass to use in RenderTechnique constructor
88                @param pass the parentRenderable to pass to RenderTechnique constructor
89                @param pass the parentTechniqueGroup to pass to RenderTechnique constructor
90        */
91        virtual OgreRenderTechnique* createInstance(IllumTechniqueParams* params,
92                                                                                Pass* pass,
93                                                                                OgreRenderable* parentRenderable,
94                                                                                OgreTechniqueGroup* parentTechniqueGroup) = 0;
95
96        virtual void parseParams(IllumTechniqueParams* params);
97       
98       
99};
Note: See TracBrowser for help on using the repository browser.