fixed: compile issue
[opensg.git] / Source / System / Window / Background / OSGPolygonBackgroundBase.cpp
blob37e1039f525e83d8f51393254ec5efe6c09b83d0
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 PolygonBackground!
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 "OSGPrimeMaterial.h" // Material Class
67 #include "OSGPolygonBackgroundBase.h"
68 #include "OSGPolygonBackground.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::PolygonBackground
79 A Background that renders a single polygon using the specified material.
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var PrimeMaterial * PolygonBackgroundBase::_sfMaterial
87 The material used to display.
90 /*! \var Vec3f PolygonBackgroundBase::_mfTexCoords
91 The texture coordinates of the geometry to display.
94 /*! \var Pnt2f PolygonBackgroundBase::_mfPositions
95 The positions of the geometry to display.
98 /*! \var bool PolygonBackgroundBase::_sfNormalizedX
99 Define whether the x coordinates are normalized (0-1) or pixel-based.
102 /*! \var bool PolygonBackgroundBase::_sfNormalizedY
103 Define whether the y coordinates are normalized (0-1) or pixel-based.
106 /*! \var UInt16 PolygonBackgroundBase::_sfAspectHeight
107 Useful for keeping aspect ratio when rendering things like images.
110 /*! \var UInt16 PolygonBackgroundBase::_sfAspectWidth
111 Useful for keeping aspect ratio when rendering things like images.
114 /*! \var Real32 PolygonBackgroundBase::_sfScale
115 Scale factor for zooming.
118 /*! \var bool PolygonBackgroundBase::_sfCleanup
119 Clear depth/ stencil buffer after applying the material.
123 /***************************************************************************\
124 * FieldType/FieldTrait Instantiation *
125 \***************************************************************************/
127 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
128 PointerType FieldTraits<PolygonBackground *, nsOSG>::_type(
129 "PolygonBackgroundPtr",
130 "TileableBackgroundPtr",
131 PolygonBackground::getClassType(),
132 nsOSG);
133 #endif
135 OSG_FIELDTRAITS_GETTYPE_NS(PolygonBackground *, nsOSG)
137 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
138 PolygonBackground *,
139 nsOSG)
141 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
142 PolygonBackground *,
143 nsOSG)
145 /***************************************************************************\
146 * Field Description *
147 \***************************************************************************/
149 void PolygonBackgroundBase::classDescInserter(TypeObject &oType)
151 FieldDescriptionBase *pDesc = NULL;
154 pDesc = new SFUnrecPrimeMaterialPtr::Description(
155 SFUnrecPrimeMaterialPtr::getClassType(),
156 "material",
157 "The material used to display.\n",
158 MaterialFieldId, MaterialFieldMask,
159 false,
160 (Field::SFDefaultFlags | Field::FStdAccess),
161 static_cast<FieldEditMethodSig>(&PolygonBackground::editHandleMaterial),
162 static_cast<FieldGetMethodSig >(&PolygonBackground::getHandleMaterial));
164 oType.addInitialDesc(pDesc);
166 pDesc = new MFVec3f::Description(
167 MFVec3f::getClassType(),
168 "texCoords",
169 "The texture coordinates of the geometry to display.\n",
170 TexCoordsFieldId, TexCoordsFieldMask,
171 false,
172 (Field::MFDefaultFlags | Field::FStdAccess),
173 static_cast<FieldEditMethodSig>(&PolygonBackground::editHandleTexCoords),
174 static_cast<FieldGetMethodSig >(&PolygonBackground::getHandleTexCoords));
176 oType.addInitialDesc(pDesc);
178 pDesc = new MFPnt2f::Description(
179 MFPnt2f::getClassType(),
180 "positions",
181 "The positions of the geometry to display.\n",
182 PositionsFieldId, PositionsFieldMask,
183 false,
184 (Field::MFDefaultFlags | Field::FStdAccess),
185 static_cast<FieldEditMethodSig>(&PolygonBackground::editHandlePositions),
186 static_cast<FieldGetMethodSig >(&PolygonBackground::getHandlePositions));
188 oType.addInitialDesc(pDesc);
190 pDesc = new SFBool::Description(
191 SFBool::getClassType(),
192 "normalizedX",
193 "Define whether the x coordinates are normalized (0-1) or pixel-based.\n",
194 NormalizedXFieldId, NormalizedXFieldMask,
195 false,
196 (Field::SFDefaultFlags | Field::FStdAccess),
197 static_cast<FieldEditMethodSig>(&PolygonBackground::editHandleNormalizedX),
198 static_cast<FieldGetMethodSig >(&PolygonBackground::getHandleNormalizedX));
200 oType.addInitialDesc(pDesc);
202 pDesc = new SFBool::Description(
203 SFBool::getClassType(),
204 "normalizedY",
205 "Define whether the y coordinates are normalized (0-1) or pixel-based.\n",
206 NormalizedYFieldId, NormalizedYFieldMask,
207 false,
208 (Field::SFDefaultFlags | Field::FStdAccess),
209 static_cast<FieldEditMethodSig>(&PolygonBackground::editHandleNormalizedY),
210 static_cast<FieldGetMethodSig >(&PolygonBackground::getHandleNormalizedY));
212 oType.addInitialDesc(pDesc);
214 pDesc = new SFUInt16::Description(
215 SFUInt16::getClassType(),
216 "aspectHeight",
217 "Useful for keeping aspect ratio when rendering things like images.\n",
218 AspectHeightFieldId, AspectHeightFieldMask,
219 false,
220 (Field::SFDefaultFlags | Field::FStdAccess),
221 static_cast<FieldEditMethodSig>(&PolygonBackground::editHandleAspectHeight),
222 static_cast<FieldGetMethodSig >(&PolygonBackground::getHandleAspectHeight));
224 oType.addInitialDesc(pDesc);
226 pDesc = new SFUInt16::Description(
227 SFUInt16::getClassType(),
228 "aspectWidth",
229 "Useful for keeping aspect ratio when rendering things like images.\n",
230 AspectWidthFieldId, AspectWidthFieldMask,
231 false,
232 (Field::SFDefaultFlags | Field::FStdAccess),
233 static_cast<FieldEditMethodSig>(&PolygonBackground::editHandleAspectWidth),
234 static_cast<FieldGetMethodSig >(&PolygonBackground::getHandleAspectWidth));
236 oType.addInitialDesc(pDesc);
238 pDesc = new SFReal32::Description(
239 SFReal32::getClassType(),
240 "scale",
241 "Scale factor for zooming.\n",
242 ScaleFieldId, ScaleFieldMask,
243 false,
244 (Field::SFDefaultFlags | Field::FStdAccess),
245 static_cast<FieldEditMethodSig>(&PolygonBackground::editHandleScale),
246 static_cast<FieldGetMethodSig >(&PolygonBackground::getHandleScale));
248 oType.addInitialDesc(pDesc);
250 pDesc = new SFBool::Description(
251 SFBool::getClassType(),
252 "cleanup",
253 "Clear depth/ stencil buffer after applying the material.\n",
254 CleanupFieldId, CleanupFieldMask,
255 false,
256 (Field::SFDefaultFlags | Field::FStdAccess),
257 static_cast<FieldEditMethodSig>(&PolygonBackground::editHandleCleanup),
258 static_cast<FieldGetMethodSig >(&PolygonBackground::getHandleCleanup));
260 oType.addInitialDesc(pDesc);
264 PolygonBackgroundBase::TypeObject PolygonBackgroundBase::_type(
265 PolygonBackgroundBase::getClassname(),
266 Inherited::getClassname(),
267 "NULL",
268 nsOSG, //Namespace
269 reinterpret_cast<PrototypeCreateF>(&PolygonBackgroundBase::createEmptyLocal),
270 reinterpret_cast<InitContainerF>(&PolygonBackground::initMethod),
271 reinterpret_cast<ExitContainerF>(&PolygonBackground::exitMethod),
272 reinterpret_cast<InitalInsertDescFunc>(
273 reinterpret_cast<void *>(&PolygonBackground::classDescInserter)),
274 false,
276 "<?xml version=\"1.0\"?>\n"
277 "\n"
278 "<FieldContainer\n"
279 " name=\"PolygonBackground\"\n"
280 " parent=\"TileableBackground\"\n"
281 " library=\"Window\"\n"
282 " pointerfieldtypes=\"both\"\n"
283 " structure=\"concrete\"\n"
284 " systemcomponent=\"true\"\n"
285 " parentsystemcomponent=\"true\"\n"
286 " decoratable=\"false\"\n"
287 " useLocalIncludes=\"false\"\n"
288 " docGroupBase=\"GrpWindowBackground\"\n"
289 " >\n"
290 " A Background that renders a single polygon using the specified material.\n"
291 " <Field\n"
292 "\t name=\"material\"\n"
293 "\t type=\"PrimeMaterialPtr\"\n"
294 "\t cardinality=\"single\"\n"
295 "\t visibility=\"external\"\n"
296 "\t access=\"public\"\n"
297 "\t >\n"
298 "\tThe material used to display.\n"
299 " </Field>\n"
300 " <Field\n"
301 "\t name=\"texCoords\"\n"
302 "\t type=\"Vec3f\"\n"
303 "\t cardinality=\"multi\"\n"
304 "\t visibility=\"external\"\n"
305 "\t access=\"public\"\n"
306 "\t >\n"
307 "\tThe texture coordinates of the geometry to display.\n"
308 " </Field>\n"
309 " <Field\n"
310 "\t name=\"positions\"\n"
311 "\t type=\"Pnt2f\"\n"
312 "\t cardinality=\"multi\"\n"
313 "\t visibility=\"external\"\n"
314 "\t access=\"public\"\n"
315 "\t >\n"
316 "\tThe positions of the geometry to display.\n"
317 " </Field>\n"
318 " <Field\n"
319 "\t name=\"normalizedX\"\n"
320 "\t type=\"bool\"\n"
321 "\t cardinality=\"single\"\n"
322 "\t visibility=\"external\"\n"
323 "\t defaultValue=\"true\"\n"
324 "\t access=\"public\"\n"
325 "\t >\n"
326 "\tDefine whether the x coordinates are normalized (0-1) or pixel-based.\n"
327 " </Field>\n"
328 " <Field\n"
329 "\t name=\"normalizedY\"\n"
330 "\t type=\"bool\"\n"
331 "\t cardinality=\"single\"\n"
332 "\t visibility=\"external\"\n"
333 "\t defaultValue=\"true\"\n"
334 "\t access=\"public\"\n"
335 "\t >\n"
336 "\tDefine whether the y coordinates are normalized (0-1) or pixel-based.\n"
337 " </Field>\n"
338 " <Field\n"
339 "\t name=\"aspectHeight\"\n"
340 "\t type=\"UInt16\"\n"
341 "\t cardinality=\"single\"\n"
342 "\t visibility=\"external\"\n"
343 "\t defaultValue=\"0\"\n"
344 "\t access=\"public\"\n"
345 "\t >\n"
346 "\tUseful for keeping aspect ratio when rendering things like images.\n"
347 " </Field>\n"
348 " <Field\n"
349 "\t name=\"aspectWidth\"\n"
350 "\t type=\"UInt16\"\n"
351 "\t cardinality=\"single\"\n"
352 "\t visibility=\"external\"\n"
353 "\t defaultValue=\"0\"\n"
354 "\t access=\"public\"\n"
355 "\t >\n"
356 "\tUseful for keeping aspect ratio when rendering things like images.\n"
357 " </Field>\n"
358 " <Field\n"
359 "\t name=\"scale\"\n"
360 "\t type=\"Real32\"\n"
361 "\t cardinality=\"single\"\n"
362 "\t visibility=\"external\"\n"
363 "\t defaultValue=\"1.0\"\n"
364 "\t access=\"public\"\n"
365 "\t >\n"
366 "\tScale factor for zooming.\n"
367 " </Field>\n"
368 " <Field\n"
369 "\t name=\"cleanup\"\n"
370 "\t type=\"bool\"\n"
371 "\t cardinality=\"single\"\n"
372 "\t visibility=\"external\"\n"
373 "\t defaultValue=\"true\"\n"
374 "\t access=\"public\"\n"
375 "\t >\n"
376 "\tClear depth/ stencil buffer after applying the material.\n"
377 " </Field>\n"
378 "</FieldContainer>\n",
379 "A Background that renders a single polygon using the specified material.\n"
382 /*------------------------------ get -----------------------------------*/
384 FieldContainerType &PolygonBackgroundBase::getType(void)
386 return _type;
389 const FieldContainerType &PolygonBackgroundBase::getType(void) const
391 return _type;
394 UInt32 PolygonBackgroundBase::getContainerSize(void) const
396 return sizeof(PolygonBackground);
399 /*------------------------- decorator get ------------------------------*/
402 //! Get the PolygonBackground::_sfMaterial field.
403 const SFUnrecPrimeMaterialPtr *PolygonBackgroundBase::getSFMaterial(void) const
405 return &_sfMaterial;
408 SFUnrecPrimeMaterialPtr *PolygonBackgroundBase::editSFMaterial (void)
410 editSField(MaterialFieldMask);
412 return &_sfMaterial;
415 //! Get the value of the PolygonBackground::_sfMaterial field.
416 PrimeMaterial * PolygonBackgroundBase::getMaterial(void) const
418 return _sfMaterial.getValue();
421 //! Set the value of the PolygonBackground::_sfMaterial field.
422 void PolygonBackgroundBase::setMaterial(PrimeMaterial * const value)
424 editSField(MaterialFieldMask);
426 _sfMaterial.setValue(value);
430 MFVec3f *PolygonBackgroundBase::editMFTexCoords(void)
432 editMField(TexCoordsFieldMask, _mfTexCoords);
434 return &_mfTexCoords;
437 const MFVec3f *PolygonBackgroundBase::getMFTexCoords(void) const
439 return &_mfTexCoords;
443 MFPnt2f *PolygonBackgroundBase::editMFPositions(void)
445 editMField(PositionsFieldMask, _mfPositions);
447 return &_mfPositions;
450 const MFPnt2f *PolygonBackgroundBase::getMFPositions(void) const
452 return &_mfPositions;
456 SFBool *PolygonBackgroundBase::editSFNormalizedX(void)
458 editSField(NormalizedXFieldMask);
460 return &_sfNormalizedX;
463 const SFBool *PolygonBackgroundBase::getSFNormalizedX(void) const
465 return &_sfNormalizedX;
469 SFBool *PolygonBackgroundBase::editSFNormalizedY(void)
471 editSField(NormalizedYFieldMask);
473 return &_sfNormalizedY;
476 const SFBool *PolygonBackgroundBase::getSFNormalizedY(void) const
478 return &_sfNormalizedY;
482 SFUInt16 *PolygonBackgroundBase::editSFAspectHeight(void)
484 editSField(AspectHeightFieldMask);
486 return &_sfAspectHeight;
489 const SFUInt16 *PolygonBackgroundBase::getSFAspectHeight(void) const
491 return &_sfAspectHeight;
495 SFUInt16 *PolygonBackgroundBase::editSFAspectWidth(void)
497 editSField(AspectWidthFieldMask);
499 return &_sfAspectWidth;
502 const SFUInt16 *PolygonBackgroundBase::getSFAspectWidth(void) const
504 return &_sfAspectWidth;
508 SFReal32 *PolygonBackgroundBase::editSFScale(void)
510 editSField(ScaleFieldMask);
512 return &_sfScale;
515 const SFReal32 *PolygonBackgroundBase::getSFScale(void) const
517 return &_sfScale;
521 SFBool *PolygonBackgroundBase::editSFCleanup(void)
523 editSField(CleanupFieldMask);
525 return &_sfCleanup;
528 const SFBool *PolygonBackgroundBase::getSFCleanup(void) const
530 return &_sfCleanup;
538 /*------------------------------ access -----------------------------------*/
540 SizeT PolygonBackgroundBase::getBinSize(ConstFieldMaskArg whichField)
542 SizeT returnValue = Inherited::getBinSize(whichField);
544 if(FieldBits::NoField != (MaterialFieldMask & whichField))
546 returnValue += _sfMaterial.getBinSize();
548 if(FieldBits::NoField != (TexCoordsFieldMask & whichField))
550 returnValue += _mfTexCoords.getBinSize();
552 if(FieldBits::NoField != (PositionsFieldMask & whichField))
554 returnValue += _mfPositions.getBinSize();
556 if(FieldBits::NoField != (NormalizedXFieldMask & whichField))
558 returnValue += _sfNormalizedX.getBinSize();
560 if(FieldBits::NoField != (NormalizedYFieldMask & whichField))
562 returnValue += _sfNormalizedY.getBinSize();
564 if(FieldBits::NoField != (AspectHeightFieldMask & whichField))
566 returnValue += _sfAspectHeight.getBinSize();
568 if(FieldBits::NoField != (AspectWidthFieldMask & whichField))
570 returnValue += _sfAspectWidth.getBinSize();
572 if(FieldBits::NoField != (ScaleFieldMask & whichField))
574 returnValue += _sfScale.getBinSize();
576 if(FieldBits::NoField != (CleanupFieldMask & whichField))
578 returnValue += _sfCleanup.getBinSize();
581 return returnValue;
584 void PolygonBackgroundBase::copyToBin(BinaryDataHandler &pMem,
585 ConstFieldMaskArg whichField)
587 Inherited::copyToBin(pMem, whichField);
589 if(FieldBits::NoField != (MaterialFieldMask & whichField))
591 _sfMaterial.copyToBin(pMem);
593 if(FieldBits::NoField != (TexCoordsFieldMask & whichField))
595 _mfTexCoords.copyToBin(pMem);
597 if(FieldBits::NoField != (PositionsFieldMask & whichField))
599 _mfPositions.copyToBin(pMem);
601 if(FieldBits::NoField != (NormalizedXFieldMask & whichField))
603 _sfNormalizedX.copyToBin(pMem);
605 if(FieldBits::NoField != (NormalizedYFieldMask & whichField))
607 _sfNormalizedY.copyToBin(pMem);
609 if(FieldBits::NoField != (AspectHeightFieldMask & whichField))
611 _sfAspectHeight.copyToBin(pMem);
613 if(FieldBits::NoField != (AspectWidthFieldMask & whichField))
615 _sfAspectWidth.copyToBin(pMem);
617 if(FieldBits::NoField != (ScaleFieldMask & whichField))
619 _sfScale.copyToBin(pMem);
621 if(FieldBits::NoField != (CleanupFieldMask & whichField))
623 _sfCleanup.copyToBin(pMem);
627 void PolygonBackgroundBase::copyFromBin(BinaryDataHandler &pMem,
628 ConstFieldMaskArg whichField)
630 Inherited::copyFromBin(pMem, whichField);
632 if(FieldBits::NoField != (MaterialFieldMask & whichField))
634 editSField(MaterialFieldMask);
635 _sfMaterial.copyFromBin(pMem);
637 if(FieldBits::NoField != (TexCoordsFieldMask & whichField))
639 editMField(TexCoordsFieldMask, _mfTexCoords);
640 _mfTexCoords.copyFromBin(pMem);
642 if(FieldBits::NoField != (PositionsFieldMask & whichField))
644 editMField(PositionsFieldMask, _mfPositions);
645 _mfPositions.copyFromBin(pMem);
647 if(FieldBits::NoField != (NormalizedXFieldMask & whichField))
649 editSField(NormalizedXFieldMask);
650 _sfNormalizedX.copyFromBin(pMem);
652 if(FieldBits::NoField != (NormalizedYFieldMask & whichField))
654 editSField(NormalizedYFieldMask);
655 _sfNormalizedY.copyFromBin(pMem);
657 if(FieldBits::NoField != (AspectHeightFieldMask & whichField))
659 editSField(AspectHeightFieldMask);
660 _sfAspectHeight.copyFromBin(pMem);
662 if(FieldBits::NoField != (AspectWidthFieldMask & whichField))
664 editSField(AspectWidthFieldMask);
665 _sfAspectWidth.copyFromBin(pMem);
667 if(FieldBits::NoField != (ScaleFieldMask & whichField))
669 editSField(ScaleFieldMask);
670 _sfScale.copyFromBin(pMem);
672 if(FieldBits::NoField != (CleanupFieldMask & whichField))
674 editSField(CleanupFieldMask);
675 _sfCleanup.copyFromBin(pMem);
679 //! create a new instance of the class
680 PolygonBackgroundTransitPtr PolygonBackgroundBase::createLocal(BitVector bFlags)
682 PolygonBackgroundTransitPtr fc;
684 if(getClassType().getPrototype() != NULL)
686 FieldContainerTransitPtr tmpPtr =
687 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
689 fc = dynamic_pointer_cast<PolygonBackground>(tmpPtr);
692 return fc;
695 //! create a new instance of the class, copy the container flags
696 PolygonBackgroundTransitPtr PolygonBackgroundBase::createDependent(BitVector bFlags)
698 PolygonBackgroundTransitPtr fc;
700 if(getClassType().getPrototype() != NULL)
702 FieldContainerTransitPtr tmpPtr =
703 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
705 fc = dynamic_pointer_cast<PolygonBackground>(tmpPtr);
708 return fc;
711 //! create a new instance of the class
712 PolygonBackgroundTransitPtr PolygonBackgroundBase::create(void)
714 PolygonBackgroundTransitPtr fc;
716 if(getClassType().getPrototype() != NULL)
718 FieldContainerTransitPtr tmpPtr =
719 getClassType().getPrototype()-> shallowCopy();
721 fc = dynamic_pointer_cast<PolygonBackground>(tmpPtr);
724 return fc;
727 PolygonBackground *PolygonBackgroundBase::createEmptyLocal(BitVector bFlags)
729 PolygonBackground *returnValue;
731 newPtr<PolygonBackground>(returnValue, bFlags);
733 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
735 return returnValue;
738 //! create an empty new instance of the class, do not copy the prototype
739 PolygonBackground *PolygonBackgroundBase::createEmpty(void)
741 PolygonBackground *returnValue;
743 newPtr<PolygonBackground>(returnValue, Thread::getCurrentLocalFlags());
745 returnValue->_pFieldFlags->_bNamespaceMask &=
746 ~Thread::getCurrentLocalFlags();
748 return returnValue;
752 FieldContainerTransitPtr PolygonBackgroundBase::shallowCopyLocal(
753 BitVector bFlags) const
755 PolygonBackground *tmpPtr;
757 newPtr(tmpPtr, dynamic_cast<const PolygonBackground *>(this), bFlags);
759 FieldContainerTransitPtr returnValue(tmpPtr);
761 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
763 return returnValue;
766 FieldContainerTransitPtr PolygonBackgroundBase::shallowCopyDependent(
767 BitVector bFlags) const
769 PolygonBackground *tmpPtr;
771 newPtr(tmpPtr, dynamic_cast<const PolygonBackground *>(this), ~bFlags);
773 FieldContainerTransitPtr returnValue(tmpPtr);
775 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
777 return returnValue;
780 FieldContainerTransitPtr PolygonBackgroundBase::shallowCopy(void) const
782 PolygonBackground *tmpPtr;
784 newPtr(tmpPtr,
785 dynamic_cast<const PolygonBackground *>(this),
786 Thread::getCurrentLocalFlags());
788 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
790 FieldContainerTransitPtr returnValue(tmpPtr);
792 return returnValue;
798 /*------------------------- constructors ----------------------------------*/
800 PolygonBackgroundBase::PolygonBackgroundBase(void) :
801 Inherited(),
802 _sfMaterial (NULL),
803 _mfTexCoords (),
804 _mfPositions (),
805 _sfNormalizedX (bool(true)),
806 _sfNormalizedY (bool(true)),
807 _sfAspectHeight (UInt16(0)),
808 _sfAspectWidth (UInt16(0)),
809 _sfScale (Real32(1.0)),
810 _sfCleanup (bool(true))
814 PolygonBackgroundBase::PolygonBackgroundBase(const PolygonBackgroundBase &source) :
815 Inherited(source),
816 _sfMaterial (NULL),
817 _mfTexCoords (source._mfTexCoords ),
818 _mfPositions (source._mfPositions ),
819 _sfNormalizedX (source._sfNormalizedX ),
820 _sfNormalizedY (source._sfNormalizedY ),
821 _sfAspectHeight (source._sfAspectHeight ),
822 _sfAspectWidth (source._sfAspectWidth ),
823 _sfScale (source._sfScale ),
824 _sfCleanup (source._sfCleanup )
829 /*-------------------------- destructors ----------------------------------*/
831 PolygonBackgroundBase::~PolygonBackgroundBase(void)
835 void PolygonBackgroundBase::onCreate(const PolygonBackground *source)
837 Inherited::onCreate(source);
839 if(source != NULL)
841 PolygonBackground *pThis = static_cast<PolygonBackground *>(this);
843 pThis->setMaterial(source->getMaterial());
847 GetFieldHandlePtr PolygonBackgroundBase::getHandleMaterial (void) const
849 SFUnrecPrimeMaterialPtr::GetHandlePtr returnValue(
850 new SFUnrecPrimeMaterialPtr::GetHandle(
851 &_sfMaterial,
852 this->getType().getFieldDesc(MaterialFieldId),
853 const_cast<PolygonBackgroundBase *>(this)));
855 return returnValue;
858 EditFieldHandlePtr PolygonBackgroundBase::editHandleMaterial (void)
860 SFUnrecPrimeMaterialPtr::EditHandlePtr returnValue(
861 new SFUnrecPrimeMaterialPtr::EditHandle(
862 &_sfMaterial,
863 this->getType().getFieldDesc(MaterialFieldId),
864 this));
866 returnValue->setSetMethod(
867 boost::bind(&PolygonBackground::setMaterial,
868 static_cast<PolygonBackground *>(this), _1));
870 editSField(MaterialFieldMask);
872 return returnValue;
875 GetFieldHandlePtr PolygonBackgroundBase::getHandleTexCoords (void) const
877 MFVec3f::GetHandlePtr returnValue(
878 new MFVec3f::GetHandle(
879 &_mfTexCoords,
880 this->getType().getFieldDesc(TexCoordsFieldId),
881 const_cast<PolygonBackgroundBase *>(this)));
883 return returnValue;
886 EditFieldHandlePtr PolygonBackgroundBase::editHandleTexCoords (void)
888 MFVec3f::EditHandlePtr returnValue(
889 new MFVec3f::EditHandle(
890 &_mfTexCoords,
891 this->getType().getFieldDesc(TexCoordsFieldId),
892 this));
895 editMField(TexCoordsFieldMask, _mfTexCoords);
897 return returnValue;
900 GetFieldHandlePtr PolygonBackgroundBase::getHandlePositions (void) const
902 MFPnt2f::GetHandlePtr returnValue(
903 new MFPnt2f::GetHandle(
904 &_mfPositions,
905 this->getType().getFieldDesc(PositionsFieldId),
906 const_cast<PolygonBackgroundBase *>(this)));
908 return returnValue;
911 EditFieldHandlePtr PolygonBackgroundBase::editHandlePositions (void)
913 MFPnt2f::EditHandlePtr returnValue(
914 new MFPnt2f::EditHandle(
915 &_mfPositions,
916 this->getType().getFieldDesc(PositionsFieldId),
917 this));
920 editMField(PositionsFieldMask, _mfPositions);
922 return returnValue;
925 GetFieldHandlePtr PolygonBackgroundBase::getHandleNormalizedX (void) const
927 SFBool::GetHandlePtr returnValue(
928 new SFBool::GetHandle(
929 &_sfNormalizedX,
930 this->getType().getFieldDesc(NormalizedXFieldId),
931 const_cast<PolygonBackgroundBase *>(this)));
933 return returnValue;
936 EditFieldHandlePtr PolygonBackgroundBase::editHandleNormalizedX (void)
938 SFBool::EditHandlePtr returnValue(
939 new SFBool::EditHandle(
940 &_sfNormalizedX,
941 this->getType().getFieldDesc(NormalizedXFieldId),
942 this));
945 editSField(NormalizedXFieldMask);
947 return returnValue;
950 GetFieldHandlePtr PolygonBackgroundBase::getHandleNormalizedY (void) const
952 SFBool::GetHandlePtr returnValue(
953 new SFBool::GetHandle(
954 &_sfNormalizedY,
955 this->getType().getFieldDesc(NormalizedYFieldId),
956 const_cast<PolygonBackgroundBase *>(this)));
958 return returnValue;
961 EditFieldHandlePtr PolygonBackgroundBase::editHandleNormalizedY (void)
963 SFBool::EditHandlePtr returnValue(
964 new SFBool::EditHandle(
965 &_sfNormalizedY,
966 this->getType().getFieldDesc(NormalizedYFieldId),
967 this));
970 editSField(NormalizedYFieldMask);
972 return returnValue;
975 GetFieldHandlePtr PolygonBackgroundBase::getHandleAspectHeight (void) const
977 SFUInt16::GetHandlePtr returnValue(
978 new SFUInt16::GetHandle(
979 &_sfAspectHeight,
980 this->getType().getFieldDesc(AspectHeightFieldId),
981 const_cast<PolygonBackgroundBase *>(this)));
983 return returnValue;
986 EditFieldHandlePtr PolygonBackgroundBase::editHandleAspectHeight (void)
988 SFUInt16::EditHandlePtr returnValue(
989 new SFUInt16::EditHandle(
990 &_sfAspectHeight,
991 this->getType().getFieldDesc(AspectHeightFieldId),
992 this));
995 editSField(AspectHeightFieldMask);
997 return returnValue;
1000 GetFieldHandlePtr PolygonBackgroundBase::getHandleAspectWidth (void) const
1002 SFUInt16::GetHandlePtr returnValue(
1003 new SFUInt16::GetHandle(
1004 &_sfAspectWidth,
1005 this->getType().getFieldDesc(AspectWidthFieldId),
1006 const_cast<PolygonBackgroundBase *>(this)));
1008 return returnValue;
1011 EditFieldHandlePtr PolygonBackgroundBase::editHandleAspectWidth (void)
1013 SFUInt16::EditHandlePtr returnValue(
1014 new SFUInt16::EditHandle(
1015 &_sfAspectWidth,
1016 this->getType().getFieldDesc(AspectWidthFieldId),
1017 this));
1020 editSField(AspectWidthFieldMask);
1022 return returnValue;
1025 GetFieldHandlePtr PolygonBackgroundBase::getHandleScale (void) const
1027 SFReal32::GetHandlePtr returnValue(
1028 new SFReal32::GetHandle(
1029 &_sfScale,
1030 this->getType().getFieldDesc(ScaleFieldId),
1031 const_cast<PolygonBackgroundBase *>(this)));
1033 return returnValue;
1036 EditFieldHandlePtr PolygonBackgroundBase::editHandleScale (void)
1038 SFReal32::EditHandlePtr returnValue(
1039 new SFReal32::EditHandle(
1040 &_sfScale,
1041 this->getType().getFieldDesc(ScaleFieldId),
1042 this));
1045 editSField(ScaleFieldMask);
1047 return returnValue;
1050 GetFieldHandlePtr PolygonBackgroundBase::getHandleCleanup (void) const
1052 SFBool::GetHandlePtr returnValue(
1053 new SFBool::GetHandle(
1054 &_sfCleanup,
1055 this->getType().getFieldDesc(CleanupFieldId),
1056 const_cast<PolygonBackgroundBase *>(this)));
1058 return returnValue;
1061 EditFieldHandlePtr PolygonBackgroundBase::editHandleCleanup (void)
1063 SFBool::EditHandlePtr returnValue(
1064 new SFBool::EditHandle(
1065 &_sfCleanup,
1066 this->getType().getFieldDesc(CleanupFieldId),
1067 this));
1070 editSField(CleanupFieldMask);
1072 return returnValue;
1076 #ifdef OSG_MT_CPTR_ASPECT
1077 void PolygonBackgroundBase::execSyncV( FieldContainer &oFrom,
1078 ConstFieldMaskArg whichField,
1079 AspectOffsetStore &oOffsets,
1080 ConstFieldMaskArg syncMode,
1081 const UInt32 uiSyncInfo)
1083 PolygonBackground *pThis = static_cast<PolygonBackground *>(this);
1085 pThis->execSync(static_cast<PolygonBackground *>(&oFrom),
1086 whichField,
1087 oOffsets,
1088 syncMode,
1089 uiSyncInfo);
1091 #endif
1094 #ifdef OSG_MT_CPTR_ASPECT
1095 FieldContainer *PolygonBackgroundBase::createAspectCopy(
1096 const FieldContainer *pRefAspect) const
1098 PolygonBackground *returnValue;
1100 newAspectCopy(returnValue,
1101 dynamic_cast<const PolygonBackground *>(pRefAspect),
1102 dynamic_cast<const PolygonBackground *>(this));
1104 return returnValue;
1106 #endif
1108 void PolygonBackgroundBase::resolveLinks(void)
1110 Inherited::resolveLinks();
1112 static_cast<PolygonBackground *>(this)->setMaterial(NULL);
1114 #ifdef OSG_MT_CPTR_ASPECT
1115 AspectOffsetStore oOffsets;
1117 _pAspectStore->fillOffsetArray(oOffsets, this);
1118 #endif
1120 #ifdef OSG_MT_CPTR_ASPECT
1121 _mfTexCoords.terminateShare(Thread::getCurrentAspect(),
1122 oOffsets);
1123 #endif
1124 #ifdef OSG_MT_CPTR_ASPECT
1125 _mfPositions.terminateShare(Thread::getCurrentAspect(),
1126 oOffsets);
1127 #endif
1131 OSG_END_NAMESPACE