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 "OgreRenderingRun.h"
|
---|
11 | #include "PhotonMapRenderingRun.h"
|
---|
12 | #include "OgreSharedRuns.h"
|
---|
13 |
|
---|
14 |
|
---|
15 | /**
|
---|
16 | @brief ColorCubeMapRenderingRun used in an OGRE environment.
|
---|
17 | */
|
---|
18 | class OgrePhotonMapRenderingRun : public OgreRenderingRun,
|
---|
19 | public PhotonMapRenderingRun
|
---|
20 | {
|
---|
21 | public:
|
---|
22 |
|
---|
23 | /**
|
---|
24 | @brief Constructor.
|
---|
25 |
|
---|
26 | @param sharedRuns a pointer to the OgreSharedRuns this run belongs to
|
---|
27 | @param name the name of the texture to be created
|
---|
28 | @param startFrame adds an offset to the current frame number to help evenly distribute updates between frames
|
---|
29 | @param updateInterval update frequency
|
---|
30 | @param resolution color cubemap resolution
|
---|
31 | @param materialName the name of the material should be used when rendering the choton hit map
|
---|
32 | @param useDistance tells if a distance cubemap impostor should be used in photon hit calculation (recommended)
|
---|
33 | */
|
---|
34 | OgrePhotonMapRenderingRun(OgreSharedRuns* sharedRuns,
|
---|
35 | String name,
|
---|
36 | unsigned long startFrame,
|
---|
37 | unsigned long updateInterval,
|
---|
38 | unsigned int resolution,
|
---|
39 | String materialName,
|
---|
40 | bool useDistance);
|
---|
41 | /**
|
---|
42 | @brief returns the name of the resulting photon hit map
|
---|
43 | */
|
---|
44 | String getPhotonMapTextureName(){return name;}
|
---|
45 | /**
|
---|
46 | @brief Refreshes light camera matrices, called in each update.
|
---|
47 | */
|
---|
48 | void refreshLight();
|
---|
49 |
|
---|
50 | bool canJoin(RenderingRun* run)
|
---|
51 | {
|
---|
52 | OgrePhotonMapRenderingRun* r = (OgrePhotonMapRenderingRun*) run->asOgreRenderingRun();
|
---|
53 | if(r->materialName == materialName)
|
---|
54 | return true;
|
---|
55 | return false;
|
---|
56 | }
|
---|
57 | void distanceCubeMapChanged(RenderingRun* run);
|
---|
58 |
|
---|
59 | void distanceCubeMapUpdated(RenderingRun* run);
|
---|
60 |
|
---|
61 | protected:
|
---|
62 | /**
|
---|
63 | @brief the name of the material should be used when rendering the choton hit map
|
---|
64 | */
|
---|
65 | String materialName;
|
---|
66 | /**
|
---|
67 | @brief pointer to the nearest light source from the caster object
|
---|
68 | */
|
---|
69 | Light* light;
|
---|
70 | /**
|
---|
71 | @brief the created photon hit map texture
|
---|
72 | */
|
---|
73 | Camera* photonMapCamera;
|
---|
74 | /**
|
---|
75 | @brief tells if a distance cubemap impostor should be used in photon hit calculation (recommended)
|
---|
76 | */
|
---|
77 | bool useDistance;
|
---|
78 | /**
|
---|
79 | @brief a pointer to the OgreSharedRuns this run belongs to
|
---|
80 | */
|
---|
81 | OgreSharedRuns* sharedRuns;
|
---|
82 | /**
|
---|
83 | @brief the name of the photonmap texture that was created by this run
|
---|
84 | */
|
---|
85 | String name;
|
---|
86 | /**
|
---|
87 | @brief a pointer to the photonmap texture that was created by this run
|
---|
88 | */
|
---|
89 | Texture* photonMapTexture;
|
---|
90 | /**
|
---|
91 | @brief the resolution of the photonmap texture that was created by this run
|
---|
92 | */
|
---|
93 | unsigned int resolution;
|
---|
94 |
|
---|
95 | //inherited
|
---|
96 | void updateFrame(unsigned long frameNum);
|
---|
97 | //inherited
|
---|
98 | inline void createPhotonMap();
|
---|
99 |
|
---|
100 | };
|
---|