2
// Copyright (C) 1997 - 2007, Paul C. Gregory
4
// Contact: pgregory@aqsis.org
6
// This library is free software; you can redistribute it and/or
7
// modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation; either
9
// version 2 of the License, or (at your option) any later version.
11
// This library is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
// General Public License for more details.
16
// You should have received a copy of the GNU General Public
17
// License along with this library; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
* \brief Shadow texture sampler.
24
* \author Chris Foster [ chris42f (at) gmail (dot) com ]
27
#ifndef SHADOWSAMPLER_H_INCLUDED
28
#define SHADOWSAMPLER_H_INCLUDED
30
#include <aqsis/aqsis.h>
32
#include <aqsis/tex/filtering/ishadowsampler.h>
33
#include <aqsis/math/matrix.h>
34
#include <aqsis/tex/filtering/texturesampleoptions.h>
42
//------------------------------------------------------------------------------
43
/** \brief A sampler for shadow maps, implementing percentage closer filtering.
45
class AQSIS_TEX_SHARE CqShadowSampler : public IqShadowSampler
48
/** \brief Construct a shadow sampler with data from the provided file.
50
* \param file - file to obtain the shadow map data from.
51
* \param currToWorld - a matrix transforming the "current" coordinate
52
* system to the world coordinate system. Sample
53
* quads are assumed to be passed to the sample()
54
* function represented in the "current"
57
CqShadowSampler(const boost::shared_ptr<IqTiledTexInputFile>& file,
58
const CqMatrix& currToWorld);
61
virtual void sample(const Sq3DSampleQuad& sampleQuad,
62
const CqShadowSampleOptions& sampleOpts, TqFloat* outSamps) const;
63
virtual const CqShadowSampleOptions& defaultSampleOptions() const;
65
/// transformation: current -> light coordinates
66
CqMatrix m_currToLight;
67
/// transformation: current -> raster coordinates ( [0,1]x[0,1] )
68
CqMatrix m_currToTexture;
69
/// Pixel data for shadow map.
70
boost::shared_ptr<CqTileArray<TqFloat> > m_pixelBuf;
71
/// Default shadow sampling options.
72
CqShadowSampleOptions m_defaultSampleOptions;
78
#endif // SHADOWSAMPLER_H_INCLUDED