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