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 PolygonChunk!
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"
64 #include "OSGGL.h" // CullFace default header
65 #include "OSGGL.h" // FrontFace default header
66 #include "OSGGL.h" // FrontMode default header
67 #include "OSGGL.h" // BackMode default header
68 #include "OSGGL.h" // Smooth default header
69 #include "OSGGL.h" // OffsetPoint default header
70 #include "OSGGL.h" // OffsetLine default header
71 #include "OSGGL.h" // OffsetFill default header
74 #include "OSGPolygonChunkBase.h"
75 #include "OSGPolygonChunk.h"
77 #include <boost/bind.hpp>
81 /***************************************************************************\
83 \***************************************************************************/
85 /*! \class OSG::PolygonChunk
86 See \ref PageSystemPolygonChunk for details.
88 The parameters of the following functions are wrapped here:
90 <li>glCullFace() (OSG::PolygonChunk::_sfCullFace),</li>
91 <li>glFrontFace()(OSG::PolygonChunk::_sfFrontFace),</li>
92 <li>glPolygonMode() (OSG::PolygonChunk::_sfFrontMode, OSG::PolygonChunk::_sfBackMode),</li>
93 <li>glEnable(GL_POLYGON_SMOOTH) (OSG::PolygonChunk::_sfSmooth),</li>
94 <li>glPolygonOffset() (OSG::PolygonChunk::_sfOffsetFactor, OSG::PolygonChunk::_sfOffsetBias),</li>
95 <li>glEnable(GL_POLYGON_OFFSET_POINT) (OSG::PolygonChunk::_sfOffsetPoint),</li>
96 <li>glEnable(GL_POLYGON_OFFSET_LINE) (OSG::PolygonChunk::_sfOffsetLine),</li>
97 <li>glEnable(GL_POLYGON_OFFSET_FILL) (OSG::PolygonChunk::_sfOffsetFill),</li>
98 <li>glStipplePattern() and glEnable(GL_POLYGON_STIPPLE) (OSG::PolygonChunk::_sfStipple).</li>
102 /***************************************************************************\
103 * Field Documentation *
104 \***************************************************************************/
106 /*! \var GLenum PolygonChunkBase::_sfCullFace
107 Defines which side of the polygon is invisible. Set to GL_NONE to not cull anything. See glCullFace.
110 /*! \var GLenum PolygonChunkBase::_sfFrontFace
111 Defines which side of the polygon is considered the front side base on vertex ordering
112 of clockwise (CW) of counter clockwise (CCW). defaults to GL_CCW. See glFrontFace.
115 /*! \var GLenum PolygonChunkBase::_sfFrontMode
116 Defines if polygon front sides are rendered filled (default), outlined or as points. See glPolygonMode.
119 /*! \var GLenum PolygonChunkBase::_sfBackMode
120 Defines if polygon front sides are rendered filled (default), outlined or as points. See glPolygonMode.
123 /*! \var bool PolygonChunkBase::_sfSmooth
124 Defines if polygon antialiasing is used. See GL_POLYGON_SMOOTH.
127 /*! \var Real32 PolygonChunkBase::_sfOffsetFactor
128 Defines the offset factor. See glPolygonOffset.
131 /*! \var Real32 PolygonChunkBase::_sfOffsetBias
132 Defines the offset bias. See glPolygonOffset.
135 /*! \var bool PolygonChunkBase::_sfOffsetPoint
136 Enables offsetting for points.
139 /*! \var bool PolygonChunkBase::_sfOffsetLine
140 Enables offsetting for lines.
143 /*! \var bool PolygonChunkBase::_sfOffsetFill
144 Enables offsetting for polygons.
147 /*! \var Int32 PolygonChunkBase::_mfStipple
148 Defines the stipple pattern. Is only valid and used if it contains
153 /***************************************************************************\
154 * FieldType/FieldTrait Instantiation *
155 \***************************************************************************/
157 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
158 PointerType FieldTraits
<PolygonChunk
*, nsOSG
>::_type(
161 PolygonChunk::getClassType(),
165 OSG_FIELDTRAITS_GETTYPE_NS(PolygonChunk
*, nsOSG
)
167 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
171 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
175 /***************************************************************************\
176 * Field Description *
177 \***************************************************************************/
179 void PolygonChunkBase::classDescInserter(TypeObject
&oType
)
181 FieldDescriptionBase
*pDesc
= NULL
;
184 pDesc
= new SFGLenum::Description(
185 SFGLenum::getClassType(),
187 "Defines which side of the polygon is invisible. Set to GL_NONE to not cull anything. See glCullFace.\n",
188 CullFaceFieldId
, CullFaceFieldMask
,
190 (Field::SFDefaultFlags
| Field::FStdAccess
),
191 static_cast<FieldEditMethodSig
>(&PolygonChunk::editHandleCullFace
),
192 static_cast<FieldGetMethodSig
>(&PolygonChunk::getHandleCullFace
));
194 oType
.addInitialDesc(pDesc
);
196 pDesc
= new SFGLenum::Description(
197 SFGLenum::getClassType(),
199 "Defines which side of the polygon is considered the front side base on vertex ordering\n"
200 "of clockwise (CW) of counter clockwise (CCW). defaults to GL_CCW. See glFrontFace.\n",
201 FrontFaceFieldId
, FrontFaceFieldMask
,
203 (Field::SFDefaultFlags
| Field::FStdAccess
),
204 static_cast<FieldEditMethodSig
>(&PolygonChunk::editHandleFrontFace
),
205 static_cast<FieldGetMethodSig
>(&PolygonChunk::getHandleFrontFace
));
207 oType
.addInitialDesc(pDesc
);
209 pDesc
= new SFGLenum::Description(
210 SFGLenum::getClassType(),
212 "Defines if polygon front sides are rendered filled (default), outlined or as points. See glPolygonMode.\n",
213 FrontModeFieldId
, FrontModeFieldMask
,
215 (Field::SFDefaultFlags
| Field::FStdAccess
),
216 static_cast<FieldEditMethodSig
>(&PolygonChunk::editHandleFrontMode
),
217 static_cast<FieldGetMethodSig
>(&PolygonChunk::getHandleFrontMode
));
219 oType
.addInitialDesc(pDesc
);
221 pDesc
= new SFGLenum::Description(
222 SFGLenum::getClassType(),
224 "Defines if polygon front sides are rendered filled (default), outlined or as points. See glPolygonMode.\n",
225 BackModeFieldId
, BackModeFieldMask
,
227 (Field::SFDefaultFlags
| Field::FStdAccess
),
228 static_cast<FieldEditMethodSig
>(&PolygonChunk::editHandleBackMode
),
229 static_cast<FieldGetMethodSig
>(&PolygonChunk::getHandleBackMode
));
231 oType
.addInitialDesc(pDesc
);
233 pDesc
= new SFBool::Description(
234 SFBool::getClassType(),
236 "Defines if polygon antialiasing is used. See GL_POLYGON_SMOOTH.\n",
237 SmoothFieldId
, SmoothFieldMask
,
239 (Field::SFDefaultFlags
| Field::FStdAccess
),
240 static_cast<FieldEditMethodSig
>(&PolygonChunk::editHandleSmooth
),
241 static_cast<FieldGetMethodSig
>(&PolygonChunk::getHandleSmooth
));
243 oType
.addInitialDesc(pDesc
);
245 pDesc
= new SFReal32::Description(
246 SFReal32::getClassType(),
248 "Defines the offset factor. See glPolygonOffset.\n",
249 OffsetFactorFieldId
, OffsetFactorFieldMask
,
251 (Field::SFDefaultFlags
| Field::FStdAccess
),
252 static_cast<FieldEditMethodSig
>(&PolygonChunk::editHandleOffsetFactor
),
253 static_cast<FieldGetMethodSig
>(&PolygonChunk::getHandleOffsetFactor
));
255 oType
.addInitialDesc(pDesc
);
257 pDesc
= new SFReal32::Description(
258 SFReal32::getClassType(),
260 "Defines the offset bias. See glPolygonOffset.\n",
261 OffsetBiasFieldId
, OffsetBiasFieldMask
,
263 (Field::SFDefaultFlags
| Field::FStdAccess
),
264 static_cast<FieldEditMethodSig
>(&PolygonChunk::editHandleOffsetBias
),
265 static_cast<FieldGetMethodSig
>(&PolygonChunk::getHandleOffsetBias
));
267 oType
.addInitialDesc(pDesc
);
269 pDesc
= new SFBool::Description(
270 SFBool::getClassType(),
272 "Enables offsetting for points.\n",
273 OffsetPointFieldId
, OffsetPointFieldMask
,
275 (Field::SFDefaultFlags
| Field::FStdAccess
),
276 static_cast<FieldEditMethodSig
>(&PolygonChunk::editHandleOffsetPoint
),
277 static_cast<FieldGetMethodSig
>(&PolygonChunk::getHandleOffsetPoint
));
279 oType
.addInitialDesc(pDesc
);
281 pDesc
= new SFBool::Description(
282 SFBool::getClassType(),
284 "Enables offsetting for lines.\n",
285 OffsetLineFieldId
, OffsetLineFieldMask
,
287 (Field::SFDefaultFlags
| Field::FStdAccess
),
288 static_cast<FieldEditMethodSig
>(&PolygonChunk::editHandleOffsetLine
),
289 static_cast<FieldGetMethodSig
>(&PolygonChunk::getHandleOffsetLine
));
291 oType
.addInitialDesc(pDesc
);
293 pDesc
= new SFBool::Description(
294 SFBool::getClassType(),
296 "Enables offsetting for polygons.\n",
297 OffsetFillFieldId
, OffsetFillFieldMask
,
299 (Field::SFDefaultFlags
| Field::FStdAccess
),
300 static_cast<FieldEditMethodSig
>(&PolygonChunk::editHandleOffsetFill
),
301 static_cast<FieldGetMethodSig
>(&PolygonChunk::getHandleOffsetFill
));
303 oType
.addInitialDesc(pDesc
);
305 pDesc
= new MFInt32::Description(
306 MFInt32::getClassType(),
308 "Defines the stipple pattern. Is only valid and used if it contains \n"
310 StippleFieldId
, StippleFieldMask
,
312 (Field::MFDefaultFlags
| Field::FStdAccess
),
313 static_cast<FieldEditMethodSig
>(&PolygonChunk::editHandleStipple
),
314 static_cast<FieldGetMethodSig
>(&PolygonChunk::getHandleStipple
));
316 oType
.addInitialDesc(pDesc
);
320 PolygonChunkBase::TypeObject
PolygonChunkBase::_type(
321 PolygonChunkBase::getClassname(),
322 Inherited::getClassname(),
325 reinterpret_cast<PrototypeCreateF
>(&PolygonChunkBase::createEmptyLocal
),
326 reinterpret_cast<InitContainerF
>(&PolygonChunk::initMethod
),
327 reinterpret_cast<ExitContainerF
>(&PolygonChunk::exitMethod
),
328 reinterpret_cast<InitalInsertDescFunc
>(
329 reinterpret_cast<void *>(&PolygonChunk::classDescInserter
)),
332 "<?xml version=\"1.0\" ?>\n"
335 " name=\"PolygonChunk\"\n"
336 " parent=\"StateChunk\"\n"
337 " library=\"System\"\n"
338 " structure=\"concrete\"\n"
339 " pointerfieldtypes=\"both\"\n"
340 " systemcomponent=\"true\"\n"
341 " parentsystemcomponent=\"true\"\n"
342 " docGroupBase=\"GrpSystemState\"\n"
345 "See \\ref PageSystemPolygonChunk for details.\n"
347 "The parameters of the following functions are wrapped here:\n"
349 "<li>glCullFace() (OSG::PolygonChunk::_sfCullFace),</li>\n"
350 "<li>glFrontFace()(OSG::PolygonChunk::_sfFrontFace),</li>\n"
351 "<li>glPolygonMode() (OSG::PolygonChunk::_sfFrontMode, OSG::PolygonChunk::_sfBackMode),</li>\n"
352 "<li>glEnable(GL_POLYGON_SMOOTH) (OSG::PolygonChunk::_sfSmooth),</li>\n"
353 "<li>glPolygonOffset() (OSG::PolygonChunk::_sfOffsetFactor, OSG::PolygonChunk::_sfOffsetBias),</li>\n"
354 "<li>glEnable(GL_POLYGON_OFFSET_POINT) (OSG::PolygonChunk::_sfOffsetPoint),</li>\n"
355 "<li>glEnable(GL_POLYGON_OFFSET_LINE) (OSG::PolygonChunk::_sfOffsetLine),</li>\n"
356 "<li>glEnable(GL_POLYGON_OFFSET_FILL) (OSG::PolygonChunk::_sfOffsetFill),</li>\n"
357 "<li>glStipplePattern() and glEnable(GL_POLYGON_STIPPLE) (OSG::PolygonChunk::_sfStipple).</li>\n"
360 "\t\tname=\"cullFace\"\n"
361 "\t\ttype=\"GLenum\"\n"
362 "\t\tcardinality=\"single\"\n"
363 "\t\tvisibility=\"external\"\n"
364 "\t\tdefaultValue=\"GL_NONE\"\n"
365 "\t\tdefaultHeader=\""OSGGL.h"\"\n"
366 " potential_values=\"GL_NONE,GL_FRONT,GL_BACK,GL_FRONT_AND_BACK\"\n"
368 "\tDefines which side of the polygon is invisible. Set to GL_NONE to not cull anything. See glCullFace.\n"
371 "\t\tname=\"frontFace\"\n"
372 "\t\ttype=\"GLenum\"\n"
373 "\t\tcardinality=\"single\"\n"
374 "\t\tvisibility=\"external\"\n"
375 "\t\tdefaultValue=\"GL_CCW\"\n"
376 "\t\tdefaultHeader=\""OSGGL.h"\"\n"
377 " potential_values=\"GL_CCW,GL_CW\"\n"
379 "\tDefines which side of the polygon is considered the front side base on vertex ordering\n"
380 " of clockwise (CW) of counter clockwise (CCW). defaults to GL_CCW. See glFrontFace.\n"
383 "\t\tname=\"frontMode\"\n"
384 "\t\ttype=\"GLenum\"\n"
385 "\t\tcardinality=\"single\"\n"
386 "\t\tvisibility=\"external\"\n"
387 "\t\tdefaultValue=\"GL_FILL\"\n"
388 "\t\tdefaultHeader=\""OSGGL.h"\"\n"
389 " potential_values=\"GL_FILL,GL_LINE,GL_POINT\"\n"
391 "\tDefines if polygon front sides are rendered filled (default), outlined or as points. See glPolygonMode.\n"
394 "\t\tname=\"backMode\"\n"
395 "\t\ttype=\"GLenum\"\n"
396 "\t\tcardinality=\"single\"\n"
397 "\t\tvisibility=\"external\"\n"
398 "\t\tdefaultValue=\"GL_FILL\"\n"
399 "\t\tdefaultHeader=\""OSGGL.h"\"\n"
400 " potential_values=\"GL_FILL,GL_LINE,GL_POINT\" \n"
402 "\tDefines if polygon front sides are rendered filled (default), outlined or as points. See glPolygonMode.\n"
405 "\t\tname=\"smooth\"\n"
406 "\t\ttype=\"bool\"\n"
407 "\t\tcardinality=\"single\"\n"
408 "\t\tvisibility=\"external\"\n"
409 "\t\tdefaultValue=\"GL_FALSE\"\n"
410 "\t\tdefaultHeader=\""OSGGL.h"\"\n"
412 "\tDefines if polygon antialiasing is used. See GL_POLYGON_SMOOTH.\n"
415 "\t\tname=\"offsetFactor\"\n"
416 "\t\ttype=\"Real32\"\n"
417 "\t\tcardinality=\"single\"\n"
418 "\t\tvisibility=\"external\"\n"
419 "\t\tdefaultValue=\"0\"\n"
421 "\tDefines the offset factor. See glPolygonOffset.\n"
424 "\t\tname=\"offsetBias\"\n"
425 "\t\ttype=\"Real32\"\n"
426 "\t\tcardinality=\"single\"\n"
427 "\t\tvisibility=\"external\"\n"
428 "\t\tdefaultValue=\"0\"\n"
430 "\tDefines the offset bias. See glPolygonOffset.\n"
433 "\t\tname=\"offsetPoint\"\n"
434 "\t\ttype=\"bool\"\n"
435 "\t\tcardinality=\"single\"\n"
436 "\t\tvisibility=\"external\"\n"
437 "\t\tdefaultValue=\"GL_FALSE\"\n"
438 "\t\tdefaultHeader=\""OSGGL.h"\"\n"
440 "\tEnables offsetting for points.\n"
443 "\t\tname=\"offsetLine\"\n"
444 "\t\ttype=\"bool\"\n"
445 "\t\tcardinality=\"single\"\n"
446 "\t\tvisibility=\"external\"\n"
447 "\t\tdefaultValue=\"GL_FALSE\"\n"
448 "\t\tdefaultHeader=\""OSGGL.h"\"\n"
450 "\tEnables offsetting for lines.\n"
453 "\t\tname=\"offsetFill\"\n"
454 "\t\ttype=\"bool\"\n"
455 "\t\tcardinality=\"single\"\n"
456 "\t\tvisibility=\"external\"\n"
457 "\t\tdefaultValue=\"GL_FALSE\"\n"
458 "\t\tdefaultHeader=\""OSGGL.h"\"\n"
460 "\tEnables offsetting for polygons.\n"
463 "\t\tname=\"stipple\"\n"
464 "\t\ttype=\"Int32\"\n"
465 "\t\tcardinality=\"multi\"\n"
466 "\t\tvisibility=\"external\"\n"
467 "\t\tdefaultValue=\"\"\n"
469 "\tDefines the stipple pattern. Is only valid and used if it contains \n"
472 "</FieldContainer>\n",
473 "See \\ref PageSystemPolygonChunk for details.\n"
475 "The parameters of the following functions are wrapped here:\n"
477 "<li>glCullFace() (OSG::PolygonChunk::_sfCullFace),</li>\n"
478 "<li>glFrontFace()(OSG::PolygonChunk::_sfFrontFace),</li>\n"
479 "<li>glPolygonMode() (OSG::PolygonChunk::_sfFrontMode, OSG::PolygonChunk::_sfBackMode),</li>\n"
480 "<li>glEnable(GL_POLYGON_SMOOTH) (OSG::PolygonChunk::_sfSmooth),</li>\n"
481 "<li>glPolygonOffset() (OSG::PolygonChunk::_sfOffsetFactor, OSG::PolygonChunk::_sfOffsetBias),</li>\n"
482 "<li>glEnable(GL_POLYGON_OFFSET_POINT) (OSG::PolygonChunk::_sfOffsetPoint),</li>\n"
483 "<li>glEnable(GL_POLYGON_OFFSET_LINE) (OSG::PolygonChunk::_sfOffsetLine),</li>\n"
484 "<li>glEnable(GL_POLYGON_OFFSET_FILL) (OSG::PolygonChunk::_sfOffsetFill),</li>\n"
485 "<li>glStipplePattern() and glEnable(GL_POLYGON_STIPPLE) (OSG::PolygonChunk::_sfStipple).</li>\n"
489 /*------------------------------ get -----------------------------------*/
491 FieldContainerType
&PolygonChunkBase::getType(void)
496 const FieldContainerType
&PolygonChunkBase::getType(void) const
501 UInt32
PolygonChunkBase::getContainerSize(void) const
503 return sizeof(PolygonChunk
);
506 /*------------------------- decorator get ------------------------------*/
509 SFGLenum
*PolygonChunkBase::editSFCullFace(void)
511 editSField(CullFaceFieldMask
);
516 const SFGLenum
*PolygonChunkBase::getSFCullFace(void) const
522 SFGLenum
*PolygonChunkBase::editSFFrontFace(void)
524 editSField(FrontFaceFieldMask
);
526 return &_sfFrontFace
;
529 const SFGLenum
*PolygonChunkBase::getSFFrontFace(void) const
531 return &_sfFrontFace
;
535 SFGLenum
*PolygonChunkBase::editSFFrontMode(void)
537 editSField(FrontModeFieldMask
);
539 return &_sfFrontMode
;
542 const SFGLenum
*PolygonChunkBase::getSFFrontMode(void) const
544 return &_sfFrontMode
;
548 SFGLenum
*PolygonChunkBase::editSFBackMode(void)
550 editSField(BackModeFieldMask
);
555 const SFGLenum
*PolygonChunkBase::getSFBackMode(void) const
561 SFBool
*PolygonChunkBase::editSFSmooth(void)
563 editSField(SmoothFieldMask
);
568 const SFBool
*PolygonChunkBase::getSFSmooth(void) const
574 SFReal32
*PolygonChunkBase::editSFOffsetFactor(void)
576 editSField(OffsetFactorFieldMask
);
578 return &_sfOffsetFactor
;
581 const SFReal32
*PolygonChunkBase::getSFOffsetFactor(void) const
583 return &_sfOffsetFactor
;
587 SFReal32
*PolygonChunkBase::editSFOffsetBias(void)
589 editSField(OffsetBiasFieldMask
);
591 return &_sfOffsetBias
;
594 const SFReal32
*PolygonChunkBase::getSFOffsetBias(void) const
596 return &_sfOffsetBias
;
600 SFBool
*PolygonChunkBase::editSFOffsetPoint(void)
602 editSField(OffsetPointFieldMask
);
604 return &_sfOffsetPoint
;
607 const SFBool
*PolygonChunkBase::getSFOffsetPoint(void) const
609 return &_sfOffsetPoint
;
613 SFBool
*PolygonChunkBase::editSFOffsetLine(void)
615 editSField(OffsetLineFieldMask
);
617 return &_sfOffsetLine
;
620 const SFBool
*PolygonChunkBase::getSFOffsetLine(void) const
622 return &_sfOffsetLine
;
626 SFBool
*PolygonChunkBase::editSFOffsetFill(void)
628 editSField(OffsetFillFieldMask
);
630 return &_sfOffsetFill
;
633 const SFBool
*PolygonChunkBase::getSFOffsetFill(void) const
635 return &_sfOffsetFill
;
639 MFInt32
*PolygonChunkBase::editMFStipple(void)
641 editMField(StippleFieldMask
, _mfStipple
);
646 const MFInt32
*PolygonChunkBase::getMFStipple(void) const
656 /*------------------------------ access -----------------------------------*/
658 SizeT
PolygonChunkBase::getBinSize(ConstFieldMaskArg whichField
)
660 SizeT returnValue
= Inherited::getBinSize(whichField
);
662 if(FieldBits::NoField
!= (CullFaceFieldMask
& whichField
))
664 returnValue
+= _sfCullFace
.getBinSize();
666 if(FieldBits::NoField
!= (FrontFaceFieldMask
& whichField
))
668 returnValue
+= _sfFrontFace
.getBinSize();
670 if(FieldBits::NoField
!= (FrontModeFieldMask
& whichField
))
672 returnValue
+= _sfFrontMode
.getBinSize();
674 if(FieldBits::NoField
!= (BackModeFieldMask
& whichField
))
676 returnValue
+= _sfBackMode
.getBinSize();
678 if(FieldBits::NoField
!= (SmoothFieldMask
& whichField
))
680 returnValue
+= _sfSmooth
.getBinSize();
682 if(FieldBits::NoField
!= (OffsetFactorFieldMask
& whichField
))
684 returnValue
+= _sfOffsetFactor
.getBinSize();
686 if(FieldBits::NoField
!= (OffsetBiasFieldMask
& whichField
))
688 returnValue
+= _sfOffsetBias
.getBinSize();
690 if(FieldBits::NoField
!= (OffsetPointFieldMask
& whichField
))
692 returnValue
+= _sfOffsetPoint
.getBinSize();
694 if(FieldBits::NoField
!= (OffsetLineFieldMask
& whichField
))
696 returnValue
+= _sfOffsetLine
.getBinSize();
698 if(FieldBits::NoField
!= (OffsetFillFieldMask
& whichField
))
700 returnValue
+= _sfOffsetFill
.getBinSize();
702 if(FieldBits::NoField
!= (StippleFieldMask
& whichField
))
704 returnValue
+= _mfStipple
.getBinSize();
710 void PolygonChunkBase::copyToBin(BinaryDataHandler
&pMem
,
711 ConstFieldMaskArg whichField
)
713 Inherited::copyToBin(pMem
, whichField
);
715 if(FieldBits::NoField
!= (CullFaceFieldMask
& whichField
))
717 _sfCullFace
.copyToBin(pMem
);
719 if(FieldBits::NoField
!= (FrontFaceFieldMask
& whichField
))
721 _sfFrontFace
.copyToBin(pMem
);
723 if(FieldBits::NoField
!= (FrontModeFieldMask
& whichField
))
725 _sfFrontMode
.copyToBin(pMem
);
727 if(FieldBits::NoField
!= (BackModeFieldMask
& whichField
))
729 _sfBackMode
.copyToBin(pMem
);
731 if(FieldBits::NoField
!= (SmoothFieldMask
& whichField
))
733 _sfSmooth
.copyToBin(pMem
);
735 if(FieldBits::NoField
!= (OffsetFactorFieldMask
& whichField
))
737 _sfOffsetFactor
.copyToBin(pMem
);
739 if(FieldBits::NoField
!= (OffsetBiasFieldMask
& whichField
))
741 _sfOffsetBias
.copyToBin(pMem
);
743 if(FieldBits::NoField
!= (OffsetPointFieldMask
& whichField
))
745 _sfOffsetPoint
.copyToBin(pMem
);
747 if(FieldBits::NoField
!= (OffsetLineFieldMask
& whichField
))
749 _sfOffsetLine
.copyToBin(pMem
);
751 if(FieldBits::NoField
!= (OffsetFillFieldMask
& whichField
))
753 _sfOffsetFill
.copyToBin(pMem
);
755 if(FieldBits::NoField
!= (StippleFieldMask
& whichField
))
757 _mfStipple
.copyToBin(pMem
);
761 void PolygonChunkBase::copyFromBin(BinaryDataHandler
&pMem
,
762 ConstFieldMaskArg whichField
)
764 Inherited::copyFromBin(pMem
, whichField
);
766 if(FieldBits::NoField
!= (CullFaceFieldMask
& whichField
))
768 editSField(CullFaceFieldMask
);
769 _sfCullFace
.copyFromBin(pMem
);
771 if(FieldBits::NoField
!= (FrontFaceFieldMask
& whichField
))
773 editSField(FrontFaceFieldMask
);
774 _sfFrontFace
.copyFromBin(pMem
);
776 if(FieldBits::NoField
!= (FrontModeFieldMask
& whichField
))
778 editSField(FrontModeFieldMask
);
779 _sfFrontMode
.copyFromBin(pMem
);
781 if(FieldBits::NoField
!= (BackModeFieldMask
& whichField
))
783 editSField(BackModeFieldMask
);
784 _sfBackMode
.copyFromBin(pMem
);
786 if(FieldBits::NoField
!= (SmoothFieldMask
& whichField
))
788 editSField(SmoothFieldMask
);
789 _sfSmooth
.copyFromBin(pMem
);
791 if(FieldBits::NoField
!= (OffsetFactorFieldMask
& whichField
))
793 editSField(OffsetFactorFieldMask
);
794 _sfOffsetFactor
.copyFromBin(pMem
);
796 if(FieldBits::NoField
!= (OffsetBiasFieldMask
& whichField
))
798 editSField(OffsetBiasFieldMask
);
799 _sfOffsetBias
.copyFromBin(pMem
);
801 if(FieldBits::NoField
!= (OffsetPointFieldMask
& whichField
))
803 editSField(OffsetPointFieldMask
);
804 _sfOffsetPoint
.copyFromBin(pMem
);
806 if(FieldBits::NoField
!= (OffsetLineFieldMask
& whichField
))
808 editSField(OffsetLineFieldMask
);
809 _sfOffsetLine
.copyFromBin(pMem
);
811 if(FieldBits::NoField
!= (OffsetFillFieldMask
& whichField
))
813 editSField(OffsetFillFieldMask
);
814 _sfOffsetFill
.copyFromBin(pMem
);
816 if(FieldBits::NoField
!= (StippleFieldMask
& whichField
))
818 editMField(StippleFieldMask
, _mfStipple
);
819 _mfStipple
.copyFromBin(pMem
);
823 //! create a new instance of the class
824 PolygonChunkTransitPtr
PolygonChunkBase::createLocal(BitVector bFlags
)
826 PolygonChunkTransitPtr fc
;
828 if(getClassType().getPrototype() != NULL
)
830 FieldContainerTransitPtr tmpPtr
=
831 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
833 fc
= dynamic_pointer_cast
<PolygonChunk
>(tmpPtr
);
839 //! create a new instance of the class, copy the container flags
840 PolygonChunkTransitPtr
PolygonChunkBase::createDependent(BitVector bFlags
)
842 PolygonChunkTransitPtr fc
;
844 if(getClassType().getPrototype() != NULL
)
846 FieldContainerTransitPtr tmpPtr
=
847 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
849 fc
= dynamic_pointer_cast
<PolygonChunk
>(tmpPtr
);
855 //! create a new instance of the class
856 PolygonChunkTransitPtr
PolygonChunkBase::create(void)
858 PolygonChunkTransitPtr fc
;
860 if(getClassType().getPrototype() != NULL
)
862 FieldContainerTransitPtr tmpPtr
=
863 getClassType().getPrototype()-> shallowCopy();
865 fc
= dynamic_pointer_cast
<PolygonChunk
>(tmpPtr
);
871 PolygonChunk
*PolygonChunkBase::createEmptyLocal(BitVector bFlags
)
873 PolygonChunk
*returnValue
;
875 newPtr
<PolygonChunk
>(returnValue
, bFlags
);
877 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
882 //! create an empty new instance of the class, do not copy the prototype
883 PolygonChunk
*PolygonChunkBase::createEmpty(void)
885 PolygonChunk
*returnValue
;
887 newPtr
<PolygonChunk
>(returnValue
, Thread::getCurrentLocalFlags());
889 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
890 ~Thread::getCurrentLocalFlags();
896 FieldContainerTransitPtr
PolygonChunkBase::shallowCopyLocal(
897 BitVector bFlags
) const
899 PolygonChunk
*tmpPtr
;
901 newPtr(tmpPtr
, dynamic_cast<const PolygonChunk
*>(this), bFlags
);
903 FieldContainerTransitPtr
returnValue(tmpPtr
);
905 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
910 FieldContainerTransitPtr
PolygonChunkBase::shallowCopyDependent(
911 BitVector bFlags
) const
913 PolygonChunk
*tmpPtr
;
915 newPtr(tmpPtr
, dynamic_cast<const PolygonChunk
*>(this), ~bFlags
);
917 FieldContainerTransitPtr
returnValue(tmpPtr
);
919 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
924 FieldContainerTransitPtr
PolygonChunkBase::shallowCopy(void) const
926 PolygonChunk
*tmpPtr
;
929 dynamic_cast<const PolygonChunk
*>(this),
930 Thread::getCurrentLocalFlags());
932 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
934 FieldContainerTransitPtr
returnValue(tmpPtr
);
942 /*------------------------- constructors ----------------------------------*/
944 PolygonChunkBase::PolygonChunkBase(void) :
946 _sfCullFace (GLenum(GL_NONE
)),
947 _sfFrontFace (GLenum(GL_CCW
)),
948 _sfFrontMode (GLenum(GL_FILL
)),
949 _sfBackMode (GLenum(GL_FILL
)),
950 _sfSmooth (bool(GL_FALSE
)),
951 _sfOffsetFactor (Real32(0)),
952 _sfOffsetBias (Real32(0)),
953 _sfOffsetPoint (bool(GL_FALSE
)),
954 _sfOffsetLine (bool(GL_FALSE
)),
955 _sfOffsetFill (bool(GL_FALSE
)),
960 PolygonChunkBase::PolygonChunkBase(const PolygonChunkBase
&source
) :
962 _sfCullFace (source
._sfCullFace
),
963 _sfFrontFace (source
._sfFrontFace
),
964 _sfFrontMode (source
._sfFrontMode
),
965 _sfBackMode (source
._sfBackMode
),
966 _sfSmooth (source
._sfSmooth
),
967 _sfOffsetFactor (source
._sfOffsetFactor
),
968 _sfOffsetBias (source
._sfOffsetBias
),
969 _sfOffsetPoint (source
._sfOffsetPoint
),
970 _sfOffsetLine (source
._sfOffsetLine
),
971 _sfOffsetFill (source
._sfOffsetFill
),
972 _mfStipple (source
._mfStipple
)
977 /*-------------------------- destructors ----------------------------------*/
979 PolygonChunkBase::~PolygonChunkBase(void)
984 GetFieldHandlePtr
PolygonChunkBase::getHandleCullFace (void) const
986 SFGLenum::GetHandlePtr
returnValue(
987 new SFGLenum::GetHandle(
989 this->getType().getFieldDesc(CullFaceFieldId
),
990 const_cast<PolygonChunkBase
*>(this)));
995 EditFieldHandlePtr
PolygonChunkBase::editHandleCullFace (void)
997 SFGLenum::EditHandlePtr
returnValue(
998 new SFGLenum::EditHandle(
1000 this->getType().getFieldDesc(CullFaceFieldId
),
1004 editSField(CullFaceFieldMask
);
1009 GetFieldHandlePtr
PolygonChunkBase::getHandleFrontFace (void) const
1011 SFGLenum::GetHandlePtr
returnValue(
1012 new SFGLenum::GetHandle(
1014 this->getType().getFieldDesc(FrontFaceFieldId
),
1015 const_cast<PolygonChunkBase
*>(this)));
1020 EditFieldHandlePtr
PolygonChunkBase::editHandleFrontFace (void)
1022 SFGLenum::EditHandlePtr
returnValue(
1023 new SFGLenum::EditHandle(
1025 this->getType().getFieldDesc(FrontFaceFieldId
),
1029 editSField(FrontFaceFieldMask
);
1034 GetFieldHandlePtr
PolygonChunkBase::getHandleFrontMode (void) const
1036 SFGLenum::GetHandlePtr
returnValue(
1037 new SFGLenum::GetHandle(
1039 this->getType().getFieldDesc(FrontModeFieldId
),
1040 const_cast<PolygonChunkBase
*>(this)));
1045 EditFieldHandlePtr
PolygonChunkBase::editHandleFrontMode (void)
1047 SFGLenum::EditHandlePtr
returnValue(
1048 new SFGLenum::EditHandle(
1050 this->getType().getFieldDesc(FrontModeFieldId
),
1054 editSField(FrontModeFieldMask
);
1059 GetFieldHandlePtr
PolygonChunkBase::getHandleBackMode (void) const
1061 SFGLenum::GetHandlePtr
returnValue(
1062 new SFGLenum::GetHandle(
1064 this->getType().getFieldDesc(BackModeFieldId
),
1065 const_cast<PolygonChunkBase
*>(this)));
1070 EditFieldHandlePtr
PolygonChunkBase::editHandleBackMode (void)
1072 SFGLenum::EditHandlePtr
returnValue(
1073 new SFGLenum::EditHandle(
1075 this->getType().getFieldDesc(BackModeFieldId
),
1079 editSField(BackModeFieldMask
);
1084 GetFieldHandlePtr
PolygonChunkBase::getHandleSmooth (void) const
1086 SFBool::GetHandlePtr
returnValue(
1087 new SFBool::GetHandle(
1089 this->getType().getFieldDesc(SmoothFieldId
),
1090 const_cast<PolygonChunkBase
*>(this)));
1095 EditFieldHandlePtr
PolygonChunkBase::editHandleSmooth (void)
1097 SFBool::EditHandlePtr
returnValue(
1098 new SFBool::EditHandle(
1100 this->getType().getFieldDesc(SmoothFieldId
),
1104 editSField(SmoothFieldMask
);
1109 GetFieldHandlePtr
PolygonChunkBase::getHandleOffsetFactor (void) const
1111 SFReal32::GetHandlePtr
returnValue(
1112 new SFReal32::GetHandle(
1114 this->getType().getFieldDesc(OffsetFactorFieldId
),
1115 const_cast<PolygonChunkBase
*>(this)));
1120 EditFieldHandlePtr
PolygonChunkBase::editHandleOffsetFactor (void)
1122 SFReal32::EditHandlePtr
returnValue(
1123 new SFReal32::EditHandle(
1125 this->getType().getFieldDesc(OffsetFactorFieldId
),
1129 editSField(OffsetFactorFieldMask
);
1134 GetFieldHandlePtr
PolygonChunkBase::getHandleOffsetBias (void) const
1136 SFReal32::GetHandlePtr
returnValue(
1137 new SFReal32::GetHandle(
1139 this->getType().getFieldDesc(OffsetBiasFieldId
),
1140 const_cast<PolygonChunkBase
*>(this)));
1145 EditFieldHandlePtr
PolygonChunkBase::editHandleOffsetBias (void)
1147 SFReal32::EditHandlePtr
returnValue(
1148 new SFReal32::EditHandle(
1150 this->getType().getFieldDesc(OffsetBiasFieldId
),
1154 editSField(OffsetBiasFieldMask
);
1159 GetFieldHandlePtr
PolygonChunkBase::getHandleOffsetPoint (void) const
1161 SFBool::GetHandlePtr
returnValue(
1162 new SFBool::GetHandle(
1164 this->getType().getFieldDesc(OffsetPointFieldId
),
1165 const_cast<PolygonChunkBase
*>(this)));
1170 EditFieldHandlePtr
PolygonChunkBase::editHandleOffsetPoint (void)
1172 SFBool::EditHandlePtr
returnValue(
1173 new SFBool::EditHandle(
1175 this->getType().getFieldDesc(OffsetPointFieldId
),
1179 editSField(OffsetPointFieldMask
);
1184 GetFieldHandlePtr
PolygonChunkBase::getHandleOffsetLine (void) const
1186 SFBool::GetHandlePtr
returnValue(
1187 new SFBool::GetHandle(
1189 this->getType().getFieldDesc(OffsetLineFieldId
),
1190 const_cast<PolygonChunkBase
*>(this)));
1195 EditFieldHandlePtr
PolygonChunkBase::editHandleOffsetLine (void)
1197 SFBool::EditHandlePtr
returnValue(
1198 new SFBool::EditHandle(
1200 this->getType().getFieldDesc(OffsetLineFieldId
),
1204 editSField(OffsetLineFieldMask
);
1209 GetFieldHandlePtr
PolygonChunkBase::getHandleOffsetFill (void) const
1211 SFBool::GetHandlePtr
returnValue(
1212 new SFBool::GetHandle(
1214 this->getType().getFieldDesc(OffsetFillFieldId
),
1215 const_cast<PolygonChunkBase
*>(this)));
1220 EditFieldHandlePtr
PolygonChunkBase::editHandleOffsetFill (void)
1222 SFBool::EditHandlePtr
returnValue(
1223 new SFBool::EditHandle(
1225 this->getType().getFieldDesc(OffsetFillFieldId
),
1229 editSField(OffsetFillFieldMask
);
1234 GetFieldHandlePtr
PolygonChunkBase::getHandleStipple (void) const
1236 MFInt32::GetHandlePtr
returnValue(
1237 new MFInt32::GetHandle(
1239 this->getType().getFieldDesc(StippleFieldId
),
1240 const_cast<PolygonChunkBase
*>(this)));
1245 EditFieldHandlePtr
PolygonChunkBase::editHandleStipple (void)
1247 MFInt32::EditHandlePtr
returnValue(
1248 new MFInt32::EditHandle(
1250 this->getType().getFieldDesc(StippleFieldId
),
1254 editMField(StippleFieldMask
, _mfStipple
);
1260 #ifdef OSG_MT_CPTR_ASPECT
1261 void PolygonChunkBase::execSyncV( FieldContainer
&oFrom
,
1262 ConstFieldMaskArg whichField
,
1263 AspectOffsetStore
&oOffsets
,
1264 ConstFieldMaskArg syncMode
,
1265 const UInt32 uiSyncInfo
)
1267 PolygonChunk
*pThis
= static_cast<PolygonChunk
*>(this);
1269 pThis
->execSync(static_cast<PolygonChunk
*>(&oFrom
),
1278 #ifdef OSG_MT_CPTR_ASPECT
1279 FieldContainer
*PolygonChunkBase::createAspectCopy(
1280 const FieldContainer
*pRefAspect
) const
1282 PolygonChunk
*returnValue
;
1284 newAspectCopy(returnValue
,
1285 dynamic_cast<const PolygonChunk
*>(pRefAspect
),
1286 dynamic_cast<const PolygonChunk
*>(this));
1292 void PolygonChunkBase::resolveLinks(void)
1294 Inherited::resolveLinks();
1296 #ifdef OSG_MT_CPTR_ASPECT
1297 AspectOffsetStore oOffsets
;
1299 _pAspectStore
->fillOffsetArray(oOffsets
, this);
1302 #ifdef OSG_MT_CPTR_ASPECT
1303 _mfStipple
.terminateShare(Thread::getCurrentAspect(),