3 This file is part of libmspgl
4 Copyright © 2009 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
12 #include "framebuffer.h"
13 #include "texture2d.h"
23 Creates shadows on a Scene through a shadow map texture. In the preparation
24 phase, the scene is rendered to a depth texture from the point of view of the
25 lightsource. This texture is then used in the rendering phase together with
26 texture coordinate generation to determine whether each fragment is lit.
28 class ShadowMap: public Effect
41 ShadowMap(unsigned, const Scene &, const Light &);
43 /** Sets the ShadowMap target point and radius. The transformation matrix is
44 computed so that a sphere with the specified parameters will be completely
45 covered by the ShadowMap. */
46 void set_target(const Vector3 &, float);
48 /** Sets the texture unit to bind the shadow map to during the rendering
49 phase. The default is texture unit 3. */
50 void set_texture_unit(unsigned);
52 virtual void prepare();
53 virtual void cleanup();