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" // Func default header
67 #include "OSGDepthChunkBase.h"
68 #include "OSGDepthChunk.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::DepthChunk
79 The depth chunk contains the parameters that are specific for depth control.
81 The parameters of the following functions are wrapped here: glDepthFunc
82 (OSG::DepthChunk::_sfFunc), glDepthRange (OSG::DepthChunk::_sfNear,
83 OSG::DepthChunk::_sfFar), glEnable(GL_DEPTH_TEST)
84 (OSG::DepthChunk::_sfEnable).
87 /***************************************************************************\
88 * Field Documentation *
89 \***************************************************************************/
91 /*! \var bool DepthChunkBase::_sfEnable
92 Whether the depth test should be enabled or not.
95 /*! \var GLenum DepthChunkBase::_sfFunc
96 The depth function to use. If GL_NONE, it's not changed. The default is GL_LEQUAL.
99 /*! \var Real32 DepthChunkBase::_sfNear
100 The near value for glDepthRange. Ignored if less than 0, defaults to -1.
103 /*! \var Real32 DepthChunkBase::_sfFar
104 The far value for glDepthRange. Ignored if less than 0, defaults to -1.
107 /*! \var bool DepthChunkBase::_sfReadOnly
108 Whether the depth buffer is enabled for writing or not.
112 /***************************************************************************\
113 * FieldType/FieldTrait Instantiation *
114 \***************************************************************************/
116 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
117 PointerType FieldTraits
<DepthChunk
*, nsOSG
>::_type(
120 DepthChunk::getClassType(),
124 OSG_FIELDTRAITS_GETTYPE_NS(DepthChunk
*, nsOSG
)
126 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
130 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
134 /***************************************************************************\
135 * Field Description *
136 \***************************************************************************/
138 void DepthChunkBase::classDescInserter(TypeObject
&oType
)
140 FieldDescriptionBase
*pDesc
= NULL
;
143 pDesc
= new SFBool::Description(
144 SFBool::getClassType(),
146 "Whether the depth test should be enabled or not.\n",
147 EnableFieldId
, EnableFieldMask
,
149 (Field::SFDefaultFlags
| Field::FStdAccess
),
150 static_cast<FieldEditMethodSig
>(&DepthChunk::editHandleEnable
),
151 static_cast<FieldGetMethodSig
>(&DepthChunk::getHandleEnable
));
153 oType
.addInitialDesc(pDesc
);
155 pDesc
= new SFGLenum::Description(
156 SFGLenum::getClassType(),
158 "The depth function to use. If GL_NONE, it's not changed. The default is GL_LEQUAL.\n",
159 FuncFieldId
, FuncFieldMask
,
161 (Field::SFDefaultFlags
| Field::FStdAccess
),
162 static_cast<FieldEditMethodSig
>(&DepthChunk::editHandleFunc
),
163 static_cast<FieldGetMethodSig
>(&DepthChunk::getHandleFunc
));
165 oType
.addInitialDesc(pDesc
);
167 pDesc
= new SFReal32::Description(
168 SFReal32::getClassType(),
170 "The near value for glDepthRange. Ignored if less than 0, defaults to -1.\n",
171 NearFieldId
, NearFieldMask
,
173 (Field::SFDefaultFlags
| Field::FStdAccess
),
174 static_cast<FieldEditMethodSig
>(&DepthChunk::editHandleNear
),
175 static_cast<FieldGetMethodSig
>(&DepthChunk::getHandleNear
));
177 oType
.addInitialDesc(pDesc
);
179 pDesc
= new SFReal32::Description(
180 SFReal32::getClassType(),
182 "The far value for glDepthRange. Ignored if less than 0, defaults to -1.\n",
183 FarFieldId
, FarFieldMask
,
185 (Field::SFDefaultFlags
| Field::FStdAccess
),
186 static_cast<FieldEditMethodSig
>(&DepthChunk::editHandleFar
),
187 static_cast<FieldGetMethodSig
>(&DepthChunk::getHandleFar
));
189 oType
.addInitialDesc(pDesc
);
191 pDesc
= new SFBool::Description(
192 SFBool::getClassType(),
194 "Whether the depth buffer is enabled for writing or not.\n",
195 ReadOnlyFieldId
, ReadOnlyFieldMask
,
197 (Field::SFDefaultFlags
| Field::FStdAccess
),
198 static_cast<FieldEditMethodSig
>(&DepthChunk::editHandleReadOnly
),
199 static_cast<FieldGetMethodSig
>(&DepthChunk::getHandleReadOnly
));
201 oType
.addInitialDesc(pDesc
);
205 DepthChunkBase::TypeObject
DepthChunkBase::_type(
206 DepthChunkBase::getClassname(),
207 Inherited::getClassname(),
210 reinterpret_cast<PrototypeCreateF
>(&DepthChunkBase::createEmptyLocal
),
211 reinterpret_cast<InitContainerF
>(&DepthChunk::initMethod
),
212 reinterpret_cast<ExitContainerF
>(&DepthChunk::exitMethod
),
213 reinterpret_cast<InitalInsertDescFunc
>(
214 reinterpret_cast<void *>(&DepthChunk::classDescInserter
)),
217 "<?xml version=\"1.0\"?>\n"
220 " name=\"DepthChunk\"\n"
221 " parent=\"StateChunk\"\n"
222 " library=\"System\"\n"
223 " pointerfieldtypes=\"both\"\n"
224 " structure=\"concrete\"\n"
225 " systemcomponent=\"true\"\n"
226 " parentsystemcomponent=\"true\"\n"
227 " decoratable=\"false\"\n"
228 " useLocalIncludes=\"false\"\n"
229 " docGroupBase=\"GrpSystemState\"\n"
231 "The depth chunk contains the parameters that are specific for depth control.\n"
233 "The parameters of the following functions are wrapped here: glDepthFunc\n"
234 "(OSG::DepthChunk::_sfFunc), glDepthRange (OSG::DepthChunk::_sfNear,\n"
235 "OSG::DepthChunk::_sfFar), glEnable(GL_DEPTH_TEST)\n"
236 "(OSG::DepthChunk::_sfEnable).\n"
238 "\t\tname=\"enable\"\n"
239 "\t\ttype=\"bool\"\n"
240 "\t\tcardinality=\"single\"\n"
241 "\t\tvisibility=\"external\"\n"
242 "\t\tdefaultValue=\"true\"\n"
243 "\t\taccess=\"public\"\n"
245 "\tWhether the depth test should be enabled or not.\n"
248 "\t\tname=\"func\"\n"
249 "\t\ttype=\"GLenum\"\n"
250 "\t\tcardinality=\"single\"\n"
251 "\t\tvisibility=\"external\"\n"
252 "\t\tdefaultValue=\"GL_LEQUAL\"\n"
253 "\t\tdefaultHeader=\""OSGGL.h"\"\n"
254 "\t\taccess=\"public\"\n"
256 "\tThe depth function to use. If GL_NONE, it's not changed. The default is GL_LEQUAL.\n"
259 "\t\tname=\"near\"\n"
260 "\t\ttype=\"Real32\"\n"
261 "\t\tcardinality=\"single\"\n"
262 "\t\tvisibility=\"external\"\n"
263 "\t\tdefaultValue=\"-1.f\"\n"
264 "\t\taccess=\"public\"\n"
266 "\tThe near value for glDepthRange. Ignored if less than 0, defaults to -1.\n"
270 "\t\ttype=\"Real32\"\n"
271 "\t\tcardinality=\"single\"\n"
272 "\t\tvisibility=\"external\"\n"
273 "\t\tdefaultValue=\"-1.f\"\n"
274 "\t\taccess=\"public\"\n"
276 "\tThe far value for glDepthRange. Ignored if less than 0, defaults to -1.\n"
279 "\t\tname=\"readOnly\"\n"
280 "\t\ttype=\"bool\"\n"
281 "\t\tcardinality=\"single\"\n"
282 "\t\tvisibility=\"external\"\n"
283 "\t\tdefaultValue=\"false\"\n"
284 "\t\taccess=\"public\"\n"
286 "\tWhether the depth buffer is enabled for writing or not.\n"
288 "</FieldContainer>\n",
289 "The depth chunk contains the parameters that are specific for depth control.\n"
291 "The parameters of the following functions are wrapped here: glDepthFunc\n"
292 "(OSG::DepthChunk::_sfFunc), glDepthRange (OSG::DepthChunk::_sfNear,\n"
293 "OSG::DepthChunk::_sfFar), glEnable(GL_DEPTH_TEST)\n"
294 "(OSG::DepthChunk::_sfEnable).\n"
297 /*------------------------------ get -----------------------------------*/
299 FieldContainerType
&DepthChunkBase::getType(void)
304 const FieldContainerType
&DepthChunkBase::getType(void) const
309 UInt32
DepthChunkBase::getContainerSize(void) const
311 return sizeof(DepthChunk
);
314 /*------------------------- decorator get ------------------------------*/
317 SFBool
*DepthChunkBase::editSFEnable(void)
319 editSField(EnableFieldMask
);
324 const SFBool
*DepthChunkBase::getSFEnable(void) const
330 SFGLenum
*DepthChunkBase::editSFFunc(void)
332 editSField(FuncFieldMask
);
337 const SFGLenum
*DepthChunkBase::getSFFunc(void) const
343 SFReal32
*DepthChunkBase::editSFNear(void)
345 editSField(NearFieldMask
);
350 const SFReal32
*DepthChunkBase::getSFNear(void) const
356 SFReal32
*DepthChunkBase::editSFFar(void)
358 editSField(FarFieldMask
);
363 const SFReal32
*DepthChunkBase::getSFFar(void) const
369 SFBool
*DepthChunkBase::editSFReadOnly(void)
371 editSField(ReadOnlyFieldMask
);
376 const SFBool
*DepthChunkBase::getSFReadOnly(void) const
386 /*------------------------------ access -----------------------------------*/
388 SizeT
DepthChunkBase::getBinSize(ConstFieldMaskArg whichField
)
390 SizeT returnValue
= Inherited::getBinSize(whichField
);
392 if(FieldBits::NoField
!= (EnableFieldMask
& whichField
))
394 returnValue
+= _sfEnable
.getBinSize();
396 if(FieldBits::NoField
!= (FuncFieldMask
& whichField
))
398 returnValue
+= _sfFunc
.getBinSize();
400 if(FieldBits::NoField
!= (NearFieldMask
& whichField
))
402 returnValue
+= _sfNear
.getBinSize();
404 if(FieldBits::NoField
!= (FarFieldMask
& whichField
))
406 returnValue
+= _sfFar
.getBinSize();
408 if(FieldBits::NoField
!= (ReadOnlyFieldMask
& whichField
))
410 returnValue
+= _sfReadOnly
.getBinSize();
416 void DepthChunkBase::copyToBin(BinaryDataHandler
&pMem
,
417 ConstFieldMaskArg whichField
)
419 Inherited::copyToBin(pMem
, whichField
);
421 if(FieldBits::NoField
!= (EnableFieldMask
& whichField
))
423 _sfEnable
.copyToBin(pMem
);
425 if(FieldBits::NoField
!= (FuncFieldMask
& whichField
))
427 _sfFunc
.copyToBin(pMem
);
429 if(FieldBits::NoField
!= (NearFieldMask
& whichField
))
431 _sfNear
.copyToBin(pMem
);
433 if(FieldBits::NoField
!= (FarFieldMask
& whichField
))
435 _sfFar
.copyToBin(pMem
);
437 if(FieldBits::NoField
!= (ReadOnlyFieldMask
& whichField
))
439 _sfReadOnly
.copyToBin(pMem
);
443 void DepthChunkBase::copyFromBin(BinaryDataHandler
&pMem
,
444 ConstFieldMaskArg whichField
)
446 Inherited::copyFromBin(pMem
, whichField
);
448 if(FieldBits::NoField
!= (EnableFieldMask
& whichField
))
450 editSField(EnableFieldMask
);
451 _sfEnable
.copyFromBin(pMem
);
453 if(FieldBits::NoField
!= (FuncFieldMask
& whichField
))
455 editSField(FuncFieldMask
);
456 _sfFunc
.copyFromBin(pMem
);
458 if(FieldBits::NoField
!= (NearFieldMask
& whichField
))
460 editSField(NearFieldMask
);
461 _sfNear
.copyFromBin(pMem
);
463 if(FieldBits::NoField
!= (FarFieldMask
& whichField
))
465 editSField(FarFieldMask
);
466 _sfFar
.copyFromBin(pMem
);
468 if(FieldBits::NoField
!= (ReadOnlyFieldMask
& whichField
))
470 editSField(ReadOnlyFieldMask
);
471 _sfReadOnly
.copyFromBin(pMem
);
475 //! create a new instance of the class
476 DepthChunkTransitPtr
DepthChunkBase::createLocal(BitVector bFlags
)
478 DepthChunkTransitPtr fc
;
480 if(getClassType().getPrototype() != NULL
)
482 FieldContainerTransitPtr tmpPtr
=
483 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
485 fc
= dynamic_pointer_cast
<DepthChunk
>(tmpPtr
);
491 //! create a new instance of the class, copy the container flags
492 DepthChunkTransitPtr
DepthChunkBase::createDependent(BitVector bFlags
)
494 DepthChunkTransitPtr fc
;
496 if(getClassType().getPrototype() != NULL
)
498 FieldContainerTransitPtr tmpPtr
=
499 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
501 fc
= dynamic_pointer_cast
<DepthChunk
>(tmpPtr
);
507 //! create a new instance of the class
508 DepthChunkTransitPtr
DepthChunkBase::create(void)
510 DepthChunkTransitPtr fc
;
512 if(getClassType().getPrototype() != NULL
)
514 FieldContainerTransitPtr tmpPtr
=
515 getClassType().getPrototype()-> shallowCopy();
517 fc
= dynamic_pointer_cast
<DepthChunk
>(tmpPtr
);
523 DepthChunk
*DepthChunkBase::createEmptyLocal(BitVector bFlags
)
525 DepthChunk
*returnValue
;
527 newPtr
<DepthChunk
>(returnValue
, bFlags
);
529 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
534 //! create an empty new instance of the class, do not copy the prototype
535 DepthChunk
*DepthChunkBase::createEmpty(void)
537 DepthChunk
*returnValue
;
539 newPtr
<DepthChunk
>(returnValue
, Thread::getCurrentLocalFlags());
541 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
542 ~Thread::getCurrentLocalFlags();
548 FieldContainerTransitPtr
DepthChunkBase::shallowCopyLocal(
549 BitVector bFlags
) const
553 newPtr(tmpPtr
, dynamic_cast<const DepthChunk
*>(this), bFlags
);
555 FieldContainerTransitPtr
returnValue(tmpPtr
);
557 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
562 FieldContainerTransitPtr
DepthChunkBase::shallowCopyDependent(
563 BitVector bFlags
) const
567 newPtr(tmpPtr
, dynamic_cast<const DepthChunk
*>(this), ~bFlags
);
569 FieldContainerTransitPtr
returnValue(tmpPtr
);
571 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
576 FieldContainerTransitPtr
DepthChunkBase::shallowCopy(void) const
581 dynamic_cast<const DepthChunk
*>(this),
582 Thread::getCurrentLocalFlags());
584 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
586 FieldContainerTransitPtr
returnValue(tmpPtr
);
594 /*------------------------- constructors ----------------------------------*/
596 DepthChunkBase::DepthChunkBase(void) :
598 _sfEnable (bool(true)),
599 _sfFunc (GLenum(GL_LEQUAL
)),
600 _sfNear (Real32(-1.f
)),
601 _sfFar (Real32(-1.f
)),
602 _sfReadOnly (bool(false))
606 DepthChunkBase::DepthChunkBase(const DepthChunkBase
&source
) :
608 _sfEnable (source
._sfEnable
),
609 _sfFunc (source
._sfFunc
),
610 _sfNear (source
._sfNear
),
611 _sfFar (source
._sfFar
),
612 _sfReadOnly (source
._sfReadOnly
)
617 /*-------------------------- destructors ----------------------------------*/
619 DepthChunkBase::~DepthChunkBase(void)
624 GetFieldHandlePtr
DepthChunkBase::getHandleEnable (void) const
626 SFBool::GetHandlePtr
returnValue(
627 new SFBool::GetHandle(
629 this->getType().getFieldDesc(EnableFieldId
),
630 const_cast<DepthChunkBase
*>(this)));
635 EditFieldHandlePtr
DepthChunkBase::editHandleEnable (void)
637 SFBool::EditHandlePtr
returnValue(
638 new SFBool::EditHandle(
640 this->getType().getFieldDesc(EnableFieldId
),
644 editSField(EnableFieldMask
);
649 GetFieldHandlePtr
DepthChunkBase::getHandleFunc (void) const
651 SFGLenum::GetHandlePtr
returnValue(
652 new SFGLenum::GetHandle(
654 this->getType().getFieldDesc(FuncFieldId
),
655 const_cast<DepthChunkBase
*>(this)));
660 EditFieldHandlePtr
DepthChunkBase::editHandleFunc (void)
662 SFGLenum::EditHandlePtr
returnValue(
663 new SFGLenum::EditHandle(
665 this->getType().getFieldDesc(FuncFieldId
),
669 editSField(FuncFieldMask
);
674 GetFieldHandlePtr
DepthChunkBase::getHandleNear (void) const
676 SFReal32::GetHandlePtr
returnValue(
677 new SFReal32::GetHandle(
679 this->getType().getFieldDesc(NearFieldId
),
680 const_cast<DepthChunkBase
*>(this)));
685 EditFieldHandlePtr
DepthChunkBase::editHandleNear (void)
687 SFReal32::EditHandlePtr
returnValue(
688 new SFReal32::EditHandle(
690 this->getType().getFieldDesc(NearFieldId
),
694 editSField(NearFieldMask
);
699 GetFieldHandlePtr
DepthChunkBase::getHandleFar (void) const
701 SFReal32::GetHandlePtr
returnValue(
702 new SFReal32::GetHandle(
704 this->getType().getFieldDesc(FarFieldId
),
705 const_cast<DepthChunkBase
*>(this)));
710 EditFieldHandlePtr
DepthChunkBase::editHandleFar (void)
712 SFReal32::EditHandlePtr
returnValue(
713 new SFReal32::EditHandle(
715 this->getType().getFieldDesc(FarFieldId
),
719 editSField(FarFieldMask
);
724 GetFieldHandlePtr
DepthChunkBase::getHandleReadOnly (void) const
726 SFBool::GetHandlePtr
returnValue(
727 new SFBool::GetHandle(
729 this->getType().getFieldDesc(ReadOnlyFieldId
),
730 const_cast<DepthChunkBase
*>(this)));
735 EditFieldHandlePtr
DepthChunkBase::editHandleReadOnly (void)
737 SFBool::EditHandlePtr
returnValue(
738 new SFBool::EditHandle(
740 this->getType().getFieldDesc(ReadOnlyFieldId
),
744 editSField(ReadOnlyFieldMask
);
750 #ifdef OSG_MT_CPTR_ASPECT
751 void DepthChunkBase::execSyncV( FieldContainer
&oFrom
,
752 ConstFieldMaskArg whichField
,
753 AspectOffsetStore
&oOffsets
,
754 ConstFieldMaskArg syncMode
,
755 const UInt32 uiSyncInfo
)
757 DepthChunk
*pThis
= static_cast<DepthChunk
*>(this);
759 pThis
->execSync(static_cast<DepthChunk
*>(&oFrom
),
768 #ifdef OSG_MT_CPTR_ASPECT
769 FieldContainer
*DepthChunkBase::createAspectCopy(
770 const FieldContainer
*pRefAspect
) const
772 DepthChunk
*returnValue
;
774 newAspectCopy(returnValue
,
775 dynamic_cast<const DepthChunk
*>(pRefAspect
),
776 dynamic_cast<const DepthChunk
*>(this));
782 void DepthChunkBase::resolveLinks(void)
784 Inherited::resolveLinks();