1 | #pragma once
|
---|
2 |
|
---|
3 | //disable inheritance warning caused by multiple inheritance
|
---|
4 | #if _WIN32
|
---|
5 | #if _MSC_VER
|
---|
6 | #pragma warning(disable: 4250)
|
---|
7 | #endif
|
---|
8 | #endif
|
---|
9 |
|
---|
10 | #include "OgreRenderTechnique.h"
|
---|
11 | #include "Ogre.h"
|
---|
12 |
|
---|
13 | using namespace Ogre;
|
---|
14 |
|
---|
15 | class FireRenderTarget : public GlobalUseRenderTarget
|
---|
16 | {
|
---|
17 |
|
---|
18 | public:
|
---|
19 |
|
---|
20 | static int targetsize;
|
---|
21 |
|
---|
22 | FireRenderTarget();
|
---|
23 | ~FireRenderTarget();
|
---|
24 | };
|
---|
25 |
|
---|
26 |
|
---|
27 |
|
---|
28 | /**
|
---|
29 | @brief A special SBBRenderTechnique used in an OGRE environment.
|
---|
30 |
|
---|
31 | Instead of rendering to the frame buffer this Technique renders into two render targets at the same time.
|
---|
32 | The firs render target will be used as it were an ordinary backbuffer.
|
---|
33 | The second rendertarget will be used to simulate heat shimmering (offset values will be written to it).
|
---|
34 | The shimmering effect will be achieved with post processing: combining the backbuffer with the first render target using the second render target as uv offset.
|
---|
35 | Just like the spherical billboard techniqeue, this thechnique requires a depth image taken from main camera's viewpoint.
|
---|
36 | */
|
---|
37 | class OgreFireRenderTechnique : public OgreRenderTechnique,
|
---|
38 | public RenderTargetListener,
|
---|
39 | public FrameListener,
|
---|
40 | public UpdateListener
|
---|
41 | {
|
---|
42 | public:
|
---|
43 | /**
|
---|
44 | @brief Constructor.
|
---|
45 |
|
---|
46 | @param depthTexID the id of the texture unit state the resulting
|
---|
47 | scene depth map should be bound to
|
---|
48 | @param pass the pass to operate on
|
---|
49 | @param parentRenderable the object to operate on
|
---|
50 | @param parentTechniqueGroup the TechniqueGroup this RenderedTechnique is attached to
|
---|
51 | */
|
---|
52 | OgreFireRenderTechnique( unsigned char depthTexID,
|
---|
53 | Pass* pass,
|
---|
54 | OgreRenderable* parentRenderable,
|
---|
55 | OgreTechniqueGroup* parentTechniqueGroup
|
---|
56 | );
|
---|
57 | virtual ~OgreFireRenderTechnique();
|
---|
58 |
|
---|
59 | //inherited
|
---|
60 | virtual void update(unsigned long frameNum);
|
---|
61 | //inherited
|
---|
62 | void preRenderTargetUpdate (const RenderTargetEvent &evt);
|
---|
63 | //inherited
|
---|
64 | void postRenderTargetUpdate (const RenderTargetEvent &evt);
|
---|
65 | //inherited
|
---|
66 | bool frameEnded (const FrameEvent &evt);
|
---|
67 | //inherited
|
---|
68 | void preAllUpdates();
|
---|
69 |
|
---|
70 | protected:
|
---|
71 | /**
|
---|
72 | &brief the id of the texture unit state the resulting scene depth map should be bound to
|
---|
73 | */
|
---|
74 | unsigned char depthTexID;
|
---|
75 | bool lastVisibility;
|
---|
76 |
|
---|
77 | };
|
---|
78 |
|
---|
79 | /**
|
---|
80 | @brief RenderTechniqueFactory to create OgreFireRenderTechnique instances.
|
---|
81 | */
|
---|
82 | class OgreFireRenderTechniqueFactory : public RenderTechniqueFactory
|
---|
83 | {
|
---|
84 | public:
|
---|
85 |
|
---|
86 | OgreFireRenderTechniqueFactory();
|
---|
87 |
|
---|
88 | OgreRenderTechnique* createInstance(IllumTechniqueParams* params,
|
---|
89 | Pass* pass,
|
---|
90 | OgreRenderable* parentRenderable,
|
---|
91 | OgreTechniqueGroup* parentTechniqueGroup);
|
---|
92 |
|
---|
93 |
|
---|
94 | unsigned char depthTexID;
|
---|
95 |
|
---|
96 | };
|
---|
97 |
|
---|
98 |
|
---|