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