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 ColorMaskChunk!
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"
66 #include "OSGColorMaskChunkBase.h"
67 #include "OSGColorMaskChunk.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::ColorMaskChunk
78 The color mask chunk contains the parameters that are specific for color writing.
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var bool ColorMaskChunkBase::_sfMaskR
86 Used to mask the writing of the R value to the color buffer.
89 /*! \var bool ColorMaskChunkBase::_sfMaskG
90 Used to mask the writing of the G value to the color buffer.
93 /*! \var bool ColorMaskChunkBase::_sfMaskB
94 Used to mask the writing of the B value to the color buffer.
97 /*! \var bool ColorMaskChunkBase::_sfMaskA
98 Used to mask the writing of the A value to the color buffer.
102 /***************************************************************************\
103 * FieldType/FieldTrait Instantiation *
104 \***************************************************************************/
106 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
107 PointerType FieldTraits
<ColorMaskChunk
*, nsOSG
>::_type(
110 ColorMaskChunk::getClassType(),
114 OSG_FIELDTRAITS_GETTYPE_NS(ColorMaskChunk
*, nsOSG
)
116 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
120 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
124 /***************************************************************************\
125 * Field Description *
126 \***************************************************************************/
128 void ColorMaskChunkBase::classDescInserter(TypeObject
&oType
)
130 FieldDescriptionBase
*pDesc
= NULL
;
133 pDesc
= new SFBool::Description(
134 SFBool::getClassType(),
136 "Used to mask the writing of the R value to the color buffer.\n",
137 MaskRFieldId
, MaskRFieldMask
,
139 (Field::SFDefaultFlags
| Field::FStdAccess
),
140 static_cast<FieldEditMethodSig
>(&ColorMaskChunk::editHandleMaskR
),
141 static_cast<FieldGetMethodSig
>(&ColorMaskChunk::getHandleMaskR
));
143 oType
.addInitialDesc(pDesc
);
145 pDesc
= new SFBool::Description(
146 SFBool::getClassType(),
148 "Used to mask the writing of the G value to the color buffer.\n",
149 MaskGFieldId
, MaskGFieldMask
,
151 (Field::SFDefaultFlags
| Field::FStdAccess
),
152 static_cast<FieldEditMethodSig
>(&ColorMaskChunk::editHandleMaskG
),
153 static_cast<FieldGetMethodSig
>(&ColorMaskChunk::getHandleMaskG
));
155 oType
.addInitialDesc(pDesc
);
157 pDesc
= new SFBool::Description(
158 SFBool::getClassType(),
160 "Used to mask the writing of the B value to the color buffer.\n",
161 MaskBFieldId
, MaskBFieldMask
,
163 (Field::SFDefaultFlags
| Field::FStdAccess
),
164 static_cast<FieldEditMethodSig
>(&ColorMaskChunk::editHandleMaskB
),
165 static_cast<FieldGetMethodSig
>(&ColorMaskChunk::getHandleMaskB
));
167 oType
.addInitialDesc(pDesc
);
169 pDesc
= new SFBool::Description(
170 SFBool::getClassType(),
172 "Used to mask the writing of the A value to the color buffer.\n",
173 MaskAFieldId
, MaskAFieldMask
,
175 (Field::SFDefaultFlags
| Field::FStdAccess
),
176 static_cast<FieldEditMethodSig
>(&ColorMaskChunk::editHandleMaskA
),
177 static_cast<FieldGetMethodSig
>(&ColorMaskChunk::getHandleMaskA
));
179 oType
.addInitialDesc(pDesc
);
183 ColorMaskChunkBase::TypeObject
ColorMaskChunkBase::_type(
184 ColorMaskChunkBase::getClassname(),
185 Inherited::getClassname(),
188 reinterpret_cast<PrototypeCreateF
>(&ColorMaskChunkBase::createEmptyLocal
),
189 reinterpret_cast<InitContainerF
>(&ColorMaskChunk::initMethod
),
190 reinterpret_cast<ExitContainerF
>(&ColorMaskChunk::exitMethod
),
191 reinterpret_cast<InitalInsertDescFunc
>(
192 reinterpret_cast<void *>(&ColorMaskChunk::classDescInserter
)),
195 "<?xml version=\"1.0\"?>\n"
198 " name=\"ColorMaskChunk\"\n"
199 " parent=\"StateChunk\"\n"
200 " library=\"System\"\n"
201 " pointerfieldtypes=\"both\"\n"
202 " structure=\"concrete\"\n"
203 " systemcomponent=\"true\"\n"
204 " parentsystemcomponent=\"true\"\n"
205 " decoratable=\"false\"\n"
206 " useLocalIncludes=\"false\"\n"
207 " docGroupBase=\"GrpSystemState\"\n"
209 "The color mask chunk contains the parameters that are specific for color writing.\n"
211 "\t\tname=\"maskR\"\n"
212 "\t\ttype=\"bool\"\n"
213 "\t\tcardinality=\"single\"\n"
214 "\t\tvisibility=\"external\"\n"
215 "\t\tdefaultValue=\"true\"\n"
216 "\t\taccess=\"public\"\n"
218 "\tUsed to mask the writing of the R value to the color buffer.\n"
221 "\t\tname=\"maskG\"\n"
222 "\t\ttype=\"bool\"\n"
223 "\t\tcardinality=\"single\"\n"
224 "\t\tvisibility=\"external\"\n"
225 "\t\tdefaultValue=\"true\"\n"
226 "\t\taccess=\"public\"\n"
228 "\tUsed to mask the writing of the G value to the color buffer.\n"
231 "\t\tname=\"maskB\"\n"
232 "\t\ttype=\"bool\"\n"
233 "\t\tcardinality=\"single\"\n"
234 "\t\tvisibility=\"external\"\n"
235 "\t\tdefaultValue=\"true\"\n"
236 "\t\taccess=\"public\"\n"
238 "\tUsed to mask the writing of the B value to the color buffer.\n"
241 "\t\tname=\"maskA\"\n"
242 "\t\ttype=\"bool\"\n"
243 "\t\tcardinality=\"single\"\n"
244 "\t\tvisibility=\"external\"\n"
245 "\t\tdefaultValue=\"true\"\n"
246 "\t\taccess=\"public\"\n"
248 "\tUsed to mask the writing of the A value to the color buffer.\n"
250 "</FieldContainer>\n",
251 "The color mask chunk contains the parameters that are specific for color writing.\n"
254 /*------------------------------ get -----------------------------------*/
256 FieldContainerType
&ColorMaskChunkBase::getType(void)
261 const FieldContainerType
&ColorMaskChunkBase::getType(void) const
266 UInt32
ColorMaskChunkBase::getContainerSize(void) const
268 return sizeof(ColorMaskChunk
);
271 /*------------------------- decorator get ------------------------------*/
274 SFBool
*ColorMaskChunkBase::editSFMaskR(void)
276 editSField(MaskRFieldMask
);
281 const SFBool
*ColorMaskChunkBase::getSFMaskR(void) const
287 SFBool
*ColorMaskChunkBase::editSFMaskG(void)
289 editSField(MaskGFieldMask
);
294 const SFBool
*ColorMaskChunkBase::getSFMaskG(void) const
300 SFBool
*ColorMaskChunkBase::editSFMaskB(void)
302 editSField(MaskBFieldMask
);
307 const SFBool
*ColorMaskChunkBase::getSFMaskB(void) const
313 SFBool
*ColorMaskChunkBase::editSFMaskA(void)
315 editSField(MaskAFieldMask
);
320 const SFBool
*ColorMaskChunkBase::getSFMaskA(void) const
330 /*------------------------------ access -----------------------------------*/
332 SizeT
ColorMaskChunkBase::getBinSize(ConstFieldMaskArg whichField
)
334 SizeT returnValue
= Inherited::getBinSize(whichField
);
336 if(FieldBits::NoField
!= (MaskRFieldMask
& whichField
))
338 returnValue
+= _sfMaskR
.getBinSize();
340 if(FieldBits::NoField
!= (MaskGFieldMask
& whichField
))
342 returnValue
+= _sfMaskG
.getBinSize();
344 if(FieldBits::NoField
!= (MaskBFieldMask
& whichField
))
346 returnValue
+= _sfMaskB
.getBinSize();
348 if(FieldBits::NoField
!= (MaskAFieldMask
& whichField
))
350 returnValue
+= _sfMaskA
.getBinSize();
356 void ColorMaskChunkBase::copyToBin(BinaryDataHandler
&pMem
,
357 ConstFieldMaskArg whichField
)
359 Inherited::copyToBin(pMem
, whichField
);
361 if(FieldBits::NoField
!= (MaskRFieldMask
& whichField
))
363 _sfMaskR
.copyToBin(pMem
);
365 if(FieldBits::NoField
!= (MaskGFieldMask
& whichField
))
367 _sfMaskG
.copyToBin(pMem
);
369 if(FieldBits::NoField
!= (MaskBFieldMask
& whichField
))
371 _sfMaskB
.copyToBin(pMem
);
373 if(FieldBits::NoField
!= (MaskAFieldMask
& whichField
))
375 _sfMaskA
.copyToBin(pMem
);
379 void ColorMaskChunkBase::copyFromBin(BinaryDataHandler
&pMem
,
380 ConstFieldMaskArg whichField
)
382 Inherited::copyFromBin(pMem
, whichField
);
384 if(FieldBits::NoField
!= (MaskRFieldMask
& whichField
))
386 editSField(MaskRFieldMask
);
387 _sfMaskR
.copyFromBin(pMem
);
389 if(FieldBits::NoField
!= (MaskGFieldMask
& whichField
))
391 editSField(MaskGFieldMask
);
392 _sfMaskG
.copyFromBin(pMem
);
394 if(FieldBits::NoField
!= (MaskBFieldMask
& whichField
))
396 editSField(MaskBFieldMask
);
397 _sfMaskB
.copyFromBin(pMem
);
399 if(FieldBits::NoField
!= (MaskAFieldMask
& whichField
))
401 editSField(MaskAFieldMask
);
402 _sfMaskA
.copyFromBin(pMem
);
406 //! create a new instance of the class
407 ColorMaskChunkTransitPtr
ColorMaskChunkBase::createLocal(BitVector bFlags
)
409 ColorMaskChunkTransitPtr fc
;
411 if(getClassType().getPrototype() != NULL
)
413 FieldContainerTransitPtr tmpPtr
=
414 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
416 fc
= dynamic_pointer_cast
<ColorMaskChunk
>(tmpPtr
);
422 //! create a new instance of the class, copy the container flags
423 ColorMaskChunkTransitPtr
ColorMaskChunkBase::createDependent(BitVector bFlags
)
425 ColorMaskChunkTransitPtr fc
;
427 if(getClassType().getPrototype() != NULL
)
429 FieldContainerTransitPtr tmpPtr
=
430 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
432 fc
= dynamic_pointer_cast
<ColorMaskChunk
>(tmpPtr
);
438 //! create a new instance of the class
439 ColorMaskChunkTransitPtr
ColorMaskChunkBase::create(void)
441 ColorMaskChunkTransitPtr fc
;
443 if(getClassType().getPrototype() != NULL
)
445 FieldContainerTransitPtr tmpPtr
=
446 getClassType().getPrototype()-> shallowCopy();
448 fc
= dynamic_pointer_cast
<ColorMaskChunk
>(tmpPtr
);
454 ColorMaskChunk
*ColorMaskChunkBase::createEmptyLocal(BitVector bFlags
)
456 ColorMaskChunk
*returnValue
;
458 newPtr
<ColorMaskChunk
>(returnValue
, bFlags
);
460 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
465 //! create an empty new instance of the class, do not copy the prototype
466 ColorMaskChunk
*ColorMaskChunkBase::createEmpty(void)
468 ColorMaskChunk
*returnValue
;
470 newPtr
<ColorMaskChunk
>(returnValue
, Thread::getCurrentLocalFlags());
472 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
473 ~Thread::getCurrentLocalFlags();
479 FieldContainerTransitPtr
ColorMaskChunkBase::shallowCopyLocal(
480 BitVector bFlags
) const
482 ColorMaskChunk
*tmpPtr
;
484 newPtr(tmpPtr
, dynamic_cast<const ColorMaskChunk
*>(this), bFlags
);
486 FieldContainerTransitPtr
returnValue(tmpPtr
);
488 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
493 FieldContainerTransitPtr
ColorMaskChunkBase::shallowCopyDependent(
494 BitVector bFlags
) const
496 ColorMaskChunk
*tmpPtr
;
498 newPtr(tmpPtr
, dynamic_cast<const ColorMaskChunk
*>(this), ~bFlags
);
500 FieldContainerTransitPtr
returnValue(tmpPtr
);
502 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
507 FieldContainerTransitPtr
ColorMaskChunkBase::shallowCopy(void) const
509 ColorMaskChunk
*tmpPtr
;
512 dynamic_cast<const ColorMaskChunk
*>(this),
513 Thread::getCurrentLocalFlags());
515 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
517 FieldContainerTransitPtr
returnValue(tmpPtr
);
525 /*------------------------- constructors ----------------------------------*/
527 ColorMaskChunkBase::ColorMaskChunkBase(void) :
529 _sfMaskR (bool(true)),
530 _sfMaskG (bool(true)),
531 _sfMaskB (bool(true)),
532 _sfMaskA (bool(true))
536 ColorMaskChunkBase::ColorMaskChunkBase(const ColorMaskChunkBase
&source
) :
538 _sfMaskR (source
._sfMaskR
),
539 _sfMaskG (source
._sfMaskG
),
540 _sfMaskB (source
._sfMaskB
),
541 _sfMaskA (source
._sfMaskA
)
546 /*-------------------------- destructors ----------------------------------*/
548 ColorMaskChunkBase::~ColorMaskChunkBase(void)
553 GetFieldHandlePtr
ColorMaskChunkBase::getHandleMaskR (void) const
555 SFBool::GetHandlePtr
returnValue(
556 new SFBool::GetHandle(
558 this->getType().getFieldDesc(MaskRFieldId
),
559 const_cast<ColorMaskChunkBase
*>(this)));
564 EditFieldHandlePtr
ColorMaskChunkBase::editHandleMaskR (void)
566 SFBool::EditHandlePtr
returnValue(
567 new SFBool::EditHandle(
569 this->getType().getFieldDesc(MaskRFieldId
),
573 editSField(MaskRFieldMask
);
578 GetFieldHandlePtr
ColorMaskChunkBase::getHandleMaskG (void) const
580 SFBool::GetHandlePtr
returnValue(
581 new SFBool::GetHandle(
583 this->getType().getFieldDesc(MaskGFieldId
),
584 const_cast<ColorMaskChunkBase
*>(this)));
589 EditFieldHandlePtr
ColorMaskChunkBase::editHandleMaskG (void)
591 SFBool::EditHandlePtr
returnValue(
592 new SFBool::EditHandle(
594 this->getType().getFieldDesc(MaskGFieldId
),
598 editSField(MaskGFieldMask
);
603 GetFieldHandlePtr
ColorMaskChunkBase::getHandleMaskB (void) const
605 SFBool::GetHandlePtr
returnValue(
606 new SFBool::GetHandle(
608 this->getType().getFieldDesc(MaskBFieldId
),
609 const_cast<ColorMaskChunkBase
*>(this)));
614 EditFieldHandlePtr
ColorMaskChunkBase::editHandleMaskB (void)
616 SFBool::EditHandlePtr
returnValue(
617 new SFBool::EditHandle(
619 this->getType().getFieldDesc(MaskBFieldId
),
623 editSField(MaskBFieldMask
);
628 GetFieldHandlePtr
ColorMaskChunkBase::getHandleMaskA (void) const
630 SFBool::GetHandlePtr
returnValue(
631 new SFBool::GetHandle(
633 this->getType().getFieldDesc(MaskAFieldId
),
634 const_cast<ColorMaskChunkBase
*>(this)));
639 EditFieldHandlePtr
ColorMaskChunkBase::editHandleMaskA (void)
641 SFBool::EditHandlePtr
returnValue(
642 new SFBool::EditHandle(
644 this->getType().getFieldDesc(MaskAFieldId
),
648 editSField(MaskAFieldMask
);
654 #ifdef OSG_MT_CPTR_ASPECT
655 void ColorMaskChunkBase::execSyncV( FieldContainer
&oFrom
,
656 ConstFieldMaskArg whichField
,
657 AspectOffsetStore
&oOffsets
,
658 ConstFieldMaskArg syncMode
,
659 const UInt32 uiSyncInfo
)
661 ColorMaskChunk
*pThis
= static_cast<ColorMaskChunk
*>(this);
663 pThis
->execSync(static_cast<ColorMaskChunk
*>(&oFrom
),
672 #ifdef OSG_MT_CPTR_ASPECT
673 FieldContainer
*ColorMaskChunkBase::createAspectCopy(
674 const FieldContainer
*pRefAspect
) const
676 ColorMaskChunk
*returnValue
;
678 newAspectCopy(returnValue
,
679 dynamic_cast<const ColorMaskChunk
*>(pRefAspect
),
680 dynamic_cast<const ColorMaskChunk
*>(this));
686 void ColorMaskChunkBase::resolveLinks(void)
688 Inherited::resolveLinks();