#ifndef _DeferredShader_H__ #define _DeferredShader_H__ #include "common.h" #include "glInterface.h" #include #include namespace CHCDemoEngine { class FrameBufferObject; class ShadowMap; class Matrix4x4; /** This class implements a deferred shading algorithm that takes a frame buffer object as input and outputs an image in the given size */ class DeferredShader { public: /** constructor for a deferred shader taking the requested output image size */ DeferredShader(int w, int h, float maxDepth); ~DeferredShader(); /** The algorithm renders the scene given an fbo. The fbo must have color buffer, position buffer, normal buffer. */ void Render(FrameBufferObject *fbo); /** Initialises the deferred shader and loads the required shaders: This function has to be called only once. */ static void Init(CGcontext context); void Render(FrameBufferObject *fbo, ShadowMap *shadowMap); protected: void FirstPass(FrameBufferObject *fbo); void FirstPassShadow(FrameBufferObject *fbo, ShadowMap *shadowMap); void AntiAliasing(FrameBufferObject *fbo); ////////////////// int mWidth; int mHeight; float mScaleFactor; }; } // namespace #endif // _DeferredShader_H__