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" // SrcFactor default header
65 #include "OSGGL.h" // DestFactor default header
66 #include "OSGGL.h" // Equation default header
67 #include "OSGGL.h" // AlphaFunc default header
70 #include "OSGBlendChunkBase.h"
71 #include "OSGBlendChunk.h"
73 #include <boost/bind.hpp>
77 /***************************************************************************\
79 \***************************************************************************/
81 /*! \class OSG::BlendChunk
82 See \ref PageSystemBlendChunk for a description.
84 The blending chunk handles OpenGL blending, i.e. the definition how incoming pixel
85 are combined with the pixel already in the frame buffer.
87 This chunk wraps glBlendFunc() (OSG::BlendChunk::_sfSrcFactor,
88 OSG::BlendChunk::_sfDestFactor), glBlendEquation() or glBlendEquationEXT()
89 (whichever is supported) (OSG::BlendChunk::_sfEquation), glBlendColor()
90 (OSG::BlendChunk::_sfColor) and glAlphaFunc() (OSG::BlendChunk::_sfAlphaFunc,
91 OSG::BlendChunk::_sfAlphaValue) including glEnable(GL_ALPHA_TEST).
94 /***************************************************************************\
95 * Field Documentation *
96 \***************************************************************************/
98 /*! \var GLenum BlendChunkBase::_sfSrcFactor
99 The incoming pixel is multiplied by the source factor. Legal values are directly taken from the glBlendFunc() manpage.
102 /*! \var GLenum BlendChunkBase::_sfDestFactor
103 The frame buffer pixel is multiplied by the destination factor. Legal values are directly taken from the glBlendFunc() manpage.
106 /*! \var GLenum BlendChunkBase::_sfEquation
107 The equation used to combine the two values. Only available where GL_ARB_imaging is supported. See glBlendEquation() for details.
110 /*! \var Color4f BlendChunkBase::_sfColor
111 This is the constant color used by blend modes *_CONSTANT_*.
114 /*! \var GLenum BlendChunkBase::_sfAlphaFunc
115 The alphaFunc defines how fragments which do not fulfill a certain condition are handled.
116 See glAlphaFunc() for details. GL_NONE is used to disable alpha comparison.
119 /*! \var Real32 BlendChunkBase::_sfAlphaValue
120 The value used in alpha comparison.
123 /*! \var GLenum BlendChunkBase::_sfAlphaSrcFactor
124 The incoming alpha is multiplied by the source factor before being stored
125 in the frame buffer. Only available where GL_EXT_blend_func_separate is supported.
126 The default is GL_NONE, which indicates using the standard BlendFunction.
129 /*! \var GLenum BlendChunkBase::_sfAlphaDestFactor
130 The frame buffer alpha is multiplied by the source factor before being stored
131 in the frame buffer. Only available where GL_EXT_blend_func_separate is supported.
132 The default is GL_NONE, which indicates using the standard BlendFunction.
136 /***************************************************************************\
137 * FieldType/FieldTrait Instantiation *
138 \***************************************************************************/
140 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
141 PointerType FieldTraits
<BlendChunk
*, nsOSG
>::_type(
144 BlendChunk::getClassType(),
148 OSG_FIELDTRAITS_GETTYPE_NS(BlendChunk
*, nsOSG
)
150 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
154 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
158 /***************************************************************************\
159 * Field Description *
160 \***************************************************************************/
162 void BlendChunkBase::classDescInserter(TypeObject
&oType
)
164 FieldDescriptionBase
*pDesc
= NULL
;
167 pDesc
= new SFGLenum::Description(
168 SFGLenum::getClassType(),
170 "The incoming pixel is multiplied by the source factor. Legal values are directly taken from the glBlendFunc() manpage.\n",
171 SrcFactorFieldId
, SrcFactorFieldMask
,
173 (Field::SFDefaultFlags
| Field::FStdAccess
),
174 static_cast<FieldEditMethodSig
>(&BlendChunk::editHandleSrcFactor
),
175 static_cast<FieldGetMethodSig
>(&BlendChunk::getHandleSrcFactor
));
177 oType
.addInitialDesc(pDesc
);
179 pDesc
= new SFGLenum::Description(
180 SFGLenum::getClassType(),
182 "The frame buffer pixel is multiplied by the destination factor. Legal values are directly taken from the glBlendFunc() manpage.\n",
183 DestFactorFieldId
, DestFactorFieldMask
,
185 (Field::SFDefaultFlags
| Field::FStdAccess
),
186 static_cast<FieldEditMethodSig
>(&BlendChunk::editHandleDestFactor
),
187 static_cast<FieldGetMethodSig
>(&BlendChunk::getHandleDestFactor
));
189 oType
.addInitialDesc(pDesc
);
191 pDesc
= new SFGLenum::Description(
192 SFGLenum::getClassType(),
194 "The equation used to combine the two values. Only available where GL_ARB_imaging is supported. See glBlendEquation() for details.\n",
195 EquationFieldId
, EquationFieldMask
,
197 (Field::SFDefaultFlags
| Field::FStdAccess
),
198 static_cast<FieldEditMethodSig
>(&BlendChunk::editHandleEquation
),
199 static_cast<FieldGetMethodSig
>(&BlendChunk::getHandleEquation
));
201 oType
.addInitialDesc(pDesc
);
203 pDesc
= new SFColor4f::Description(
204 SFColor4f::getClassType(),
206 "This is the constant color used by blend modes *_CONSTANT_*.\n",
207 ColorFieldId
, ColorFieldMask
,
209 (Field::SFDefaultFlags
| Field::FStdAccess
),
210 static_cast<FieldEditMethodSig
>(&BlendChunk::editHandleColor
),
211 static_cast<FieldGetMethodSig
>(&BlendChunk::getHandleColor
));
213 oType
.addInitialDesc(pDesc
);
215 pDesc
= new SFGLenum::Description(
216 SFGLenum::getClassType(),
218 "The alphaFunc defines how fragments which do not fulfill a certain condition are handled. \n"
219 "See glAlphaFunc() for details. GL_NONE is used to disable alpha comparison.\n",
220 AlphaFuncFieldId
, AlphaFuncFieldMask
,
222 (Field::SFDefaultFlags
| Field::FStdAccess
),
223 static_cast<FieldEditMethodSig
>(&BlendChunk::editHandleAlphaFunc
),
224 static_cast<FieldGetMethodSig
>(&BlendChunk::getHandleAlphaFunc
));
226 oType
.addInitialDesc(pDesc
);
228 pDesc
= new SFReal32::Description(
229 SFReal32::getClassType(),
231 "The value used in alpha comparison.\n",
232 AlphaValueFieldId
, AlphaValueFieldMask
,
234 (Field::SFDefaultFlags
| Field::FStdAccess
),
235 static_cast<FieldEditMethodSig
>(&BlendChunk::editHandleAlphaValue
),
236 static_cast<FieldGetMethodSig
>(&BlendChunk::getHandleAlphaValue
));
238 oType
.addInitialDesc(pDesc
);
240 pDesc
= new SFGLenum::Description(
241 SFGLenum::getClassType(),
243 "The incoming alpha is multiplied by the source factor before being stored \n"
244 "in the frame buffer. Only available where GL_EXT_blend_func_separate is supported.\n"
245 "The default is GL_NONE, which indicates using the standard BlendFunction.\n",
246 AlphaSrcFactorFieldId
, AlphaSrcFactorFieldMask
,
248 (Field::SFDefaultFlags
| Field::FStdAccess
),
249 static_cast<FieldEditMethodSig
>(&BlendChunk::editHandleAlphaSrcFactor
),
250 static_cast<FieldGetMethodSig
>(&BlendChunk::getHandleAlphaSrcFactor
));
252 oType
.addInitialDesc(pDesc
);
254 pDesc
= new SFGLenum::Description(
255 SFGLenum::getClassType(),
257 "The frame buffer alpha is multiplied by the source factor before being stored \n"
258 "in the frame buffer. Only available where GL_EXT_blend_func_separate is supported.\n"
259 "The default is GL_NONE, which indicates using the standard BlendFunction.\n",
260 AlphaDestFactorFieldId
, AlphaDestFactorFieldMask
,
262 (Field::SFDefaultFlags
| Field::FStdAccess
),
263 static_cast<FieldEditMethodSig
>(&BlendChunk::editHandleAlphaDestFactor
),
264 static_cast<FieldGetMethodSig
>(&BlendChunk::getHandleAlphaDestFactor
));
266 oType
.addInitialDesc(pDesc
);
270 BlendChunkBase::TypeObject
BlendChunkBase::_type(
271 BlendChunkBase::getClassname(),
272 Inherited::getClassname(),
275 reinterpret_cast<PrototypeCreateF
>(&BlendChunkBase::createEmptyLocal
),
276 reinterpret_cast<InitContainerF
>(&BlendChunk::initMethod
),
277 reinterpret_cast<ExitContainerF
>(&BlendChunk::exitMethod
),
278 reinterpret_cast<InitalInsertDescFunc
>(
279 reinterpret_cast<void *>(&BlendChunk::classDescInserter
)),
282 "<?xml version=\"1.0\"?>\n"
285 " name=\"BlendChunk\"\n"
286 " parent=\"StateChunk\"\n"
287 " library=\"System\"\n"
288 " pointerfieldtypes=\"both\"\n"
289 " structure=\"concrete\"\n"
290 " systemcomponent=\"true\"\n"
291 " parentsystemcomponent=\"true\"\n"
292 " docGroupBase=\"GrpSystemState\"\n"
295 "See \\ref PageSystemBlendChunk for a description. \n"
297 "The blending chunk handles OpenGL blending, i.e. the definition how incoming pixel\n"
298 "are combined with the pixel already in the frame buffer.\n"
300 "This chunk wraps glBlendFunc() (OSG::BlendChunk::_sfSrcFactor,\n"
301 "OSG::BlendChunk::_sfDestFactor), glBlendEquation() or glBlendEquationEXT()\n"
302 "(whichever is supported) (OSG::BlendChunk::_sfEquation), glBlendColor() \n"
303 "(OSG::BlendChunk::_sfColor) and glAlphaFunc() (OSG::BlendChunk::_sfAlphaFunc,\n"
304 "OSG::BlendChunk::_sfAlphaValue) including glEnable(GL_ALPHA_TEST).\n"
306 "\t\tname=\"srcFactor\"\n"
307 "\t\ttype=\"GLenum\"\n"
308 "\t\tcardinality=\"single\"\n"
309 "\t\tvisibility=\"external\"\n"
310 "\t\tdefaultHeader=\""OSGGL.h"\"\n"
311 "\t\tdefaultValue=\"GL_ONE\"\n"
312 "\t\taccess=\"public\"\n"
314 "\tThe incoming pixel is multiplied by the source factor. Legal values are directly taken from the glBlendFunc() manpage.\n"
317 "\t\tname=\"destFactor\"\n"
318 "\t\ttype=\"GLenum\"\n"
319 "\t\tcardinality=\"single\"\n"
320 "\t\tvisibility=\"external\"\n"
321 "\t\tdefaultHeader=\""OSGGL.h"\"\n"
322 "\t\tdefaultValue=\"GL_ZERO\"\n"
323 "\t\taccess=\"public\"\n"
325 "\tThe frame buffer pixel is multiplied by the destination factor. Legal values are directly taken from the glBlendFunc() manpage.\n"
328 "\t\tname=\"equation\"\n"
329 "\t\ttype=\"GLenum\"\n"
330 "\t\tcardinality=\"single\"\n"
331 "\t\tvisibility=\"external\"\n"
332 "\t\tdefaultHeader=\""OSGGL.h"\"\n"
333 "\t\tdefaultValue=\"GL_NONE\"\n"
334 "\t\taccess=\"public\"\n"
336 "\tThe equation used to combine the two values. Only available where GL_ARB_imaging is supported. See glBlendEquation() for details.\n"
339 "\t\tname=\"color\"\n"
340 "\t\ttype=\"Color4f\"\n"
341 "\t\tcardinality=\"single\"\n"
342 "\t\tvisibility=\"external\"\n"
343 "\t\tdefaultValue=\"0,0,0,0\"\n"
344 "\t\taccess=\"public\"\n"
346 "\tThis is the constant color used by blend modes *_CONSTANT_*.\n"
349 "\t\tname=\"alphaFunc\"\n"
350 "\t\ttype=\"GLenum\"\n"
351 "\t\tcardinality=\"single\"\n"
352 "\t\tvisibility=\"external\"\n"
353 "\t\tdefaultValue=\"GL_NONE\"\n"
354 "\t\tdefaultHeader=\""OSGGL.h"\"\n"
355 "\t\taccess=\"public\"\n"
357 "\tThe alphaFunc defines how fragments which do not fulfill a certain condition are handled. \n"
358 " See glAlphaFunc() for details. GL_NONE is used to disable alpha comparison.\n"
361 "\t\tname=\"alphaValue\"\n"
362 "\t\ttype=\"Real32\"\n"
363 "\t\tcardinality=\"single\"\n"
364 "\t\tvisibility=\"external\"\n"
365 "\t\tdefaultValue=\"0\"\n"
366 "\t\taccess=\"public\"\n"
368 " The value used in alpha comparison.\n"
371 "\t\tname=\"alphaSrcFactor\"\n"
372 "\t\ttype=\"GLenum\"\n"
373 "\t\tcardinality=\"single\"\n"
374 "\t\tvisibility=\"external\"\n"
375 "\t\tdefaultValue=\"OSG_GL_UNUSED\"\n"
376 "\t\taccess=\"public\"\n"
378 "\tThe incoming alpha is multiplied by the source factor before being stored \n"
379 " in the frame buffer. Only available where GL_EXT_blend_func_separate is supported.\n"
380 " The default is GL_NONE, which indicates using the standard BlendFunction.\n"
383 "\t\tname=\"alphaDestFactor\"\n"
384 "\t\ttype=\"GLenum\"\n"
385 "\t\tcardinality=\"single\"\n"
386 "\t\tvisibility=\"external\"\n"
387 "\t\tdefaultValue=\"OSG_GL_UNUSED\"\n"
388 "\t\taccess=\"public\"\n"
390 "\tThe frame buffer alpha is multiplied by the source factor before being stored \n"
391 " in the frame buffer. Only available where GL_EXT_blend_func_separate is supported.\n"
392 " The default is GL_NONE, which indicates using the standard BlendFunction.\n"
394 "</FieldContainer>\n",
395 "See \\ref PageSystemBlendChunk for a description. \n"
397 "The blending chunk handles OpenGL blending, i.e. the definition how incoming pixel\n"
398 "are combined with the pixel already in the frame buffer.\n"
400 "This chunk wraps glBlendFunc() (OSG::BlendChunk::_sfSrcFactor,\n"
401 "OSG::BlendChunk::_sfDestFactor), glBlendEquation() or glBlendEquationEXT()\n"
402 "(whichever is supported) (OSG::BlendChunk::_sfEquation), glBlendColor() \n"
403 "(OSG::BlendChunk::_sfColor) and glAlphaFunc() (OSG::BlendChunk::_sfAlphaFunc,\n"
404 "OSG::BlendChunk::_sfAlphaValue) including glEnable(GL_ALPHA_TEST).\n"
407 /*------------------------------ get -----------------------------------*/
409 FieldContainerType
&BlendChunkBase::getType(void)
414 const FieldContainerType
&BlendChunkBase::getType(void) const
419 UInt32
BlendChunkBase::getContainerSize(void) const
421 return sizeof(BlendChunk
);
424 /*------------------------- decorator get ------------------------------*/
427 SFGLenum
*BlendChunkBase::editSFSrcFactor(void)
429 editSField(SrcFactorFieldMask
);
431 return &_sfSrcFactor
;
434 const SFGLenum
*BlendChunkBase::getSFSrcFactor(void) const
436 return &_sfSrcFactor
;
440 SFGLenum
*BlendChunkBase::editSFDestFactor(void)
442 editSField(DestFactorFieldMask
);
444 return &_sfDestFactor
;
447 const SFGLenum
*BlendChunkBase::getSFDestFactor(void) const
449 return &_sfDestFactor
;
453 SFGLenum
*BlendChunkBase::editSFEquation(void)
455 editSField(EquationFieldMask
);
460 const SFGLenum
*BlendChunkBase::getSFEquation(void) const
466 SFColor4f
*BlendChunkBase::editSFColor(void)
468 editSField(ColorFieldMask
);
473 const SFColor4f
*BlendChunkBase::getSFColor(void) const
479 SFGLenum
*BlendChunkBase::editSFAlphaFunc(void)
481 editSField(AlphaFuncFieldMask
);
483 return &_sfAlphaFunc
;
486 const SFGLenum
*BlendChunkBase::getSFAlphaFunc(void) const
488 return &_sfAlphaFunc
;
492 SFReal32
*BlendChunkBase::editSFAlphaValue(void)
494 editSField(AlphaValueFieldMask
);
496 return &_sfAlphaValue
;
499 const SFReal32
*BlendChunkBase::getSFAlphaValue(void) const
501 return &_sfAlphaValue
;
505 SFGLenum
*BlendChunkBase::editSFAlphaSrcFactor(void)
507 editSField(AlphaSrcFactorFieldMask
);
509 return &_sfAlphaSrcFactor
;
512 const SFGLenum
*BlendChunkBase::getSFAlphaSrcFactor(void) const
514 return &_sfAlphaSrcFactor
;
518 SFGLenum
*BlendChunkBase::editSFAlphaDestFactor(void)
520 editSField(AlphaDestFactorFieldMask
);
522 return &_sfAlphaDestFactor
;
525 const SFGLenum
*BlendChunkBase::getSFAlphaDestFactor(void) const
527 return &_sfAlphaDestFactor
;
535 /*------------------------------ access -----------------------------------*/
537 SizeT
BlendChunkBase::getBinSize(ConstFieldMaskArg whichField
)
539 SizeT returnValue
= Inherited::getBinSize(whichField
);
541 if(FieldBits::NoField
!= (SrcFactorFieldMask
& whichField
))
543 returnValue
+= _sfSrcFactor
.getBinSize();
545 if(FieldBits::NoField
!= (DestFactorFieldMask
& whichField
))
547 returnValue
+= _sfDestFactor
.getBinSize();
549 if(FieldBits::NoField
!= (EquationFieldMask
& whichField
))
551 returnValue
+= _sfEquation
.getBinSize();
553 if(FieldBits::NoField
!= (ColorFieldMask
& whichField
))
555 returnValue
+= _sfColor
.getBinSize();
557 if(FieldBits::NoField
!= (AlphaFuncFieldMask
& whichField
))
559 returnValue
+= _sfAlphaFunc
.getBinSize();
561 if(FieldBits::NoField
!= (AlphaValueFieldMask
& whichField
))
563 returnValue
+= _sfAlphaValue
.getBinSize();
565 if(FieldBits::NoField
!= (AlphaSrcFactorFieldMask
& whichField
))
567 returnValue
+= _sfAlphaSrcFactor
.getBinSize();
569 if(FieldBits::NoField
!= (AlphaDestFactorFieldMask
& whichField
))
571 returnValue
+= _sfAlphaDestFactor
.getBinSize();
577 void BlendChunkBase::copyToBin(BinaryDataHandler
&pMem
,
578 ConstFieldMaskArg whichField
)
580 Inherited::copyToBin(pMem
, whichField
);
582 if(FieldBits::NoField
!= (SrcFactorFieldMask
& whichField
))
584 _sfSrcFactor
.copyToBin(pMem
);
586 if(FieldBits::NoField
!= (DestFactorFieldMask
& whichField
))
588 _sfDestFactor
.copyToBin(pMem
);
590 if(FieldBits::NoField
!= (EquationFieldMask
& whichField
))
592 _sfEquation
.copyToBin(pMem
);
594 if(FieldBits::NoField
!= (ColorFieldMask
& whichField
))
596 _sfColor
.copyToBin(pMem
);
598 if(FieldBits::NoField
!= (AlphaFuncFieldMask
& whichField
))
600 _sfAlphaFunc
.copyToBin(pMem
);
602 if(FieldBits::NoField
!= (AlphaValueFieldMask
& whichField
))
604 _sfAlphaValue
.copyToBin(pMem
);
606 if(FieldBits::NoField
!= (AlphaSrcFactorFieldMask
& whichField
))
608 _sfAlphaSrcFactor
.copyToBin(pMem
);
610 if(FieldBits::NoField
!= (AlphaDestFactorFieldMask
& whichField
))
612 _sfAlphaDestFactor
.copyToBin(pMem
);
616 void BlendChunkBase::copyFromBin(BinaryDataHandler
&pMem
,
617 ConstFieldMaskArg whichField
)
619 Inherited::copyFromBin(pMem
, whichField
);
621 if(FieldBits::NoField
!= (SrcFactorFieldMask
& whichField
))
623 editSField(SrcFactorFieldMask
);
624 _sfSrcFactor
.copyFromBin(pMem
);
626 if(FieldBits::NoField
!= (DestFactorFieldMask
& whichField
))
628 editSField(DestFactorFieldMask
);
629 _sfDestFactor
.copyFromBin(pMem
);
631 if(FieldBits::NoField
!= (EquationFieldMask
& whichField
))
633 editSField(EquationFieldMask
);
634 _sfEquation
.copyFromBin(pMem
);
636 if(FieldBits::NoField
!= (ColorFieldMask
& whichField
))
638 editSField(ColorFieldMask
);
639 _sfColor
.copyFromBin(pMem
);
641 if(FieldBits::NoField
!= (AlphaFuncFieldMask
& whichField
))
643 editSField(AlphaFuncFieldMask
);
644 _sfAlphaFunc
.copyFromBin(pMem
);
646 if(FieldBits::NoField
!= (AlphaValueFieldMask
& whichField
))
648 editSField(AlphaValueFieldMask
);
649 _sfAlphaValue
.copyFromBin(pMem
);
651 if(FieldBits::NoField
!= (AlphaSrcFactorFieldMask
& whichField
))
653 editSField(AlphaSrcFactorFieldMask
);
654 _sfAlphaSrcFactor
.copyFromBin(pMem
);
656 if(FieldBits::NoField
!= (AlphaDestFactorFieldMask
& whichField
))
658 editSField(AlphaDestFactorFieldMask
);
659 _sfAlphaDestFactor
.copyFromBin(pMem
);
663 //! create a new instance of the class
664 BlendChunkTransitPtr
BlendChunkBase::createLocal(BitVector bFlags
)
666 BlendChunkTransitPtr fc
;
668 if(getClassType().getPrototype() != NULL
)
670 FieldContainerTransitPtr tmpPtr
=
671 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
673 fc
= dynamic_pointer_cast
<BlendChunk
>(tmpPtr
);
679 //! create a new instance of the class, copy the container flags
680 BlendChunkTransitPtr
BlendChunkBase::createDependent(BitVector bFlags
)
682 BlendChunkTransitPtr fc
;
684 if(getClassType().getPrototype() != NULL
)
686 FieldContainerTransitPtr tmpPtr
=
687 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
689 fc
= dynamic_pointer_cast
<BlendChunk
>(tmpPtr
);
695 //! create a new instance of the class
696 BlendChunkTransitPtr
BlendChunkBase::create(void)
698 BlendChunkTransitPtr fc
;
700 if(getClassType().getPrototype() != NULL
)
702 FieldContainerTransitPtr tmpPtr
=
703 getClassType().getPrototype()-> shallowCopy();
705 fc
= dynamic_pointer_cast
<BlendChunk
>(tmpPtr
);
711 BlendChunk
*BlendChunkBase::createEmptyLocal(BitVector bFlags
)
713 BlendChunk
*returnValue
;
715 newPtr
<BlendChunk
>(returnValue
, bFlags
);
717 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
722 //! create an empty new instance of the class, do not copy the prototype
723 BlendChunk
*BlendChunkBase::createEmpty(void)
725 BlendChunk
*returnValue
;
727 newPtr
<BlendChunk
>(returnValue
, Thread::getCurrentLocalFlags());
729 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
730 ~Thread::getCurrentLocalFlags();
736 FieldContainerTransitPtr
BlendChunkBase::shallowCopyLocal(
737 BitVector bFlags
) const
741 newPtr(tmpPtr
, dynamic_cast<const BlendChunk
*>(this), bFlags
);
743 FieldContainerTransitPtr
returnValue(tmpPtr
);
745 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
750 FieldContainerTransitPtr
BlendChunkBase::shallowCopyDependent(
751 BitVector bFlags
) const
755 newPtr(tmpPtr
, dynamic_cast<const BlendChunk
*>(this), ~bFlags
);
757 FieldContainerTransitPtr
returnValue(tmpPtr
);
759 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
764 FieldContainerTransitPtr
BlendChunkBase::shallowCopy(void) const
769 dynamic_cast<const BlendChunk
*>(this),
770 Thread::getCurrentLocalFlags());
772 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
774 FieldContainerTransitPtr
returnValue(tmpPtr
);
782 /*------------------------- constructors ----------------------------------*/
784 BlendChunkBase::BlendChunkBase(void) :
786 _sfSrcFactor (GLenum(GL_ONE
)),
787 _sfDestFactor (GLenum(GL_ZERO
)),
788 _sfEquation (GLenum(GL_NONE
)),
789 _sfColor (Color4f(0,0,0,0)),
790 _sfAlphaFunc (GLenum(GL_NONE
)),
791 _sfAlphaValue (Real32(0)),
792 _sfAlphaSrcFactor (GLenum(OSG_GL_UNUSED
)),
793 _sfAlphaDestFactor (GLenum(OSG_GL_UNUSED
))
797 BlendChunkBase::BlendChunkBase(const BlendChunkBase
&source
) :
799 _sfSrcFactor (source
._sfSrcFactor
),
800 _sfDestFactor (source
._sfDestFactor
),
801 _sfEquation (source
._sfEquation
),
802 _sfColor (source
._sfColor
),
803 _sfAlphaFunc (source
._sfAlphaFunc
),
804 _sfAlphaValue (source
._sfAlphaValue
),
805 _sfAlphaSrcFactor (source
._sfAlphaSrcFactor
),
806 _sfAlphaDestFactor (source
._sfAlphaDestFactor
)
811 /*-------------------------- destructors ----------------------------------*/
813 BlendChunkBase::~BlendChunkBase(void)
818 GetFieldHandlePtr
BlendChunkBase::getHandleSrcFactor (void) const
820 SFGLenum::GetHandlePtr
returnValue(
821 new SFGLenum::GetHandle(
823 this->getType().getFieldDesc(SrcFactorFieldId
),
824 const_cast<BlendChunkBase
*>(this)));
829 EditFieldHandlePtr
BlendChunkBase::editHandleSrcFactor (void)
831 SFGLenum::EditHandlePtr
returnValue(
832 new SFGLenum::EditHandle(
834 this->getType().getFieldDesc(SrcFactorFieldId
),
838 editSField(SrcFactorFieldMask
);
843 GetFieldHandlePtr
BlendChunkBase::getHandleDestFactor (void) const
845 SFGLenum::GetHandlePtr
returnValue(
846 new SFGLenum::GetHandle(
848 this->getType().getFieldDesc(DestFactorFieldId
),
849 const_cast<BlendChunkBase
*>(this)));
854 EditFieldHandlePtr
BlendChunkBase::editHandleDestFactor (void)
856 SFGLenum::EditHandlePtr
returnValue(
857 new SFGLenum::EditHandle(
859 this->getType().getFieldDesc(DestFactorFieldId
),
863 editSField(DestFactorFieldMask
);
868 GetFieldHandlePtr
BlendChunkBase::getHandleEquation (void) const
870 SFGLenum::GetHandlePtr
returnValue(
871 new SFGLenum::GetHandle(
873 this->getType().getFieldDesc(EquationFieldId
),
874 const_cast<BlendChunkBase
*>(this)));
879 EditFieldHandlePtr
BlendChunkBase::editHandleEquation (void)
881 SFGLenum::EditHandlePtr
returnValue(
882 new SFGLenum::EditHandle(
884 this->getType().getFieldDesc(EquationFieldId
),
888 editSField(EquationFieldMask
);
893 GetFieldHandlePtr
BlendChunkBase::getHandleColor (void) const
895 SFColor4f::GetHandlePtr
returnValue(
896 new SFColor4f::GetHandle(
898 this->getType().getFieldDesc(ColorFieldId
),
899 const_cast<BlendChunkBase
*>(this)));
904 EditFieldHandlePtr
BlendChunkBase::editHandleColor (void)
906 SFColor4f::EditHandlePtr
returnValue(
907 new SFColor4f::EditHandle(
909 this->getType().getFieldDesc(ColorFieldId
),
913 editSField(ColorFieldMask
);
918 GetFieldHandlePtr
BlendChunkBase::getHandleAlphaFunc (void) const
920 SFGLenum::GetHandlePtr
returnValue(
921 new SFGLenum::GetHandle(
923 this->getType().getFieldDesc(AlphaFuncFieldId
),
924 const_cast<BlendChunkBase
*>(this)));
929 EditFieldHandlePtr
BlendChunkBase::editHandleAlphaFunc (void)
931 SFGLenum::EditHandlePtr
returnValue(
932 new SFGLenum::EditHandle(
934 this->getType().getFieldDesc(AlphaFuncFieldId
),
938 editSField(AlphaFuncFieldMask
);
943 GetFieldHandlePtr
BlendChunkBase::getHandleAlphaValue (void) const
945 SFReal32::GetHandlePtr
returnValue(
946 new SFReal32::GetHandle(
948 this->getType().getFieldDesc(AlphaValueFieldId
),
949 const_cast<BlendChunkBase
*>(this)));
954 EditFieldHandlePtr
BlendChunkBase::editHandleAlphaValue (void)
956 SFReal32::EditHandlePtr
returnValue(
957 new SFReal32::EditHandle(
959 this->getType().getFieldDesc(AlphaValueFieldId
),
963 editSField(AlphaValueFieldMask
);
968 GetFieldHandlePtr
BlendChunkBase::getHandleAlphaSrcFactor (void) const
970 SFGLenum::GetHandlePtr
returnValue(
971 new SFGLenum::GetHandle(
973 this->getType().getFieldDesc(AlphaSrcFactorFieldId
),
974 const_cast<BlendChunkBase
*>(this)));
979 EditFieldHandlePtr
BlendChunkBase::editHandleAlphaSrcFactor (void)
981 SFGLenum::EditHandlePtr
returnValue(
982 new SFGLenum::EditHandle(
984 this->getType().getFieldDesc(AlphaSrcFactorFieldId
),
988 editSField(AlphaSrcFactorFieldMask
);
993 GetFieldHandlePtr
BlendChunkBase::getHandleAlphaDestFactor (void) const
995 SFGLenum::GetHandlePtr
returnValue(
996 new SFGLenum::GetHandle(
998 this->getType().getFieldDesc(AlphaDestFactorFieldId
),
999 const_cast<BlendChunkBase
*>(this)));
1004 EditFieldHandlePtr
BlendChunkBase::editHandleAlphaDestFactor(void)
1006 SFGLenum::EditHandlePtr
returnValue(
1007 new SFGLenum::EditHandle(
1008 &_sfAlphaDestFactor
,
1009 this->getType().getFieldDesc(AlphaDestFactorFieldId
),
1013 editSField(AlphaDestFactorFieldMask
);
1019 #ifdef OSG_MT_CPTR_ASPECT
1020 void BlendChunkBase::execSyncV( FieldContainer
&oFrom
,
1021 ConstFieldMaskArg whichField
,
1022 AspectOffsetStore
&oOffsets
,
1023 ConstFieldMaskArg syncMode
,
1024 const UInt32 uiSyncInfo
)
1026 BlendChunk
*pThis
= static_cast<BlendChunk
*>(this);
1028 pThis
->execSync(static_cast<BlendChunk
*>(&oFrom
),
1037 #ifdef OSG_MT_CPTR_ASPECT
1038 FieldContainer
*BlendChunkBase::createAspectCopy(
1039 const FieldContainer
*pRefAspect
) const
1041 BlendChunk
*returnValue
;
1043 newAspectCopy(returnValue
,
1044 dynamic_cast<const BlendChunk
*>(pRefAspect
),
1045 dynamic_cast<const BlendChunk
*>(this));
1051 void BlendChunkBase::resolveLinks(void)
1053 Inherited::resolveLinks();