fixed: stay with old cmake qt link setup (policy CMP0020)
[opensg.git] / Source / System / State / OpenGL / OSGShadeModelChunkBase.cpp
blob271088d00ac930d528ba6f8199ba5315315d00f9
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 #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)
68 #endif
70 OSG_BEGIN_NAMESPACE
72 /***************************************************************************\
73 * Description *
74 \***************************************************************************/
76 /*! \class OSG::ShadeModelChunk
77 ShadeModelChunk controls the shading model used for rendering lines and filled
78 polygons.
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(
96 "ShadeModelChunkPtr",
97 "StateChunkPtr",
98 ShadeModelChunk::getClassType(),
99 nsOSG);
100 #endif
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(),
115 "shadeModel",
116 "The shading model to use (glShadeModel).\n",
117 ShadeModelFieldId, ShadeModelFieldMask,
118 false,
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(),
130 "NULL",
131 nsOSG, //Namespace
132 reinterpret_cast<PrototypeCreateF>(&ShadeModelChunkBase::createEmptyLocal),
133 ShadeModelChunk::initMethod,
134 ShadeModelChunk::exitMethod,
135 reinterpret_cast<InitalInsertDescFunc>(&ShadeModelChunk::classDescInserter),
136 false,
138 "<?xml version=\"1.0\"?>\n"
139 "\n"
140 "<FieldContainer\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"
151 " >\n"
152 " ShadeModelChunk controls the shading model used for rendering lines and filled\n"
153 " polygons.\n"
154 " <Field\n"
155 " name=\"shadeModel\"\n"
156 " type=\"GLenum\"\n"
157 " cardinality=\"single\"\n"
158 " visibility=\"external\"\n"
159 " defaultValue=\"GL_SMOOTH\"\n"
160 " access=\"public\"\n"
161 " >\n"
162 " The shading model to use (glShadeModel).\n"
163 " </Field>\n"
164 "</FieldContainer>\n",
165 "ShadeModelChunk controls the shading model used for rendering lines and filled\n"
166 "polygons.\n"
169 /*------------------------------ get -----------------------------------*/
171 FieldContainerType &ShadeModelChunkBase::getType(void)
173 return _type;
176 const FieldContainerType &ShadeModelChunkBase::getType(void) const
178 return _type;
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();
217 return returnValue;
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);
256 return fc;
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);
272 return fc;
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);
288 return fc;
291 ShadeModelChunk *ShadeModelChunkBase::createEmptyLocal(BitVector bFlags)
293 ShadeModelChunk *returnValue;
295 newPtr<ShadeModelChunk>(returnValue, bFlags);
297 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
299 return returnValue;
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();
312 return returnValue;
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;
327 return returnValue;
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;
341 return returnValue;
344 FieldContainerTransitPtr ShadeModelChunkBase::shallowCopy(void) const
346 ShadeModelChunk *tmpPtr;
348 newPtr(tmpPtr,
349 dynamic_cast<const ShadeModelChunk *>(this),
350 Thread::getCurrentLocalFlags());
352 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
354 FieldContainerTransitPtr returnValue(tmpPtr);
356 return returnValue;
362 /*------------------------- constructors ----------------------------------*/
364 ShadeModelChunkBase::ShadeModelChunkBase(void) :
365 Inherited(),
366 _sfShadeModel (GLenum(GL_SMOOTH))
370 ShadeModelChunkBase::ShadeModelChunkBase(const ShadeModelChunkBase &source) :
371 Inherited(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(
388 &_sfShadeModel,
389 this->getType().getFieldDesc(ShadeModelFieldId),
390 const_cast<ShadeModelChunkBase *>(this)));
392 return returnValue;
395 EditFieldHandlePtr ShadeModelChunkBase::editHandleShadeModel (void)
397 SFGLenum::EditHandlePtr returnValue(
398 new SFGLenum::EditHandle(
399 &_sfShadeModel,
400 this->getType().getFieldDesc(ShadeModelFieldId),
401 this));
404 editSField(ShadeModelFieldMask);
406 return returnValue;
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),
420 whichField,
421 oOffsets,
422 syncMode,
423 uiSyncInfo);
425 #endif
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));
438 return returnValue;
440 #endif
442 void ShadeModelChunkBase::resolveLinks(void)
444 Inherited::resolveLinks();
450 OSG_END_NAMESPACE