changed: gcc8 base update
[opensg.git] / Source / Contrib / CgFXMaterial / OSGCgFXPassChunkBase.cpp
blob4ffbc37a0ec9a23134a8985f64f34edf029b7a2d
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 CgFXPassChunk!
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"
65 #include "OSGCgFXMaterial.h" // Material Class
67 #include "OSGCgFXPassChunkBase.h"
68 #include "OSGCgFXPassChunk.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::CgFXPassChunk
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var CgFXMaterial * CgFXPassChunkBase::_sfMaterial
91 /***************************************************************************\
92 * FieldType/FieldTrait Instantiation *
93 \***************************************************************************/
95 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
96 PointerType FieldTraits<CgFXPassChunk *, nsOSG>::_type(
97 "CgFXPassChunkPtr",
98 "FullStateChunkPtr",
99 CgFXPassChunk::getClassType(),
100 nsOSG);
101 #endif
103 OSG_FIELDTRAITS_GETTYPE_NS(CgFXPassChunk *, nsOSG)
105 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
106 CgFXPassChunk *,
107 nsOSG)
109 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
110 CgFXPassChunk *,
111 nsOSG)
113 /***************************************************************************\
114 * Field Description *
115 \***************************************************************************/
117 void CgFXPassChunkBase::classDescInserter(TypeObject &oType)
119 FieldDescriptionBase *pDesc = NULL;
122 pDesc = new SFWeakCgFXMaterialPtr::Description(
123 SFWeakCgFXMaterialPtr::getClassType(),
124 "material",
126 MaterialFieldId, MaterialFieldMask,
127 false,
128 (Field::SFDefaultFlags | Field::FStdAccess),
129 static_cast<FieldEditMethodSig>(&CgFXPassChunk::editHandleMaterial),
130 static_cast<FieldGetMethodSig >(&CgFXPassChunk::getHandleMaterial));
132 oType.addInitialDesc(pDesc);
136 CgFXPassChunkBase::TypeObject CgFXPassChunkBase::_type(
137 CgFXPassChunkBase::getClassname(),
138 Inherited::getClassname(),
139 "NULL",
140 nsOSG, //Namespace
141 reinterpret_cast<PrototypeCreateF>(&CgFXPassChunkBase::createEmptyLocal),
142 reinterpret_cast<InitContainerF>(&CgFXPassChunk::initMethod),
143 reinterpret_cast<ExitContainerF>(&CgFXPassChunk::exitMethod),
144 reinterpret_cast<InitalInsertDescFunc>(
145 reinterpret_cast<void *>(&CgFXPassChunk::classDescInserter)),
146 false,
148 "<?xml version=\"1.0\"?>\n"
149 "\n"
150 "<FieldContainer\n"
151 " name=\"CgFXPassChunk\"\n"
152 " parent=\"FullStateChunk\"\n"
153 " library=\"ContribCgFX\"\n"
154 " pointerfieldtypes=\"both\"\n"
155 " structure=\"concrete\"\n"
156 " systemcomponent=\"true\"\n"
157 " parentsystemcomponent=\"true\"\n"
158 " decoratable=\"false\"\n"
159 " useLocalIncludes=\"false\"\n"
160 " >\n"
161 " <Field\n"
162 "\t name=\"material\"\n"
163 "\t type=\"CgFXMaterial\"\n"
164 "\t category=\"weakpointer\"\n"
165 "\t cardinality=\"single\"\n"
166 "\t visibility=\"external\"\n"
167 "\t access=\"protected\"\n"
168 "\t defaultValue=\"NULL\"\n"
169 "\t >\n"
170 " </Field>\n"
171 "<!--\n"
172 " <Field\n"
173 "\t name=\"GLId\"\n"
174 "\t type=\"UInt32\"\n"
175 "\t cardinality=\"single\"\n"
176 "\t visibility=\"internal\"\n"
177 "\t access=\"public\"\n"
178 "\t >\n"
179 " </Field> -->\n"
180 "</FieldContainer>\n",
184 /*------------------------------ get -----------------------------------*/
186 FieldContainerType &CgFXPassChunkBase::getType(void)
188 return _type;
191 const FieldContainerType &CgFXPassChunkBase::getType(void) const
193 return _type;
196 UInt32 CgFXPassChunkBase::getContainerSize(void) const
198 return sizeof(CgFXPassChunk);
201 /*------------------------- decorator get ------------------------------*/
204 //! Get the CgFXPassChunk::_sfMaterial field.
205 const SFWeakCgFXMaterialPtr *CgFXPassChunkBase::getSFMaterial(void) const
207 return &_sfMaterial;
210 SFWeakCgFXMaterialPtr *CgFXPassChunkBase::editSFMaterial (void)
212 editSField(MaterialFieldMask);
214 return &_sfMaterial;
217 //! Get the value of the CgFXPassChunk::_sfMaterial field.
218 CgFXMaterial * CgFXPassChunkBase::getMaterial(void) const
220 return _sfMaterial.getValue();
223 //! Set the value of the CgFXPassChunk::_sfMaterial field.
224 void CgFXPassChunkBase::setMaterial(CgFXMaterial * const value)
226 editSField(MaterialFieldMask);
228 _sfMaterial.setValue(value);
236 /*------------------------------ access -----------------------------------*/
238 SizeT CgFXPassChunkBase::getBinSize(ConstFieldMaskArg whichField)
240 SizeT returnValue = Inherited::getBinSize(whichField);
242 if(FieldBits::NoField != (MaterialFieldMask & whichField))
244 returnValue += _sfMaterial.getBinSize();
247 return returnValue;
250 void CgFXPassChunkBase::copyToBin(BinaryDataHandler &pMem,
251 ConstFieldMaskArg whichField)
253 Inherited::copyToBin(pMem, whichField);
255 if(FieldBits::NoField != (MaterialFieldMask & whichField))
257 _sfMaterial.copyToBin(pMem);
261 void CgFXPassChunkBase::copyFromBin(BinaryDataHandler &pMem,
262 ConstFieldMaskArg whichField)
264 Inherited::copyFromBin(pMem, whichField);
266 if(FieldBits::NoField != (MaterialFieldMask & whichField))
268 editSField(MaterialFieldMask);
269 _sfMaterial.copyFromBin(pMem);
273 //! create a new instance of the class
274 CgFXPassChunkTransitPtr CgFXPassChunkBase::createLocal(BitVector bFlags)
276 CgFXPassChunkTransitPtr fc;
278 if(getClassType().getPrototype() != NULL)
280 FieldContainerTransitPtr tmpPtr =
281 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
283 fc = dynamic_pointer_cast<CgFXPassChunk>(tmpPtr);
286 return fc;
289 //! create a new instance of the class, copy the container flags
290 CgFXPassChunkTransitPtr CgFXPassChunkBase::createDependent(BitVector bFlags)
292 CgFXPassChunkTransitPtr fc;
294 if(getClassType().getPrototype() != NULL)
296 FieldContainerTransitPtr tmpPtr =
297 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
299 fc = dynamic_pointer_cast<CgFXPassChunk>(tmpPtr);
302 return fc;
305 //! create a new instance of the class
306 CgFXPassChunkTransitPtr CgFXPassChunkBase::create(void)
308 CgFXPassChunkTransitPtr fc;
310 if(getClassType().getPrototype() != NULL)
312 FieldContainerTransitPtr tmpPtr =
313 getClassType().getPrototype()-> shallowCopy();
315 fc = dynamic_pointer_cast<CgFXPassChunk>(tmpPtr);
318 return fc;
321 CgFXPassChunk *CgFXPassChunkBase::createEmptyLocal(BitVector bFlags)
323 CgFXPassChunk *returnValue;
325 newPtr<CgFXPassChunk>(returnValue, bFlags);
327 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
329 return returnValue;
332 //! create an empty new instance of the class, do not copy the prototype
333 CgFXPassChunk *CgFXPassChunkBase::createEmpty(void)
335 CgFXPassChunk *returnValue;
337 newPtr<CgFXPassChunk>(returnValue, Thread::getCurrentLocalFlags());
339 returnValue->_pFieldFlags->_bNamespaceMask &=
340 ~Thread::getCurrentLocalFlags();
342 return returnValue;
346 FieldContainerTransitPtr CgFXPassChunkBase::shallowCopyLocal(
347 BitVector bFlags) const
349 CgFXPassChunk *tmpPtr;
351 newPtr(tmpPtr, dynamic_cast<const CgFXPassChunk *>(this), bFlags);
353 FieldContainerTransitPtr returnValue(tmpPtr);
355 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
357 return returnValue;
360 FieldContainerTransitPtr CgFXPassChunkBase::shallowCopyDependent(
361 BitVector bFlags) const
363 CgFXPassChunk *tmpPtr;
365 newPtr(tmpPtr, dynamic_cast<const CgFXPassChunk *>(this), ~bFlags);
367 FieldContainerTransitPtr returnValue(tmpPtr);
369 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
371 return returnValue;
374 FieldContainerTransitPtr CgFXPassChunkBase::shallowCopy(void) const
376 CgFXPassChunk *tmpPtr;
378 newPtr(tmpPtr,
379 dynamic_cast<const CgFXPassChunk *>(this),
380 Thread::getCurrentLocalFlags());
382 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
384 FieldContainerTransitPtr returnValue(tmpPtr);
386 return returnValue;
392 /*------------------------- constructors ----------------------------------*/
394 CgFXPassChunkBase::CgFXPassChunkBase(void) :
395 Inherited(),
396 _sfMaterial (NULL)
400 CgFXPassChunkBase::CgFXPassChunkBase(const CgFXPassChunkBase &source) :
401 Inherited(source),
402 _sfMaterial (NULL)
407 /*-------------------------- destructors ----------------------------------*/
409 CgFXPassChunkBase::~CgFXPassChunkBase(void)
413 void CgFXPassChunkBase::onCreate(const CgFXPassChunk *source)
415 Inherited::onCreate(source);
417 if(source != NULL)
419 CgFXPassChunk *pThis = static_cast<CgFXPassChunk *>(this);
421 pThis->setMaterial(source->getMaterial());
425 GetFieldHandlePtr CgFXPassChunkBase::getHandleMaterial (void) const
427 SFWeakCgFXMaterialPtr::GetHandlePtr returnValue(
428 new SFWeakCgFXMaterialPtr::GetHandle(
429 &_sfMaterial,
430 this->getType().getFieldDesc(MaterialFieldId),
431 const_cast<CgFXPassChunkBase *>(this)));
433 return returnValue;
436 EditFieldHandlePtr CgFXPassChunkBase::editHandleMaterial (void)
438 SFWeakCgFXMaterialPtr::EditHandlePtr returnValue(
439 new SFWeakCgFXMaterialPtr::EditHandle(
440 &_sfMaterial,
441 this->getType().getFieldDesc(MaterialFieldId),
442 this));
444 returnValue->setSetMethod(
445 boost::bind(&CgFXPassChunk::setMaterial,
446 static_cast<CgFXPassChunk *>(this), _1));
448 editSField(MaterialFieldMask);
450 return returnValue;
454 #ifdef OSG_MT_CPTR_ASPECT
455 void CgFXPassChunkBase::execSyncV( FieldContainer &oFrom,
456 ConstFieldMaskArg whichField,
457 AspectOffsetStore &oOffsets,
458 ConstFieldMaskArg syncMode,
459 const UInt32 uiSyncInfo)
461 CgFXPassChunk *pThis = static_cast<CgFXPassChunk *>(this);
463 pThis->execSync(static_cast<CgFXPassChunk *>(&oFrom),
464 whichField,
465 oOffsets,
466 syncMode,
467 uiSyncInfo);
469 #endif
472 #ifdef OSG_MT_CPTR_ASPECT
473 FieldContainer *CgFXPassChunkBase::createAspectCopy(
474 const FieldContainer *pRefAspect) const
476 CgFXPassChunk *returnValue;
478 newAspectCopy(returnValue,
479 dynamic_cast<const CgFXPassChunk *>(pRefAspect),
480 dynamic_cast<const CgFXPassChunk *>(this));
482 return returnValue;
484 #endif
486 void CgFXPassChunkBase::resolveLinks(void)
488 Inherited::resolveLinks();
490 static_cast<CgFXPassChunk *>(this)->setMaterial(NULL);
496 OSG_END_NAMESPACE