changed: gcc8 base update
[opensg.git] / Source / System / State / OpenGL / OSGShadeModelChunkBase.cpp
blobd03044863929b0ac5ce758f6f5ce1b6961e44955
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
41 ** **
42 ** This file is automatically generated. **
43 ** **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
46 ** **
47 ** Do not change this file, changes should be done in the derived **
48 ** class ShadeModelChunk!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #ifdef WIN32
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
59 #endif
61 #include "OSGConfig.h"
66 #include "OSGShadeModelChunkBase.h"
67 #include "OSGShadeModelChunk.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::ShadeModelChunk
78 ShadeModelChunk controls the shading model used for rendering lines and filled
79 polygons.
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(
97 "ShadeModelChunkPtr",
98 "StateChunkPtr",
99 ShadeModelChunk::getClassType(),
100 nsOSG);
101 #endif
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(),
116 "shadeModel",
117 "The shading model to use (glShadeModel).\n",
118 ShadeModelFieldId, ShadeModelFieldMask,
119 false,
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(),
131 "NULL",
132 nsOSG, //Namespace
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)),
138 false,
140 "<?xml version=\"1.0\"?>\n"
141 "\n"
142 "<FieldContainer\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"
153 " >\n"
154 " ShadeModelChunk controls the shading model used for rendering lines and filled\n"
155 " polygons.\n"
156 " <Field\n"
157 " name=\"shadeModel\"\n"
158 " type=\"GLenum\"\n"
159 " cardinality=\"single\"\n"
160 " visibility=\"external\"\n"
161 " defaultValue=\"GL_SMOOTH\"\n"
162 " access=\"public\"\n"
163 " >\n"
164 " The shading model to use (glShadeModel).\n"
165 " </Field>\n"
166 "</FieldContainer>\n",
167 "ShadeModelChunk controls the shading model used for rendering lines and filled\n"
168 "polygons.\n"
171 /*------------------------------ get -----------------------------------*/
173 FieldContainerType &ShadeModelChunkBase::getType(void)
175 return _type;
178 const FieldContainerType &ShadeModelChunkBase::getType(void) const
180 return _type;
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();
219 return returnValue;
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);
258 return fc;
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);
274 return fc;
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);
290 return fc;
293 ShadeModelChunk *ShadeModelChunkBase::createEmptyLocal(BitVector bFlags)
295 ShadeModelChunk *returnValue;
297 newPtr<ShadeModelChunk>(returnValue, bFlags);
299 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
301 return returnValue;
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();
314 return returnValue;
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;
329 return returnValue;
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;
343 return returnValue;
346 FieldContainerTransitPtr ShadeModelChunkBase::shallowCopy(void) const
348 ShadeModelChunk *tmpPtr;
350 newPtr(tmpPtr,
351 dynamic_cast<const ShadeModelChunk *>(this),
352 Thread::getCurrentLocalFlags());
354 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
356 FieldContainerTransitPtr returnValue(tmpPtr);
358 return returnValue;
364 /*------------------------- constructors ----------------------------------*/
366 ShadeModelChunkBase::ShadeModelChunkBase(void) :
367 Inherited(),
368 _sfShadeModel (GLenum(GL_SMOOTH))
372 ShadeModelChunkBase::ShadeModelChunkBase(const ShadeModelChunkBase &source) :
373 Inherited(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(
390 &_sfShadeModel,
391 this->getType().getFieldDesc(ShadeModelFieldId),
392 const_cast<ShadeModelChunkBase *>(this)));
394 return returnValue;
397 EditFieldHandlePtr ShadeModelChunkBase::editHandleShadeModel (void)
399 SFGLenum::EditHandlePtr returnValue(
400 new SFGLenum::EditHandle(
401 &_sfShadeModel,
402 this->getType().getFieldDesc(ShadeModelFieldId),
403 this));
406 editSField(ShadeModelFieldMask);
408 return returnValue;
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),
422 whichField,
423 oOffsets,
424 syncMode,
425 uiSyncInfo);
427 #endif
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));
440 return returnValue;
442 #endif
444 void ShadeModelChunkBase::resolveLinks(void)
446 Inherited::resolveLinks();
452 OSG_END_NAMESPACE