changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Groups / Light / Shadow / Base / OSGShadowMapEngine.cpp
blobe3e2a75330e9934c7eeedd821c02c325e987e4e5
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 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 #include <cstdlib>
40 #include <cstdio>
42 #include "OSGConfig.h"
44 #include "OSGShadowMapEngine.h"
45 #include "OSGPassMaskPool.h"
46 #include "OSGChunkMaterial.h"
47 #include "OSGMaterialChunk.h"
49 OSG_USING_NAMESPACE
51 // Documentation for this class is emited in the
52 // OSGShadowMapEngineBase.cpp file.
53 // To modify it, please change the .fcd file (OSGShadowMapEngine.fcd) and
54 // regenerate the base file.
56 BitVector ShadowMapEngine::bvLightPassMask = 0;
57 BitVector ShadowMapEngine::bvAmbientPassMask = 0;
58 BitVector ShadowMapEngine::bvDiffusePassMask = 0;
60 ChunkMaterialUnrecPtr ShadowMapEngine::_pLightPassMat = NULL;
62 /*-------------------------------------------------------------------------*/
63 /* Sync */
65 void ShadowMapEngine::changed(ConstFieldMaskArg whichField,
66 UInt32 origin,
67 BitVector details)
69 Inherited::changed(whichField, origin, details);
72 /*-------------------------------------------------------------------------*/
73 /* Dump */
75 void ShadowMapEngine::dump( UInt32 uiIndent,
76 const BitVector bvFlags) const
78 Inherited::dump(uiIndent, bvFlags);
81 /*-------------------------------------------------------------------------*/
82 /* Constructors */
84 ShadowMapEngine::ShadowMapEngine(void) :
85 Inherited ( )
90 ShadowMapEngine::ShadowMapEngine(const ShadowMapEngine &source) :
91 Inherited (source)
95 /*-------------------------------------------------------------------------*/
96 /* Destructor */
98 ShadowMapEngine::~ShadowMapEngine(void)
102 /*-------------------------------------------------------------------------*/
103 /* Init */
105 void ShadowMapEngine::initMethod(InitPhase ePhase)
107 Inherited::initMethod(ePhase);
110 if(ePhase == TypeObject::SystemPost)
112 bvLightPassMask =
113 PassMaskPool::the()->get("shadowMapEngine::LightPass");
114 bvAmbientPassMask =
115 PassMaskPool::the()->get("shadowMapEngine::AmbientPass");
116 bvDiffusePassMask =
117 PassMaskPool::the()->get("shadowMapEngine::DiffusePass");
119 else if(ePhase == TypeObject::FactoryPost)
121 if(_pLightPassMat == NULL)
123 _pLightPassMat = ChunkMaterial::createLocal();
125 MaterialChunkUnrecPtr pMatChunk = MaterialChunk::createLocal();
127 pMatChunk->setLit (false );
128 pMatChunk->setColorMaterial(GL_NONE);
130 _pLightPassMat->addChunk(pMatChunk);
132 _pLightPassMat->changed(FieldBits::AllFields,
133 ChangedOrigin::Commit,
139 void ShadowMapEngine::exitMethod(InitPhase ePhase)
141 Inherited::exitMethod(ePhase);
143 if(ePhase == TypeObject::SystemPost)
145 _pLightPassMat = NULL;