changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Groups / Light / Shadow / Engines / OSGShaderShadowMapEngineDataBase.cpp
blob7403e3e23398798bc335d35980c5ca22d095f470
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 ShaderShadowMapEngineData!
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 "OSGFrameBufferObject.h" // RenderTargets Class
66 #include "OSGTextureBuffer.h" // ShadowTexBuffers Class
67 #include "OSGTextureObjChunk.h" // ShadowTexChunk Class
68 #include "OSGImage.h" // ShadowTexImage Class
69 #include "OSGChunkMaterial.h" // LightPassMaterials Class
70 #include "OSGBackground.h" // Background Class
72 #include "OSGShaderShadowMapEngineDataBase.h"
73 #include "OSGShaderShadowMapEngineData.h"
75 #include <boost/bind.hpp>
77 OSG_BEGIN_NAMESPACE
79 /***************************************************************************\
80 * Description *
81 \***************************************************************************/
83 /*! \class OSG::ShaderShadowMapEngineData
84 Data use for rendering by the DSShadowMapEngine
87 /***************************************************************************\
88 * Field Documentation *
89 \***************************************************************************/
91 /*! \var FrameBufferObject * ShaderShadowMapEngineDataBase::_mfRenderTargets
92 FBOs for rendering the depth texture, can be multiple for point lights.
95 /*! \var TextureBuffer * ShaderShadowMapEngineDataBase::_mfShadowTexBuffers
96 FBO Attachments holding the depth texture, can be multiple for point lights.
99 /*! \var TextureObjChunk * ShaderShadowMapEngineDataBase::_sfShadowTexChunk
100 The depth texture.
103 /*! \var Image * ShaderShadowMapEngineDataBase::_sfShadowTexImage
104 The depth texture image.
107 /*! \var ChunkMaterial * ShaderShadowMapEngineDataBase::_mfLightPassMaterials
108 Material used to render the scene from the lights point of view.
111 /*! \var Background * ShaderShadowMapEngineDataBase::_sfBackground
116 /***************************************************************************\
117 * FieldType/FieldTrait Instantiation *
118 \***************************************************************************/
120 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
121 PointerType FieldTraits<ShaderShadowMapEngineData *, nsOSG>::_type(
122 "ShaderShadowMapEngineDataPtr",
123 "StageDataPtr",
124 ShaderShadowMapEngineData::getClassType(),
125 nsOSG);
126 #endif
128 OSG_FIELDTRAITS_GETTYPE_NS(ShaderShadowMapEngineData *, nsOSG)
130 /***************************************************************************\
131 * Field Description *
132 \***************************************************************************/
134 void ShaderShadowMapEngineDataBase::classDescInserter(TypeObject &oType)
136 FieldDescriptionBase *pDesc = NULL;
139 pDesc = new MFUnrecFrameBufferObjectPtr::Description(
140 MFUnrecFrameBufferObjectPtr::getClassType(),
141 "renderTargets",
142 "FBOs for rendering the depth texture, can be multiple for point lights.\n",
143 RenderTargetsFieldId, RenderTargetsFieldMask,
144 false,
145 (Field::MFDefaultFlags | Field::FStdAccess),
146 static_cast<FieldEditMethodSig>(&ShaderShadowMapEngineData::editHandleRenderTargets),
147 static_cast<FieldGetMethodSig >(&ShaderShadowMapEngineData::getHandleRenderTargets));
149 oType.addInitialDesc(pDesc);
151 pDesc = new MFUnrecTextureBufferPtr::Description(
152 MFUnrecTextureBufferPtr::getClassType(),
153 "shadowTexBuffers",
154 "FBO Attachments holding the depth texture, can be multiple for point lights.\n",
155 ShadowTexBuffersFieldId, ShadowTexBuffersFieldMask,
156 false,
157 (Field::MFDefaultFlags | Field::FStdAccess),
158 static_cast<FieldEditMethodSig>(&ShaderShadowMapEngineData::editHandleShadowTexBuffers),
159 static_cast<FieldGetMethodSig >(&ShaderShadowMapEngineData::getHandleShadowTexBuffers));
161 oType.addInitialDesc(pDesc);
163 pDesc = new SFUnrecTextureObjChunkPtr::Description(
164 SFUnrecTextureObjChunkPtr::getClassType(),
165 "shadowTexChunk",
166 "The depth texture.\n",
167 ShadowTexChunkFieldId, ShadowTexChunkFieldMask,
168 false,
169 (Field::SFDefaultFlags | Field::FStdAccess),
170 static_cast<FieldEditMethodSig>(&ShaderShadowMapEngineData::editHandleShadowTexChunk),
171 static_cast<FieldGetMethodSig >(&ShaderShadowMapEngineData::getHandleShadowTexChunk));
173 oType.addInitialDesc(pDesc);
175 pDesc = new SFUnrecImagePtr::Description(
176 SFUnrecImagePtr::getClassType(),
177 "shadowTexImage",
178 "The depth texture image.\n",
179 ShadowTexImageFieldId, ShadowTexImageFieldMask,
180 false,
181 (Field::SFDefaultFlags | Field::FStdAccess),
182 static_cast<FieldEditMethodSig>(&ShaderShadowMapEngineData::editHandleShadowTexImage),
183 static_cast<FieldGetMethodSig >(&ShaderShadowMapEngineData::getHandleShadowTexImage));
185 oType.addInitialDesc(pDesc);
187 pDesc = new MFUnrecChunkMaterialPtr::Description(
188 MFUnrecChunkMaterialPtr::getClassType(),
189 "lightPassMaterials",
190 "Material used to render the scene from the lights point of view.\n",
191 LightPassMaterialsFieldId, LightPassMaterialsFieldMask,
192 false,
193 (Field::MFDefaultFlags | Field::FStdAccess),
194 static_cast<FieldEditMethodSig>(&ShaderShadowMapEngineData::editHandleLightPassMaterials),
195 static_cast<FieldGetMethodSig >(&ShaderShadowMapEngineData::getHandleLightPassMaterials));
197 oType.addInitialDesc(pDesc);
199 pDesc = new SFUnrecBackgroundPtr::Description(
200 SFUnrecBackgroundPtr::getClassType(),
201 "background",
203 BackgroundFieldId, BackgroundFieldMask,
204 false,
205 (Field::SFDefaultFlags | Field::FStdAccess),
206 static_cast<FieldEditMethodSig>(&ShaderShadowMapEngineData::editHandleBackground),
207 static_cast<FieldGetMethodSig >(&ShaderShadowMapEngineData::getHandleBackground));
209 oType.addInitialDesc(pDesc);
213 ShaderShadowMapEngineDataBase::TypeObject ShaderShadowMapEngineDataBase::_type(
214 ShaderShadowMapEngineDataBase::getClassname(),
215 Inherited::getClassname(),
216 "NULL",
217 nsOSG, //Namespace
218 reinterpret_cast<PrototypeCreateF>(&ShaderShadowMapEngineDataBase::createEmptyLocal),
219 reinterpret_cast<InitContainerF>(&ShaderShadowMapEngineData::initMethod),
220 reinterpret_cast<ExitContainerF>(&ShaderShadowMapEngineData::exitMethod),
221 reinterpret_cast<InitalInsertDescFunc>(
222 reinterpret_cast<void *>(&ShaderShadowMapEngineData::classDescInserter)),
223 false,
225 "<?xml version=\"1.0\"?>\n"
226 "\n"
227 "<FieldContainer\n"
228 " name=\"ShaderShadowMapEngineData\"\n"
229 " parent=\"StageData\"\n"
230 " library=\"Group\"\n"
231 " pointerfieldtypes=\"none\"\n"
232 " structure=\"concrete\"\n"
233 " systemcomponent=\"true\"\n"
234 " parentsystemcomponent=\"true\"\n"
235 " decoratable=\"false\"\n"
236 " useLocalIncludes=\"false\"\n"
237 " isNodeCore=\"false\"\n"
238 " isBundle=\"true\"\n"
239 " docGroupBase=\"GrpGroupLightShadowEngines\"\n"
240 " >\n"
241 " Data use for rendering by the DSShadowMapEngine\n"
242 " <Field\n"
243 " name=\"renderTargets\"\n"
244 " category=\"pointer\"\n"
245 " type=\"FrameBufferObject\"\n"
246 " cardinality=\"multi\"\n"
247 " visibility=\"external\"\n"
248 " access=\"public\"\n"
249 " >\n"
250 " FBOs for rendering the depth texture, can be multiple for point lights.\n"
251 " </Field>\n"
252 " <Field\n"
253 " name=\"shadowTexBuffers\"\n"
254 " category=\"pointer\"\n"
255 " type=\"TextureBuffer\"\n"
256 " cardinality=\"multi\"\n"
257 " visibility=\"external\"\n"
258 " access=\"public\"\n"
259 " >\n"
260 " FBO Attachments holding the depth texture, can be multiple for point lights.\n"
261 " </Field>\n"
262 " <Field\n"
263 " name=\"shadowTexChunk\"\n"
264 " category=\"pointer\"\n"
265 " type=\"TextureObjChunk\"\n"
266 " cardinality=\"single\"\n"
267 " visibility=\"external\"\n"
268 " defaultValue=\"NULL\"\n"
269 " access=\"public\"\n"
270 " >\n"
271 " The depth texture.\n"
272 " </Field>\n"
273 " <Field\n"
274 " name=\"shadowTexImage\"\n"
275 " category=\"pointer\"\n"
276 " type=\"Image\"\n"
277 " cardinality=\"single\"\n"
278 " visibility=\"external\"\n"
279 " access=\"public\"\n"
280 " >\n"
281 " The depth texture image.\n"
282 " </Field>\n"
283 " <Field\n"
284 " name=\"lightPassMaterials\"\n"
285 " category=\"pointer\"\n"
286 " type=\"ChunkMaterial\"\n"
287 " cardinality=\"multi\"\n"
288 " visibility=\"external\"\n"
289 " access=\"public\"\n"
290 " > \n"
291 " Material used to render the scene from the lights point of view.\n"
292 " </Field>\n"
293 " <Field\n"
294 " name=\"background\"\n"
295 " category=\"pointer\"\n"
296 " type=\"Background\"\n"
297 " cardinality=\"single\"\n"
298 " visibility=\"external\"\n"
299 " defaultValue=\"NULL\"\n"
300 " access=\"public\"\n"
301 " >\n"
302 " </Field>\n"
303 "</FieldContainer>\n",
304 "Data use for rendering by the DSShadowMapEngine\n"
307 /*------------------------------ get -----------------------------------*/
309 FieldContainerType &ShaderShadowMapEngineDataBase::getType(void)
311 return _type;
314 const FieldContainerType &ShaderShadowMapEngineDataBase::getType(void) const
316 return _type;
319 UInt32 ShaderShadowMapEngineDataBase::getContainerSize(void) const
321 return sizeof(ShaderShadowMapEngineData);
324 /*------------------------- decorator get ------------------------------*/
327 //! Get the ShaderShadowMapEngineData::_mfRenderTargets field.
328 const MFUnrecFrameBufferObjectPtr *ShaderShadowMapEngineDataBase::getMFRenderTargets(void) const
330 return &_mfRenderTargets;
333 MFUnrecFrameBufferObjectPtr *ShaderShadowMapEngineDataBase::editMFRenderTargets (void)
335 editMField(RenderTargetsFieldMask, _mfRenderTargets);
337 return &_mfRenderTargets;
339 FrameBufferObject * ShaderShadowMapEngineDataBase::getRenderTargets(const UInt32 index) const
341 return _mfRenderTargets[index];
344 //! Get the ShaderShadowMapEngineData::_mfShadowTexBuffers field.
345 const MFUnrecTextureBufferPtr *ShaderShadowMapEngineDataBase::getMFShadowTexBuffers(void) const
347 return &_mfShadowTexBuffers;
350 MFUnrecTextureBufferPtr *ShaderShadowMapEngineDataBase::editMFShadowTexBuffers(void)
352 editMField(ShadowTexBuffersFieldMask, _mfShadowTexBuffers);
354 return &_mfShadowTexBuffers;
356 TextureBuffer * ShaderShadowMapEngineDataBase::getShadowTexBuffers(const UInt32 index) const
358 return _mfShadowTexBuffers[index];
361 //! Get the ShaderShadowMapEngineData::_sfShadowTexChunk field.
362 const SFUnrecTextureObjChunkPtr *ShaderShadowMapEngineDataBase::getSFShadowTexChunk(void) const
364 return &_sfShadowTexChunk;
367 SFUnrecTextureObjChunkPtr *ShaderShadowMapEngineDataBase::editSFShadowTexChunk (void)
369 editSField(ShadowTexChunkFieldMask);
371 return &_sfShadowTexChunk;
374 //! Get the value of the ShaderShadowMapEngineData::_sfShadowTexChunk field.
375 TextureObjChunk * ShaderShadowMapEngineDataBase::getShadowTexChunk(void) const
377 return _sfShadowTexChunk.getValue();
380 //! Set the value of the ShaderShadowMapEngineData::_sfShadowTexChunk field.
381 void ShaderShadowMapEngineDataBase::setShadowTexChunk(TextureObjChunk * const value)
383 editSField(ShadowTexChunkFieldMask);
385 _sfShadowTexChunk.setValue(value);
389 //! Get the ShaderShadowMapEngineData::_sfShadowTexImage field.
390 const SFUnrecImagePtr *ShaderShadowMapEngineDataBase::getSFShadowTexImage(void) const
392 return &_sfShadowTexImage;
395 SFUnrecImagePtr *ShaderShadowMapEngineDataBase::editSFShadowTexImage (void)
397 editSField(ShadowTexImageFieldMask);
399 return &_sfShadowTexImage;
402 //! Get the value of the ShaderShadowMapEngineData::_sfShadowTexImage field.
403 Image * ShaderShadowMapEngineDataBase::getShadowTexImage(void) const
405 return _sfShadowTexImage.getValue();
408 //! Set the value of the ShaderShadowMapEngineData::_sfShadowTexImage field.
409 void ShaderShadowMapEngineDataBase::setShadowTexImage(Image * const value)
411 editSField(ShadowTexImageFieldMask);
413 _sfShadowTexImage.setValue(value);
417 //! Get the ShaderShadowMapEngineData::_mfLightPassMaterials field.
418 const MFUnrecChunkMaterialPtr *ShaderShadowMapEngineDataBase::getMFLightPassMaterials(void) const
420 return &_mfLightPassMaterials;
423 MFUnrecChunkMaterialPtr *ShaderShadowMapEngineDataBase::editMFLightPassMaterials(void)
425 editMField(LightPassMaterialsFieldMask, _mfLightPassMaterials);
427 return &_mfLightPassMaterials;
429 ChunkMaterial * ShaderShadowMapEngineDataBase::getLightPassMaterials(const UInt32 index) const
431 return _mfLightPassMaterials[index];
434 //! Get the ShaderShadowMapEngineData::_sfBackground field.
435 const SFUnrecBackgroundPtr *ShaderShadowMapEngineDataBase::getSFBackground(void) const
437 return &_sfBackground;
440 SFUnrecBackgroundPtr *ShaderShadowMapEngineDataBase::editSFBackground (void)
442 editSField(BackgroundFieldMask);
444 return &_sfBackground;
447 //! Get the value of the ShaderShadowMapEngineData::_sfBackground field.
448 Background * ShaderShadowMapEngineDataBase::getBackground(void) const
450 return _sfBackground.getValue();
453 //! Set the value of the ShaderShadowMapEngineData::_sfBackground field.
454 void ShaderShadowMapEngineDataBase::setBackground(Background * const value)
456 editSField(BackgroundFieldMask);
458 _sfBackground.setValue(value);
464 void ShaderShadowMapEngineDataBase::pushToRenderTargets(FrameBufferObject * const value)
466 editMField(RenderTargetsFieldMask, _mfRenderTargets);
468 _mfRenderTargets.push_back(value);
471 void ShaderShadowMapEngineDataBase::assignRenderTargets(const MFUnrecFrameBufferObjectPtr &value)
473 MFUnrecFrameBufferObjectPtr::const_iterator elemIt =
474 value.begin();
475 MFUnrecFrameBufferObjectPtr::const_iterator elemEnd =
476 value.end ();
478 static_cast<ShaderShadowMapEngineData *>(this)->clearRenderTargets();
480 while(elemIt != elemEnd)
482 this->pushToRenderTargets(*elemIt);
484 ++elemIt;
488 void ShaderShadowMapEngineDataBase::removeFromRenderTargets(UInt32 uiIndex)
490 if(uiIndex < _mfRenderTargets.size())
492 editMField(RenderTargetsFieldMask, _mfRenderTargets);
494 _mfRenderTargets.erase(uiIndex);
498 void ShaderShadowMapEngineDataBase::removeObjFromRenderTargets(FrameBufferObject * const value)
500 Int32 iElemIdx = _mfRenderTargets.findIndex(value);
502 if(iElemIdx != -1)
504 editMField(RenderTargetsFieldMask, _mfRenderTargets);
506 _mfRenderTargets.erase(iElemIdx);
509 void ShaderShadowMapEngineDataBase::clearRenderTargets(void)
511 editMField(RenderTargetsFieldMask, _mfRenderTargets);
514 _mfRenderTargets.clear();
517 void ShaderShadowMapEngineDataBase::pushToShadowTexBuffers(TextureBuffer * const value)
519 editMField(ShadowTexBuffersFieldMask, _mfShadowTexBuffers);
521 _mfShadowTexBuffers.push_back(value);
524 void ShaderShadowMapEngineDataBase::assignShadowTexBuffers(const MFUnrecTextureBufferPtr &value)
526 MFUnrecTextureBufferPtr::const_iterator elemIt =
527 value.begin();
528 MFUnrecTextureBufferPtr::const_iterator elemEnd =
529 value.end ();
531 static_cast<ShaderShadowMapEngineData *>(this)->clearShadowTexBuffers();
533 while(elemIt != elemEnd)
535 this->pushToShadowTexBuffers(*elemIt);
537 ++elemIt;
541 void ShaderShadowMapEngineDataBase::removeFromShadowTexBuffers(UInt32 uiIndex)
543 if(uiIndex < _mfShadowTexBuffers.size())
545 editMField(ShadowTexBuffersFieldMask, _mfShadowTexBuffers);
547 _mfShadowTexBuffers.erase(uiIndex);
551 void ShaderShadowMapEngineDataBase::removeObjFromShadowTexBuffers(TextureBuffer * const value)
553 Int32 iElemIdx = _mfShadowTexBuffers.findIndex(value);
555 if(iElemIdx != -1)
557 editMField(ShadowTexBuffersFieldMask, _mfShadowTexBuffers);
559 _mfShadowTexBuffers.erase(iElemIdx);
562 void ShaderShadowMapEngineDataBase::clearShadowTexBuffers(void)
564 editMField(ShadowTexBuffersFieldMask, _mfShadowTexBuffers);
567 _mfShadowTexBuffers.clear();
570 void ShaderShadowMapEngineDataBase::pushToLightPassMaterials(ChunkMaterial * const value)
572 editMField(LightPassMaterialsFieldMask, _mfLightPassMaterials);
574 _mfLightPassMaterials.push_back(value);
577 void ShaderShadowMapEngineDataBase::assignLightPassMaterials(const MFUnrecChunkMaterialPtr &value)
579 MFUnrecChunkMaterialPtr::const_iterator elemIt =
580 value.begin();
581 MFUnrecChunkMaterialPtr::const_iterator elemEnd =
582 value.end ();
584 static_cast<ShaderShadowMapEngineData *>(this)->clearLightPassMaterials();
586 while(elemIt != elemEnd)
588 this->pushToLightPassMaterials(*elemIt);
590 ++elemIt;
594 void ShaderShadowMapEngineDataBase::removeFromLightPassMaterials(UInt32 uiIndex)
596 if(uiIndex < _mfLightPassMaterials.size())
598 editMField(LightPassMaterialsFieldMask, _mfLightPassMaterials);
600 _mfLightPassMaterials.erase(uiIndex);
604 void ShaderShadowMapEngineDataBase::removeObjFromLightPassMaterials(ChunkMaterial * const value)
606 Int32 iElemIdx = _mfLightPassMaterials.findIndex(value);
608 if(iElemIdx != -1)
610 editMField(LightPassMaterialsFieldMask, _mfLightPassMaterials);
612 _mfLightPassMaterials.erase(iElemIdx);
615 void ShaderShadowMapEngineDataBase::clearLightPassMaterials(void)
617 editMField(LightPassMaterialsFieldMask, _mfLightPassMaterials);
620 _mfLightPassMaterials.clear();
625 /*------------------------------ access -----------------------------------*/
627 SizeT ShaderShadowMapEngineDataBase::getBinSize(ConstFieldMaskArg whichField)
629 SizeT returnValue = Inherited::getBinSize(whichField);
631 if(FieldBits::NoField != (RenderTargetsFieldMask & whichField))
633 returnValue += _mfRenderTargets.getBinSize();
635 if(FieldBits::NoField != (ShadowTexBuffersFieldMask & whichField))
637 returnValue += _mfShadowTexBuffers.getBinSize();
639 if(FieldBits::NoField != (ShadowTexChunkFieldMask & whichField))
641 returnValue += _sfShadowTexChunk.getBinSize();
643 if(FieldBits::NoField != (ShadowTexImageFieldMask & whichField))
645 returnValue += _sfShadowTexImage.getBinSize();
647 if(FieldBits::NoField != (LightPassMaterialsFieldMask & whichField))
649 returnValue += _mfLightPassMaterials.getBinSize();
651 if(FieldBits::NoField != (BackgroundFieldMask & whichField))
653 returnValue += _sfBackground.getBinSize();
656 return returnValue;
659 void ShaderShadowMapEngineDataBase::copyToBin(BinaryDataHandler &pMem,
660 ConstFieldMaskArg whichField)
662 Inherited::copyToBin(pMem, whichField);
664 if(FieldBits::NoField != (RenderTargetsFieldMask & whichField))
666 _mfRenderTargets.copyToBin(pMem);
668 if(FieldBits::NoField != (ShadowTexBuffersFieldMask & whichField))
670 _mfShadowTexBuffers.copyToBin(pMem);
672 if(FieldBits::NoField != (ShadowTexChunkFieldMask & whichField))
674 _sfShadowTexChunk.copyToBin(pMem);
676 if(FieldBits::NoField != (ShadowTexImageFieldMask & whichField))
678 _sfShadowTexImage.copyToBin(pMem);
680 if(FieldBits::NoField != (LightPassMaterialsFieldMask & whichField))
682 _mfLightPassMaterials.copyToBin(pMem);
684 if(FieldBits::NoField != (BackgroundFieldMask & whichField))
686 _sfBackground.copyToBin(pMem);
690 void ShaderShadowMapEngineDataBase::copyFromBin(BinaryDataHandler &pMem,
691 ConstFieldMaskArg whichField)
693 Inherited::copyFromBin(pMem, whichField);
695 if(FieldBits::NoField != (RenderTargetsFieldMask & whichField))
697 editMField(RenderTargetsFieldMask, _mfRenderTargets);
698 _mfRenderTargets.copyFromBin(pMem);
700 if(FieldBits::NoField != (ShadowTexBuffersFieldMask & whichField))
702 editMField(ShadowTexBuffersFieldMask, _mfShadowTexBuffers);
703 _mfShadowTexBuffers.copyFromBin(pMem);
705 if(FieldBits::NoField != (ShadowTexChunkFieldMask & whichField))
707 editSField(ShadowTexChunkFieldMask);
708 _sfShadowTexChunk.copyFromBin(pMem);
710 if(FieldBits::NoField != (ShadowTexImageFieldMask & whichField))
712 editSField(ShadowTexImageFieldMask);
713 _sfShadowTexImage.copyFromBin(pMem);
715 if(FieldBits::NoField != (LightPassMaterialsFieldMask & whichField))
717 editMField(LightPassMaterialsFieldMask, _mfLightPassMaterials);
718 _mfLightPassMaterials.copyFromBin(pMem);
720 if(FieldBits::NoField != (BackgroundFieldMask & whichField))
722 editSField(BackgroundFieldMask);
723 _sfBackground.copyFromBin(pMem);
727 //! create a new instance of the class
728 ShaderShadowMapEngineDataTransitPtr ShaderShadowMapEngineDataBase::createLocal(BitVector bFlags)
730 ShaderShadowMapEngineDataTransitPtr fc;
732 if(getClassType().getPrototype() != NULL)
734 FieldContainerTransitPtr tmpPtr =
735 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
737 fc = dynamic_pointer_cast<ShaderShadowMapEngineData>(tmpPtr);
740 return fc;
743 //! create a new instance of the class, copy the container flags
744 ShaderShadowMapEngineDataTransitPtr ShaderShadowMapEngineDataBase::createDependent(BitVector bFlags)
746 ShaderShadowMapEngineDataTransitPtr fc;
748 if(getClassType().getPrototype() != NULL)
750 FieldContainerTransitPtr tmpPtr =
751 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
753 fc = dynamic_pointer_cast<ShaderShadowMapEngineData>(tmpPtr);
756 return fc;
759 //! create a new instance of the class
760 ShaderShadowMapEngineDataTransitPtr ShaderShadowMapEngineDataBase::create(void)
762 return createLocal();
765 ShaderShadowMapEngineData *ShaderShadowMapEngineDataBase::createEmptyLocal(BitVector bFlags)
767 ShaderShadowMapEngineData *returnValue;
769 newPtr<ShaderShadowMapEngineData>(returnValue, bFlags);
771 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
773 return returnValue;
776 //! create an empty new instance of the class, do not copy the prototype
777 ShaderShadowMapEngineData *ShaderShadowMapEngineDataBase::createEmpty(void)
779 return createEmptyLocal();
783 FieldContainerTransitPtr ShaderShadowMapEngineDataBase::shallowCopyLocal(
784 BitVector bFlags) const
786 ShaderShadowMapEngineData *tmpPtr;
788 newPtr(tmpPtr, dynamic_cast<const ShaderShadowMapEngineData *>(this), bFlags);
790 FieldContainerTransitPtr returnValue(tmpPtr);
792 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
794 return returnValue;
797 FieldContainerTransitPtr ShaderShadowMapEngineDataBase::shallowCopyDependent(
798 BitVector bFlags) const
800 ShaderShadowMapEngineData *tmpPtr;
802 newPtr(tmpPtr, dynamic_cast<const ShaderShadowMapEngineData *>(this), ~bFlags);
804 FieldContainerTransitPtr returnValue(tmpPtr);
806 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
808 return returnValue;
811 FieldContainerTransitPtr ShaderShadowMapEngineDataBase::shallowCopy(void) const
813 return shallowCopyLocal();
819 /*------------------------- constructors ----------------------------------*/
821 ShaderShadowMapEngineDataBase::ShaderShadowMapEngineDataBase(void) :
822 Inherited(),
823 _mfRenderTargets (),
824 _mfShadowTexBuffers (),
825 _sfShadowTexChunk (NULL),
826 _sfShadowTexImage (NULL),
827 _mfLightPassMaterials (),
828 _sfBackground (NULL)
832 ShaderShadowMapEngineDataBase::ShaderShadowMapEngineDataBase(const ShaderShadowMapEngineDataBase &source) :
833 Inherited(source),
834 _mfRenderTargets (),
835 _mfShadowTexBuffers (),
836 _sfShadowTexChunk (NULL),
837 _sfShadowTexImage (NULL),
838 _mfLightPassMaterials (),
839 _sfBackground (NULL)
844 /*-------------------------- destructors ----------------------------------*/
846 ShaderShadowMapEngineDataBase::~ShaderShadowMapEngineDataBase(void)
850 void ShaderShadowMapEngineDataBase::onCreate(const ShaderShadowMapEngineData *source)
852 Inherited::onCreate(source);
854 if(source != NULL)
856 ShaderShadowMapEngineData *pThis = static_cast<ShaderShadowMapEngineData *>(this);
858 MFUnrecFrameBufferObjectPtr::const_iterator RenderTargetsIt =
859 source->_mfRenderTargets.begin();
860 MFUnrecFrameBufferObjectPtr::const_iterator RenderTargetsEnd =
861 source->_mfRenderTargets.end ();
863 while(RenderTargetsIt != RenderTargetsEnd)
865 pThis->pushToRenderTargets(*RenderTargetsIt);
867 ++RenderTargetsIt;
870 MFUnrecTextureBufferPtr::const_iterator ShadowTexBuffersIt =
871 source->_mfShadowTexBuffers.begin();
872 MFUnrecTextureBufferPtr::const_iterator ShadowTexBuffersEnd =
873 source->_mfShadowTexBuffers.end ();
875 while(ShadowTexBuffersIt != ShadowTexBuffersEnd)
877 pThis->pushToShadowTexBuffers(*ShadowTexBuffersIt);
879 ++ShadowTexBuffersIt;
882 pThis->setShadowTexChunk(source->getShadowTexChunk());
884 pThis->setShadowTexImage(source->getShadowTexImage());
886 MFUnrecChunkMaterialPtr::const_iterator LightPassMaterialsIt =
887 source->_mfLightPassMaterials.begin();
888 MFUnrecChunkMaterialPtr::const_iterator LightPassMaterialsEnd =
889 source->_mfLightPassMaterials.end ();
891 while(LightPassMaterialsIt != LightPassMaterialsEnd)
893 pThis->pushToLightPassMaterials(*LightPassMaterialsIt);
895 ++LightPassMaterialsIt;
898 pThis->setBackground(source->getBackground());
902 GetFieldHandlePtr ShaderShadowMapEngineDataBase::getHandleRenderTargets (void) const
904 MFUnrecFrameBufferObjectPtr::GetHandlePtr returnValue(
905 new MFUnrecFrameBufferObjectPtr::GetHandle(
906 &_mfRenderTargets,
907 this->getType().getFieldDesc(RenderTargetsFieldId),
908 const_cast<ShaderShadowMapEngineDataBase *>(this)));
910 return returnValue;
913 EditFieldHandlePtr ShaderShadowMapEngineDataBase::editHandleRenderTargets (void)
915 MFUnrecFrameBufferObjectPtr::EditHandlePtr returnValue(
916 new MFUnrecFrameBufferObjectPtr::EditHandle(
917 &_mfRenderTargets,
918 this->getType().getFieldDesc(RenderTargetsFieldId),
919 this));
921 returnValue->setAddMethod(
922 boost::bind(&ShaderShadowMapEngineData::pushToRenderTargets,
923 static_cast<ShaderShadowMapEngineData *>(this), _1));
924 returnValue->setRemoveMethod(
925 boost::bind(&ShaderShadowMapEngineData::removeFromRenderTargets,
926 static_cast<ShaderShadowMapEngineData *>(this), _1));
927 returnValue->setRemoveObjMethod(
928 boost::bind(&ShaderShadowMapEngineData::removeObjFromRenderTargets,
929 static_cast<ShaderShadowMapEngineData *>(this), _1));
930 returnValue->setClearMethod(
931 boost::bind(&ShaderShadowMapEngineData::clearRenderTargets,
932 static_cast<ShaderShadowMapEngineData *>(this)));
934 editMField(RenderTargetsFieldMask, _mfRenderTargets);
936 return returnValue;
939 GetFieldHandlePtr ShaderShadowMapEngineDataBase::getHandleShadowTexBuffers (void) const
941 MFUnrecTextureBufferPtr::GetHandlePtr returnValue(
942 new MFUnrecTextureBufferPtr::GetHandle(
943 &_mfShadowTexBuffers,
944 this->getType().getFieldDesc(ShadowTexBuffersFieldId),
945 const_cast<ShaderShadowMapEngineDataBase *>(this)));
947 return returnValue;
950 EditFieldHandlePtr ShaderShadowMapEngineDataBase::editHandleShadowTexBuffers(void)
952 MFUnrecTextureBufferPtr::EditHandlePtr returnValue(
953 new MFUnrecTextureBufferPtr::EditHandle(
954 &_mfShadowTexBuffers,
955 this->getType().getFieldDesc(ShadowTexBuffersFieldId),
956 this));
958 returnValue->setAddMethod(
959 boost::bind(&ShaderShadowMapEngineData::pushToShadowTexBuffers,
960 static_cast<ShaderShadowMapEngineData *>(this), _1));
961 returnValue->setRemoveMethod(
962 boost::bind(&ShaderShadowMapEngineData::removeFromShadowTexBuffers,
963 static_cast<ShaderShadowMapEngineData *>(this), _1));
964 returnValue->setRemoveObjMethod(
965 boost::bind(&ShaderShadowMapEngineData::removeObjFromShadowTexBuffers,
966 static_cast<ShaderShadowMapEngineData *>(this), _1));
967 returnValue->setClearMethod(
968 boost::bind(&ShaderShadowMapEngineData::clearShadowTexBuffers,
969 static_cast<ShaderShadowMapEngineData *>(this)));
971 editMField(ShadowTexBuffersFieldMask, _mfShadowTexBuffers);
973 return returnValue;
976 GetFieldHandlePtr ShaderShadowMapEngineDataBase::getHandleShadowTexChunk (void) const
978 SFUnrecTextureObjChunkPtr::GetHandlePtr returnValue(
979 new SFUnrecTextureObjChunkPtr::GetHandle(
980 &_sfShadowTexChunk,
981 this->getType().getFieldDesc(ShadowTexChunkFieldId),
982 const_cast<ShaderShadowMapEngineDataBase *>(this)));
984 return returnValue;
987 EditFieldHandlePtr ShaderShadowMapEngineDataBase::editHandleShadowTexChunk (void)
989 SFUnrecTextureObjChunkPtr::EditHandlePtr returnValue(
990 new SFUnrecTextureObjChunkPtr::EditHandle(
991 &_sfShadowTexChunk,
992 this->getType().getFieldDesc(ShadowTexChunkFieldId),
993 this));
995 returnValue->setSetMethod(
996 boost::bind(&ShaderShadowMapEngineData::setShadowTexChunk,
997 static_cast<ShaderShadowMapEngineData *>(this), _1));
999 editSField(ShadowTexChunkFieldMask);
1001 return returnValue;
1004 GetFieldHandlePtr ShaderShadowMapEngineDataBase::getHandleShadowTexImage (void) const
1006 SFUnrecImagePtr::GetHandlePtr returnValue(
1007 new SFUnrecImagePtr::GetHandle(
1008 &_sfShadowTexImage,
1009 this->getType().getFieldDesc(ShadowTexImageFieldId),
1010 const_cast<ShaderShadowMapEngineDataBase *>(this)));
1012 return returnValue;
1015 EditFieldHandlePtr ShaderShadowMapEngineDataBase::editHandleShadowTexImage (void)
1017 SFUnrecImagePtr::EditHandlePtr returnValue(
1018 new SFUnrecImagePtr::EditHandle(
1019 &_sfShadowTexImage,
1020 this->getType().getFieldDesc(ShadowTexImageFieldId),
1021 this));
1023 returnValue->setSetMethod(
1024 boost::bind(&ShaderShadowMapEngineData::setShadowTexImage,
1025 static_cast<ShaderShadowMapEngineData *>(this), _1));
1027 editSField(ShadowTexImageFieldMask);
1029 return returnValue;
1032 GetFieldHandlePtr ShaderShadowMapEngineDataBase::getHandleLightPassMaterials (void) const
1034 MFUnrecChunkMaterialPtr::GetHandlePtr returnValue(
1035 new MFUnrecChunkMaterialPtr::GetHandle(
1036 &_mfLightPassMaterials,
1037 this->getType().getFieldDesc(LightPassMaterialsFieldId),
1038 const_cast<ShaderShadowMapEngineDataBase *>(this)));
1040 return returnValue;
1043 EditFieldHandlePtr ShaderShadowMapEngineDataBase::editHandleLightPassMaterials(void)
1045 MFUnrecChunkMaterialPtr::EditHandlePtr returnValue(
1046 new MFUnrecChunkMaterialPtr::EditHandle(
1047 &_mfLightPassMaterials,
1048 this->getType().getFieldDesc(LightPassMaterialsFieldId),
1049 this));
1051 returnValue->setAddMethod(
1052 boost::bind(&ShaderShadowMapEngineData::pushToLightPassMaterials,
1053 static_cast<ShaderShadowMapEngineData *>(this), _1));
1054 returnValue->setRemoveMethod(
1055 boost::bind(&ShaderShadowMapEngineData::removeFromLightPassMaterials,
1056 static_cast<ShaderShadowMapEngineData *>(this), _1));
1057 returnValue->setRemoveObjMethod(
1058 boost::bind(&ShaderShadowMapEngineData::removeObjFromLightPassMaterials,
1059 static_cast<ShaderShadowMapEngineData *>(this), _1));
1060 returnValue->setClearMethod(
1061 boost::bind(&ShaderShadowMapEngineData::clearLightPassMaterials,
1062 static_cast<ShaderShadowMapEngineData *>(this)));
1064 editMField(LightPassMaterialsFieldMask, _mfLightPassMaterials);
1066 return returnValue;
1069 GetFieldHandlePtr ShaderShadowMapEngineDataBase::getHandleBackground (void) const
1071 SFUnrecBackgroundPtr::GetHandlePtr returnValue(
1072 new SFUnrecBackgroundPtr::GetHandle(
1073 &_sfBackground,
1074 this->getType().getFieldDesc(BackgroundFieldId),
1075 const_cast<ShaderShadowMapEngineDataBase *>(this)));
1077 return returnValue;
1080 EditFieldHandlePtr ShaderShadowMapEngineDataBase::editHandleBackground (void)
1082 SFUnrecBackgroundPtr::EditHandlePtr returnValue(
1083 new SFUnrecBackgroundPtr::EditHandle(
1084 &_sfBackground,
1085 this->getType().getFieldDesc(BackgroundFieldId),
1086 this));
1088 returnValue->setSetMethod(
1089 boost::bind(&ShaderShadowMapEngineData::setBackground,
1090 static_cast<ShaderShadowMapEngineData *>(this), _1));
1092 editSField(BackgroundFieldMask);
1094 return returnValue;
1098 #ifdef OSG_MT_CPTR_ASPECT
1099 void ShaderShadowMapEngineDataBase::execSyncV( FieldContainer &oFrom,
1100 ConstFieldMaskArg whichField,
1101 AspectOffsetStore &oOffsets,
1102 ConstFieldMaskArg syncMode,
1103 const UInt32 uiSyncInfo)
1105 ShaderShadowMapEngineData *pThis = static_cast<ShaderShadowMapEngineData *>(this);
1107 pThis->execSync(static_cast<ShaderShadowMapEngineData *>(&oFrom),
1108 whichField,
1109 oOffsets,
1110 syncMode,
1111 uiSyncInfo);
1113 #endif
1116 #ifdef OSG_MT_CPTR_ASPECT
1117 FieldContainer *ShaderShadowMapEngineDataBase::createAspectCopy(
1118 const FieldContainer *pRefAspect) const
1120 ShaderShadowMapEngineData *returnValue;
1122 newAspectCopy(returnValue,
1123 dynamic_cast<const ShaderShadowMapEngineData *>(pRefAspect),
1124 dynamic_cast<const ShaderShadowMapEngineData *>(this));
1126 return returnValue;
1128 #endif
1130 void ShaderShadowMapEngineDataBase::resolveLinks(void)
1132 Inherited::resolveLinks();
1134 static_cast<ShaderShadowMapEngineData *>(this)->clearRenderTargets();
1136 static_cast<ShaderShadowMapEngineData *>(this)->clearShadowTexBuffers();
1138 static_cast<ShaderShadowMapEngineData *>(this)->setShadowTexChunk(NULL);
1140 static_cast<ShaderShadowMapEngineData *>(this)->setShadowTexImage(NULL);
1142 static_cast<ShaderShadowMapEngineData *>(this)->clearLightPassMaterials();
1144 static_cast<ShaderShadowMapEngineData *>(this)->setBackground(NULL);
1150 OSG_END_NAMESPACE