1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
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 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
42 ** This file is automatically generated. **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
47 ** Do not change this file, changes should be done in the derived **
48 ** class PolygonBackground!
50 *****************************************************************************
51 \*****************************************************************************/
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
61 #include "OSGConfig.h"
65 #include "OSGPrimeMaterial.h" // Material Class
67 #include "OSGPolygonBackgroundBase.h"
68 #include "OSGPolygonBackground.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
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(),
135 OSG_FIELDTRAITS_GETTYPE_NS(PolygonBackground
*, nsOSG
)
137 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
141 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
145 /***************************************************************************\
146 * Field Description *
147 \***************************************************************************/
149 void PolygonBackgroundBase::classDescInserter(TypeObject
&oType
)
151 FieldDescriptionBase
*pDesc
= NULL
;
154 pDesc
= new SFUnrecPrimeMaterialPtr::Description(
155 SFUnrecPrimeMaterialPtr::getClassType(),
157 "The material used to display.\n",
158 MaterialFieldId
, MaterialFieldMask
,
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(),
169 "The texture coordinates of the geometry to display.\n",
170 TexCoordsFieldId
, TexCoordsFieldMask
,
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(),
181 "The positions of the geometry to display.\n",
182 PositionsFieldId
, PositionsFieldMask
,
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(),
193 "Define whether the x coordinates are normalized (0-1) or pixel-based.\n",
194 NormalizedXFieldId
, NormalizedXFieldMask
,
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(),
205 "Define whether the y coordinates are normalized (0-1) or pixel-based.\n",
206 NormalizedYFieldId
, NormalizedYFieldMask
,
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(),
217 "Useful for keeping aspect ratio when rendering things like images.\n",
218 AspectHeightFieldId
, AspectHeightFieldMask
,
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(),
229 "Useful for keeping aspect ratio when rendering things like images.\n",
230 AspectWidthFieldId
, AspectWidthFieldMask
,
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(),
241 "Scale factor for zooming.\n",
242 ScaleFieldId
, ScaleFieldMask
,
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(),
253 "Clear depth/ stencil buffer after applying the material.\n",
254 CleanupFieldId
, CleanupFieldMask
,
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(),
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
)),
276 "<?xml version=\"1.0\"?>\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"
290 " A Background that renders a single polygon using the specified material.\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"
298 "\tThe material used to display.\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"
307 "\tThe texture coordinates of the geometry to display.\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"
316 "\tThe positions of the geometry to display.\n"
319 "\t name=\"normalizedX\"\n"
321 "\t cardinality=\"single\"\n"
322 "\t visibility=\"external\"\n"
323 "\t defaultValue=\"true\"\n"
324 "\t access=\"public\"\n"
326 "\tDefine whether the x coordinates are normalized (0-1) or pixel-based.\n"
329 "\t name=\"normalizedY\"\n"
331 "\t cardinality=\"single\"\n"
332 "\t visibility=\"external\"\n"
333 "\t defaultValue=\"true\"\n"
334 "\t access=\"public\"\n"
336 "\tDefine whether the y coordinates are normalized (0-1) or pixel-based.\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"
346 "\tUseful for keeping aspect ratio when rendering things like images.\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"
356 "\tUseful for keeping aspect ratio when rendering things like images.\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"
366 "\tScale factor for zooming.\n"
369 "\t name=\"cleanup\"\n"
371 "\t cardinality=\"single\"\n"
372 "\t visibility=\"external\"\n"
373 "\t defaultValue=\"true\"\n"
374 "\t access=\"public\"\n"
376 "\tClear depth/ stencil buffer after applying the material.\n"
378 "</FieldContainer>\n",
379 "A Background that renders a single polygon using the specified material.\n"
382 /*------------------------------ get -----------------------------------*/
384 FieldContainerType
&PolygonBackgroundBase::getType(void)
389 const FieldContainerType
&PolygonBackgroundBase::getType(void) const
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
408 SFUnrecPrimeMaterialPtr
*PolygonBackgroundBase::editSFMaterial (void)
410 editSField(MaterialFieldMask
);
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
);
515 const SFReal32
*PolygonBackgroundBase::getSFScale(void) const
521 SFBool
*PolygonBackgroundBase::editSFCleanup(void)
523 editSField(CleanupFieldMask
);
528 const SFBool
*PolygonBackgroundBase::getSFCleanup(void) const
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();
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
);
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
);
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
);
727 PolygonBackground
*PolygonBackgroundBase::createEmptyLocal(BitVector bFlags
)
729 PolygonBackground
*returnValue
;
731 newPtr
<PolygonBackground
>(returnValue
, bFlags
);
733 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
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();
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
;
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
;
780 FieldContainerTransitPtr
PolygonBackgroundBase::shallowCopy(void) const
782 PolygonBackground
*tmpPtr
;
785 dynamic_cast<const PolygonBackground
*>(this),
786 Thread::getCurrentLocalFlags());
788 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
790 FieldContainerTransitPtr
returnValue(tmpPtr
);
798 /*------------------------- constructors ----------------------------------*/
800 PolygonBackgroundBase::PolygonBackgroundBase(void) :
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
) :
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
);
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(
852 this->getType().getFieldDesc(MaterialFieldId
),
853 const_cast<PolygonBackgroundBase
*>(this)));
858 EditFieldHandlePtr
PolygonBackgroundBase::editHandleMaterial (void)
860 SFUnrecPrimeMaterialPtr::EditHandlePtr
returnValue(
861 new SFUnrecPrimeMaterialPtr::EditHandle(
863 this->getType().getFieldDesc(MaterialFieldId
),
866 returnValue
->setSetMethod(
867 boost::bind(&PolygonBackground::setMaterial
,
868 static_cast<PolygonBackground
*>(this), _1
));
870 editSField(MaterialFieldMask
);
875 GetFieldHandlePtr
PolygonBackgroundBase::getHandleTexCoords (void) const
877 MFVec3f::GetHandlePtr
returnValue(
878 new MFVec3f::GetHandle(
880 this->getType().getFieldDesc(TexCoordsFieldId
),
881 const_cast<PolygonBackgroundBase
*>(this)));
886 EditFieldHandlePtr
PolygonBackgroundBase::editHandleTexCoords (void)
888 MFVec3f::EditHandlePtr
returnValue(
889 new MFVec3f::EditHandle(
891 this->getType().getFieldDesc(TexCoordsFieldId
),
895 editMField(TexCoordsFieldMask
, _mfTexCoords
);
900 GetFieldHandlePtr
PolygonBackgroundBase::getHandlePositions (void) const
902 MFPnt2f::GetHandlePtr
returnValue(
903 new MFPnt2f::GetHandle(
905 this->getType().getFieldDesc(PositionsFieldId
),
906 const_cast<PolygonBackgroundBase
*>(this)));
911 EditFieldHandlePtr
PolygonBackgroundBase::editHandlePositions (void)
913 MFPnt2f::EditHandlePtr
returnValue(
914 new MFPnt2f::EditHandle(
916 this->getType().getFieldDesc(PositionsFieldId
),
920 editMField(PositionsFieldMask
, _mfPositions
);
925 GetFieldHandlePtr
PolygonBackgroundBase::getHandleNormalizedX (void) const
927 SFBool::GetHandlePtr
returnValue(
928 new SFBool::GetHandle(
930 this->getType().getFieldDesc(NormalizedXFieldId
),
931 const_cast<PolygonBackgroundBase
*>(this)));
936 EditFieldHandlePtr
PolygonBackgroundBase::editHandleNormalizedX (void)
938 SFBool::EditHandlePtr
returnValue(
939 new SFBool::EditHandle(
941 this->getType().getFieldDesc(NormalizedXFieldId
),
945 editSField(NormalizedXFieldMask
);
950 GetFieldHandlePtr
PolygonBackgroundBase::getHandleNormalizedY (void) const
952 SFBool::GetHandlePtr
returnValue(
953 new SFBool::GetHandle(
955 this->getType().getFieldDesc(NormalizedYFieldId
),
956 const_cast<PolygonBackgroundBase
*>(this)));
961 EditFieldHandlePtr
PolygonBackgroundBase::editHandleNormalizedY (void)
963 SFBool::EditHandlePtr
returnValue(
964 new SFBool::EditHandle(
966 this->getType().getFieldDesc(NormalizedYFieldId
),
970 editSField(NormalizedYFieldMask
);
975 GetFieldHandlePtr
PolygonBackgroundBase::getHandleAspectHeight (void) const
977 SFUInt16::GetHandlePtr
returnValue(
978 new SFUInt16::GetHandle(
980 this->getType().getFieldDesc(AspectHeightFieldId
),
981 const_cast<PolygonBackgroundBase
*>(this)));
986 EditFieldHandlePtr
PolygonBackgroundBase::editHandleAspectHeight (void)
988 SFUInt16::EditHandlePtr
returnValue(
989 new SFUInt16::EditHandle(
991 this->getType().getFieldDesc(AspectHeightFieldId
),
995 editSField(AspectHeightFieldMask
);
1000 GetFieldHandlePtr
PolygonBackgroundBase::getHandleAspectWidth (void) const
1002 SFUInt16::GetHandlePtr
returnValue(
1003 new SFUInt16::GetHandle(
1005 this->getType().getFieldDesc(AspectWidthFieldId
),
1006 const_cast<PolygonBackgroundBase
*>(this)));
1011 EditFieldHandlePtr
PolygonBackgroundBase::editHandleAspectWidth (void)
1013 SFUInt16::EditHandlePtr
returnValue(
1014 new SFUInt16::EditHandle(
1016 this->getType().getFieldDesc(AspectWidthFieldId
),
1020 editSField(AspectWidthFieldMask
);
1025 GetFieldHandlePtr
PolygonBackgroundBase::getHandleScale (void) const
1027 SFReal32::GetHandlePtr
returnValue(
1028 new SFReal32::GetHandle(
1030 this->getType().getFieldDesc(ScaleFieldId
),
1031 const_cast<PolygonBackgroundBase
*>(this)));
1036 EditFieldHandlePtr
PolygonBackgroundBase::editHandleScale (void)
1038 SFReal32::EditHandlePtr
returnValue(
1039 new SFReal32::EditHandle(
1041 this->getType().getFieldDesc(ScaleFieldId
),
1045 editSField(ScaleFieldMask
);
1050 GetFieldHandlePtr
PolygonBackgroundBase::getHandleCleanup (void) const
1052 SFBool::GetHandlePtr
returnValue(
1053 new SFBool::GetHandle(
1055 this->getType().getFieldDesc(CleanupFieldId
),
1056 const_cast<PolygonBackgroundBase
*>(this)));
1061 EditFieldHandlePtr
PolygonBackgroundBase::editHandleCleanup (void)
1063 SFBool::EditHandlePtr
returnValue(
1064 new SFBool::EditHandle(
1066 this->getType().getFieldDesc(CleanupFieldId
),
1070 editSField(CleanupFieldMask
);
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
),
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));
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);
1120 #ifdef OSG_MT_CPTR_ASPECT
1121 _mfTexCoords
.terminateShare(Thread::getCurrentAspect(),
1124 #ifdef OSG_MT_CPTR_ASPECT
1125 _mfPositions
.terminateShare(Thread::getCurrentAspect(),