changed: gcc8 base update
[opensg.git] / Source / System / State / Base / OSGPolygonChunkBase.cpp
blob2fce3c1cca9c19ac632c2c14f3e8aed66fcf89e3
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 PolygonChunk!
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"
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>
79 OSG_BEGIN_NAMESPACE
81 /***************************************************************************\
82 * Description *
83 \***************************************************************************/
85 /*! \class OSG::PolygonChunk
86 See \ref PageSystemPolygonChunk for details.
88 The parameters of the following functions are wrapped here:
89 <ul>
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>
99 </ul>
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
149 32 elements.
153 /***************************************************************************\
154 * FieldType/FieldTrait Instantiation *
155 \***************************************************************************/
157 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
158 PointerType FieldTraits<PolygonChunk *, nsOSG>::_type(
159 "PolygonChunkPtr",
160 "StateChunkPtr",
161 PolygonChunk::getClassType(),
162 nsOSG);
163 #endif
165 OSG_FIELDTRAITS_GETTYPE_NS(PolygonChunk *, nsOSG)
167 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
168 PolygonChunk *,
169 nsOSG)
171 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
172 PolygonChunk *,
173 nsOSG)
175 /***************************************************************************\
176 * Field Description *
177 \***************************************************************************/
179 void PolygonChunkBase::classDescInserter(TypeObject &oType)
181 FieldDescriptionBase *pDesc = NULL;
184 pDesc = new SFGLenum::Description(
185 SFGLenum::getClassType(),
186 "cullFace",
187 "Defines which side of the polygon is invisible. Set to GL_NONE to not cull anything. See glCullFace.\n",
188 CullFaceFieldId, CullFaceFieldMask,
189 false,
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(),
198 "frontFace",
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,
202 false,
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(),
211 "frontMode",
212 "Defines if polygon front sides are rendered filled (default), outlined or as points. See glPolygonMode.\n",
213 FrontModeFieldId, FrontModeFieldMask,
214 false,
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(),
223 "backMode",
224 "Defines if polygon front sides are rendered filled (default), outlined or as points. See glPolygonMode.\n",
225 BackModeFieldId, BackModeFieldMask,
226 false,
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(),
235 "smooth",
236 "Defines if polygon antialiasing is used. See GL_POLYGON_SMOOTH.\n",
237 SmoothFieldId, SmoothFieldMask,
238 false,
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(),
247 "offsetFactor",
248 "Defines the offset factor. See glPolygonOffset.\n",
249 OffsetFactorFieldId, OffsetFactorFieldMask,
250 false,
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(),
259 "offsetBias",
260 "Defines the offset bias. See glPolygonOffset.\n",
261 OffsetBiasFieldId, OffsetBiasFieldMask,
262 false,
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(),
271 "offsetPoint",
272 "Enables offsetting for points.\n",
273 OffsetPointFieldId, OffsetPointFieldMask,
274 false,
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(),
283 "offsetLine",
284 "Enables offsetting for lines.\n",
285 OffsetLineFieldId, OffsetLineFieldMask,
286 false,
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(),
295 "offsetFill",
296 "Enables offsetting for polygons.\n",
297 OffsetFillFieldId, OffsetFillFieldMask,
298 false,
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(),
307 "stipple",
308 "Defines the stipple pattern. Is only valid and used if it contains \n"
309 "32 elements.\n",
310 StippleFieldId, StippleFieldMask,
311 false,
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(),
323 "NULL",
324 nsOSG, //Namespace
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)),
330 false,
332 "<?xml version=\"1.0\" ?>\n"
333 "\n"
334 "<FieldContainer\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"
343 "><![CDATA[\n"
344 "\n"
345 "See \\ref PageSystemPolygonChunk for details.\n"
346 "\n"
347 "The parameters of the following functions are wrapped here:\n"
348 "<ul>\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"
358 "</ul>]]>\n"
359 "\t<Field\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=\"&quot;OSGGL.h&quot;\"\n"
366 " potential_values=\"GL_NONE,GL_FRONT,GL_BACK,GL_FRONT_AND_BACK\"\n"
367 "\t>\n"
368 "\tDefines which side of the polygon is invisible. Set to GL_NONE to not cull anything. See glCullFace.\n"
369 "\t</Field>\n"
370 "\t<Field\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=\"&quot;OSGGL.h&quot;\"\n"
377 " potential_values=\"GL_CCW,GL_CW\"\n"
378 "\t>\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"
381 "\t</Field>\n"
382 "\t<Field\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=\"&quot;OSGGL.h&quot;\"\n"
389 " potential_values=\"GL_FILL,GL_LINE,GL_POINT\"\n"
390 "\t>\n"
391 "\tDefines if polygon front sides are rendered filled (default), outlined or as points. See glPolygonMode.\n"
392 "\t</Field>\n"
393 "\t<Field\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=\"&quot;OSGGL.h&quot;\"\n"
400 " potential_values=\"GL_FILL,GL_LINE,GL_POINT\" \n"
401 "\t>\n"
402 "\tDefines if polygon front sides are rendered filled (default), outlined or as points. See glPolygonMode.\n"
403 "\t</Field>\n"
404 "\t<Field\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=\"&quot;OSGGL.h&quot;\"\n"
411 "\t>\n"
412 "\tDefines if polygon antialiasing is used. See GL_POLYGON_SMOOTH.\n"
413 "\t</Field>\n"
414 "\t<Field\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"
420 "\t>\n"
421 "\tDefines the offset factor. See glPolygonOffset.\n"
422 "\t</Field>\n"
423 "\t<Field\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"
429 "\t>\n"
430 "\tDefines the offset bias. See glPolygonOffset.\n"
431 "\t</Field>\n"
432 "\t<Field\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=\"&quot;OSGGL.h&quot;\"\n"
439 "\t>\n"
440 "\tEnables offsetting for points.\n"
441 "\t</Field>\n"
442 "\t<Field\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=\"&quot;OSGGL.h&quot;\"\n"
449 "\t>\n"
450 "\tEnables offsetting for lines.\n"
451 "\t</Field>\n"
452 "\t<Field\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=\"&quot;OSGGL.h&quot;\"\n"
459 "\t>\n"
460 "\tEnables offsetting for polygons.\n"
461 "\t</Field>\n"
462 "\t<Field\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"
468 "\t>\n"
469 "\tDefines the stipple pattern. Is only valid and used if it contains \n"
470 " 32 elements.\n"
471 "\t</Field>\n"
472 "</FieldContainer>\n",
473 "See \\ref PageSystemPolygonChunk for details.\n"
474 "\n"
475 "The parameters of the following functions are wrapped here:\n"
476 "<ul>\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"
486 "</ul>\n"
489 /*------------------------------ get -----------------------------------*/
491 FieldContainerType &PolygonChunkBase::getType(void)
493 return _type;
496 const FieldContainerType &PolygonChunkBase::getType(void) const
498 return _type;
501 UInt32 PolygonChunkBase::getContainerSize(void) const
503 return sizeof(PolygonChunk);
506 /*------------------------- decorator get ------------------------------*/
509 SFGLenum *PolygonChunkBase::editSFCullFace(void)
511 editSField(CullFaceFieldMask);
513 return &_sfCullFace;
516 const SFGLenum *PolygonChunkBase::getSFCullFace(void) const
518 return &_sfCullFace;
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);
552 return &_sfBackMode;
555 const SFGLenum *PolygonChunkBase::getSFBackMode(void) const
557 return &_sfBackMode;
561 SFBool *PolygonChunkBase::editSFSmooth(void)
563 editSField(SmoothFieldMask);
565 return &_sfSmooth;
568 const SFBool *PolygonChunkBase::getSFSmooth(void) const
570 return &_sfSmooth;
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);
643 return &_mfStipple;
646 const MFInt32 *PolygonChunkBase::getMFStipple(void) const
648 return &_mfStipple;
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();
707 return returnValue;
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);
836 return fc;
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);
852 return fc;
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);
868 return fc;
871 PolygonChunk *PolygonChunkBase::createEmptyLocal(BitVector bFlags)
873 PolygonChunk *returnValue;
875 newPtr<PolygonChunk>(returnValue, bFlags);
877 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
879 return returnValue;
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();
892 return returnValue;
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;
907 return returnValue;
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;
921 return returnValue;
924 FieldContainerTransitPtr PolygonChunkBase::shallowCopy(void) const
926 PolygonChunk *tmpPtr;
928 newPtr(tmpPtr,
929 dynamic_cast<const PolygonChunk *>(this),
930 Thread::getCurrentLocalFlags());
932 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
934 FieldContainerTransitPtr returnValue(tmpPtr);
936 return returnValue;
942 /*------------------------- constructors ----------------------------------*/
944 PolygonChunkBase::PolygonChunkBase(void) :
945 Inherited(),
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)),
956 _mfStipple ()
960 PolygonChunkBase::PolygonChunkBase(const PolygonChunkBase &source) :
961 Inherited(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(
988 &_sfCullFace,
989 this->getType().getFieldDesc(CullFaceFieldId),
990 const_cast<PolygonChunkBase *>(this)));
992 return returnValue;
995 EditFieldHandlePtr PolygonChunkBase::editHandleCullFace (void)
997 SFGLenum::EditHandlePtr returnValue(
998 new SFGLenum::EditHandle(
999 &_sfCullFace,
1000 this->getType().getFieldDesc(CullFaceFieldId),
1001 this));
1004 editSField(CullFaceFieldMask);
1006 return returnValue;
1009 GetFieldHandlePtr PolygonChunkBase::getHandleFrontFace (void) const
1011 SFGLenum::GetHandlePtr returnValue(
1012 new SFGLenum::GetHandle(
1013 &_sfFrontFace,
1014 this->getType().getFieldDesc(FrontFaceFieldId),
1015 const_cast<PolygonChunkBase *>(this)));
1017 return returnValue;
1020 EditFieldHandlePtr PolygonChunkBase::editHandleFrontFace (void)
1022 SFGLenum::EditHandlePtr returnValue(
1023 new SFGLenum::EditHandle(
1024 &_sfFrontFace,
1025 this->getType().getFieldDesc(FrontFaceFieldId),
1026 this));
1029 editSField(FrontFaceFieldMask);
1031 return returnValue;
1034 GetFieldHandlePtr PolygonChunkBase::getHandleFrontMode (void) const
1036 SFGLenum::GetHandlePtr returnValue(
1037 new SFGLenum::GetHandle(
1038 &_sfFrontMode,
1039 this->getType().getFieldDesc(FrontModeFieldId),
1040 const_cast<PolygonChunkBase *>(this)));
1042 return returnValue;
1045 EditFieldHandlePtr PolygonChunkBase::editHandleFrontMode (void)
1047 SFGLenum::EditHandlePtr returnValue(
1048 new SFGLenum::EditHandle(
1049 &_sfFrontMode,
1050 this->getType().getFieldDesc(FrontModeFieldId),
1051 this));
1054 editSField(FrontModeFieldMask);
1056 return returnValue;
1059 GetFieldHandlePtr PolygonChunkBase::getHandleBackMode (void) const
1061 SFGLenum::GetHandlePtr returnValue(
1062 new SFGLenum::GetHandle(
1063 &_sfBackMode,
1064 this->getType().getFieldDesc(BackModeFieldId),
1065 const_cast<PolygonChunkBase *>(this)));
1067 return returnValue;
1070 EditFieldHandlePtr PolygonChunkBase::editHandleBackMode (void)
1072 SFGLenum::EditHandlePtr returnValue(
1073 new SFGLenum::EditHandle(
1074 &_sfBackMode,
1075 this->getType().getFieldDesc(BackModeFieldId),
1076 this));
1079 editSField(BackModeFieldMask);
1081 return returnValue;
1084 GetFieldHandlePtr PolygonChunkBase::getHandleSmooth (void) const
1086 SFBool::GetHandlePtr returnValue(
1087 new SFBool::GetHandle(
1088 &_sfSmooth,
1089 this->getType().getFieldDesc(SmoothFieldId),
1090 const_cast<PolygonChunkBase *>(this)));
1092 return returnValue;
1095 EditFieldHandlePtr PolygonChunkBase::editHandleSmooth (void)
1097 SFBool::EditHandlePtr returnValue(
1098 new SFBool::EditHandle(
1099 &_sfSmooth,
1100 this->getType().getFieldDesc(SmoothFieldId),
1101 this));
1104 editSField(SmoothFieldMask);
1106 return returnValue;
1109 GetFieldHandlePtr PolygonChunkBase::getHandleOffsetFactor (void) const
1111 SFReal32::GetHandlePtr returnValue(
1112 new SFReal32::GetHandle(
1113 &_sfOffsetFactor,
1114 this->getType().getFieldDesc(OffsetFactorFieldId),
1115 const_cast<PolygonChunkBase *>(this)));
1117 return returnValue;
1120 EditFieldHandlePtr PolygonChunkBase::editHandleOffsetFactor (void)
1122 SFReal32::EditHandlePtr returnValue(
1123 new SFReal32::EditHandle(
1124 &_sfOffsetFactor,
1125 this->getType().getFieldDesc(OffsetFactorFieldId),
1126 this));
1129 editSField(OffsetFactorFieldMask);
1131 return returnValue;
1134 GetFieldHandlePtr PolygonChunkBase::getHandleOffsetBias (void) const
1136 SFReal32::GetHandlePtr returnValue(
1137 new SFReal32::GetHandle(
1138 &_sfOffsetBias,
1139 this->getType().getFieldDesc(OffsetBiasFieldId),
1140 const_cast<PolygonChunkBase *>(this)));
1142 return returnValue;
1145 EditFieldHandlePtr PolygonChunkBase::editHandleOffsetBias (void)
1147 SFReal32::EditHandlePtr returnValue(
1148 new SFReal32::EditHandle(
1149 &_sfOffsetBias,
1150 this->getType().getFieldDesc(OffsetBiasFieldId),
1151 this));
1154 editSField(OffsetBiasFieldMask);
1156 return returnValue;
1159 GetFieldHandlePtr PolygonChunkBase::getHandleOffsetPoint (void) const
1161 SFBool::GetHandlePtr returnValue(
1162 new SFBool::GetHandle(
1163 &_sfOffsetPoint,
1164 this->getType().getFieldDesc(OffsetPointFieldId),
1165 const_cast<PolygonChunkBase *>(this)));
1167 return returnValue;
1170 EditFieldHandlePtr PolygonChunkBase::editHandleOffsetPoint (void)
1172 SFBool::EditHandlePtr returnValue(
1173 new SFBool::EditHandle(
1174 &_sfOffsetPoint,
1175 this->getType().getFieldDesc(OffsetPointFieldId),
1176 this));
1179 editSField(OffsetPointFieldMask);
1181 return returnValue;
1184 GetFieldHandlePtr PolygonChunkBase::getHandleOffsetLine (void) const
1186 SFBool::GetHandlePtr returnValue(
1187 new SFBool::GetHandle(
1188 &_sfOffsetLine,
1189 this->getType().getFieldDesc(OffsetLineFieldId),
1190 const_cast<PolygonChunkBase *>(this)));
1192 return returnValue;
1195 EditFieldHandlePtr PolygonChunkBase::editHandleOffsetLine (void)
1197 SFBool::EditHandlePtr returnValue(
1198 new SFBool::EditHandle(
1199 &_sfOffsetLine,
1200 this->getType().getFieldDesc(OffsetLineFieldId),
1201 this));
1204 editSField(OffsetLineFieldMask);
1206 return returnValue;
1209 GetFieldHandlePtr PolygonChunkBase::getHandleOffsetFill (void) const
1211 SFBool::GetHandlePtr returnValue(
1212 new SFBool::GetHandle(
1213 &_sfOffsetFill,
1214 this->getType().getFieldDesc(OffsetFillFieldId),
1215 const_cast<PolygonChunkBase *>(this)));
1217 return returnValue;
1220 EditFieldHandlePtr PolygonChunkBase::editHandleOffsetFill (void)
1222 SFBool::EditHandlePtr returnValue(
1223 new SFBool::EditHandle(
1224 &_sfOffsetFill,
1225 this->getType().getFieldDesc(OffsetFillFieldId),
1226 this));
1229 editSField(OffsetFillFieldMask);
1231 return returnValue;
1234 GetFieldHandlePtr PolygonChunkBase::getHandleStipple (void) const
1236 MFInt32::GetHandlePtr returnValue(
1237 new MFInt32::GetHandle(
1238 &_mfStipple,
1239 this->getType().getFieldDesc(StippleFieldId),
1240 const_cast<PolygonChunkBase *>(this)));
1242 return returnValue;
1245 EditFieldHandlePtr PolygonChunkBase::editHandleStipple (void)
1247 MFInt32::EditHandlePtr returnValue(
1248 new MFInt32::EditHandle(
1249 &_mfStipple,
1250 this->getType().getFieldDesc(StippleFieldId),
1251 this));
1254 editMField(StippleFieldMask, _mfStipple);
1256 return returnValue;
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),
1270 whichField,
1271 oOffsets,
1272 syncMode,
1273 uiSyncInfo);
1275 #endif
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));
1288 return returnValue;
1290 #endif
1292 void PolygonChunkBase::resolveLinks(void)
1294 Inherited::resolveLinks();
1296 #ifdef OSG_MT_CPTR_ASPECT
1297 AspectOffsetStore oOffsets;
1299 _pAspectStore->fillOffsetArray(oOffsets, this);
1300 #endif
1302 #ifdef OSG_MT_CPTR_ASPECT
1303 _mfStipple.terminateShare(Thread::getCurrentAspect(),
1304 oOffsets);
1305 #endif
1309 OSG_END_NAMESPACE