[790] | 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 | /**
|
---|
[2264] | 16 | @brief PhotonMapRenderingRun used in an OGRE environment.
|
---|
[790] | 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
|
---|
[2264] | 30 | @param resolution photon map resolution
|
---|
| 31 | @param materialName the name of the material should be used when rendering the photon hit map
|
---|
[790] | 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);
|
---|
[2320] | 41 |
|
---|
| 42 | virtual ~OgrePhotonMapRenderingRun(){}
|
---|
| 43 |
|
---|
[790] | 44 | /**
|
---|
[2264] | 45 | @brief returns the name of the resulting photon hit map texture
|
---|
[790] | 46 | */
|
---|
| 47 | String getPhotonMapTextureName(){return name;}
|
---|
| 48 | /**
|
---|
| 49 | @brief Refreshes light camera matrices, called in each update.
|
---|
| 50 | */
|
---|
| 51 | void refreshLight();
|
---|
[2264] | 52 | //inherited
|
---|
[1722] | 53 | bool canJoin(RenderingRun* run)
|
---|
[1055] | 54 | {
|
---|
[1722] | 55 | OgrePhotonMapRenderingRun* r = (OgrePhotonMapRenderingRun*) run->asOgreRenderingRun();
|
---|
[1055] | 56 | if(r->materialName == materialName)
|
---|
| 57 | return true;
|
---|
| 58 | return false;
|
---|
| 59 | }
|
---|
[2264] | 60 | //inherited
|
---|
[790] | 61 | void distanceCubeMapChanged(RenderingRun* run);
|
---|
[2264] | 62 | //inherited
|
---|
[949] | 63 | void distanceCubeMapUpdated(RenderingRun* run);
|
---|
[2320] | 64 |
|
---|
| 65 | void freeAllResources();
|
---|
[949] | 66 |
|
---|
[790] | 67 | protected:
|
---|
| 68 | /**
|
---|
[2264] | 69 | @brief the name of the material should be used when rendering the photon hit map
|
---|
[790] | 70 | */
|
---|
| 71 | String materialName;
|
---|
| 72 | /**
|
---|
| 73 | @brief pointer to the nearest light source from the caster object
|
---|
| 74 | */
|
---|
| 75 | Light* light;
|
---|
| 76 | /**
|
---|
[2264] | 77 | @brief the camera used while rendering the photon hit map
|
---|
[790] | 78 | */
|
---|
| 79 | Camera* photonMapCamera;
|
---|
| 80 | /**
|
---|
| 81 | @brief tells if a distance cubemap impostor should be used in photon hit calculation (recommended)
|
---|
| 82 | */
|
---|
| 83 | bool useDistance;
|
---|
| 84 | /**
|
---|
| 85 | @brief a pointer to the OgreSharedRuns this run belongs to
|
---|
| 86 | */
|
---|
| 87 | OgreSharedRuns* sharedRuns;
|
---|
| 88 | /**
|
---|
[2264] | 89 | @brief the name of the photon map texture that was created by this run
|
---|
[790] | 90 | */
|
---|
| 91 | String name;
|
---|
| 92 | /**
|
---|
[2264] | 93 | @brief a pointer to the photon map texture that was created by this run
|
---|
[790] | 94 | */
|
---|
| 95 | Texture* photonMapTexture;
|
---|
| 96 | /**
|
---|
| 97 | @brief the resolution of the photonmap texture that was created by this run
|
---|
| 98 | */
|
---|
| 99 | unsigned int resolution;
|
---|
| 100 |
|
---|
| 101 | //inherited
|
---|
| 102 | void updateFrame(unsigned long frameNum);
|
---|
| 103 | //inherited
|
---|
| 104 | inline void createPhotonMap();
|
---|
| 105 |
|
---|
| 106 | };
|
---|