1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 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 \*---------------------------------------------------------------------------*/
42 #include "OSGConfig.h"
44 #include "OSGShadowMapEngine.h"
45 #include "OSGPassMaskPool.h"
46 #include "OSGChunkMaterial.h"
47 #include "OSGMaterialChunk.h"
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 /*-------------------------------------------------------------------------*/
65 void ShadowMapEngine::changed(ConstFieldMaskArg whichField
,
69 Inherited::changed(whichField
, origin
, details
);
72 /*-------------------------------------------------------------------------*/
75 void ShadowMapEngine::dump( UInt32 uiIndent
,
76 const BitVector bvFlags
) const
78 Inherited::dump(uiIndent
, bvFlags
);
81 /*-------------------------------------------------------------------------*/
84 ShadowMapEngine::ShadowMapEngine(void) :
90 ShadowMapEngine::ShadowMapEngine(const ShadowMapEngine
&source
) :
95 /*-------------------------------------------------------------------------*/
98 ShadowMapEngine::~ShadowMapEngine(void)
102 /*-------------------------------------------------------------------------*/
105 void ShadowMapEngine::initMethod(InitPhase ePhase
)
107 Inherited::initMethod(ePhase
);
110 if(ePhase
== TypeObject::SystemPost
)
113 PassMaskPool::the()->get("shadowMapEngine::LightPass");
115 PassMaskPool::the()->get("shadowMapEngine::AmbientPass");
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
;