1 | #pragma once
|
---|
2 | #include "RenderTechnique.h"
|
---|
3 | #include "OgreRenderable.h"
|
---|
4 | #include "OgreSharedRuns.h"
|
---|
5 |
|
---|
6 | class OgreTechniqueGroup;
|
---|
7 |
|
---|
8 | /**
|
---|
9 | @brief Event handler class.
|
---|
10 |
|
---|
11 | The derived calsses of this class can register task that should be done before and/or after updating all RenderTechniques.
|
---|
12 | UpdateListeners can be registered to the OgreIlluminationMager. @see addUpdateListener
|
---|
13 | */
|
---|
14 | class UpdateListener
|
---|
15 | {
|
---|
16 | public:
|
---|
17 | /**
|
---|
18 | @brief Called before RenderTechnique updates
|
---|
19 | */
|
---|
20 | virtual void preAllUpdates(){}
|
---|
21 | /**
|
---|
22 | @brief Called after RenderTechnique updates
|
---|
23 | */
|
---|
24 | virtual void postAllUpdates(){}
|
---|
25 | };
|
---|
26 |
|
---|
27 | /**
|
---|
28 | @brief Class of RenderTechniques used in an OGRE environment.
|
---|
29 | */
|
---|
30 | class OgreRenderTechnique : virtual public RenderTechnique
|
---|
31 | {
|
---|
32 | public:
|
---|
33 | /**
|
---|
34 | @brief Constructor.
|
---|
35 |
|
---|
36 | @param the pass to operate on
|
---|
37 | @param parentRenderable the object to operate on
|
---|
38 | @param parentTechniqueGroup the TechniqueGroup this RenderedTechnique is attached to
|
---|
39 | */
|
---|
40 | OgreRenderTechnique(
|
---|
41 | Pass* pass,
|
---|
42 | OgreRenderable* parentRenderable,
|
---|
43 | OgreTechniqueGroup* parentTechniqueGroup);
|
---|
44 | virtual ~OgreRenderTechnique( );
|
---|
45 |
|
---|
46 | //inherited
|
---|
47 | virtual OgreRenderTechnique* asOgreRenderTechnique(){return this;}
|
---|
48 |
|
---|
49 | protected:
|
---|
50 | /**
|
---|
51 | @brief a OgreRenderable pointer to the renderable this technique operates on.
|
---|
52 | */
|
---|
53 | OgreRenderable* parentOgreRenderable;
|
---|
54 | /**
|
---|
55 | @brief a OgreTechniqueGroup pointer to the TechniqueGroup this technique is attached to.
|
---|
56 | */
|
---|
57 | OgreTechniqueGroup* parentOgreTechniqueGroup;
|
---|
58 | /**
|
---|
59 | @brief a pointer to the pass this technique operates on.
|
---|
60 | */
|
---|
61 | Pass* pass;
|
---|
62 | };
|
---|
63 |
|
---|
64 | /**
|
---|
65 | @brief Base abstract class for creating RenderTechnique instances.
|
---|
66 | */
|
---|
67 | class RenderTechniqueFactory
|
---|
68 | {
|
---|
69 | protected:
|
---|
70 |
|
---|
71 | /**
|
---|
72 | @brief function for parsing RenderTechnique attributes
|
---|
73 |
|
---|
74 | @param params attribute value stored in a String
|
---|
75 | */
|
---|
76 | typedef void (*ILLUM_ATTRIBUTE_PARSER)(String& params, RenderTechniqueFactory* factory);
|
---|
77 | /**
|
---|
78 | @brief Keyword-mapped attribute parsers.
|
---|
79 | */
|
---|
80 | typedef std::map<String, ILLUM_ATTRIBUTE_PARSER> AttribParserList;
|
---|
81 |
|
---|
82 | /**
|
---|
83 | @brief map of parser functions
|
---|
84 | */
|
---|
85 | AttribParserList attributeParsers;
|
---|
86 | /**
|
---|
87 | @brief factoryname
|
---|
88 | */
|
---|
89 | String typeName;
|
---|
90 |
|
---|
91 | public:
|
---|
92 | /**
|
---|
93 | @brief Returns if this factory can create a RenderTechnique of the given type.
|
---|
94 |
|
---|
95 | @param type RenderTechnique type
|
---|
96 | */
|
---|
97 | bool isType(String type)
|
---|
98 | {
|
---|
99 | return typeName == type;
|
---|
100 | }
|
---|
101 |
|
---|
102 | /**
|
---|
103 | @brief Creates a RenderTechnique of the factory type.
|
---|
104 |
|
---|
105 | @param params containes constructor parameters as NameValuePairList
|
---|
106 | @param pass the Pass to use in RenderTechnique constructor
|
---|
107 | @param pass the parentRenderable to pass to RenderTechnique constructor
|
---|
108 | @param pass the parentTechniqueGroup to pass to RenderTechnique constructor
|
---|
109 | */
|
---|
110 | virtual OgreRenderTechnique* createInstance(IllumTechniqueParams* params,
|
---|
111 | Pass* pass,
|
---|
112 | OgreRenderable* parentRenderable,
|
---|
113 | OgreTechniqueGroup* parentTechniqueGroup) = 0;
|
---|
114 |
|
---|
115 | virtual bool needMaterialCopy(IllumTechniqueParams* params){return false;}
|
---|
116 | /**
|
---|
117 | @brief parses parameters from the material file.
|
---|
118 |
|
---|
119 | The parsed parameters will be passed to the new RenderTechnique's constructor.
|
---|
120 |
|
---|
121 | @param params pointer to the IllumTechniqueParams structure that was read from the material script and containes the parameters to be parsed.
|
---|
122 |
|
---|
123 | */
|
---|
124 | virtual void parseParams(IllumTechniqueParams* params);
|
---|
125 |
|
---|
126 |
|
---|
127 | };
|
---|