changed: gcc8 base update
[opensg.git] / Source / System / State / OpenGL / OSGPointChunkBase.cpp
blobaf6e922044bc4406064bcd7a2027780a7ef50d2a
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 PointChunk!
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" // Smooth default header
65 #include "OSGGL.h" // Sprite default header
66 #include "OSGGL.h" // RMode default header
69 #include "OSGPointChunkBase.h"
70 #include "OSGPointChunk.h"
72 #include <boost/bind.hpp>
74 OSG_BEGIN_NAMESPACE
76 /***************************************************************************\
77 * Description *
78 \***************************************************************************/
80 /*! \class OSG::PointChunk
81 See \ref PageSystemPointChunk for a description.
83 This chunk wraps glPointSize() (OSG::PointChunk::_sfSize) and
84 glEnable(GL_POINT_SMOOTH) (OSG::PointChunk::_sfSmooth). It encompasses the
85 ARB_point_parameters extension (OSG::PointChunk::_sfMinSize,
86 OSG::PointChunk::_sfMaxSize, OSG::PointChunk::_sfFadeThreshold,
87 OSG::PointChunk::_sfConstantAttenuation,
88 OSG::PointChunk::_sfLinearAttenuation,
89 OSG::PointChunk::_sfQuadraticAttenuation) and ARB_point_sprite
90 (OSG::PointChunk::_sfSprite, OSG::PointChunk::_sfRMode).
93 /***************************************************************************\
94 * Field Documentation *
95 \***************************************************************************/
97 /*! \var Real32 PointChunkBase::_sfSize
98 The point's size in pixel.
101 /*! \var bool PointChunkBase::_sfSmooth
102 Defines if line antialiasing is used.
105 /*! \var Real32 PointChunkBase::_sfMinSize
106 Minimum point size for attenuation, use less than 0 to disable it. See
107 ARB_point_parameters extension.
110 /*! \var Real32 PointChunkBase::_sfMaxSize
111 Maximum point size for attenuation. See ARB_point_parameters extension.
114 /*! \var Real32 PointChunkBase::_sfConstantAttenuation
115 The point size's constant attenuation.
118 /*! \var Real32 PointChunkBase::_sfLinearAttenuation
119 The point size's linear attenuation.
122 /*! \var Real32 PointChunkBase::_sfQuadraticAttenuation
123 The point size's quadratic attenuation.
126 /*! \var Real32 PointChunkBase::_sfFadeThreshold
127 Minimum point size for attenuation. See ARB_point_parameters extension.
130 /*! \var bool PointChunkBase::_sfSprite
131 Flag to enable point sprites, see ARB_point_sprite for details.
134 /*! \var GLenum PointChunkBase::_sfRMode
139 /***************************************************************************\
140 * FieldType/FieldTrait Instantiation *
141 \***************************************************************************/
143 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
144 PointerType FieldTraits<PointChunk *, nsOSG>::_type(
145 "PointChunkPtr",
146 "StateChunkPtr",
147 PointChunk::getClassType(),
148 nsOSG);
149 #endif
151 OSG_FIELDTRAITS_GETTYPE_NS(PointChunk *, nsOSG)
153 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
154 PointChunk *,
155 nsOSG)
157 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
158 PointChunk *,
159 nsOSG)
161 /***************************************************************************\
162 * Field Description *
163 \***************************************************************************/
165 void PointChunkBase::classDescInserter(TypeObject &oType)
167 FieldDescriptionBase *pDesc = NULL;
170 pDesc = new SFReal32::Description(
171 SFReal32::getClassType(),
172 "size",
173 "The point's size in pixel.\n",
174 SizeFieldId, SizeFieldMask,
175 false,
176 (Field::SFDefaultFlags | Field::FStdAccess),
177 static_cast<FieldEditMethodSig>(&PointChunk::editHandleSize),
178 static_cast<FieldGetMethodSig >(&PointChunk::getHandleSize));
180 oType.addInitialDesc(pDesc);
182 pDesc = new SFBool::Description(
183 SFBool::getClassType(),
184 "smooth",
185 "Defines if line antialiasing is used.\n",
186 SmoothFieldId, SmoothFieldMask,
187 false,
188 (Field::SFDefaultFlags | Field::FStdAccess),
189 static_cast<FieldEditMethodSig>(&PointChunk::editHandleSmooth),
190 static_cast<FieldGetMethodSig >(&PointChunk::getHandleSmooth));
192 oType.addInitialDesc(pDesc);
194 pDesc = new SFReal32::Description(
195 SFReal32::getClassType(),
196 "minSize",
197 "Minimum point size for attenuation, use less than 0 to disable it. See\n"
198 "ARB_point_parameters extension. \n",
199 MinSizeFieldId, MinSizeFieldMask,
200 false,
201 (Field::SFDefaultFlags | Field::FStdAccess),
202 static_cast<FieldEditMethodSig>(&PointChunk::editHandleMinSize),
203 static_cast<FieldGetMethodSig >(&PointChunk::getHandleMinSize));
205 oType.addInitialDesc(pDesc);
207 pDesc = new SFReal32::Description(
208 SFReal32::getClassType(),
209 "maxSize",
210 "Maximum point size for attenuation. See ARB_point_parameters extension.\n",
211 MaxSizeFieldId, MaxSizeFieldMask,
212 false,
213 (Field::SFDefaultFlags | Field::FStdAccess),
214 static_cast<FieldEditMethodSig>(&PointChunk::editHandleMaxSize),
215 static_cast<FieldGetMethodSig >(&PointChunk::getHandleMaxSize));
217 oType.addInitialDesc(pDesc);
219 pDesc = new SFReal32::Description(
220 SFReal32::getClassType(),
221 "constantAttenuation",
222 "The point size's constant attenuation.\n",
223 ConstantAttenuationFieldId, ConstantAttenuationFieldMask,
224 false,
225 (Field::SFDefaultFlags | Field::FStdAccess),
226 static_cast<FieldEditMethodSig>(&PointChunk::editHandleConstantAttenuation),
227 static_cast<FieldGetMethodSig >(&PointChunk::getHandleConstantAttenuation));
229 oType.addInitialDesc(pDesc);
231 pDesc = new SFReal32::Description(
232 SFReal32::getClassType(),
233 "linearAttenuation",
234 "The point size's linear attenuation.\n",
235 LinearAttenuationFieldId, LinearAttenuationFieldMask,
236 false,
237 (Field::SFDefaultFlags | Field::FStdAccess),
238 static_cast<FieldEditMethodSig>(&PointChunk::editHandleLinearAttenuation),
239 static_cast<FieldGetMethodSig >(&PointChunk::getHandleLinearAttenuation));
241 oType.addInitialDesc(pDesc);
243 pDesc = new SFReal32::Description(
244 SFReal32::getClassType(),
245 "quadraticAttenuation",
246 "The point size's quadratic attenuation.\n",
247 QuadraticAttenuationFieldId, QuadraticAttenuationFieldMask,
248 false,
249 (Field::SFDefaultFlags | Field::FStdAccess),
250 static_cast<FieldEditMethodSig>(&PointChunk::editHandleQuadraticAttenuation),
251 static_cast<FieldGetMethodSig >(&PointChunk::getHandleQuadraticAttenuation));
253 oType.addInitialDesc(pDesc);
255 pDesc = new SFReal32::Description(
256 SFReal32::getClassType(),
257 "fadeThreshold",
258 "Minimum point size for attenuation. See ARB_point_parameters extension.\n",
259 FadeThresholdFieldId, FadeThresholdFieldMask,
260 false,
261 (Field::SFDefaultFlags | Field::FStdAccess),
262 static_cast<FieldEditMethodSig>(&PointChunk::editHandleFadeThreshold),
263 static_cast<FieldGetMethodSig >(&PointChunk::getHandleFadeThreshold));
265 oType.addInitialDesc(pDesc);
267 pDesc = new SFBool::Description(
268 SFBool::getClassType(),
269 "sprite",
270 "Flag to enable point sprites, see ARB_point_sprite for details.\n",
271 SpriteFieldId, SpriteFieldMask,
272 false,
273 (Field::SFDefaultFlags | Field::FStdAccess),
274 static_cast<FieldEditMethodSig>(&PointChunk::editHandleSprite),
275 static_cast<FieldGetMethodSig >(&PointChunk::getHandleSprite));
277 oType.addInitialDesc(pDesc);
279 pDesc = new SFGLenum::Description(
280 SFGLenum::getClassType(),
281 "rMode",
283 RModeFieldId, RModeFieldMask,
284 false,
285 (Field::SFDefaultFlags | Field::FStdAccess),
286 static_cast<FieldEditMethodSig>(&PointChunk::editHandleRMode),
287 static_cast<FieldGetMethodSig >(&PointChunk::getHandleRMode));
289 oType.addInitialDesc(pDesc);
293 PointChunkBase::TypeObject PointChunkBase::_type(
294 PointChunkBase::getClassname(),
295 Inherited::getClassname(),
296 "NULL",
297 nsOSG, //Namespace
298 reinterpret_cast<PrototypeCreateF>(&PointChunkBase::createEmptyLocal),
299 reinterpret_cast<InitContainerF>(&PointChunk::initMethod),
300 reinterpret_cast<ExitContainerF>(&PointChunk::exitMethod),
301 reinterpret_cast<InitalInsertDescFunc>(
302 reinterpret_cast<void *>(&PointChunk::classDescInserter)),
303 false,
305 "<?xml version=\"1.0\"?>\n"
306 "\n"
307 "<FieldContainer\n"
308 " name=\"PointChunk\"\n"
309 " parent=\"StateChunk\"\n"
310 " library=\"State\"\n"
311 " pointerfieldtypes=\"both\"\n"
312 " structure=\"concrete\"\n"
313 " systemcomponent=\"true\"\n"
314 " parentsystemcomponent=\"true\"\n"
315 " decoratable=\"false\"\n"
316 " docGroupBase=\"GrpStateOpenGL\"\n"
317 " >\n"
318 " See \\ref PageSystemPointChunk for a description. \n"
319 "\n"
320 " This chunk wraps glPointSize() (OSG::PointChunk::_sfSize) and\n"
321 " glEnable(GL_POINT_SMOOTH) (OSG::PointChunk::_sfSmooth). It encompasses the\n"
322 " ARB_point_parameters extension (OSG::PointChunk::_sfMinSize, \n"
323 " OSG::PointChunk::_sfMaxSize, OSG::PointChunk::_sfFadeThreshold, \n"
324 " OSG::PointChunk::_sfConstantAttenuation, \n"
325 " OSG::PointChunk::_sfLinearAttenuation,\n"
326 " OSG::PointChunk::_sfQuadraticAttenuation) and ARB_point_sprite\n"
327 " (OSG::PointChunk::_sfSprite, OSG::PointChunk::_sfRMode).\n"
328 " <Field\n"
329 "\t name=\"size\"\n"
330 "\t type=\"Real32\"\n"
331 "\t cardinality=\"single\"\n"
332 "\t visibility=\"external\"\n"
333 "\t defaultValue=\"1\"\n"
334 "\t access=\"public\"\n"
335 "\t >\n"
336 "\tThe point's size in pixel.\n"
337 " </Field>\n"
338 " <Field\n"
339 "\t name=\"smooth\"\n"
340 "\t type=\"bool\"\n"
341 "\t cardinality=\"single\"\n"
342 "\t visibility=\"external\"\n"
343 "\t defaultValue=\"GL_FALSE\"\n"
344 "\t defaultHeader=\"&quot;OSGGL.h&quot;\"\n"
345 "\t access=\"public\"\n"
346 "\t >\n"
347 "\tDefines if line antialiasing is used.\n"
348 " </Field>\n"
349 " <Field\n"
350 "\t name=\"minSize\"\n"
351 "\t type=\"Real32\"\n"
352 "\t cardinality=\"single\"\n"
353 "\t visibility=\"external\"\n"
354 "\t defaultValue=\"-1.f\"\n"
355 "\t access=\"public\"\n"
356 "\t >\n"
357 "\tMinimum point size for attenuation, use less than 0 to disable it. See\n"
358 "\tARB_point_parameters extension. \n"
359 " </Field>\n"
360 " <Field\n"
361 "\t name=\"maxSize\"\n"
362 "\t type=\"Real32\"\n"
363 "\t cardinality=\"single\"\n"
364 "\t visibility=\"external\"\n"
365 "\t defaultValue=\"-1.f\"\n"
366 "\t access=\"public\"\n"
367 "\t >\n"
368 "\tMaximum point size for attenuation. See ARB_point_parameters extension.\n"
369 " </Field>\n"
370 " <Field\n"
371 "\t name=\"constantAttenuation\"\n"
372 "\t type=\"Real32\"\n"
373 "\t cardinality=\"single\"\n"
374 "\t visibility=\"external\"\n"
375 "\t defaultValue=\"1\"\n"
376 "\t access=\"public\"\n"
377 "\t >\n"
378 "\tThe point size's constant attenuation.\n"
379 " </Field>\n"
380 " <Field\n"
381 "\t name=\"linearAttenuation\"\n"
382 "\t type=\"Real32\"\n"
383 "\t cardinality=\"single\"\n"
384 "\t visibility=\"external\"\n"
385 "\t defaultValue=\"0\"\n"
386 "\t access=\"public\"\n"
387 "\t >\n"
388 "\tThe point size's linear attenuation.\n"
389 " </Field>\n"
390 " <Field\n"
391 "\t name=\"quadraticAttenuation\"\n"
392 "\t type=\"Real32\"\n"
393 "\t cardinality=\"single\"\n"
394 "\t visibility=\"external\"\n"
395 "\t defaultValue=\"0\"\n"
396 "\t access=\"public\"\n"
397 "\t >\n"
398 "\tThe point size's quadratic attenuation.\n"
399 " </Field>\n"
400 " <Field\n"
401 "\t name=\"fadeThreshold\"\n"
402 "\t type=\"Real32\"\n"
403 "\t cardinality=\"single\"\n"
404 "\t visibility=\"external\"\n"
405 "\t defaultValue=\"0.f\"\n"
406 "\t access=\"public\"\n"
407 "\t >\n"
408 "\tMinimum point size for attenuation. See ARB_point_parameters extension.\n"
409 " </Field>\n"
410 " <Field\n"
411 "\t name=\"sprite\"\n"
412 "\t type=\"bool\"\n"
413 "\t cardinality=\"single\"\n"
414 "\t visibility=\"external\"\n"
415 "\t defaultValue=\"GL_FALSE\"\n"
416 "\t defaultHeader=\"&quot;OSGGL.h&quot;\"\n"
417 "\t access=\"public\"\n"
418 "\t >\n"
419 "\tFlag to enable point sprites, see ARB_point_sprite for details.\n"
420 " </Field>\n"
421 " <Field\n"
422 "\t name=\"rMode\"\n"
423 "\t type=\"GLenum\"\n"
424 "\t cardinality=\"single\"\n"
425 "\t visibility=\"external\"\n"
426 "\t defaultValue=\"GL_ZERO\"\n"
427 "\t defaultHeader=\"&quot;OSGGL.h&quot;\"\n"
428 "\t access=\"public\"\n"
429 "\t >\n"
430 " </Field>\n"
431 "</FieldContainer>\n",
432 "See \\ref PageSystemPointChunk for a description. \n"
433 "\n"
434 "This chunk wraps glPointSize() (OSG::PointChunk::_sfSize) and\n"
435 "glEnable(GL_POINT_SMOOTH) (OSG::PointChunk::_sfSmooth). It encompasses the\n"
436 "ARB_point_parameters extension (OSG::PointChunk::_sfMinSize, \n"
437 "OSG::PointChunk::_sfMaxSize, OSG::PointChunk::_sfFadeThreshold, \n"
438 "OSG::PointChunk::_sfConstantAttenuation, \n"
439 "OSG::PointChunk::_sfLinearAttenuation,\n"
440 "OSG::PointChunk::_sfQuadraticAttenuation) and ARB_point_sprite\n"
441 "(OSG::PointChunk::_sfSprite, OSG::PointChunk::_sfRMode).\n"
444 /*------------------------------ get -----------------------------------*/
446 FieldContainerType &PointChunkBase::getType(void)
448 return _type;
451 const FieldContainerType &PointChunkBase::getType(void) const
453 return _type;
456 UInt32 PointChunkBase::getContainerSize(void) const
458 return sizeof(PointChunk);
461 /*------------------------- decorator get ------------------------------*/
464 SFReal32 *PointChunkBase::editSFSize(void)
466 editSField(SizeFieldMask);
468 return &_sfSize;
471 const SFReal32 *PointChunkBase::getSFSize(void) const
473 return &_sfSize;
477 SFBool *PointChunkBase::editSFSmooth(void)
479 editSField(SmoothFieldMask);
481 return &_sfSmooth;
484 const SFBool *PointChunkBase::getSFSmooth(void) const
486 return &_sfSmooth;
490 SFReal32 *PointChunkBase::editSFMinSize(void)
492 editSField(MinSizeFieldMask);
494 return &_sfMinSize;
497 const SFReal32 *PointChunkBase::getSFMinSize(void) const
499 return &_sfMinSize;
503 SFReal32 *PointChunkBase::editSFMaxSize(void)
505 editSField(MaxSizeFieldMask);
507 return &_sfMaxSize;
510 const SFReal32 *PointChunkBase::getSFMaxSize(void) const
512 return &_sfMaxSize;
516 SFReal32 *PointChunkBase::editSFConstantAttenuation(void)
518 editSField(ConstantAttenuationFieldMask);
520 return &_sfConstantAttenuation;
523 const SFReal32 *PointChunkBase::getSFConstantAttenuation(void) const
525 return &_sfConstantAttenuation;
529 SFReal32 *PointChunkBase::editSFLinearAttenuation(void)
531 editSField(LinearAttenuationFieldMask);
533 return &_sfLinearAttenuation;
536 const SFReal32 *PointChunkBase::getSFLinearAttenuation(void) const
538 return &_sfLinearAttenuation;
542 SFReal32 *PointChunkBase::editSFQuadraticAttenuation(void)
544 editSField(QuadraticAttenuationFieldMask);
546 return &_sfQuadraticAttenuation;
549 const SFReal32 *PointChunkBase::getSFQuadraticAttenuation(void) const
551 return &_sfQuadraticAttenuation;
555 SFReal32 *PointChunkBase::editSFFadeThreshold(void)
557 editSField(FadeThresholdFieldMask);
559 return &_sfFadeThreshold;
562 const SFReal32 *PointChunkBase::getSFFadeThreshold(void) const
564 return &_sfFadeThreshold;
568 SFBool *PointChunkBase::editSFSprite(void)
570 editSField(SpriteFieldMask);
572 return &_sfSprite;
575 const SFBool *PointChunkBase::getSFSprite(void) const
577 return &_sfSprite;
581 SFGLenum *PointChunkBase::editSFRMode(void)
583 editSField(RModeFieldMask);
585 return &_sfRMode;
588 const SFGLenum *PointChunkBase::getSFRMode(void) const
590 return &_sfRMode;
598 /*------------------------------ access -----------------------------------*/
600 SizeT PointChunkBase::getBinSize(ConstFieldMaskArg whichField)
602 SizeT returnValue = Inherited::getBinSize(whichField);
604 if(FieldBits::NoField != (SizeFieldMask & whichField))
606 returnValue += _sfSize.getBinSize();
608 if(FieldBits::NoField != (SmoothFieldMask & whichField))
610 returnValue += _sfSmooth.getBinSize();
612 if(FieldBits::NoField != (MinSizeFieldMask & whichField))
614 returnValue += _sfMinSize.getBinSize();
616 if(FieldBits::NoField != (MaxSizeFieldMask & whichField))
618 returnValue += _sfMaxSize.getBinSize();
620 if(FieldBits::NoField != (ConstantAttenuationFieldMask & whichField))
622 returnValue += _sfConstantAttenuation.getBinSize();
624 if(FieldBits::NoField != (LinearAttenuationFieldMask & whichField))
626 returnValue += _sfLinearAttenuation.getBinSize();
628 if(FieldBits::NoField != (QuadraticAttenuationFieldMask & whichField))
630 returnValue += _sfQuadraticAttenuation.getBinSize();
632 if(FieldBits::NoField != (FadeThresholdFieldMask & whichField))
634 returnValue += _sfFadeThreshold.getBinSize();
636 if(FieldBits::NoField != (SpriteFieldMask & whichField))
638 returnValue += _sfSprite.getBinSize();
640 if(FieldBits::NoField != (RModeFieldMask & whichField))
642 returnValue += _sfRMode.getBinSize();
645 return returnValue;
648 void PointChunkBase::copyToBin(BinaryDataHandler &pMem,
649 ConstFieldMaskArg whichField)
651 Inherited::copyToBin(pMem, whichField);
653 if(FieldBits::NoField != (SizeFieldMask & whichField))
655 _sfSize.copyToBin(pMem);
657 if(FieldBits::NoField != (SmoothFieldMask & whichField))
659 _sfSmooth.copyToBin(pMem);
661 if(FieldBits::NoField != (MinSizeFieldMask & whichField))
663 _sfMinSize.copyToBin(pMem);
665 if(FieldBits::NoField != (MaxSizeFieldMask & whichField))
667 _sfMaxSize.copyToBin(pMem);
669 if(FieldBits::NoField != (ConstantAttenuationFieldMask & whichField))
671 _sfConstantAttenuation.copyToBin(pMem);
673 if(FieldBits::NoField != (LinearAttenuationFieldMask & whichField))
675 _sfLinearAttenuation.copyToBin(pMem);
677 if(FieldBits::NoField != (QuadraticAttenuationFieldMask & whichField))
679 _sfQuadraticAttenuation.copyToBin(pMem);
681 if(FieldBits::NoField != (FadeThresholdFieldMask & whichField))
683 _sfFadeThreshold.copyToBin(pMem);
685 if(FieldBits::NoField != (SpriteFieldMask & whichField))
687 _sfSprite.copyToBin(pMem);
689 if(FieldBits::NoField != (RModeFieldMask & whichField))
691 _sfRMode.copyToBin(pMem);
695 void PointChunkBase::copyFromBin(BinaryDataHandler &pMem,
696 ConstFieldMaskArg whichField)
698 Inherited::copyFromBin(pMem, whichField);
700 if(FieldBits::NoField != (SizeFieldMask & whichField))
702 editSField(SizeFieldMask);
703 _sfSize.copyFromBin(pMem);
705 if(FieldBits::NoField != (SmoothFieldMask & whichField))
707 editSField(SmoothFieldMask);
708 _sfSmooth.copyFromBin(pMem);
710 if(FieldBits::NoField != (MinSizeFieldMask & whichField))
712 editSField(MinSizeFieldMask);
713 _sfMinSize.copyFromBin(pMem);
715 if(FieldBits::NoField != (MaxSizeFieldMask & whichField))
717 editSField(MaxSizeFieldMask);
718 _sfMaxSize.copyFromBin(pMem);
720 if(FieldBits::NoField != (ConstantAttenuationFieldMask & whichField))
722 editSField(ConstantAttenuationFieldMask);
723 _sfConstantAttenuation.copyFromBin(pMem);
725 if(FieldBits::NoField != (LinearAttenuationFieldMask & whichField))
727 editSField(LinearAttenuationFieldMask);
728 _sfLinearAttenuation.copyFromBin(pMem);
730 if(FieldBits::NoField != (QuadraticAttenuationFieldMask & whichField))
732 editSField(QuadraticAttenuationFieldMask);
733 _sfQuadraticAttenuation.copyFromBin(pMem);
735 if(FieldBits::NoField != (FadeThresholdFieldMask & whichField))
737 editSField(FadeThresholdFieldMask);
738 _sfFadeThreshold.copyFromBin(pMem);
740 if(FieldBits::NoField != (SpriteFieldMask & whichField))
742 editSField(SpriteFieldMask);
743 _sfSprite.copyFromBin(pMem);
745 if(FieldBits::NoField != (RModeFieldMask & whichField))
747 editSField(RModeFieldMask);
748 _sfRMode.copyFromBin(pMem);
752 //! create a new instance of the class
753 PointChunkTransitPtr PointChunkBase::createLocal(BitVector bFlags)
755 PointChunkTransitPtr fc;
757 if(getClassType().getPrototype() != NULL)
759 FieldContainerTransitPtr tmpPtr =
760 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
762 fc = dynamic_pointer_cast<PointChunk>(tmpPtr);
765 return fc;
768 //! create a new instance of the class, copy the container flags
769 PointChunkTransitPtr PointChunkBase::createDependent(BitVector bFlags)
771 PointChunkTransitPtr fc;
773 if(getClassType().getPrototype() != NULL)
775 FieldContainerTransitPtr tmpPtr =
776 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
778 fc = dynamic_pointer_cast<PointChunk>(tmpPtr);
781 return fc;
784 //! create a new instance of the class
785 PointChunkTransitPtr PointChunkBase::create(void)
787 PointChunkTransitPtr fc;
789 if(getClassType().getPrototype() != NULL)
791 FieldContainerTransitPtr tmpPtr =
792 getClassType().getPrototype()-> shallowCopy();
794 fc = dynamic_pointer_cast<PointChunk>(tmpPtr);
797 return fc;
800 PointChunk *PointChunkBase::createEmptyLocal(BitVector bFlags)
802 PointChunk *returnValue;
804 newPtr<PointChunk>(returnValue, bFlags);
806 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
808 return returnValue;
811 //! create an empty new instance of the class, do not copy the prototype
812 PointChunk *PointChunkBase::createEmpty(void)
814 PointChunk *returnValue;
816 newPtr<PointChunk>(returnValue, Thread::getCurrentLocalFlags());
818 returnValue->_pFieldFlags->_bNamespaceMask &=
819 ~Thread::getCurrentLocalFlags();
821 return returnValue;
825 FieldContainerTransitPtr PointChunkBase::shallowCopyLocal(
826 BitVector bFlags) const
828 PointChunk *tmpPtr;
830 newPtr(tmpPtr, dynamic_cast<const PointChunk *>(this), bFlags);
832 FieldContainerTransitPtr returnValue(tmpPtr);
834 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
836 return returnValue;
839 FieldContainerTransitPtr PointChunkBase::shallowCopyDependent(
840 BitVector bFlags) const
842 PointChunk *tmpPtr;
844 newPtr(tmpPtr, dynamic_cast<const PointChunk *>(this), ~bFlags);
846 FieldContainerTransitPtr returnValue(tmpPtr);
848 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
850 return returnValue;
853 FieldContainerTransitPtr PointChunkBase::shallowCopy(void) const
855 PointChunk *tmpPtr;
857 newPtr(tmpPtr,
858 dynamic_cast<const PointChunk *>(this),
859 Thread::getCurrentLocalFlags());
861 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
863 FieldContainerTransitPtr returnValue(tmpPtr);
865 return returnValue;
871 /*------------------------- constructors ----------------------------------*/
873 PointChunkBase::PointChunkBase(void) :
874 Inherited(),
875 _sfSize (Real32(1)),
876 _sfSmooth (bool(GL_FALSE)),
877 _sfMinSize (Real32(-1.f)),
878 _sfMaxSize (Real32(-1.f)),
879 _sfConstantAttenuation (Real32(1)),
880 _sfLinearAttenuation (Real32(0)),
881 _sfQuadraticAttenuation (Real32(0)),
882 _sfFadeThreshold (Real32(0.f)),
883 _sfSprite (bool(GL_FALSE)),
884 _sfRMode (GLenum(GL_ZERO))
888 PointChunkBase::PointChunkBase(const PointChunkBase &source) :
889 Inherited(source),
890 _sfSize (source._sfSize ),
891 _sfSmooth (source._sfSmooth ),
892 _sfMinSize (source._sfMinSize ),
893 _sfMaxSize (source._sfMaxSize ),
894 _sfConstantAttenuation (source._sfConstantAttenuation ),
895 _sfLinearAttenuation (source._sfLinearAttenuation ),
896 _sfQuadraticAttenuation (source._sfQuadraticAttenuation ),
897 _sfFadeThreshold (source._sfFadeThreshold ),
898 _sfSprite (source._sfSprite ),
899 _sfRMode (source._sfRMode )
904 /*-------------------------- destructors ----------------------------------*/
906 PointChunkBase::~PointChunkBase(void)
911 GetFieldHandlePtr PointChunkBase::getHandleSize (void) const
913 SFReal32::GetHandlePtr returnValue(
914 new SFReal32::GetHandle(
915 &_sfSize,
916 this->getType().getFieldDesc(SizeFieldId),
917 const_cast<PointChunkBase *>(this)));
919 return returnValue;
922 EditFieldHandlePtr PointChunkBase::editHandleSize (void)
924 SFReal32::EditHandlePtr returnValue(
925 new SFReal32::EditHandle(
926 &_sfSize,
927 this->getType().getFieldDesc(SizeFieldId),
928 this));
931 editSField(SizeFieldMask);
933 return returnValue;
936 GetFieldHandlePtr PointChunkBase::getHandleSmooth (void) const
938 SFBool::GetHandlePtr returnValue(
939 new SFBool::GetHandle(
940 &_sfSmooth,
941 this->getType().getFieldDesc(SmoothFieldId),
942 const_cast<PointChunkBase *>(this)));
944 return returnValue;
947 EditFieldHandlePtr PointChunkBase::editHandleSmooth (void)
949 SFBool::EditHandlePtr returnValue(
950 new SFBool::EditHandle(
951 &_sfSmooth,
952 this->getType().getFieldDesc(SmoothFieldId),
953 this));
956 editSField(SmoothFieldMask);
958 return returnValue;
961 GetFieldHandlePtr PointChunkBase::getHandleMinSize (void) const
963 SFReal32::GetHandlePtr returnValue(
964 new SFReal32::GetHandle(
965 &_sfMinSize,
966 this->getType().getFieldDesc(MinSizeFieldId),
967 const_cast<PointChunkBase *>(this)));
969 return returnValue;
972 EditFieldHandlePtr PointChunkBase::editHandleMinSize (void)
974 SFReal32::EditHandlePtr returnValue(
975 new SFReal32::EditHandle(
976 &_sfMinSize,
977 this->getType().getFieldDesc(MinSizeFieldId),
978 this));
981 editSField(MinSizeFieldMask);
983 return returnValue;
986 GetFieldHandlePtr PointChunkBase::getHandleMaxSize (void) const
988 SFReal32::GetHandlePtr returnValue(
989 new SFReal32::GetHandle(
990 &_sfMaxSize,
991 this->getType().getFieldDesc(MaxSizeFieldId),
992 const_cast<PointChunkBase *>(this)));
994 return returnValue;
997 EditFieldHandlePtr PointChunkBase::editHandleMaxSize (void)
999 SFReal32::EditHandlePtr returnValue(
1000 new SFReal32::EditHandle(
1001 &_sfMaxSize,
1002 this->getType().getFieldDesc(MaxSizeFieldId),
1003 this));
1006 editSField(MaxSizeFieldMask);
1008 return returnValue;
1011 GetFieldHandlePtr PointChunkBase::getHandleConstantAttenuation (void) const
1013 SFReal32::GetHandlePtr returnValue(
1014 new SFReal32::GetHandle(
1015 &_sfConstantAttenuation,
1016 this->getType().getFieldDesc(ConstantAttenuationFieldId),
1017 const_cast<PointChunkBase *>(this)));
1019 return returnValue;
1022 EditFieldHandlePtr PointChunkBase::editHandleConstantAttenuation(void)
1024 SFReal32::EditHandlePtr returnValue(
1025 new SFReal32::EditHandle(
1026 &_sfConstantAttenuation,
1027 this->getType().getFieldDesc(ConstantAttenuationFieldId),
1028 this));
1031 editSField(ConstantAttenuationFieldMask);
1033 return returnValue;
1036 GetFieldHandlePtr PointChunkBase::getHandleLinearAttenuation (void) const
1038 SFReal32::GetHandlePtr returnValue(
1039 new SFReal32::GetHandle(
1040 &_sfLinearAttenuation,
1041 this->getType().getFieldDesc(LinearAttenuationFieldId),
1042 const_cast<PointChunkBase *>(this)));
1044 return returnValue;
1047 EditFieldHandlePtr PointChunkBase::editHandleLinearAttenuation(void)
1049 SFReal32::EditHandlePtr returnValue(
1050 new SFReal32::EditHandle(
1051 &_sfLinearAttenuation,
1052 this->getType().getFieldDesc(LinearAttenuationFieldId),
1053 this));
1056 editSField(LinearAttenuationFieldMask);
1058 return returnValue;
1061 GetFieldHandlePtr PointChunkBase::getHandleQuadraticAttenuation (void) const
1063 SFReal32::GetHandlePtr returnValue(
1064 new SFReal32::GetHandle(
1065 &_sfQuadraticAttenuation,
1066 this->getType().getFieldDesc(QuadraticAttenuationFieldId),
1067 const_cast<PointChunkBase *>(this)));
1069 return returnValue;
1072 EditFieldHandlePtr PointChunkBase::editHandleQuadraticAttenuation(void)
1074 SFReal32::EditHandlePtr returnValue(
1075 new SFReal32::EditHandle(
1076 &_sfQuadraticAttenuation,
1077 this->getType().getFieldDesc(QuadraticAttenuationFieldId),
1078 this));
1081 editSField(QuadraticAttenuationFieldMask);
1083 return returnValue;
1086 GetFieldHandlePtr PointChunkBase::getHandleFadeThreshold (void) const
1088 SFReal32::GetHandlePtr returnValue(
1089 new SFReal32::GetHandle(
1090 &_sfFadeThreshold,
1091 this->getType().getFieldDesc(FadeThresholdFieldId),
1092 const_cast<PointChunkBase *>(this)));
1094 return returnValue;
1097 EditFieldHandlePtr PointChunkBase::editHandleFadeThreshold (void)
1099 SFReal32::EditHandlePtr returnValue(
1100 new SFReal32::EditHandle(
1101 &_sfFadeThreshold,
1102 this->getType().getFieldDesc(FadeThresholdFieldId),
1103 this));
1106 editSField(FadeThresholdFieldMask);
1108 return returnValue;
1111 GetFieldHandlePtr PointChunkBase::getHandleSprite (void) const
1113 SFBool::GetHandlePtr returnValue(
1114 new SFBool::GetHandle(
1115 &_sfSprite,
1116 this->getType().getFieldDesc(SpriteFieldId),
1117 const_cast<PointChunkBase *>(this)));
1119 return returnValue;
1122 EditFieldHandlePtr PointChunkBase::editHandleSprite (void)
1124 SFBool::EditHandlePtr returnValue(
1125 new SFBool::EditHandle(
1126 &_sfSprite,
1127 this->getType().getFieldDesc(SpriteFieldId),
1128 this));
1131 editSField(SpriteFieldMask);
1133 return returnValue;
1136 GetFieldHandlePtr PointChunkBase::getHandleRMode (void) const
1138 SFGLenum::GetHandlePtr returnValue(
1139 new SFGLenum::GetHandle(
1140 &_sfRMode,
1141 this->getType().getFieldDesc(RModeFieldId),
1142 const_cast<PointChunkBase *>(this)));
1144 return returnValue;
1147 EditFieldHandlePtr PointChunkBase::editHandleRMode (void)
1149 SFGLenum::EditHandlePtr returnValue(
1150 new SFGLenum::EditHandle(
1151 &_sfRMode,
1152 this->getType().getFieldDesc(RModeFieldId),
1153 this));
1156 editSField(RModeFieldMask);
1158 return returnValue;
1162 #ifdef OSG_MT_CPTR_ASPECT
1163 void PointChunkBase::execSyncV( FieldContainer &oFrom,
1164 ConstFieldMaskArg whichField,
1165 AspectOffsetStore &oOffsets,
1166 ConstFieldMaskArg syncMode,
1167 const UInt32 uiSyncInfo)
1169 PointChunk *pThis = static_cast<PointChunk *>(this);
1171 pThis->execSync(static_cast<PointChunk *>(&oFrom),
1172 whichField,
1173 oOffsets,
1174 syncMode,
1175 uiSyncInfo);
1177 #endif
1180 #ifdef OSG_MT_CPTR_ASPECT
1181 FieldContainer *PointChunkBase::createAspectCopy(
1182 const FieldContainer *pRefAspect) const
1184 PointChunk *returnValue;
1186 newAspectCopy(returnValue,
1187 dynamic_cast<const PointChunk *>(pRefAspect),
1188 dynamic_cast<const PointChunk *>(this));
1190 return returnValue;
1192 #endif
1194 void PointChunkBase::resolveLinks(void)
1196 Inherited::resolveLinks();
1202 OSG_END_NAMESPACE