1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2006 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGTRAPEZOIDALSHADOWMAPENGINE_H_
40 #define _OSGTRAPEZOIDALSHADOWMAPENGINE_H_
45 #include "OSGTrapezoidalShadowMapEngineBase.h"
49 /*! \brief TrapezoidalShadowMapEngine class. See \ref
50 PageGroupTrapezoidalShadowMapEngine for a description.
53 class OSG_CONTRIBTRAPEZOIDALSHADOWMAPS_DLLMAPPING TrapezoidalShadowMapEngine
54 : public TrapezoidalShadowMapEngineBase
58 /*========================== PUBLIC =================================*/
62 typedef TrapezoidalShadowMapEngineBase Inherited
;
63 typedef TrapezoidalShadowMapEngine Self
;
65 /*---------------------------------------------------------------------*/
69 virtual Action::ResultE
runOnEnter(Light
*light
,
72 virtual Action::ResultE
runOnLeave(Light
*light
,
77 /*---------------------------------------------------------------------*/
81 virtual void changed(ConstFieldMaskArg whichField
,
86 /*---------------------------------------------------------------------*/
90 virtual void dump( UInt32 uiIndent
= 0,
91 const BitVector bvFlags
= 0) const;
94 /*========================= PROTECTED ===============================*/
98 // Variables should all be in TrapezoidalShadowMapEngineBase.
100 typedef ShaderShadowMapEngineData TSMEngineData
;
102 static const std::string _lightPassVPCode
;
103 static const std::string _lightPassFPCode
;
105 static const std::string _pointFPCode
;
106 static const std::string _spotFPCode
;
108 /*---------------------------------------------------------------------*/
109 /*! \name Constructors */
112 TrapezoidalShadowMapEngine(void);
113 TrapezoidalShadowMapEngine(const TrapezoidalShadowMapEngine
&source
);
116 /*---------------------------------------------------------------------*/
117 /*! \name Destructors */
120 virtual ~TrapezoidalShadowMapEngine(void);
123 /*---------------------------------------------------------------------*/
127 static void initMethod(InitPhase ePhase
);
130 /*---------------------------------------------------------------------*/
131 /*! \name Render Helper */
134 void handleEnter (Light
*light
,
137 TSMEngineData
*data
);
138 void handlePointLightEnter (PointLight
*pointL
,
140 TSMEngineData
*data
);
141 void handleDirectionalLightEnter(DirectionalLight
*dirL
,
143 TSMEngineData
*data
);
144 void handleSpotLightEnter (SpotLight
*spotL
,
146 TSMEngineData
*data
);
148 void intersectFrusta (const FrustumVolume
&fA
,
149 const FrustumVolume
&fB
,
150 std::vector
<Pnt3f
> &intVerts
,
152 void updateLightPassMaterial( TSMEngineData
*data
,
154 const Matrix
&matNT
);
157 bool calcTrapezoidalTransform( Matrix
&matNT
,
158 const Matrix
&matEyeToWorld
,
159 const Matrix
&matLightFull
,
160 const FrustumVolume
&eyeFrust
,
161 const FrustumVolume
&lightFrust
);
163 void emptyCubeFaceDrawFunc ( DrawEnv
*drawEnv
);
166 /*========================== PRIVATE ================================*/
170 friend class FieldContainer
;
171 friend class TrapezoidalShadowMapEngineBase
;
173 // prohibit default functions (move to 'public' if you need one)
174 void operator =(const TrapezoidalShadowMapEngine
&source
);
177 typedef TrapezoidalShadowMapEngine
*TrapezoidalShadowMapEngineP
;
181 #include "OSGTrapezoidalShadowMapEngineBase.inl"
182 #include "OSGTrapezoidalShadowMapEngine.inl"
184 #endif /* _OSGTRAPEZOIDALSHADOWMAPENGINE_H_ */