fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / NodeCores / Groups / Light / Shadow / Engines / OSGShaderShadowMapEngineBase.cpp
blob2eaf8844ef7263ef4f5d373fc881a8a827f442e2
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
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 /*****************************************************************************\
40 *****************************************************************************
41 ** **
42 ** This file is automatically generated. **
43 ** **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
46 ** **
47 ** Do not change this file, changes should be done in the derived **
48 ** class ShaderShadowMapEngine!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #ifdef WIN32
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
59 #endif
61 #include "OSGConfig.h"
65 #include "OSGShaderProgram.h" // ShadowVertexProgram Class
67 #include "OSGShaderShadowMapEngineBase.h"
68 #include "OSGShaderShadowMapEngine.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::ShaderShadowMapEngine
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var ShaderProgram * ShaderShadowMapEngineBase::_sfShadowVertexProgram
87 Vertex program snippet to perform necessary calculations for shadow map
88 lookup. Currently not used.
91 /*! \var ShaderProgram * ShaderShadowMapEngineBase::_sfShadowFragmentProgram
92 Fragment program snippet to perform shadow map lookup.
93 Contains a function vec4 OSG_SSME_FP_calcShadow(vec4 fragPos) that returns
94 a shadow factor for the fragment with eye coordinate positoin fragPos.
97 /*! \var Int32 ShaderShadowMapEngineBase::_sfForceTextureUnit
98 Texture unit to use for the shadow texture (this is passed to the shader
99 snippets).
102 /*! \var Real32 ShaderShadowMapEngineBase::_sfShadowNear
103 Near clipping plane value to use when rendering the shadow map.
104 Only used when not 0.f.
107 /*! \var Real32 ShaderShadowMapEngineBase::_sfShadowFar
108 Far clipping plane value to use when rendering the shadow map.
109 Only used when not 0.f.
113 /***************************************************************************\
114 * FieldType/FieldTrait Instantiation *
115 \***************************************************************************/
117 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
118 PointerType FieldTraits<ShaderShadowMapEngine *, nsOSG>::_type(
119 "ShaderShadowMapEnginePtr",
120 "ShadowMapEnginePtr",
121 ShaderShadowMapEngine::getClassType(),
122 nsOSG);
123 #endif
125 OSG_FIELDTRAITS_GETTYPE_NS(ShaderShadowMapEngine *, nsOSG)
127 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
128 ShaderShadowMapEngine *,
129 nsOSG)
131 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
132 ShaderShadowMapEngine *,
133 nsOSG)
135 /***************************************************************************\
136 * Field Description *
137 \***************************************************************************/
139 void ShaderShadowMapEngineBase::classDescInserter(TypeObject &oType)
141 FieldDescriptionBase *pDesc = NULL;
144 pDesc = new SFUnrecShaderProgramPtr::Description(
145 SFUnrecShaderProgramPtr::getClassType(),
146 "shadowVertexProgram",
147 "Vertex program snippet to perform necessary calculations for shadow map\n"
148 "lookup. Currently not used.\n",
149 ShadowVertexProgramFieldId, ShadowVertexProgramFieldMask,
150 false,
151 (Field::SFDefaultFlags | Field::FStdAccess),
152 static_cast<FieldEditMethodSig>(&ShaderShadowMapEngine::editHandleShadowVertexProgram),
153 static_cast<FieldGetMethodSig >(&ShaderShadowMapEngine::getHandleShadowVertexProgram));
155 oType.addInitialDesc(pDesc);
157 pDesc = new SFUnrecShaderProgramPtr::Description(
158 SFUnrecShaderProgramPtr::getClassType(),
159 "shadowFragmentProgram",
160 "Fragment program snippet to perform shadow map lookup.\n"
161 "Contains a function vec4 OSG_SSME_FP_calcShadow(vec4 fragPos) that returns\n"
162 "a shadow factor for the fragment with eye coordinate positoin fragPos.\n",
163 ShadowFragmentProgramFieldId, ShadowFragmentProgramFieldMask,
164 false,
165 (Field::SFDefaultFlags | Field::FStdAccess),
166 static_cast<FieldEditMethodSig>(&ShaderShadowMapEngine::editHandleShadowFragmentProgram),
167 static_cast<FieldGetMethodSig >(&ShaderShadowMapEngine::getHandleShadowFragmentProgram));
169 oType.addInitialDesc(pDesc);
171 pDesc = new SFInt32::Description(
172 SFInt32::getClassType(),
173 "forceTextureUnit",
174 "Texture unit to use for the shadow texture (this is passed to the shader\n"
175 "snippets). \n",
176 ForceTextureUnitFieldId, ForceTextureUnitFieldMask,
177 false,
178 (Field::SFDefaultFlags | Field::FStdAccess),
179 static_cast<FieldEditMethodSig>(&ShaderShadowMapEngine::editHandleForceTextureUnit),
180 static_cast<FieldGetMethodSig >(&ShaderShadowMapEngine::getHandleForceTextureUnit));
182 oType.addInitialDesc(pDesc);
184 pDesc = new SFReal32::Description(
185 SFReal32::getClassType(),
186 "shadowNear",
187 "Near clipping plane value to use when rendering the shadow map.\n"
188 "Only used when not 0.f.\n",
189 ShadowNearFieldId, ShadowNearFieldMask,
190 false,
191 (Field::SFDefaultFlags | Field::FStdAccess),
192 static_cast<FieldEditMethodSig>(&ShaderShadowMapEngine::editHandleShadowNear),
193 static_cast<FieldGetMethodSig >(&ShaderShadowMapEngine::getHandleShadowNear));
195 oType.addInitialDesc(pDesc);
197 pDesc = new SFReal32::Description(
198 SFReal32::getClassType(),
199 "shadowFar",
200 "Far clipping plane value to use when rendering the shadow map.\n"
201 "Only used when not 0.f.\n",
202 ShadowFarFieldId, ShadowFarFieldMask,
203 false,
204 (Field::SFDefaultFlags | Field::FStdAccess),
205 static_cast<FieldEditMethodSig>(&ShaderShadowMapEngine::editHandleShadowFar),
206 static_cast<FieldGetMethodSig >(&ShaderShadowMapEngine::getHandleShadowFar));
208 oType.addInitialDesc(pDesc);
212 ShaderShadowMapEngineBase::TypeObject ShaderShadowMapEngineBase::_type(
213 ShaderShadowMapEngineBase::getClassname(),
214 Inherited::getClassname(),
215 "NULL",
216 nsOSG, //Namespace
217 reinterpret_cast<PrototypeCreateF>(&ShaderShadowMapEngineBase::createEmptyLocal),
218 reinterpret_cast<InitContainerF>(&ShaderShadowMapEngine::initMethod),
219 reinterpret_cast<ExitContainerF>(&ShaderShadowMapEngine::exitMethod),
220 reinterpret_cast<InitalInsertDescFunc>(
221 reinterpret_cast<void *>(&ShaderShadowMapEngine::classDescInserter)),
222 false,
224 "<?xml version=\"1.0\" ?>\n"
225 "\n"
226 "<FieldContainer\n"
227 " name=\"ShaderShadowMapEngine\"\n"
228 " parent=\"ShadowMapEngine\"\n"
229 " library=\"Group\"\n"
230 " structure=\"concrete\"\n"
231 " pointerfieldtypes=\"both\"\n"
232 " systemcomponent=\"true\"\n"
233 " parentsystemcomponent=\"true\"\n"
234 " isNodeCore=\"false\"\n"
235 " docGroupBase=\"GrpGroupLightShadowEngines\"\n"
236 " >\n"
237 " <Field\n"
238 " name=\"shadowVertexProgram\"\n"
239 " category=\"pointer\"\n"
240 " type=\"ShaderProgram\"\n"
241 " cardinality=\"single\"\n"
242 " visibility=\"external\"\n"
243 " defaultValue=\"NULL\"\n"
244 " access=\"public\"\n"
245 " >\n"
246 " Vertex program snippet to perform necessary calculations for shadow map\n"
247 " lookup. Currently not used.\n"
248 " </Field>\n"
249 " <Field\n"
250 " name=\"shadowFragmentProgram\"\n"
251 " category=\"pointer\"\n"
252 " type=\"ShaderProgram\"\n"
253 " cardinality=\"single\"\n"
254 " visibility=\"external\"\n"
255 " defaultValue=\"NULL\"\n"
256 " access=\"public\"\n"
257 " >\n"
258 " Fragment program snippet to perform shadow map lookup.\n"
259 " Contains a function vec4 OSG_SSME_FP_calcShadow(vec4 fragPos) that returns\n"
260 " a shadow factor for the fragment with eye coordinate positoin fragPos.\n"
261 " </Field>\n"
262 " <Field\n"
263 " name=\"forceTextureUnit\"\n"
264 " type=\"Int32\"\n"
265 " cardinality=\"single\"\n"
266 " visibility=\"external\"\n"
267 " defaultValue=\"-1\"\n"
268 " access=\"public\"\n"
269 " >\n"
270 " Texture unit to use for the shadow texture (this is passed to the shader\n"
271 " snippets). \n"
272 " </Field>\n"
273 " <Field\n"
274 " name=\"shadowNear\"\n"
275 " type=\"Real32\"\n"
276 " category=\"data\"\n"
277 " cardinality=\"single\"\n"
278 " visibility=\"external\"\n"
279 " defaultValue=\"0.f\"\n"
280 " access=\"public\"\n"
281 " >\n"
282 " Near clipping plane value to use when rendering the shadow map.\n"
283 " Only used when not 0.f.\n"
284 " </Field>\n"
285 " <Field\n"
286 " name=\"shadowFar\"\n"
287 " type=\"Real32\"\n"
288 " category=\"data\"\n"
289 " cardinality=\"single\"\n"
290 " visibility=\"external\"\n"
291 " defaultValue=\"0.f\"\n"
292 " access=\"public\"\n"
293 " >\n"
294 " Far clipping plane value to use when rendering the shadow map.\n"
295 " Only used when not 0.f.\n"
296 " </Field>\n"
297 "</FieldContainer>\n",
301 /*------------------------------ get -----------------------------------*/
303 FieldContainerType &ShaderShadowMapEngineBase::getType(void)
305 return _type;
308 const FieldContainerType &ShaderShadowMapEngineBase::getType(void) const
310 return _type;
313 UInt32 ShaderShadowMapEngineBase::getContainerSize(void) const
315 return sizeof(ShaderShadowMapEngine);
318 /*------------------------- decorator get ------------------------------*/
321 //! Get the ShaderShadowMapEngine::_sfShadowVertexProgram field.
322 const SFUnrecShaderProgramPtr *ShaderShadowMapEngineBase::getSFShadowVertexProgram(void) const
324 return &_sfShadowVertexProgram;
327 SFUnrecShaderProgramPtr *ShaderShadowMapEngineBase::editSFShadowVertexProgram(void)
329 editSField(ShadowVertexProgramFieldMask);
331 return &_sfShadowVertexProgram;
334 //! Get the value of the ShaderShadowMapEngine::_sfShadowVertexProgram field.
335 ShaderProgram * ShaderShadowMapEngineBase::getShadowVertexProgram(void) const
337 return _sfShadowVertexProgram.getValue();
340 //! Set the value of the ShaderShadowMapEngine::_sfShadowVertexProgram field.
341 void ShaderShadowMapEngineBase::setShadowVertexProgram(ShaderProgram * const value)
343 editSField(ShadowVertexProgramFieldMask);
345 _sfShadowVertexProgram.setValue(value);
349 //! Get the ShaderShadowMapEngine::_sfShadowFragmentProgram field.
350 const SFUnrecShaderProgramPtr *ShaderShadowMapEngineBase::getSFShadowFragmentProgram(void) const
352 return &_sfShadowFragmentProgram;
355 SFUnrecShaderProgramPtr *ShaderShadowMapEngineBase::editSFShadowFragmentProgram(void)
357 editSField(ShadowFragmentProgramFieldMask);
359 return &_sfShadowFragmentProgram;
362 //! Get the value of the ShaderShadowMapEngine::_sfShadowFragmentProgram field.
363 ShaderProgram * ShaderShadowMapEngineBase::getShadowFragmentProgram(void) const
365 return _sfShadowFragmentProgram.getValue();
368 //! Set the value of the ShaderShadowMapEngine::_sfShadowFragmentProgram field.
369 void ShaderShadowMapEngineBase::setShadowFragmentProgram(ShaderProgram * const value)
371 editSField(ShadowFragmentProgramFieldMask);
373 _sfShadowFragmentProgram.setValue(value);
377 SFInt32 *ShaderShadowMapEngineBase::editSFForceTextureUnit(void)
379 editSField(ForceTextureUnitFieldMask);
381 return &_sfForceTextureUnit;
384 const SFInt32 *ShaderShadowMapEngineBase::getSFForceTextureUnit(void) const
386 return &_sfForceTextureUnit;
390 SFReal32 *ShaderShadowMapEngineBase::editSFShadowNear(void)
392 editSField(ShadowNearFieldMask);
394 return &_sfShadowNear;
397 const SFReal32 *ShaderShadowMapEngineBase::getSFShadowNear(void) const
399 return &_sfShadowNear;
403 SFReal32 *ShaderShadowMapEngineBase::editSFShadowFar(void)
405 editSField(ShadowFarFieldMask);
407 return &_sfShadowFar;
410 const SFReal32 *ShaderShadowMapEngineBase::getSFShadowFar(void) const
412 return &_sfShadowFar;
420 /*------------------------------ access -----------------------------------*/
422 SizeT ShaderShadowMapEngineBase::getBinSize(ConstFieldMaskArg whichField)
424 SizeT returnValue = Inherited::getBinSize(whichField);
426 if(FieldBits::NoField != (ShadowVertexProgramFieldMask & whichField))
428 returnValue += _sfShadowVertexProgram.getBinSize();
430 if(FieldBits::NoField != (ShadowFragmentProgramFieldMask & whichField))
432 returnValue += _sfShadowFragmentProgram.getBinSize();
434 if(FieldBits::NoField != (ForceTextureUnitFieldMask & whichField))
436 returnValue += _sfForceTextureUnit.getBinSize();
438 if(FieldBits::NoField != (ShadowNearFieldMask & whichField))
440 returnValue += _sfShadowNear.getBinSize();
442 if(FieldBits::NoField != (ShadowFarFieldMask & whichField))
444 returnValue += _sfShadowFar.getBinSize();
447 return returnValue;
450 void ShaderShadowMapEngineBase::copyToBin(BinaryDataHandler &pMem,
451 ConstFieldMaskArg whichField)
453 Inherited::copyToBin(pMem, whichField);
455 if(FieldBits::NoField != (ShadowVertexProgramFieldMask & whichField))
457 _sfShadowVertexProgram.copyToBin(pMem);
459 if(FieldBits::NoField != (ShadowFragmentProgramFieldMask & whichField))
461 _sfShadowFragmentProgram.copyToBin(pMem);
463 if(FieldBits::NoField != (ForceTextureUnitFieldMask & whichField))
465 _sfForceTextureUnit.copyToBin(pMem);
467 if(FieldBits::NoField != (ShadowNearFieldMask & whichField))
469 _sfShadowNear.copyToBin(pMem);
471 if(FieldBits::NoField != (ShadowFarFieldMask & whichField))
473 _sfShadowFar.copyToBin(pMem);
477 void ShaderShadowMapEngineBase::copyFromBin(BinaryDataHandler &pMem,
478 ConstFieldMaskArg whichField)
480 Inherited::copyFromBin(pMem, whichField);
482 if(FieldBits::NoField != (ShadowVertexProgramFieldMask & whichField))
484 editSField(ShadowVertexProgramFieldMask);
485 _sfShadowVertexProgram.copyFromBin(pMem);
487 if(FieldBits::NoField != (ShadowFragmentProgramFieldMask & whichField))
489 editSField(ShadowFragmentProgramFieldMask);
490 _sfShadowFragmentProgram.copyFromBin(pMem);
492 if(FieldBits::NoField != (ForceTextureUnitFieldMask & whichField))
494 editSField(ForceTextureUnitFieldMask);
495 _sfForceTextureUnit.copyFromBin(pMem);
497 if(FieldBits::NoField != (ShadowNearFieldMask & whichField))
499 editSField(ShadowNearFieldMask);
500 _sfShadowNear.copyFromBin(pMem);
502 if(FieldBits::NoField != (ShadowFarFieldMask & whichField))
504 editSField(ShadowFarFieldMask);
505 _sfShadowFar.copyFromBin(pMem);
509 //! create a new instance of the class
510 ShaderShadowMapEngineTransitPtr ShaderShadowMapEngineBase::createLocal(BitVector bFlags)
512 ShaderShadowMapEngineTransitPtr fc;
514 if(getClassType().getPrototype() != NULL)
516 FieldContainerTransitPtr tmpPtr =
517 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
519 fc = dynamic_pointer_cast<ShaderShadowMapEngine>(tmpPtr);
522 return fc;
525 //! create a new instance of the class, copy the container flags
526 ShaderShadowMapEngineTransitPtr ShaderShadowMapEngineBase::createDependent(BitVector bFlags)
528 ShaderShadowMapEngineTransitPtr fc;
530 if(getClassType().getPrototype() != NULL)
532 FieldContainerTransitPtr tmpPtr =
533 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
535 fc = dynamic_pointer_cast<ShaderShadowMapEngine>(tmpPtr);
538 return fc;
541 //! create a new instance of the class
542 ShaderShadowMapEngineTransitPtr ShaderShadowMapEngineBase::create(void)
544 ShaderShadowMapEngineTransitPtr fc;
546 if(getClassType().getPrototype() != NULL)
548 FieldContainerTransitPtr tmpPtr =
549 getClassType().getPrototype()-> shallowCopy();
551 fc = dynamic_pointer_cast<ShaderShadowMapEngine>(tmpPtr);
554 return fc;
557 ShaderShadowMapEngine *ShaderShadowMapEngineBase::createEmptyLocal(BitVector bFlags)
559 ShaderShadowMapEngine *returnValue;
561 newPtr<ShaderShadowMapEngine>(returnValue, bFlags);
563 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
565 return returnValue;
568 //! create an empty new instance of the class, do not copy the prototype
569 ShaderShadowMapEngine *ShaderShadowMapEngineBase::createEmpty(void)
571 ShaderShadowMapEngine *returnValue;
573 newPtr<ShaderShadowMapEngine>(returnValue, Thread::getCurrentLocalFlags());
575 returnValue->_pFieldFlags->_bNamespaceMask &=
576 ~Thread::getCurrentLocalFlags();
578 return returnValue;
582 FieldContainerTransitPtr ShaderShadowMapEngineBase::shallowCopyLocal(
583 BitVector bFlags) const
585 ShaderShadowMapEngine *tmpPtr;
587 newPtr(tmpPtr, dynamic_cast<const ShaderShadowMapEngine *>(this), bFlags);
589 FieldContainerTransitPtr returnValue(tmpPtr);
591 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
593 return returnValue;
596 FieldContainerTransitPtr ShaderShadowMapEngineBase::shallowCopyDependent(
597 BitVector bFlags) const
599 ShaderShadowMapEngine *tmpPtr;
601 newPtr(tmpPtr, dynamic_cast<const ShaderShadowMapEngine *>(this), ~bFlags);
603 FieldContainerTransitPtr returnValue(tmpPtr);
605 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
607 return returnValue;
610 FieldContainerTransitPtr ShaderShadowMapEngineBase::shallowCopy(void) const
612 ShaderShadowMapEngine *tmpPtr;
614 newPtr(tmpPtr,
615 dynamic_cast<const ShaderShadowMapEngine *>(this),
616 Thread::getCurrentLocalFlags());
618 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
620 FieldContainerTransitPtr returnValue(tmpPtr);
622 return returnValue;
628 /*------------------------- constructors ----------------------------------*/
630 ShaderShadowMapEngineBase::ShaderShadowMapEngineBase(void) :
631 Inherited(),
632 _sfShadowVertexProgram (NULL),
633 _sfShadowFragmentProgram (NULL),
634 _sfForceTextureUnit (Int32(-1)),
635 _sfShadowNear (Real32(0.f)),
636 _sfShadowFar (Real32(0.f))
640 ShaderShadowMapEngineBase::ShaderShadowMapEngineBase(const ShaderShadowMapEngineBase &source) :
641 Inherited(source),
642 _sfShadowVertexProgram (NULL),
643 _sfShadowFragmentProgram (NULL),
644 _sfForceTextureUnit (source._sfForceTextureUnit ),
645 _sfShadowNear (source._sfShadowNear ),
646 _sfShadowFar (source._sfShadowFar )
651 /*-------------------------- destructors ----------------------------------*/
653 ShaderShadowMapEngineBase::~ShaderShadowMapEngineBase(void)
657 void ShaderShadowMapEngineBase::onCreate(const ShaderShadowMapEngine *source)
659 Inherited::onCreate(source);
661 if(source != NULL)
663 ShaderShadowMapEngine *pThis = static_cast<ShaderShadowMapEngine *>(this);
665 pThis->setShadowVertexProgram(source->getShadowVertexProgram());
667 pThis->setShadowFragmentProgram(source->getShadowFragmentProgram());
671 GetFieldHandlePtr ShaderShadowMapEngineBase::getHandleShadowVertexProgram (void) const
673 SFUnrecShaderProgramPtr::GetHandlePtr returnValue(
674 new SFUnrecShaderProgramPtr::GetHandle(
675 &_sfShadowVertexProgram,
676 this->getType().getFieldDesc(ShadowVertexProgramFieldId),
677 const_cast<ShaderShadowMapEngineBase *>(this)));
679 return returnValue;
682 EditFieldHandlePtr ShaderShadowMapEngineBase::editHandleShadowVertexProgram(void)
684 SFUnrecShaderProgramPtr::EditHandlePtr returnValue(
685 new SFUnrecShaderProgramPtr::EditHandle(
686 &_sfShadowVertexProgram,
687 this->getType().getFieldDesc(ShadowVertexProgramFieldId),
688 this));
690 returnValue->setSetMethod(
691 boost::bind(&ShaderShadowMapEngine::setShadowVertexProgram,
692 static_cast<ShaderShadowMapEngine *>(this), _1));
694 editSField(ShadowVertexProgramFieldMask);
696 return returnValue;
699 GetFieldHandlePtr ShaderShadowMapEngineBase::getHandleShadowFragmentProgram (void) const
701 SFUnrecShaderProgramPtr::GetHandlePtr returnValue(
702 new SFUnrecShaderProgramPtr::GetHandle(
703 &_sfShadowFragmentProgram,
704 this->getType().getFieldDesc(ShadowFragmentProgramFieldId),
705 const_cast<ShaderShadowMapEngineBase *>(this)));
707 return returnValue;
710 EditFieldHandlePtr ShaderShadowMapEngineBase::editHandleShadowFragmentProgram(void)
712 SFUnrecShaderProgramPtr::EditHandlePtr returnValue(
713 new SFUnrecShaderProgramPtr::EditHandle(
714 &_sfShadowFragmentProgram,
715 this->getType().getFieldDesc(ShadowFragmentProgramFieldId),
716 this));
718 returnValue->setSetMethod(
719 boost::bind(&ShaderShadowMapEngine::setShadowFragmentProgram,
720 static_cast<ShaderShadowMapEngine *>(this), _1));
722 editSField(ShadowFragmentProgramFieldMask);
724 return returnValue;
727 GetFieldHandlePtr ShaderShadowMapEngineBase::getHandleForceTextureUnit (void) const
729 SFInt32::GetHandlePtr returnValue(
730 new SFInt32::GetHandle(
731 &_sfForceTextureUnit,
732 this->getType().getFieldDesc(ForceTextureUnitFieldId),
733 const_cast<ShaderShadowMapEngineBase *>(this)));
735 return returnValue;
738 EditFieldHandlePtr ShaderShadowMapEngineBase::editHandleForceTextureUnit(void)
740 SFInt32::EditHandlePtr returnValue(
741 new SFInt32::EditHandle(
742 &_sfForceTextureUnit,
743 this->getType().getFieldDesc(ForceTextureUnitFieldId),
744 this));
747 editSField(ForceTextureUnitFieldMask);
749 return returnValue;
752 GetFieldHandlePtr ShaderShadowMapEngineBase::getHandleShadowNear (void) const
754 SFReal32::GetHandlePtr returnValue(
755 new SFReal32::GetHandle(
756 &_sfShadowNear,
757 this->getType().getFieldDesc(ShadowNearFieldId),
758 const_cast<ShaderShadowMapEngineBase *>(this)));
760 return returnValue;
763 EditFieldHandlePtr ShaderShadowMapEngineBase::editHandleShadowNear (void)
765 SFReal32::EditHandlePtr returnValue(
766 new SFReal32::EditHandle(
767 &_sfShadowNear,
768 this->getType().getFieldDesc(ShadowNearFieldId),
769 this));
772 editSField(ShadowNearFieldMask);
774 return returnValue;
777 GetFieldHandlePtr ShaderShadowMapEngineBase::getHandleShadowFar (void) const
779 SFReal32::GetHandlePtr returnValue(
780 new SFReal32::GetHandle(
781 &_sfShadowFar,
782 this->getType().getFieldDesc(ShadowFarFieldId),
783 const_cast<ShaderShadowMapEngineBase *>(this)));
785 return returnValue;
788 EditFieldHandlePtr ShaderShadowMapEngineBase::editHandleShadowFar (void)
790 SFReal32::EditHandlePtr returnValue(
791 new SFReal32::EditHandle(
792 &_sfShadowFar,
793 this->getType().getFieldDesc(ShadowFarFieldId),
794 this));
797 editSField(ShadowFarFieldMask);
799 return returnValue;
803 #ifdef OSG_MT_CPTR_ASPECT
804 void ShaderShadowMapEngineBase::execSyncV( FieldContainer &oFrom,
805 ConstFieldMaskArg whichField,
806 AspectOffsetStore &oOffsets,
807 ConstFieldMaskArg syncMode,
808 const UInt32 uiSyncInfo)
810 ShaderShadowMapEngine *pThis = static_cast<ShaderShadowMapEngine *>(this);
812 pThis->execSync(static_cast<ShaderShadowMapEngine *>(&oFrom),
813 whichField,
814 oOffsets,
815 syncMode,
816 uiSyncInfo);
818 #endif
821 #ifdef OSG_MT_CPTR_ASPECT
822 FieldContainer *ShaderShadowMapEngineBase::createAspectCopy(
823 const FieldContainer *pRefAspect) const
825 ShaderShadowMapEngine *returnValue;
827 newAspectCopy(returnValue,
828 dynamic_cast<const ShaderShadowMapEngine *>(pRefAspect),
829 dynamic_cast<const ShaderShadowMapEngine *>(this));
831 return returnValue;
833 #endif
835 void ShaderShadowMapEngineBase::resolveLinks(void)
837 Inherited::resolveLinks();
839 static_cast<ShaderShadowMapEngine *>(this)->setShadowVertexProgram(NULL);
841 static_cast<ShaderShadowMapEngine *>(this)->setShadowFragmentProgram(NULL);
847 OSG_END_NAMESPACE