fixed: gcc8 compile issues
[opensg.git] / Source / Contrib / TrapezoidalShadowMaps / OSGTrapezoidalShadowMapEngine.h
blob3f9884b734d6b51fc161b2be8290af28bac3bc28
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2006 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGTRAPEZOIDALSHADOWMAPENGINE_H_
40 #define _OSGTRAPEZOIDALSHADOWMAPENGINE_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGTrapezoidalShadowMapEngineBase.h"
47 OSG_BEGIN_NAMESPACE
49 /*! \brief TrapezoidalShadowMapEngine class. See \ref
50 PageGroupTrapezoidalShadowMapEngine for a description.
53 class OSG_CONTRIBTRAPEZOIDALSHADOWMAPS_DLLMAPPING TrapezoidalShadowMapEngine
54 : public TrapezoidalShadowMapEngineBase
56 protected:
58 /*========================== PUBLIC =================================*/
60 public:
62 typedef TrapezoidalShadowMapEngineBase Inherited;
63 typedef TrapezoidalShadowMapEngine Self;
65 /*---------------------------------------------------------------------*/
66 /*! \name Render */
67 /*! \{ */
69 virtual Action::ResultE runOnEnter(Light *light,
70 LightTypeE eType,
71 RenderAction *ract);
72 virtual Action::ResultE runOnLeave(Light *light,
73 LightTypeE eType,
74 RenderAction *ract);
76 /*! \} */
77 /*---------------------------------------------------------------------*/
78 /*! \name Sync */
79 /*! \{ */
81 virtual void changed(ConstFieldMaskArg whichField,
82 UInt32 origin,
83 BitVector details );
85 /*! \} */
86 /*---------------------------------------------------------------------*/
87 /*! \name Output */
88 /*! \{ */
90 virtual void dump( UInt32 uiIndent = 0,
91 const BitVector bvFlags = 0) const;
93 /*! \} */
94 /*========================= PROTECTED ===============================*/
96 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 */
110 /*! \{ */
112 TrapezoidalShadowMapEngine(void);
113 TrapezoidalShadowMapEngine(const TrapezoidalShadowMapEngine &source);
115 /*! \} */
116 /*---------------------------------------------------------------------*/
117 /*! \name Destructors */
118 /*! \{ */
120 virtual ~TrapezoidalShadowMapEngine(void);
122 /*! \} */
123 /*---------------------------------------------------------------------*/
124 /*! \name Init */
125 /*! \{ */
127 static void initMethod(InitPhase ePhase);
129 /*! \} */
130 /*---------------------------------------------------------------------*/
131 /*! \name Render Helper */
132 /*! \{ */
134 void handleEnter (Light *light,
135 LightTypeE eType,
136 RenderAction *ract,
137 TSMEngineData *data );
138 void handlePointLightEnter (PointLight *pointL,
139 RenderAction *ract,
140 TSMEngineData *data );
141 void handleDirectionalLightEnter(DirectionalLight *dirL,
142 RenderAction *ract,
143 TSMEngineData *data );
144 void handleSpotLightEnter (SpotLight *spotL,
145 RenderAction *ract,
146 TSMEngineData *data );
148 void intersectFrusta (const FrustumVolume &fA,
149 const FrustumVolume &fB,
150 std::vector<Pnt3f> &intVerts,
151 Pnt3f &intCenter);
152 void updateLightPassMaterial( TSMEngineData *data,
153 UInt16 faceIdx,
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 );
165 /*! \} */
166 /*========================== PRIVATE ================================*/
168 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;
179 OSG_END_NAMESPACE
181 #include "OSGTrapezoidalShadowMapEngineBase.inl"
182 #include "OSGTrapezoidalShadowMapEngine.inl"
184 #endif /* _OSGTRAPEZOIDALSHADOWMAPENGINE_H_ */