source: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredShader.h @ 2892

Revision 2892, 1.4 KB checked in by mattausch, 16 years ago (diff)
Line 
1#ifndef _DeferredShader_H__
2#define _DeferredShader_H__
3
4#include "common.h"
5#include "glInterface.h"
6#include <Cg/cg.h>
7#include <Cg/cgGL.h>
8
9
10namespace CHCDemoEngine
11{
12
13class FrameBufferObject;
14class ShadowMapping;
15class Matrix4x4;
16
17
18/** This class implements a deferred shading algorithm that takes
19        a frame buffer object as input and outputs an image in the given size
20*/
21class DeferredShader
22{
23public:
24        /** constructor for a deferred shader taking the requested output image size
25        */
26        DeferredShader(int w, int h);
27
28        ~DeferredShader();
29        /** The algorithm renders the scene given an fbo.
30                The fbo must have color buffer, position buffer, normal buffer.
31        */
32        void Render(FrameBufferObject *fbo);
33
34        /** Initialises the deferred shader and loads the required shaders:
35                This function has to be called only once.
36        */
37        static void Init(CGcontext context);
38
39
40        void Render(FrameBufferObject *fbo,
41                        const Matrix4x4 &matViewing,
42                                ShadowMapping *shadowMapping);
43
44protected:
45
46        void FirstPass(FrameBufferObject *fbo);
47        void FirstPassShadow(FrameBufferObject *fbo,
48                                                 const Matrix4x4 &matViewing,
49                                                 ShadowMapping *shadowMapping);
50
51        void AntiAliasing(FrameBufferObject *fbo);
52
53
54        //////////////////
55
56        int mWidth;
57        int mHeight;
58
59        //FrameBufferObject *mFbo;
60};
61
62} // namespace
63#endif // _DeferredShader_H__
Note: See TracBrowser for help on using the repository browser.