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 \*****************************************************************************/
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 "OSGShadeModelChunkBase.h"
67 #include "OSGShadeModelChunk.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::ShadeModelChunk
78 ShadeModelChunk controls the shading model used for rendering lines and filled
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var GLenum ShadeModelChunkBase::_sfShadeModel
87 The shading model to use (glShadeModel).
91 /***************************************************************************\
92 * FieldType/FieldTrait Instantiation *
93 \***************************************************************************/
95 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
96 PointerType FieldTraits
<ShadeModelChunk
*, nsOSG
>::_type(
99 ShadeModelChunk::getClassType(),
103 OSG_FIELDTRAITS_GETTYPE_NS(ShadeModelChunk
*, nsOSG
)
105 /***************************************************************************\
106 * Field Description *
107 \***************************************************************************/
109 void ShadeModelChunkBase::classDescInserter(TypeObject
&oType
)
111 FieldDescriptionBase
*pDesc
= NULL
;
114 pDesc
= new SFGLenum::Description(
115 SFGLenum::getClassType(),
117 "The shading model to use (glShadeModel).\n",
118 ShadeModelFieldId
, ShadeModelFieldMask
,
120 (Field::SFDefaultFlags
| Field::FStdAccess
),
121 static_cast<FieldEditMethodSig
>(&ShadeModelChunk::editHandleShadeModel
),
122 static_cast<FieldGetMethodSig
>(&ShadeModelChunk::getHandleShadeModel
));
124 oType
.addInitialDesc(pDesc
);
128 ShadeModelChunkBase::TypeObject
ShadeModelChunkBase::_type(
129 ShadeModelChunkBase::getClassname(),
130 Inherited::getClassname(),
133 reinterpret_cast<PrototypeCreateF
>(&ShadeModelChunkBase::createEmptyLocal
),
134 reinterpret_cast<InitContainerF
>(&ShadeModelChunk::initMethod
),
135 reinterpret_cast<ExitContainerF
>(&ShadeModelChunk::exitMethod
),
136 reinterpret_cast<InitalInsertDescFunc
>(
137 reinterpret_cast<void *>(&ShadeModelChunk::classDescInserter
)),
140 "<?xml version=\"1.0\"?>\n"
143 " name=\"ShadeModelChunk\"\n"
144 " parent=\"StateChunk\"\n"
145 " library=\"State\"\n"
146 " pointerfieldtypes=\"none\"\n"
147 " structure=\"concrete\"\n"
148 " systemcomponent=\"true\"\n"
149 " parentsystemcomponent=\"true\"\n"
150 " decoratable=\"false\"\n"
151 " useLocalIncludes=\"false\"\n"
152 " docGroupBase=\"GrpStateOpenGL\"\n"
154 " ShadeModelChunk controls the shading model used for rendering lines and filled\n"
157 " name=\"shadeModel\"\n"
159 " cardinality=\"single\"\n"
160 " visibility=\"external\"\n"
161 " defaultValue=\"GL_SMOOTH\"\n"
162 " access=\"public\"\n"
164 " The shading model to use (glShadeModel).\n"
166 "</FieldContainer>\n",
167 "ShadeModelChunk controls the shading model used for rendering lines and filled\n"
171 /*------------------------------ get -----------------------------------*/
173 FieldContainerType
&ShadeModelChunkBase::getType(void)
178 const FieldContainerType
&ShadeModelChunkBase::getType(void) const
183 UInt32
ShadeModelChunkBase::getContainerSize(void) const
185 return sizeof(ShadeModelChunk
);
188 /*------------------------- decorator get ------------------------------*/
191 SFGLenum
*ShadeModelChunkBase::editSFShadeModel(void)
193 editSField(ShadeModelFieldMask
);
195 return &_sfShadeModel
;
198 const SFGLenum
*ShadeModelChunkBase::getSFShadeModel(void) const
200 return &_sfShadeModel
;
208 /*------------------------------ access -----------------------------------*/
210 SizeT
ShadeModelChunkBase::getBinSize(ConstFieldMaskArg whichField
)
212 SizeT returnValue
= Inherited::getBinSize(whichField
);
214 if(FieldBits::NoField
!= (ShadeModelFieldMask
& whichField
))
216 returnValue
+= _sfShadeModel
.getBinSize();
222 void ShadeModelChunkBase::copyToBin(BinaryDataHandler
&pMem
,
223 ConstFieldMaskArg whichField
)
225 Inherited::copyToBin(pMem
, whichField
);
227 if(FieldBits::NoField
!= (ShadeModelFieldMask
& whichField
))
229 _sfShadeModel
.copyToBin(pMem
);
233 void ShadeModelChunkBase::copyFromBin(BinaryDataHandler
&pMem
,
234 ConstFieldMaskArg whichField
)
236 Inherited::copyFromBin(pMem
, whichField
);
238 if(FieldBits::NoField
!= (ShadeModelFieldMask
& whichField
))
240 editSField(ShadeModelFieldMask
);
241 _sfShadeModel
.copyFromBin(pMem
);
245 //! create a new instance of the class
246 ShadeModelChunkTransitPtr
ShadeModelChunkBase::createLocal(BitVector bFlags
)
248 ShadeModelChunkTransitPtr fc
;
250 if(getClassType().getPrototype() != NULL
)
252 FieldContainerTransitPtr tmpPtr
=
253 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
255 fc
= dynamic_pointer_cast
<ShadeModelChunk
>(tmpPtr
);
261 //! create a new instance of the class, copy the container flags
262 ShadeModelChunkTransitPtr
ShadeModelChunkBase::createDependent(BitVector bFlags
)
264 ShadeModelChunkTransitPtr fc
;
266 if(getClassType().getPrototype() != NULL
)
268 FieldContainerTransitPtr tmpPtr
=
269 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
271 fc
= dynamic_pointer_cast
<ShadeModelChunk
>(tmpPtr
);
277 //! create a new instance of the class
278 ShadeModelChunkTransitPtr
ShadeModelChunkBase::create(void)
280 ShadeModelChunkTransitPtr fc
;
282 if(getClassType().getPrototype() != NULL
)
284 FieldContainerTransitPtr tmpPtr
=
285 getClassType().getPrototype()-> shallowCopy();
287 fc
= dynamic_pointer_cast
<ShadeModelChunk
>(tmpPtr
);
293 ShadeModelChunk
*ShadeModelChunkBase::createEmptyLocal(BitVector bFlags
)
295 ShadeModelChunk
*returnValue
;
297 newPtr
<ShadeModelChunk
>(returnValue
, bFlags
);
299 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
304 //! create an empty new instance of the class, do not copy the prototype
305 ShadeModelChunk
*ShadeModelChunkBase::createEmpty(void)
307 ShadeModelChunk
*returnValue
;
309 newPtr
<ShadeModelChunk
>(returnValue
, Thread::getCurrentLocalFlags());
311 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
312 ~Thread::getCurrentLocalFlags();
318 FieldContainerTransitPtr
ShadeModelChunkBase::shallowCopyLocal(
319 BitVector bFlags
) const
321 ShadeModelChunk
*tmpPtr
;
323 newPtr(tmpPtr
, dynamic_cast<const ShadeModelChunk
*>(this), bFlags
);
325 FieldContainerTransitPtr
returnValue(tmpPtr
);
327 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
332 FieldContainerTransitPtr
ShadeModelChunkBase::shallowCopyDependent(
333 BitVector bFlags
) const
335 ShadeModelChunk
*tmpPtr
;
337 newPtr(tmpPtr
, dynamic_cast<const ShadeModelChunk
*>(this), ~bFlags
);
339 FieldContainerTransitPtr
returnValue(tmpPtr
);
341 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
346 FieldContainerTransitPtr
ShadeModelChunkBase::shallowCopy(void) const
348 ShadeModelChunk
*tmpPtr
;
351 dynamic_cast<const ShadeModelChunk
*>(this),
352 Thread::getCurrentLocalFlags());
354 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
356 FieldContainerTransitPtr
returnValue(tmpPtr
);
364 /*------------------------- constructors ----------------------------------*/
366 ShadeModelChunkBase::ShadeModelChunkBase(void) :
368 _sfShadeModel (GLenum(GL_SMOOTH
))
372 ShadeModelChunkBase::ShadeModelChunkBase(const ShadeModelChunkBase
&source
) :
374 _sfShadeModel (source
._sfShadeModel
)
379 /*-------------------------- destructors ----------------------------------*/
381 ShadeModelChunkBase::~ShadeModelChunkBase(void)
386 GetFieldHandlePtr
ShadeModelChunkBase::getHandleShadeModel (void) const
388 SFGLenum::GetHandlePtr
returnValue(
389 new SFGLenum::GetHandle(
391 this->getType().getFieldDesc(ShadeModelFieldId
),
392 const_cast<ShadeModelChunkBase
*>(this)));
397 EditFieldHandlePtr
ShadeModelChunkBase::editHandleShadeModel (void)
399 SFGLenum::EditHandlePtr
returnValue(
400 new SFGLenum::EditHandle(
402 this->getType().getFieldDesc(ShadeModelFieldId
),
406 editSField(ShadeModelFieldMask
);
412 #ifdef OSG_MT_CPTR_ASPECT
413 void ShadeModelChunkBase::execSyncV( FieldContainer
&oFrom
,
414 ConstFieldMaskArg whichField
,
415 AspectOffsetStore
&oOffsets
,
416 ConstFieldMaskArg syncMode
,
417 const UInt32 uiSyncInfo
)
419 ShadeModelChunk
*pThis
= static_cast<ShadeModelChunk
*>(this);
421 pThis
->execSync(static_cast<ShadeModelChunk
*>(&oFrom
),
430 #ifdef OSG_MT_CPTR_ASPECT
431 FieldContainer
*ShadeModelChunkBase::createAspectCopy(
432 const FieldContainer
*pRefAspect
) const
434 ShadeModelChunk
*returnValue
;
436 newAspectCopy(returnValue
,
437 dynamic_cast<const ShadeModelChunk
*>(pRefAspect
),
438 dynamic_cast<const ShadeModelChunk
*>(this));
444 void ShadeModelChunkBase::resolveLinks(void)
446 Inherited::resolveLinks();