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 ShadeModelChunk!
50 *****************************************************************************
51 \*****************************************************************************/
56 #include "OSGConfig.h"
61 #include "OSGShadeModelChunkBase.h"
62 #include "OSGShadeModelChunk.h"
64 #include <boost/bind.hpp>
66 #ifdef WIN32 // turn off 'this' : used in base member initializer list warning
67 #pragma warning(disable:4355)
72 /***************************************************************************\
74 \***************************************************************************/
76 /*! \class OSG::ShadeModelChunk
77 ShadeModelChunk controls the shading model used for rendering lines and filled
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var GLenum ShadeModelChunkBase::_sfShadeModel
86 The shading model to use (glShadeModel).
90 /***************************************************************************\
91 * FieldType/FieldTrait Instantiation *
92 \***************************************************************************/
94 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
95 PointerType FieldTraits
<ShadeModelChunk
*, nsOSG
>::_type(
98 ShadeModelChunk::getClassType(),
102 OSG_FIELDTRAITS_GETTYPE_NS(ShadeModelChunk
*, nsOSG
)
104 /***************************************************************************\
105 * Field Description *
106 \***************************************************************************/
108 void ShadeModelChunkBase::classDescInserter(TypeObject
&oType
)
110 FieldDescriptionBase
*pDesc
= NULL
;
113 pDesc
= new SFGLenum::Description(
114 SFGLenum::getClassType(),
116 "The shading model to use (glShadeModel).\n",
117 ShadeModelFieldId
, ShadeModelFieldMask
,
119 (Field::SFDefaultFlags
| Field::FStdAccess
),
120 static_cast<FieldEditMethodSig
>(&ShadeModelChunk::editHandleShadeModel
),
121 static_cast<FieldGetMethodSig
>(&ShadeModelChunk::getHandleShadeModel
));
123 oType
.addInitialDesc(pDesc
);
127 ShadeModelChunkBase::TypeObject
ShadeModelChunkBase::_type(
128 ShadeModelChunkBase::getClassname(),
129 Inherited::getClassname(),
132 reinterpret_cast<PrototypeCreateF
>(&ShadeModelChunkBase::createEmptyLocal
),
133 ShadeModelChunk::initMethod
,
134 ShadeModelChunk::exitMethod
,
135 reinterpret_cast<InitalInsertDescFunc
>(&ShadeModelChunk::classDescInserter
),
138 "<?xml version=\"1.0\"?>\n"
141 " name=\"ShadeModelChunk\"\n"
142 " parent=\"StateChunk\"\n"
143 " library=\"State\"\n"
144 " pointerfieldtypes=\"none\"\n"
145 " structure=\"concrete\"\n"
146 " systemcomponent=\"true\"\n"
147 " parentsystemcomponent=\"true\"\n"
148 " decoratable=\"false\"\n"
149 " useLocalIncludes=\"false\"\n"
150 " docGroupBase=\"GrpStateOpenGL\"\n"
152 " ShadeModelChunk controls the shading model used for rendering lines and filled\n"
155 " name=\"shadeModel\"\n"
157 " cardinality=\"single\"\n"
158 " visibility=\"external\"\n"
159 " defaultValue=\"GL_SMOOTH\"\n"
160 " access=\"public\"\n"
162 " The shading model to use (glShadeModel).\n"
164 "</FieldContainer>\n",
165 "ShadeModelChunk controls the shading model used for rendering lines and filled\n"
169 /*------------------------------ get -----------------------------------*/
171 FieldContainerType
&ShadeModelChunkBase::getType(void)
176 const FieldContainerType
&ShadeModelChunkBase::getType(void) const
181 UInt32
ShadeModelChunkBase::getContainerSize(void) const
183 return sizeof(ShadeModelChunk
);
186 /*------------------------- decorator get ------------------------------*/
189 SFGLenum
*ShadeModelChunkBase::editSFShadeModel(void)
191 editSField(ShadeModelFieldMask
);
193 return &_sfShadeModel
;
196 const SFGLenum
*ShadeModelChunkBase::getSFShadeModel(void) const
198 return &_sfShadeModel
;
206 /*------------------------------ access -----------------------------------*/
208 SizeT
ShadeModelChunkBase::getBinSize(ConstFieldMaskArg whichField
)
210 SizeT returnValue
= Inherited::getBinSize(whichField
);
212 if(FieldBits::NoField
!= (ShadeModelFieldMask
& whichField
))
214 returnValue
+= _sfShadeModel
.getBinSize();
220 void ShadeModelChunkBase::copyToBin(BinaryDataHandler
&pMem
,
221 ConstFieldMaskArg whichField
)
223 Inherited::copyToBin(pMem
, whichField
);
225 if(FieldBits::NoField
!= (ShadeModelFieldMask
& whichField
))
227 _sfShadeModel
.copyToBin(pMem
);
231 void ShadeModelChunkBase::copyFromBin(BinaryDataHandler
&pMem
,
232 ConstFieldMaskArg whichField
)
234 Inherited::copyFromBin(pMem
, whichField
);
236 if(FieldBits::NoField
!= (ShadeModelFieldMask
& whichField
))
238 editSField(ShadeModelFieldMask
);
239 _sfShadeModel
.copyFromBin(pMem
);
243 //! create a new instance of the class
244 ShadeModelChunkTransitPtr
ShadeModelChunkBase::createLocal(BitVector bFlags
)
246 ShadeModelChunkTransitPtr fc
;
248 if(getClassType().getPrototype() != NULL
)
250 FieldContainerTransitPtr tmpPtr
=
251 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
253 fc
= dynamic_pointer_cast
<ShadeModelChunk
>(tmpPtr
);
259 //! create a new instance of the class, copy the container flags
260 ShadeModelChunkTransitPtr
ShadeModelChunkBase::createDependent(BitVector bFlags
)
262 ShadeModelChunkTransitPtr fc
;
264 if(getClassType().getPrototype() != NULL
)
266 FieldContainerTransitPtr tmpPtr
=
267 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
269 fc
= dynamic_pointer_cast
<ShadeModelChunk
>(tmpPtr
);
275 //! create a new instance of the class
276 ShadeModelChunkTransitPtr
ShadeModelChunkBase::create(void)
278 ShadeModelChunkTransitPtr fc
;
280 if(getClassType().getPrototype() != NULL
)
282 FieldContainerTransitPtr tmpPtr
=
283 getClassType().getPrototype()-> shallowCopy();
285 fc
= dynamic_pointer_cast
<ShadeModelChunk
>(tmpPtr
);
291 ShadeModelChunk
*ShadeModelChunkBase::createEmptyLocal(BitVector bFlags
)
293 ShadeModelChunk
*returnValue
;
295 newPtr
<ShadeModelChunk
>(returnValue
, bFlags
);
297 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
302 //! create an empty new instance of the class, do not copy the prototype
303 ShadeModelChunk
*ShadeModelChunkBase::createEmpty(void)
305 ShadeModelChunk
*returnValue
;
307 newPtr
<ShadeModelChunk
>(returnValue
, Thread::getCurrentLocalFlags());
309 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
310 ~Thread::getCurrentLocalFlags();
316 FieldContainerTransitPtr
ShadeModelChunkBase::shallowCopyLocal(
317 BitVector bFlags
) const
319 ShadeModelChunk
*tmpPtr
;
321 newPtr(tmpPtr
, dynamic_cast<const ShadeModelChunk
*>(this), bFlags
);
323 FieldContainerTransitPtr
returnValue(tmpPtr
);
325 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
330 FieldContainerTransitPtr
ShadeModelChunkBase::shallowCopyDependent(
331 BitVector bFlags
) const
333 ShadeModelChunk
*tmpPtr
;
335 newPtr(tmpPtr
, dynamic_cast<const ShadeModelChunk
*>(this), ~bFlags
);
337 FieldContainerTransitPtr
returnValue(tmpPtr
);
339 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
344 FieldContainerTransitPtr
ShadeModelChunkBase::shallowCopy(void) const
346 ShadeModelChunk
*tmpPtr
;
349 dynamic_cast<const ShadeModelChunk
*>(this),
350 Thread::getCurrentLocalFlags());
352 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
354 FieldContainerTransitPtr
returnValue(tmpPtr
);
362 /*------------------------- constructors ----------------------------------*/
364 ShadeModelChunkBase::ShadeModelChunkBase(void) :
366 _sfShadeModel (GLenum(GL_SMOOTH
))
370 ShadeModelChunkBase::ShadeModelChunkBase(const ShadeModelChunkBase
&source
) :
372 _sfShadeModel (source
._sfShadeModel
)
377 /*-------------------------- destructors ----------------------------------*/
379 ShadeModelChunkBase::~ShadeModelChunkBase(void)
384 GetFieldHandlePtr
ShadeModelChunkBase::getHandleShadeModel (void) const
386 SFGLenum::GetHandlePtr
returnValue(
387 new SFGLenum::GetHandle(
389 this->getType().getFieldDesc(ShadeModelFieldId
),
390 const_cast<ShadeModelChunkBase
*>(this)));
395 EditFieldHandlePtr
ShadeModelChunkBase::editHandleShadeModel (void)
397 SFGLenum::EditHandlePtr
returnValue(
398 new SFGLenum::EditHandle(
400 this->getType().getFieldDesc(ShadeModelFieldId
),
404 editSField(ShadeModelFieldMask
);
410 #ifdef OSG_MT_CPTR_ASPECT
411 void ShadeModelChunkBase::execSyncV( FieldContainer
&oFrom
,
412 ConstFieldMaskArg whichField
,
413 AspectOffsetStore
&oOffsets
,
414 ConstFieldMaskArg syncMode
,
415 const UInt32 uiSyncInfo
)
417 ShadeModelChunk
*pThis
= static_cast<ShadeModelChunk
*>(this);
419 pThis
->execSync(static_cast<ShadeModelChunk
*>(&oFrom
),
428 #ifdef OSG_MT_CPTR_ASPECT
429 FieldContainer
*ShadeModelChunkBase::createAspectCopy(
430 const FieldContainer
*pRefAspect
) const
432 ShadeModelChunk
*returnValue
;
434 newAspectCopy(returnValue
,
435 dynamic_cast<const ShadeModelChunk
*>(pRefAspect
),
436 dynamic_cast<const ShadeModelChunk
*>(this));
442 void ShadeModelChunkBase::resolveLinks(void)
444 Inherited::resolveLinks();