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 PolygonForeground!
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 "OSGPolygonForegroundBase.h"
68 #include "OSGPolygonForeground.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::PolygonForeground
79 A foreground that renders a single polygon used the specified material,
80 see \ref PageSystemPolygonForeground for a
83 The polygon material is defined by _sfMaterial, the positions by _mfPositions,
84 the texture coordinates by _mfTexCoords (there must be as many texture
85 coordinates as positions). The interpretation of the positions is
86 controlled by _sfNormalizedX and _sfNormalizedY.
89 /***************************************************************************\
90 * Field Documentation *
91 \***************************************************************************/
93 /*! \var PrimeMaterial * PolygonForegroundBase::_sfMaterial
94 The material used to display.
97 /*! \var Pnt2f PolygonForegroundBase::_mfPositions
98 The vertices of the geometry to display.
101 /*! \var Vec3f PolygonForegroundBase::_mfTexCoords
102 The texture coordinates of the geometry to display.
105 /*! \var bool PolygonForegroundBase::_sfNormalizedX
106 Define whether the x coordinates are normalized (0-1) or pixel-based.
109 /*! \var bool PolygonForegroundBase::_sfNormalizedY
110 Define whether the y coordinates are normalized (0-1) or pixel-based.
113 /*! \var UInt16 PolygonForegroundBase::_sfAspectHeight
114 Useful for keeping aspect ratio when rendering things like images.
117 /*! \var UInt16 PolygonForegroundBase::_sfAspectWidth
118 Useful for keeping aspect ratio when rendering things like images.
121 /*! \var Real32 PolygonForegroundBase::_sfScale
122 Scale factor for zooming.
125 /*! \var bool PolygonForegroundBase::_sfTile
126 If true the image tiles in multi window settings.
130 /***************************************************************************\
131 * FieldType/FieldTrait Instantiation *
132 \***************************************************************************/
134 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
135 PointerType FieldTraits
<PolygonForeground
*, nsOSG
>::_type(
136 "PolygonForegroundPtr",
138 PolygonForeground::getClassType(),
142 OSG_FIELDTRAITS_GETTYPE_NS(PolygonForeground
*, nsOSG
)
144 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
148 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
152 /***************************************************************************\
153 * Field Description *
154 \***************************************************************************/
156 void PolygonForegroundBase::classDescInserter(TypeObject
&oType
)
158 FieldDescriptionBase
*pDesc
= NULL
;
161 pDesc
= new SFUnrecPrimeMaterialPtr::Description(
162 SFUnrecPrimeMaterialPtr::getClassType(),
164 "The material used to display.\n",
165 MaterialFieldId
, MaterialFieldMask
,
167 (Field::SFDefaultFlags
| Field::FStdAccess
),
168 static_cast<FieldEditMethodSig
>(&PolygonForeground::editHandleMaterial
),
169 static_cast<FieldGetMethodSig
>(&PolygonForeground::getHandleMaterial
));
171 oType
.addInitialDesc(pDesc
);
173 pDesc
= new MFPnt2f::Description(
174 MFPnt2f::getClassType(),
176 "The vertices of the geometry to display.\n",
177 PositionsFieldId
, PositionsFieldMask
,
179 (Field::MFDefaultFlags
| Field::FStdAccess
),
180 static_cast<FieldEditMethodSig
>(&PolygonForeground::editHandlePositions
),
181 static_cast<FieldGetMethodSig
>(&PolygonForeground::getHandlePositions
));
183 oType
.addInitialDesc(pDesc
);
185 pDesc
= new MFVec3f::Description(
186 MFVec3f::getClassType(),
188 "The texture coordinates of the geometry to display.\n",
189 TexCoordsFieldId
, TexCoordsFieldMask
,
191 (Field::MFDefaultFlags
| Field::FStdAccess
),
192 static_cast<FieldEditMethodSig
>(&PolygonForeground::editHandleTexCoords
),
193 static_cast<FieldGetMethodSig
>(&PolygonForeground::getHandleTexCoords
));
195 oType
.addInitialDesc(pDesc
);
197 pDesc
= new SFBool::Description(
198 SFBool::getClassType(),
200 "Define whether the x coordinates are normalized (0-1) or pixel-based.\n",
201 NormalizedXFieldId
, NormalizedXFieldMask
,
203 (Field::SFDefaultFlags
| Field::FStdAccess
),
204 static_cast<FieldEditMethodSig
>(&PolygonForeground::editHandleNormalizedX
),
205 static_cast<FieldGetMethodSig
>(&PolygonForeground::getHandleNormalizedX
));
207 oType
.addInitialDesc(pDesc
);
209 pDesc
= new SFBool::Description(
210 SFBool::getClassType(),
212 "Define whether the y coordinates are normalized (0-1) or pixel-based.\n",
213 NormalizedYFieldId
, NormalizedYFieldMask
,
215 (Field::SFDefaultFlags
| Field::FStdAccess
),
216 static_cast<FieldEditMethodSig
>(&PolygonForeground::editHandleNormalizedY
),
217 static_cast<FieldGetMethodSig
>(&PolygonForeground::getHandleNormalizedY
));
219 oType
.addInitialDesc(pDesc
);
221 pDesc
= new SFUInt16::Description(
222 SFUInt16::getClassType(),
224 "Useful for keeping aspect ratio when rendering things like images.\n",
225 AspectHeightFieldId
, AspectHeightFieldMask
,
227 (Field::SFDefaultFlags
| Field::FStdAccess
),
228 static_cast<FieldEditMethodSig
>(&PolygonForeground::editHandleAspectHeight
),
229 static_cast<FieldGetMethodSig
>(&PolygonForeground::getHandleAspectHeight
));
231 oType
.addInitialDesc(pDesc
);
233 pDesc
= new SFUInt16::Description(
234 SFUInt16::getClassType(),
236 "Useful for keeping aspect ratio when rendering things like images.\n",
237 AspectWidthFieldId
, AspectWidthFieldMask
,
239 (Field::SFDefaultFlags
| Field::FStdAccess
),
240 static_cast<FieldEditMethodSig
>(&PolygonForeground::editHandleAspectWidth
),
241 static_cast<FieldGetMethodSig
>(&PolygonForeground::getHandleAspectWidth
));
243 oType
.addInitialDesc(pDesc
);
245 pDesc
= new SFReal32::Description(
246 SFReal32::getClassType(),
248 "Scale factor for zooming.\n",
249 ScaleFieldId
, ScaleFieldMask
,
251 (Field::SFDefaultFlags
| Field::FStdAccess
),
252 static_cast<FieldEditMethodSig
>(&PolygonForeground::editHandleScale
),
253 static_cast<FieldGetMethodSig
>(&PolygonForeground::getHandleScale
));
255 oType
.addInitialDesc(pDesc
);
257 pDesc
= new SFBool::Description(
258 SFBool::getClassType(),
260 "If true the image tiles in multi window settings.\n",
261 TileFieldId
, TileFieldMask
,
263 (Field::SFDefaultFlags
| Field::FStdAccess
),
264 static_cast<FieldEditMethodSig
>(&PolygonForeground::editHandleTile
),
265 static_cast<FieldGetMethodSig
>(&PolygonForeground::getHandleTile
));
267 oType
.addInitialDesc(pDesc
);
271 PolygonForegroundBase::TypeObject
PolygonForegroundBase::_type(
272 PolygonForegroundBase::getClassname(),
273 Inherited::getClassname(),
276 reinterpret_cast<PrototypeCreateF
>(&PolygonForegroundBase::createEmptyLocal
),
277 reinterpret_cast<InitContainerF
>(&PolygonForeground::initMethod
),
278 reinterpret_cast<ExitContainerF
>(&PolygonForeground::exitMethod
),
279 reinterpret_cast<InitalInsertDescFunc
>(
280 reinterpret_cast<void *>(&PolygonForeground::classDescInserter
)),
283 "<?xml version=\"1.0\"?>\n"
286 " name=\"PolygonForeground\"\n"
287 " parent=\"Foreground\"\n"
288 " library=\"Window\"\n"
289 " pointerfieldtypes=\"both\"\n"
290 " structure=\"concrete\"\n"
291 " systemcomponent=\"true\"\n"
292 " parentsystemcomponent=\"true\"\n"
293 " decoratable=\"false\"\n"
294 " useLocalIncludes=\"false\"\n"
295 " docGroupBase=\"GrpWindowForeground\"\n"
297 " A foreground that renders a single polygon used the specified material, \n"
298 " see \\ref PageSystemPolygonForeground for a\n"
301 " The polygon material is defined by _sfMaterial, the positions by _mfPositions,\n"
302 " the texture coordinates by _mfTexCoords (there must be as many texture\n"
303 " coordinates as positions). The interpretation of the positions is\n"
304 " controlled by _sfNormalizedX and _sfNormalizedY.\n"
306 "\t name=\"material\"\n"
307 "\t type=\"PrimeMaterialPtr\"\n"
308 "\t cardinality=\"single\"\n"
309 "\t visibility=\"external\"\n"
310 "\t access=\"public\"\n"
312 "\tThe material used to display.\n"
315 "\t name=\"positions\"\n"
316 "\t type=\"Pnt2f\"\n"
317 "\t cardinality=\"multi\"\n"
318 "\t visibility=\"external\"\n"
319 "\t access=\"public\"\n"
321 "\tThe vertices of the geometry to display.\n"
324 "\t name=\"texCoords\"\n"
325 "\t type=\"Vec3f\"\n"
326 "\t cardinality=\"multi\"\n"
327 "\t visibility=\"external\"\n"
328 "\t access=\"public\"\n"
330 "\tThe texture coordinates of the geometry to display.\n"
333 "\t name=\"normalizedX\"\n"
335 "\t cardinality=\"single\"\n"
336 "\t visibility=\"external\"\n"
337 "\t defaultValue=\"true\"\n"
338 "\t access=\"public\"\n"
340 "\tDefine whether the x coordinates are normalized (0-1) or pixel-based.\n"
343 "\t name=\"normalizedY\"\n"
345 "\t cardinality=\"single\"\n"
346 "\t visibility=\"external\"\n"
347 "\t defaultValue=\"true\"\n"
348 "\t access=\"public\"\n"
350 "\tDefine whether the y coordinates are normalized (0-1) or pixel-based.\n"
353 "\t name=\"aspectHeight\"\n"
354 "\t type=\"UInt16\"\n"
355 "\t cardinality=\"single\"\n"
356 "\t visibility=\"external\"\n"
357 "\t defaultValue=\"0\"\n"
358 "\t access=\"public\"\n"
360 "\tUseful for keeping aspect ratio when rendering things like images.\n"
363 "\t name=\"aspectWidth\"\n"
364 "\t type=\"UInt16\"\n"
365 "\t cardinality=\"single\"\n"
366 "\t visibility=\"external\"\n"
367 "\t defaultValue=\"0\"\n"
368 "\t access=\"public\"\n"
370 "\tUseful for keeping aspect ratio when rendering things like images.\n"
373 "\t name=\"scale\"\n"
374 "\t type=\"Real32\"\n"
375 "\t cardinality=\"single\"\n"
376 "\t visibility=\"external\"\n"
377 "\t defaultValue=\"1.0\"\n"
378 "\t access=\"public\"\n"
380 "\tScale factor for zooming.\n"
385 "\t cardinality=\"single\"\n"
386 "\t visibility=\"external\"\n"
387 "\t defaultValue=\"true\"\n"
388 "\t access=\"public\"\n"
390 "\tIf true the image tiles in multi window settings.\n"
392 "</FieldContainer>\n",
393 "A foreground that renders a single polygon used the specified material, \n"
394 "see \\ref PageSystemPolygonForeground for a\n"
397 "The polygon material is defined by _sfMaterial, the positions by _mfPositions,\n"
398 "the texture coordinates by _mfTexCoords (there must be as many texture\n"
399 "coordinates as positions). The interpretation of the positions is\n"
400 "controlled by _sfNormalizedX and _sfNormalizedY.\n"
403 /*------------------------------ get -----------------------------------*/
405 FieldContainerType
&PolygonForegroundBase::getType(void)
410 const FieldContainerType
&PolygonForegroundBase::getType(void) const
415 UInt32
PolygonForegroundBase::getContainerSize(void) const
417 return sizeof(PolygonForeground
);
420 /*------------------------- decorator get ------------------------------*/
423 //! Get the PolygonForeground::_sfMaterial field.
424 const SFUnrecPrimeMaterialPtr
*PolygonForegroundBase::getSFMaterial(void) const
429 SFUnrecPrimeMaterialPtr
*PolygonForegroundBase::editSFMaterial (void)
431 editSField(MaterialFieldMask
);
436 //! Get the value of the PolygonForeground::_sfMaterial field.
437 PrimeMaterial
* PolygonForegroundBase::getMaterial(void) const
439 return _sfMaterial
.getValue();
442 //! Set the value of the PolygonForeground::_sfMaterial field.
443 void PolygonForegroundBase::setMaterial(PrimeMaterial
* const value
)
445 editSField(MaterialFieldMask
);
447 _sfMaterial
.setValue(value
);
451 MFPnt2f
*PolygonForegroundBase::editMFPositions(void)
453 editMField(PositionsFieldMask
, _mfPositions
);
455 return &_mfPositions
;
458 const MFPnt2f
*PolygonForegroundBase::getMFPositions(void) const
460 return &_mfPositions
;
464 MFVec3f
*PolygonForegroundBase::editMFTexCoords(void)
466 editMField(TexCoordsFieldMask
, _mfTexCoords
);
468 return &_mfTexCoords
;
471 const MFVec3f
*PolygonForegroundBase::getMFTexCoords(void) const
473 return &_mfTexCoords
;
477 SFBool
*PolygonForegroundBase::editSFNormalizedX(void)
479 editSField(NormalizedXFieldMask
);
481 return &_sfNormalizedX
;
484 const SFBool
*PolygonForegroundBase::getSFNormalizedX(void) const
486 return &_sfNormalizedX
;
490 SFBool
*PolygonForegroundBase::editSFNormalizedY(void)
492 editSField(NormalizedYFieldMask
);
494 return &_sfNormalizedY
;
497 const SFBool
*PolygonForegroundBase::getSFNormalizedY(void) const
499 return &_sfNormalizedY
;
503 SFUInt16
*PolygonForegroundBase::editSFAspectHeight(void)
505 editSField(AspectHeightFieldMask
);
507 return &_sfAspectHeight
;
510 const SFUInt16
*PolygonForegroundBase::getSFAspectHeight(void) const
512 return &_sfAspectHeight
;
516 SFUInt16
*PolygonForegroundBase::editSFAspectWidth(void)
518 editSField(AspectWidthFieldMask
);
520 return &_sfAspectWidth
;
523 const SFUInt16
*PolygonForegroundBase::getSFAspectWidth(void) const
525 return &_sfAspectWidth
;
529 SFReal32
*PolygonForegroundBase::editSFScale(void)
531 editSField(ScaleFieldMask
);
536 const SFReal32
*PolygonForegroundBase::getSFScale(void) const
542 SFBool
*PolygonForegroundBase::editSFTile(void)
544 editSField(TileFieldMask
);
549 const SFBool
*PolygonForegroundBase::getSFTile(void) const
559 /*------------------------------ access -----------------------------------*/
561 SizeT
PolygonForegroundBase::getBinSize(ConstFieldMaskArg whichField
)
563 SizeT returnValue
= Inherited::getBinSize(whichField
);
565 if(FieldBits::NoField
!= (MaterialFieldMask
& whichField
))
567 returnValue
+= _sfMaterial
.getBinSize();
569 if(FieldBits::NoField
!= (PositionsFieldMask
& whichField
))
571 returnValue
+= _mfPositions
.getBinSize();
573 if(FieldBits::NoField
!= (TexCoordsFieldMask
& whichField
))
575 returnValue
+= _mfTexCoords
.getBinSize();
577 if(FieldBits::NoField
!= (NormalizedXFieldMask
& whichField
))
579 returnValue
+= _sfNormalizedX
.getBinSize();
581 if(FieldBits::NoField
!= (NormalizedYFieldMask
& whichField
))
583 returnValue
+= _sfNormalizedY
.getBinSize();
585 if(FieldBits::NoField
!= (AspectHeightFieldMask
& whichField
))
587 returnValue
+= _sfAspectHeight
.getBinSize();
589 if(FieldBits::NoField
!= (AspectWidthFieldMask
& whichField
))
591 returnValue
+= _sfAspectWidth
.getBinSize();
593 if(FieldBits::NoField
!= (ScaleFieldMask
& whichField
))
595 returnValue
+= _sfScale
.getBinSize();
597 if(FieldBits::NoField
!= (TileFieldMask
& whichField
))
599 returnValue
+= _sfTile
.getBinSize();
605 void PolygonForegroundBase::copyToBin(BinaryDataHandler
&pMem
,
606 ConstFieldMaskArg whichField
)
608 Inherited::copyToBin(pMem
, whichField
);
610 if(FieldBits::NoField
!= (MaterialFieldMask
& whichField
))
612 _sfMaterial
.copyToBin(pMem
);
614 if(FieldBits::NoField
!= (PositionsFieldMask
& whichField
))
616 _mfPositions
.copyToBin(pMem
);
618 if(FieldBits::NoField
!= (TexCoordsFieldMask
& whichField
))
620 _mfTexCoords
.copyToBin(pMem
);
622 if(FieldBits::NoField
!= (NormalizedXFieldMask
& whichField
))
624 _sfNormalizedX
.copyToBin(pMem
);
626 if(FieldBits::NoField
!= (NormalizedYFieldMask
& whichField
))
628 _sfNormalizedY
.copyToBin(pMem
);
630 if(FieldBits::NoField
!= (AspectHeightFieldMask
& whichField
))
632 _sfAspectHeight
.copyToBin(pMem
);
634 if(FieldBits::NoField
!= (AspectWidthFieldMask
& whichField
))
636 _sfAspectWidth
.copyToBin(pMem
);
638 if(FieldBits::NoField
!= (ScaleFieldMask
& whichField
))
640 _sfScale
.copyToBin(pMem
);
642 if(FieldBits::NoField
!= (TileFieldMask
& whichField
))
644 _sfTile
.copyToBin(pMem
);
648 void PolygonForegroundBase::copyFromBin(BinaryDataHandler
&pMem
,
649 ConstFieldMaskArg whichField
)
651 Inherited::copyFromBin(pMem
, whichField
);
653 if(FieldBits::NoField
!= (MaterialFieldMask
& whichField
))
655 editSField(MaterialFieldMask
);
656 _sfMaterial
.copyFromBin(pMem
);
658 if(FieldBits::NoField
!= (PositionsFieldMask
& whichField
))
660 editMField(PositionsFieldMask
, _mfPositions
);
661 _mfPositions
.copyFromBin(pMem
);
663 if(FieldBits::NoField
!= (TexCoordsFieldMask
& whichField
))
665 editMField(TexCoordsFieldMask
, _mfTexCoords
);
666 _mfTexCoords
.copyFromBin(pMem
);
668 if(FieldBits::NoField
!= (NormalizedXFieldMask
& whichField
))
670 editSField(NormalizedXFieldMask
);
671 _sfNormalizedX
.copyFromBin(pMem
);
673 if(FieldBits::NoField
!= (NormalizedYFieldMask
& whichField
))
675 editSField(NormalizedYFieldMask
);
676 _sfNormalizedY
.copyFromBin(pMem
);
678 if(FieldBits::NoField
!= (AspectHeightFieldMask
& whichField
))
680 editSField(AspectHeightFieldMask
);
681 _sfAspectHeight
.copyFromBin(pMem
);
683 if(FieldBits::NoField
!= (AspectWidthFieldMask
& whichField
))
685 editSField(AspectWidthFieldMask
);
686 _sfAspectWidth
.copyFromBin(pMem
);
688 if(FieldBits::NoField
!= (ScaleFieldMask
& whichField
))
690 editSField(ScaleFieldMask
);
691 _sfScale
.copyFromBin(pMem
);
693 if(FieldBits::NoField
!= (TileFieldMask
& whichField
))
695 editSField(TileFieldMask
);
696 _sfTile
.copyFromBin(pMem
);
700 //! create a new instance of the class
701 PolygonForegroundTransitPtr
PolygonForegroundBase::createLocal(BitVector bFlags
)
703 PolygonForegroundTransitPtr fc
;
705 if(getClassType().getPrototype() != NULL
)
707 FieldContainerTransitPtr tmpPtr
=
708 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
710 fc
= dynamic_pointer_cast
<PolygonForeground
>(tmpPtr
);
716 //! create a new instance of the class, copy the container flags
717 PolygonForegroundTransitPtr
PolygonForegroundBase::createDependent(BitVector bFlags
)
719 PolygonForegroundTransitPtr fc
;
721 if(getClassType().getPrototype() != NULL
)
723 FieldContainerTransitPtr tmpPtr
=
724 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
726 fc
= dynamic_pointer_cast
<PolygonForeground
>(tmpPtr
);
732 //! create a new instance of the class
733 PolygonForegroundTransitPtr
PolygonForegroundBase::create(void)
735 PolygonForegroundTransitPtr fc
;
737 if(getClassType().getPrototype() != NULL
)
739 FieldContainerTransitPtr tmpPtr
=
740 getClassType().getPrototype()-> shallowCopy();
742 fc
= dynamic_pointer_cast
<PolygonForeground
>(tmpPtr
);
748 PolygonForeground
*PolygonForegroundBase::createEmptyLocal(BitVector bFlags
)
750 PolygonForeground
*returnValue
;
752 newPtr
<PolygonForeground
>(returnValue
, bFlags
);
754 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
759 //! create an empty new instance of the class, do not copy the prototype
760 PolygonForeground
*PolygonForegroundBase::createEmpty(void)
762 PolygonForeground
*returnValue
;
764 newPtr
<PolygonForeground
>(returnValue
, Thread::getCurrentLocalFlags());
766 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
767 ~Thread::getCurrentLocalFlags();
773 FieldContainerTransitPtr
PolygonForegroundBase::shallowCopyLocal(
774 BitVector bFlags
) const
776 PolygonForeground
*tmpPtr
;
778 newPtr(tmpPtr
, dynamic_cast<const PolygonForeground
*>(this), bFlags
);
780 FieldContainerTransitPtr
returnValue(tmpPtr
);
782 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
787 FieldContainerTransitPtr
PolygonForegroundBase::shallowCopyDependent(
788 BitVector bFlags
) const
790 PolygonForeground
*tmpPtr
;
792 newPtr(tmpPtr
, dynamic_cast<const PolygonForeground
*>(this), ~bFlags
);
794 FieldContainerTransitPtr
returnValue(tmpPtr
);
796 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
801 FieldContainerTransitPtr
PolygonForegroundBase::shallowCopy(void) const
803 PolygonForeground
*tmpPtr
;
806 dynamic_cast<const PolygonForeground
*>(this),
807 Thread::getCurrentLocalFlags());
809 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
811 FieldContainerTransitPtr
returnValue(tmpPtr
);
819 /*------------------------- constructors ----------------------------------*/
821 PolygonForegroundBase::PolygonForegroundBase(void) :
826 _sfNormalizedX (bool(true)),
827 _sfNormalizedY (bool(true)),
828 _sfAspectHeight (UInt16(0)),
829 _sfAspectWidth (UInt16(0)),
830 _sfScale (Real32(1.0)),
835 PolygonForegroundBase::PolygonForegroundBase(const PolygonForegroundBase
&source
) :
838 _mfPositions (source
._mfPositions
),
839 _mfTexCoords (source
._mfTexCoords
),
840 _sfNormalizedX (source
._sfNormalizedX
),
841 _sfNormalizedY (source
._sfNormalizedY
),
842 _sfAspectHeight (source
._sfAspectHeight
),
843 _sfAspectWidth (source
._sfAspectWidth
),
844 _sfScale (source
._sfScale
),
845 _sfTile (source
._sfTile
)
850 /*-------------------------- destructors ----------------------------------*/
852 PolygonForegroundBase::~PolygonForegroundBase(void)
856 void PolygonForegroundBase::onCreate(const PolygonForeground
*source
)
858 Inherited::onCreate(source
);
862 PolygonForeground
*pThis
= static_cast<PolygonForeground
*>(this);
864 pThis
->setMaterial(source
->getMaterial());
868 GetFieldHandlePtr
PolygonForegroundBase::getHandleMaterial (void) const
870 SFUnrecPrimeMaterialPtr::GetHandlePtr
returnValue(
871 new SFUnrecPrimeMaterialPtr::GetHandle(
873 this->getType().getFieldDesc(MaterialFieldId
),
874 const_cast<PolygonForegroundBase
*>(this)));
879 EditFieldHandlePtr
PolygonForegroundBase::editHandleMaterial (void)
881 SFUnrecPrimeMaterialPtr::EditHandlePtr
returnValue(
882 new SFUnrecPrimeMaterialPtr::EditHandle(
884 this->getType().getFieldDesc(MaterialFieldId
),
887 returnValue
->setSetMethod(
888 boost::bind(&PolygonForeground::setMaterial
,
889 static_cast<PolygonForeground
*>(this), _1
));
891 editSField(MaterialFieldMask
);
896 GetFieldHandlePtr
PolygonForegroundBase::getHandlePositions (void) const
898 MFPnt2f::GetHandlePtr
returnValue(
899 new MFPnt2f::GetHandle(
901 this->getType().getFieldDesc(PositionsFieldId
),
902 const_cast<PolygonForegroundBase
*>(this)));
907 EditFieldHandlePtr
PolygonForegroundBase::editHandlePositions (void)
909 MFPnt2f::EditHandlePtr
returnValue(
910 new MFPnt2f::EditHandle(
912 this->getType().getFieldDesc(PositionsFieldId
),
916 editMField(PositionsFieldMask
, _mfPositions
);
921 GetFieldHandlePtr
PolygonForegroundBase::getHandleTexCoords (void) const
923 MFVec3f::GetHandlePtr
returnValue(
924 new MFVec3f::GetHandle(
926 this->getType().getFieldDesc(TexCoordsFieldId
),
927 const_cast<PolygonForegroundBase
*>(this)));
932 EditFieldHandlePtr
PolygonForegroundBase::editHandleTexCoords (void)
934 MFVec3f::EditHandlePtr
returnValue(
935 new MFVec3f::EditHandle(
937 this->getType().getFieldDesc(TexCoordsFieldId
),
941 editMField(TexCoordsFieldMask
, _mfTexCoords
);
946 GetFieldHandlePtr
PolygonForegroundBase::getHandleNormalizedX (void) const
948 SFBool::GetHandlePtr
returnValue(
949 new SFBool::GetHandle(
951 this->getType().getFieldDesc(NormalizedXFieldId
),
952 const_cast<PolygonForegroundBase
*>(this)));
957 EditFieldHandlePtr
PolygonForegroundBase::editHandleNormalizedX (void)
959 SFBool::EditHandlePtr
returnValue(
960 new SFBool::EditHandle(
962 this->getType().getFieldDesc(NormalizedXFieldId
),
966 editSField(NormalizedXFieldMask
);
971 GetFieldHandlePtr
PolygonForegroundBase::getHandleNormalizedY (void) const
973 SFBool::GetHandlePtr
returnValue(
974 new SFBool::GetHandle(
976 this->getType().getFieldDesc(NormalizedYFieldId
),
977 const_cast<PolygonForegroundBase
*>(this)));
982 EditFieldHandlePtr
PolygonForegroundBase::editHandleNormalizedY (void)
984 SFBool::EditHandlePtr
returnValue(
985 new SFBool::EditHandle(
987 this->getType().getFieldDesc(NormalizedYFieldId
),
991 editSField(NormalizedYFieldMask
);
996 GetFieldHandlePtr
PolygonForegroundBase::getHandleAspectHeight (void) const
998 SFUInt16::GetHandlePtr
returnValue(
999 new SFUInt16::GetHandle(
1001 this->getType().getFieldDesc(AspectHeightFieldId
),
1002 const_cast<PolygonForegroundBase
*>(this)));
1007 EditFieldHandlePtr
PolygonForegroundBase::editHandleAspectHeight (void)
1009 SFUInt16::EditHandlePtr
returnValue(
1010 new SFUInt16::EditHandle(
1012 this->getType().getFieldDesc(AspectHeightFieldId
),
1016 editSField(AspectHeightFieldMask
);
1021 GetFieldHandlePtr
PolygonForegroundBase::getHandleAspectWidth (void) const
1023 SFUInt16::GetHandlePtr
returnValue(
1024 new SFUInt16::GetHandle(
1026 this->getType().getFieldDesc(AspectWidthFieldId
),
1027 const_cast<PolygonForegroundBase
*>(this)));
1032 EditFieldHandlePtr
PolygonForegroundBase::editHandleAspectWidth (void)
1034 SFUInt16::EditHandlePtr
returnValue(
1035 new SFUInt16::EditHandle(
1037 this->getType().getFieldDesc(AspectWidthFieldId
),
1041 editSField(AspectWidthFieldMask
);
1046 GetFieldHandlePtr
PolygonForegroundBase::getHandleScale (void) const
1048 SFReal32::GetHandlePtr
returnValue(
1049 new SFReal32::GetHandle(
1051 this->getType().getFieldDesc(ScaleFieldId
),
1052 const_cast<PolygonForegroundBase
*>(this)));
1057 EditFieldHandlePtr
PolygonForegroundBase::editHandleScale (void)
1059 SFReal32::EditHandlePtr
returnValue(
1060 new SFReal32::EditHandle(
1062 this->getType().getFieldDesc(ScaleFieldId
),
1066 editSField(ScaleFieldMask
);
1071 GetFieldHandlePtr
PolygonForegroundBase::getHandleTile (void) const
1073 SFBool::GetHandlePtr
returnValue(
1074 new SFBool::GetHandle(
1076 this->getType().getFieldDesc(TileFieldId
),
1077 const_cast<PolygonForegroundBase
*>(this)));
1082 EditFieldHandlePtr
PolygonForegroundBase::editHandleTile (void)
1084 SFBool::EditHandlePtr
returnValue(
1085 new SFBool::EditHandle(
1087 this->getType().getFieldDesc(TileFieldId
),
1091 editSField(TileFieldMask
);
1097 #ifdef OSG_MT_CPTR_ASPECT
1098 void PolygonForegroundBase::execSyncV( FieldContainer
&oFrom
,
1099 ConstFieldMaskArg whichField
,
1100 AspectOffsetStore
&oOffsets
,
1101 ConstFieldMaskArg syncMode
,
1102 const UInt32 uiSyncInfo
)
1104 PolygonForeground
*pThis
= static_cast<PolygonForeground
*>(this);
1106 pThis
->execSync(static_cast<PolygonForeground
*>(&oFrom
),
1115 #ifdef OSG_MT_CPTR_ASPECT
1116 FieldContainer
*PolygonForegroundBase::createAspectCopy(
1117 const FieldContainer
*pRefAspect
) const
1119 PolygonForeground
*returnValue
;
1121 newAspectCopy(returnValue
,
1122 dynamic_cast<const PolygonForeground
*>(pRefAspect
),
1123 dynamic_cast<const PolygonForeground
*>(this));
1129 void PolygonForegroundBase::resolveLinks(void)
1131 Inherited::resolveLinks();
1133 static_cast<PolygonForeground
*>(this)->setMaterial(NULL
);
1135 #ifdef OSG_MT_CPTR_ASPECT
1136 AspectOffsetStore oOffsets
;
1138 _pAspectStore
->fillOffsetArray(oOffsets
, this);
1141 #ifdef OSG_MT_CPTR_ASPECT
1142 _mfPositions
.terminateShare(Thread::getCurrentAspect(),
1145 #ifdef OSG_MT_CPTR_ASPECT
1146 _mfTexCoords
.terminateShare(Thread::getCurrentAspect(),