[1103] | 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 "OgreSharedRuns.h"
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 | /**
|
---|
[2251] | 15 | @brief FocusingMapRenderingRun.
|
---|
| 16 |
|
---|
| 17 | A run to help focusing light projections for shadow mapping.
|
---|
[1103] | 18 | */
|
---|
| 19 | class OgreFocusingMapRenderingRun : public OgreRenderingRun
|
---|
| 20 | {
|
---|
| 21 | public:
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | @brief Constructor.
|
---|
[2264] | 25 | @param name the name of the focusing map texture to be created
|
---|
| 26 | @param lightMatrix the light matrix to be focused
|
---|
| 27 | @param focusingMapSize size of the focusing map
|
---|
[1103] | 28 | */
|
---|
| 29 | OgreFocusingMapRenderingRun(String name,
|
---|
| 30 | Matrix4 lightMatrix,
|
---|
| 31 | unsigned int focusingMapSize);
|
---|
| 32 | /**
|
---|
[2251] | 33 | @brief returns the name of the focusing texture
|
---|
[1103] | 34 | */
|
---|
| 35 | String getFocusingTextureName(){return name;}
|
---|
[2264] | 36 | /**
|
---|
| 37 | @brief gets the boundig box min-max points
|
---|
| 38 |
|
---|
| 39 | These values are given in light space and can be used to adjust the light matrices to focuse on important objects only.
|
---|
| 40 | */
|
---|
[1103] | 41 | void getMinMax(Vector3& min, Vector3& max);
|
---|
[2264] | 42 | /**
|
---|
| 43 | @brief Sets the light matrix that should be focused.
|
---|
| 44 | */
|
---|
[1103] | 45 | void setLightMatrix(Matrix4 &m){this->lightMatrix = m;}
|
---|
[2264] | 46 | /**
|
---|
| 47 | @brief Sets the player camera matrices.
|
---|
| 48 | */
|
---|
[1125] | 49 | void setCameraMatrices(const Matrix4 &view, const Matrix4 &projection);
|
---|
[1103] | 50 |
|
---|
| 51 | protected:
|
---|
| 52 | /**
|
---|
[2264] | 53 | @brief light matrix to be focused
|
---|
[1103] | 54 | */
|
---|
| 55 | Matrix4 lightMatrix;
|
---|
| 56 | /**
|
---|
[2264] | 57 | @brief fosusing map camera
|
---|
[1103] | 58 | */
|
---|
[1125] | 59 | Camera* camera;
|
---|
[1103] | 60 |
|
---|
| 61 | /**
|
---|
[2251] | 62 | @brief the name of the focusing texture that was created by this run
|
---|
[1103] | 63 | */
|
---|
| 64 | String name;
|
---|
| 65 | /**
|
---|
[2251] | 66 | @brief a pointer to the focusing texture that was created by this run
|
---|
[1103] | 67 | */
|
---|
| 68 | Texture* focusingTexture;
|
---|
[2264] | 69 | /**
|
---|
| 70 | @brief the size of the focusing map
|
---|
| 71 | */
|
---|
[1103] | 72 | unsigned int focusingMapSize;
|
---|
| 73 |
|
---|
| 74 | //inherited
|
---|
| 75 | void updateFrame(unsigned long frameNum);
|
---|
[2264] | 76 | /**
|
---|
| 77 | @brief creates the focusing map texture
|
---|
| 78 | */
|
---|
[1103] | 79 | inline void createFocusingMap();
|
---|
[2264] | 80 | //inherited
|
---|
[1125] | 81 | bool needUpdate(unsigned long frameNum )
|
---|
| 82 | {
|
---|
| 83 | return true;
|
---|
| 84 | }
|
---|
| 85 |
|
---|
[1103] | 86 | };
|
---|