Line | |
---|
1 | #ifndef _ShadowMapping_H__
|
---|
2 | #define _ShadowMapping_H__
|
---|
3 |
|
---|
4 | #include "common.h"
|
---|
5 | #include "glInterface.h"
|
---|
6 | #include "AxisAlignedBox3.h"
|
---|
7 | #include "Matrix4x4.h"
|
---|
8 | #include <Cg/cg.h>
|
---|
9 | #include <Cg/cgGL.h>
|
---|
10 |
|
---|
11 |
|
---|
12 |
|
---|
13 | namespace CHCDemoEngine
|
---|
14 | {
|
---|
15 |
|
---|
16 | class FrameBufferObject;
|
---|
17 | class RenderTraverser;
|
---|
18 | class Vector3;
|
---|
19 | class Camera;
|
---|
20 | class Light;
|
---|
21 |
|
---|
22 | /** This class implements a shadow mapping algorithm
|
---|
23 | */
|
---|
24 | class ShadowMapping
|
---|
25 | {
|
---|
26 | public:
|
---|
27 | /** constructor for a deferred shader taking the requested shadow size
|
---|
28 | */
|
---|
29 | ShadowMapping(const AxisAlignedBox3 &sceneBox, int size);
|
---|
30 |
|
---|
31 | ~ShadowMapping();
|
---|
32 | /** Renders the shadowed scene
|
---|
33 | */
|
---|
34 | void Render(RenderTraverser *traverser, Camera *cam);
|
---|
35 | /** Initialises shadow mapping and loads the required shaders:
|
---|
36 | This function has to be called only once.
|
---|
37 | */
|
---|
38 | static void Init(CGcontext context);
|
---|
39 |
|
---|
40 | //protected:
|
---|
41 |
|
---|
42 | void ComputeShadowMap(Light *light, RenderTraverser *traverser);
|
---|
43 |
|
---|
44 | //protected:
|
---|
45 |
|
---|
46 | FrameBufferObject *mFbo;
|
---|
47 |
|
---|
48 | int mSize;
|
---|
49 |
|
---|
50 | AxisAlignedBox3 mSceneBox;
|
---|
51 |
|
---|
52 | Camera *mShadowCam;
|
---|
53 |
|
---|
54 | Matrix4x4 mLightViewMatrix;
|
---|
55 | Matrix4x4 mLightProjectionMatrix;
|
---|
56 |
|
---|
57 | Light *mLight;
|
---|
58 | };
|
---|
59 |
|
---|
60 | } // namespace
|
---|
61 | #endif // _DeferredShader_H__ |
---|
Note: See
TracBrowser
for help on using the repository browser.