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 **
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" // Smooth default header
67 #include "OSGLineChunkBase.h"
68 #include "OSGLineChunk.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::LineChunk
79 See \ref PageSystemLineChunk for a description.
81 The line chunk contains the parameters that are specific to lines.
83 The parameters of the following functions are wrapped here: glLineWidth
84 (OSG::LineChunk::_sfWidth), glLineStipple (OSG::LineChunk::_sfStippleRepeat,
85 OSG::LineChunk::_sfStipplePattern), glEnable(GL_LINE_SMOOTH)
86 (OSG::LineChunk::_sfSmooth).
89 /***************************************************************************\
90 * Field Documentation *
91 \***************************************************************************/
93 /*! \var Real32 LineChunkBase::_sfWidth
94 The line's width, in pixels.
97 /*! \var Int32 LineChunkBase::_sfStippleRepeat
98 Repetition factor for stippling.
101 /*! \var UInt16 LineChunkBase::_sfStipplePattern
102 Defines the stipple pattern. 1 bits are drawn, 0 bits are ignored,
103 starting with the most significant bit.
106 /*! \var bool LineChunkBase::_sfSmooth
107 Defines if line antialiasing is used.
111 /***************************************************************************\
112 * FieldType/FieldTrait Instantiation *
113 \***************************************************************************/
115 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
116 PointerType FieldTraits
<LineChunk
*, nsOSG
>::_type(
119 LineChunk::getClassType(),
123 OSG_FIELDTRAITS_GETTYPE_NS(LineChunk
*, nsOSG
)
125 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
129 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
133 /***************************************************************************\
134 * Field Description *
135 \***************************************************************************/
137 void LineChunkBase::classDescInserter(TypeObject
&oType
)
139 FieldDescriptionBase
*pDesc
= NULL
;
142 pDesc
= new SFReal32::Description(
143 SFReal32::getClassType(),
145 "The line's width, in pixels.\n",
146 WidthFieldId
, WidthFieldMask
,
148 (Field::SFDefaultFlags
| Field::FStdAccess
),
149 static_cast<FieldEditMethodSig
>(&LineChunk::editHandleWidth
),
150 static_cast<FieldGetMethodSig
>(&LineChunk::getHandleWidth
));
152 oType
.addInitialDesc(pDesc
);
154 pDesc
= new SFInt32::Description(
155 SFInt32::getClassType(),
157 "Repetition factor for stippling.\n",
158 StippleRepeatFieldId
, StippleRepeatFieldMask
,
160 (Field::SFDefaultFlags
| Field::FStdAccess
),
161 static_cast<FieldEditMethodSig
>(&LineChunk::editHandleStippleRepeat
),
162 static_cast<FieldGetMethodSig
>(&LineChunk::getHandleStippleRepeat
));
164 oType
.addInitialDesc(pDesc
);
166 pDesc
= new SFUInt16::Description(
167 SFUInt16::getClassType(),
169 "Defines the stipple pattern. 1 bits are drawn, 0 bits are ignored, \n"
170 "starting with the most significant bit.\n",
171 StipplePatternFieldId
, StipplePatternFieldMask
,
173 (Field::SFDefaultFlags
| Field::FStdAccess
),
174 static_cast<FieldEditMethodSig
>(&LineChunk::editHandleStipplePattern
),
175 static_cast<FieldGetMethodSig
>(&LineChunk::getHandleStipplePattern
));
177 oType
.addInitialDesc(pDesc
);
179 pDesc
= new SFBool::Description(
180 SFBool::getClassType(),
182 "Defines if line antialiasing is used.\n",
183 SmoothFieldId
, SmoothFieldMask
,
185 (Field::SFDefaultFlags
| Field::FStdAccess
),
186 static_cast<FieldEditMethodSig
>(&LineChunk::editHandleSmooth
),
187 static_cast<FieldGetMethodSig
>(&LineChunk::getHandleSmooth
));
189 oType
.addInitialDesc(pDesc
);
193 LineChunkBase::TypeObject
LineChunkBase::_type(
194 LineChunkBase::getClassname(),
195 Inherited::getClassname(),
198 reinterpret_cast<PrototypeCreateF
>(&LineChunkBase::createEmptyLocal
),
199 reinterpret_cast<InitContainerF
>(&LineChunk::initMethod
),
200 reinterpret_cast<ExitContainerF
>(&LineChunk::exitMethod
),
201 reinterpret_cast<InitalInsertDescFunc
>(
202 reinterpret_cast<void *>(&LineChunk::classDescInserter
)),
205 "<?xml version=\"1.0\"?>\n"
208 " name=\"LineChunk\"\n"
209 " parent=\"StateChunk\"\n"
210 " library=\"State\"\n"
211 " pointerfieldtypes=\"both\"\n"
212 " structure=\"concrete\"\n"
213 " systemcomponent=\"true\"\n"
214 " parentsystemcomponent=\"true\"\n"
215 " docGroupBase=\"GrpStateOpenGL\"\n"
217 " See \\ref PageSystemLineChunk for a description.\n"
219 " The line chunk contains the parameters that are specific to lines.\n"
221 " The parameters of the following functions are wrapped here: glLineWidth\n"
222 " (OSG::LineChunk::_sfWidth), glLineStipple (OSG::LineChunk::_sfStippleRepeat,\n"
223 " OSG::LineChunk::_sfStipplePattern), glEnable(GL_LINE_SMOOTH)\n"
224 " (OSG::LineChunk::_sfSmooth).\n"
226 "\t name=\"width\"\n"
227 "\t type=\"Real32\"\n"
228 "\t cardinality=\"single\"\n"
229 "\t visibility=\"external\"\n"
230 "\t defaultValue=\"1\"\n"
231 "\t access=\"public\"\n"
233 " The line's width, in pixels.\n"
236 "\t name=\"stippleRepeat\"\n"
237 "\t type=\"Int32\"\n"
238 "\t cardinality=\"single\"\n"
239 "\t visibility=\"external\"\n"
240 "\t defaultValue=\"1\"\n"
241 "\t access=\"public\"\n"
243 " Repetition factor for stippling.\n"
246 "\t name=\"stipplePattern\"\n"
247 "\t type=\"UInt16\"\n"
248 "\t cardinality=\"single\"\n"
249 "\t visibility=\"external\"\n"
250 "\t defaultValue=\"0xffff\"\n"
251 "\t access=\"public\"\n"
253 "\tDefines the stipple pattern. 1 bits are drawn, 0 bits are ignored, \n"
254 " starting with the most significant bit.\n"
257 "\t name=\"smooth\"\n"
259 "\t cardinality=\"single\"\n"
260 "\t visibility=\"external\"\n"
261 "\t defaultValue=\"GL_FALSE\"\n"
262 "\t defaultHeader=\""OSGGL.h"\"\n"
263 "\t access=\"public\"\n"
265 "\tDefines if line antialiasing is used.\n"
267 "</FieldContainer>\n",
268 "See \\ref PageSystemLineChunk for a description.\n"
270 "The line chunk contains the parameters that are specific to lines.\n"
272 "The parameters of the following functions are wrapped here: glLineWidth\n"
273 "(OSG::LineChunk::_sfWidth), glLineStipple (OSG::LineChunk::_sfStippleRepeat,\n"
274 "OSG::LineChunk::_sfStipplePattern), glEnable(GL_LINE_SMOOTH)\n"
275 "(OSG::LineChunk::_sfSmooth).\n"
278 /*------------------------------ get -----------------------------------*/
280 FieldContainerType
&LineChunkBase::getType(void)
285 const FieldContainerType
&LineChunkBase::getType(void) const
290 UInt32
LineChunkBase::getContainerSize(void) const
292 return sizeof(LineChunk
);
295 /*------------------------- decorator get ------------------------------*/
298 SFReal32
*LineChunkBase::editSFWidth(void)
300 editSField(WidthFieldMask
);
305 const SFReal32
*LineChunkBase::getSFWidth(void) const
311 SFInt32
*LineChunkBase::editSFStippleRepeat(void)
313 editSField(StippleRepeatFieldMask
);
315 return &_sfStippleRepeat
;
318 const SFInt32
*LineChunkBase::getSFStippleRepeat(void) const
320 return &_sfStippleRepeat
;
324 SFUInt16
*LineChunkBase::editSFStipplePattern(void)
326 editSField(StipplePatternFieldMask
);
328 return &_sfStipplePattern
;
331 const SFUInt16
*LineChunkBase::getSFStipplePattern(void) const
333 return &_sfStipplePattern
;
337 SFBool
*LineChunkBase::editSFSmooth(void)
339 editSField(SmoothFieldMask
);
344 const SFBool
*LineChunkBase::getSFSmooth(void) const
354 /*------------------------------ access -----------------------------------*/
356 SizeT
LineChunkBase::getBinSize(ConstFieldMaskArg whichField
)
358 SizeT returnValue
= Inherited::getBinSize(whichField
);
360 if(FieldBits::NoField
!= (WidthFieldMask
& whichField
))
362 returnValue
+= _sfWidth
.getBinSize();
364 if(FieldBits::NoField
!= (StippleRepeatFieldMask
& whichField
))
366 returnValue
+= _sfStippleRepeat
.getBinSize();
368 if(FieldBits::NoField
!= (StipplePatternFieldMask
& whichField
))
370 returnValue
+= _sfStipplePattern
.getBinSize();
372 if(FieldBits::NoField
!= (SmoothFieldMask
& whichField
))
374 returnValue
+= _sfSmooth
.getBinSize();
380 void LineChunkBase::copyToBin(BinaryDataHandler
&pMem
,
381 ConstFieldMaskArg whichField
)
383 Inherited::copyToBin(pMem
, whichField
);
385 if(FieldBits::NoField
!= (WidthFieldMask
& whichField
))
387 _sfWidth
.copyToBin(pMem
);
389 if(FieldBits::NoField
!= (StippleRepeatFieldMask
& whichField
))
391 _sfStippleRepeat
.copyToBin(pMem
);
393 if(FieldBits::NoField
!= (StipplePatternFieldMask
& whichField
))
395 _sfStipplePattern
.copyToBin(pMem
);
397 if(FieldBits::NoField
!= (SmoothFieldMask
& whichField
))
399 _sfSmooth
.copyToBin(pMem
);
403 void LineChunkBase::copyFromBin(BinaryDataHandler
&pMem
,
404 ConstFieldMaskArg whichField
)
406 Inherited::copyFromBin(pMem
, whichField
);
408 if(FieldBits::NoField
!= (WidthFieldMask
& whichField
))
410 editSField(WidthFieldMask
);
411 _sfWidth
.copyFromBin(pMem
);
413 if(FieldBits::NoField
!= (StippleRepeatFieldMask
& whichField
))
415 editSField(StippleRepeatFieldMask
);
416 _sfStippleRepeat
.copyFromBin(pMem
);
418 if(FieldBits::NoField
!= (StipplePatternFieldMask
& whichField
))
420 editSField(StipplePatternFieldMask
);
421 _sfStipplePattern
.copyFromBin(pMem
);
423 if(FieldBits::NoField
!= (SmoothFieldMask
& whichField
))
425 editSField(SmoothFieldMask
);
426 _sfSmooth
.copyFromBin(pMem
);
430 //! create a new instance of the class
431 LineChunkTransitPtr
LineChunkBase::createLocal(BitVector bFlags
)
433 LineChunkTransitPtr fc
;
435 if(getClassType().getPrototype() != NULL
)
437 FieldContainerTransitPtr tmpPtr
=
438 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
440 fc
= dynamic_pointer_cast
<LineChunk
>(tmpPtr
);
446 //! create a new instance of the class, copy the container flags
447 LineChunkTransitPtr
LineChunkBase::createDependent(BitVector bFlags
)
449 LineChunkTransitPtr fc
;
451 if(getClassType().getPrototype() != NULL
)
453 FieldContainerTransitPtr tmpPtr
=
454 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
456 fc
= dynamic_pointer_cast
<LineChunk
>(tmpPtr
);
462 //! create a new instance of the class
463 LineChunkTransitPtr
LineChunkBase::create(void)
465 LineChunkTransitPtr fc
;
467 if(getClassType().getPrototype() != NULL
)
469 FieldContainerTransitPtr tmpPtr
=
470 getClassType().getPrototype()-> shallowCopy();
472 fc
= dynamic_pointer_cast
<LineChunk
>(tmpPtr
);
478 LineChunk
*LineChunkBase::createEmptyLocal(BitVector bFlags
)
480 LineChunk
*returnValue
;
482 newPtr
<LineChunk
>(returnValue
, bFlags
);
484 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
489 //! create an empty new instance of the class, do not copy the prototype
490 LineChunk
*LineChunkBase::createEmpty(void)
492 LineChunk
*returnValue
;
494 newPtr
<LineChunk
>(returnValue
, Thread::getCurrentLocalFlags());
496 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
497 ~Thread::getCurrentLocalFlags();
503 FieldContainerTransitPtr
LineChunkBase::shallowCopyLocal(
504 BitVector bFlags
) const
508 newPtr(tmpPtr
, dynamic_cast<const LineChunk
*>(this), bFlags
);
510 FieldContainerTransitPtr
returnValue(tmpPtr
);
512 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
517 FieldContainerTransitPtr
LineChunkBase::shallowCopyDependent(
518 BitVector bFlags
) const
522 newPtr(tmpPtr
, dynamic_cast<const LineChunk
*>(this), ~bFlags
);
524 FieldContainerTransitPtr
returnValue(tmpPtr
);
526 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
531 FieldContainerTransitPtr
LineChunkBase::shallowCopy(void) const
536 dynamic_cast<const LineChunk
*>(this),
537 Thread::getCurrentLocalFlags());
539 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
541 FieldContainerTransitPtr
returnValue(tmpPtr
);
549 /*------------------------- constructors ----------------------------------*/
551 LineChunkBase::LineChunkBase(void) :
553 _sfWidth (Real32(1)),
554 _sfStippleRepeat (Int32(1)),
555 _sfStipplePattern (UInt16(0xffff)),
556 _sfSmooth (bool(GL_FALSE
))
560 LineChunkBase::LineChunkBase(const LineChunkBase
&source
) :
562 _sfWidth (source
._sfWidth
),
563 _sfStippleRepeat (source
._sfStippleRepeat
),
564 _sfStipplePattern (source
._sfStipplePattern
),
565 _sfSmooth (source
._sfSmooth
)
570 /*-------------------------- destructors ----------------------------------*/
572 LineChunkBase::~LineChunkBase(void)
577 GetFieldHandlePtr
LineChunkBase::getHandleWidth (void) const
579 SFReal32::GetHandlePtr
returnValue(
580 new SFReal32::GetHandle(
582 this->getType().getFieldDesc(WidthFieldId
),
583 const_cast<LineChunkBase
*>(this)));
588 EditFieldHandlePtr
LineChunkBase::editHandleWidth (void)
590 SFReal32::EditHandlePtr
returnValue(
591 new SFReal32::EditHandle(
593 this->getType().getFieldDesc(WidthFieldId
),
597 editSField(WidthFieldMask
);
602 GetFieldHandlePtr
LineChunkBase::getHandleStippleRepeat (void) const
604 SFInt32::GetHandlePtr
returnValue(
605 new SFInt32::GetHandle(
607 this->getType().getFieldDesc(StippleRepeatFieldId
),
608 const_cast<LineChunkBase
*>(this)));
613 EditFieldHandlePtr
LineChunkBase::editHandleStippleRepeat (void)
615 SFInt32::EditHandlePtr
returnValue(
616 new SFInt32::EditHandle(
618 this->getType().getFieldDesc(StippleRepeatFieldId
),
622 editSField(StippleRepeatFieldMask
);
627 GetFieldHandlePtr
LineChunkBase::getHandleStipplePattern (void) const
629 SFUInt16::GetHandlePtr
returnValue(
630 new SFUInt16::GetHandle(
632 this->getType().getFieldDesc(StipplePatternFieldId
),
633 const_cast<LineChunkBase
*>(this)));
638 EditFieldHandlePtr
LineChunkBase::editHandleStipplePattern (void)
640 SFUInt16::EditHandlePtr
returnValue(
641 new SFUInt16::EditHandle(
643 this->getType().getFieldDesc(StipplePatternFieldId
),
647 editSField(StipplePatternFieldMask
);
652 GetFieldHandlePtr
LineChunkBase::getHandleSmooth (void) const
654 SFBool::GetHandlePtr
returnValue(
655 new SFBool::GetHandle(
657 this->getType().getFieldDesc(SmoothFieldId
),
658 const_cast<LineChunkBase
*>(this)));
663 EditFieldHandlePtr
LineChunkBase::editHandleSmooth (void)
665 SFBool::EditHandlePtr
returnValue(
666 new SFBool::EditHandle(
668 this->getType().getFieldDesc(SmoothFieldId
),
672 editSField(SmoothFieldMask
);
678 #ifdef OSG_MT_CPTR_ASPECT
679 void LineChunkBase::execSyncV( FieldContainer
&oFrom
,
680 ConstFieldMaskArg whichField
,
681 AspectOffsetStore
&oOffsets
,
682 ConstFieldMaskArg syncMode
,
683 const UInt32 uiSyncInfo
)
685 LineChunk
*pThis
= static_cast<LineChunk
*>(this);
687 pThis
->execSync(static_cast<LineChunk
*>(&oFrom
),
696 #ifdef OSG_MT_CPTR_ASPECT
697 FieldContainer
*LineChunkBase::createAspectCopy(
698 const FieldContainer
*pRefAspect
) const
700 LineChunk
*returnValue
;
702 newAspectCopy(returnValue
,
703 dynamic_cast<const LineChunk
*>(pRefAspect
),
704 dynamic_cast<const LineChunk
*>(this));
710 void LineChunkBase::resolveLinks(void)
712 Inherited::resolveLinks();