changed: gcc8 base update
[opensg.git] / Source / System / Dynamics / Skeleton / OSGGPUSkinningDataAttachmentBase.cpp
blobe0985c332baed831cf90e27621ce454b25a33c93
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 GPUSkinningDataAttachment!
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 "OSGShaderProgramChunk.h" // ShaderCode Class
67 #include "OSGGPUSkinningDataAttachmentBase.h"
68 #include "OSGGPUSkinningDataAttachment.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::GPUSkinningDataAttachment
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var ShaderProgramChunk * GPUSkinningDataAttachmentBase::_sfShaderCode
90 /*! \var bool GPUSkinningDataAttachmentBase::_sfDataValid
95 /***************************************************************************\
96 * FieldType/FieldTrait Instantiation *
97 \***************************************************************************/
99 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
100 PointerType FieldTraits<GPUSkinningDataAttachment *, nsOSG>::_type(
101 "GPUSkinningDataAttachmentPtr",
102 "AttachmentPtr",
103 GPUSkinningDataAttachment::getClassType(),
104 nsOSG);
105 #endif
107 OSG_FIELDTRAITS_GETTYPE_NS(GPUSkinningDataAttachment *, nsOSG)
109 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
110 GPUSkinningDataAttachment *,
111 nsOSG)
113 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
114 GPUSkinningDataAttachment *,
115 nsOSG)
117 /***************************************************************************\
118 * Field Description *
119 \***************************************************************************/
121 void GPUSkinningDataAttachmentBase::classDescInserter(TypeObject &oType)
123 FieldDescriptionBase *pDesc = NULL;
126 pDesc = new SFUnrecShaderProgramChunkPtr::Description(
127 SFUnrecShaderProgramChunkPtr::getClassType(),
128 "shaderCode",
130 ShaderCodeFieldId, ShaderCodeFieldMask,
131 false,
132 (Field::SFDefaultFlags | Field::FStdAccess),
133 static_cast<FieldEditMethodSig>(&GPUSkinningDataAttachment::editHandleShaderCode),
134 static_cast<FieldGetMethodSig >(&GPUSkinningDataAttachment::getHandleShaderCode));
136 oType.addInitialDesc(pDesc);
138 pDesc = new SFBool::Description(
139 SFBool::getClassType(),
140 "dataValid",
142 DataValidFieldId, DataValidFieldMask,
143 false,
144 (Field::SFDefaultFlags | Field::FStdAccess),
145 static_cast<FieldEditMethodSig>(&GPUSkinningDataAttachment::editHandleDataValid),
146 static_cast<FieldGetMethodSig >(&GPUSkinningDataAttachment::getHandleDataValid));
148 oType.addInitialDesc(pDesc);
152 GPUSkinningDataAttachmentBase::TypeObject GPUSkinningDataAttachmentBase::_type(
153 GPUSkinningDataAttachmentBase::getClassname(),
154 Inherited::getClassname(),
155 "GPUSkinningDataAttachment",
156 nsOSG, //Namespace
157 reinterpret_cast<PrototypeCreateF>(&GPUSkinningDataAttachmentBase::createEmptyLocal),
158 reinterpret_cast<InitContainerF>(&GPUSkinningDataAttachment::initMethod),
159 reinterpret_cast<ExitContainerF>(&GPUSkinningDataAttachment::exitMethod),
160 reinterpret_cast<InitalInsertDescFunc>(
161 reinterpret_cast<void *>(&GPUSkinningDataAttachment::classDescInserter)),
162 false,
164 "<?xml version=\"1.0\"?>\n"
165 "\n"
166 "<FieldContainer\n"
167 " name=\"GPUSkinningDataAttachment\"\n"
168 " parent=\"Attachment\"\n"
169 " library=\"Dynamics\"\n"
170 " pointerfieldtypes=\"both\"\n"
171 " structure=\"concrete\"\n"
172 " systemcomponent=\"true\"\n"
173 " parentsystemcomponent=\"true\"\n"
174 " decoratable=\"false\"\n"
175 " childFields=\"none\"\n"
176 " parentFields=\"none\"\n"
177 ">\n"
178 " <Field\n"
179 " name=\"shaderCode\"\n"
180 " type=\"ShaderProgramChunk\"\n"
181 " category=\"pointer\"\n"
182 " cardinality=\"single\"\n"
183 " visibility=\"external\"\n"
184 " access=\"public\"\n"
185 " defaultValue=\"NULL\"\n"
186 " >\n"
187 " </Field>\n"
188 "\n"
189 " <Field\n"
190 " name=\"dataValid\"\n"
191 " type=\"bool\"\n"
192 " category=\"data\"\n"
193 " cardinality=\"single\"\n"
194 " visibility=\"external\"\n"
195 " access=\"public\"\n"
196 " defaultValue=\"false\"\n"
197 " >\n"
198 " </Field>\n"
199 "\n"
200 "</FieldContainer>\n",
204 /*------------------------------ get -----------------------------------*/
206 FieldContainerType &GPUSkinningDataAttachmentBase::getType(void)
208 return _type;
211 const FieldContainerType &GPUSkinningDataAttachmentBase::getType(void) const
213 return _type;
216 UInt32 GPUSkinningDataAttachmentBase::getContainerSize(void) const
218 return sizeof(GPUSkinningDataAttachment);
221 /*------------------------- decorator get ------------------------------*/
224 //! Get the GPUSkinningDataAttachment::_sfShaderCode field.
225 const SFUnrecShaderProgramChunkPtr *GPUSkinningDataAttachmentBase::getSFShaderCode(void) const
227 return &_sfShaderCode;
230 SFUnrecShaderProgramChunkPtr *GPUSkinningDataAttachmentBase::editSFShaderCode (void)
232 editSField(ShaderCodeFieldMask);
234 return &_sfShaderCode;
237 //! Get the value of the GPUSkinningDataAttachment::_sfShaderCode field.
238 ShaderProgramChunk * GPUSkinningDataAttachmentBase::getShaderCode(void) const
240 return _sfShaderCode.getValue();
243 //! Set the value of the GPUSkinningDataAttachment::_sfShaderCode field.
244 void GPUSkinningDataAttachmentBase::setShaderCode(ShaderProgramChunk * const value)
246 editSField(ShaderCodeFieldMask);
248 _sfShaderCode.setValue(value);
252 SFBool *GPUSkinningDataAttachmentBase::editSFDataValid(void)
254 editSField(DataValidFieldMask);
256 return &_sfDataValid;
259 const SFBool *GPUSkinningDataAttachmentBase::getSFDataValid(void) const
261 return &_sfDataValid;
269 /*------------------------------ access -----------------------------------*/
271 SizeT GPUSkinningDataAttachmentBase::getBinSize(ConstFieldMaskArg whichField)
273 SizeT returnValue = Inherited::getBinSize(whichField);
275 if(FieldBits::NoField != (ShaderCodeFieldMask & whichField))
277 returnValue += _sfShaderCode.getBinSize();
279 if(FieldBits::NoField != (DataValidFieldMask & whichField))
281 returnValue += _sfDataValid.getBinSize();
284 return returnValue;
287 void GPUSkinningDataAttachmentBase::copyToBin(BinaryDataHandler &pMem,
288 ConstFieldMaskArg whichField)
290 Inherited::copyToBin(pMem, whichField);
292 if(FieldBits::NoField != (ShaderCodeFieldMask & whichField))
294 _sfShaderCode.copyToBin(pMem);
296 if(FieldBits::NoField != (DataValidFieldMask & whichField))
298 _sfDataValid.copyToBin(pMem);
302 void GPUSkinningDataAttachmentBase::copyFromBin(BinaryDataHandler &pMem,
303 ConstFieldMaskArg whichField)
305 Inherited::copyFromBin(pMem, whichField);
307 if(FieldBits::NoField != (ShaderCodeFieldMask & whichField))
309 editSField(ShaderCodeFieldMask);
310 _sfShaderCode.copyFromBin(pMem);
312 if(FieldBits::NoField != (DataValidFieldMask & whichField))
314 editSField(DataValidFieldMask);
315 _sfDataValid.copyFromBin(pMem);
319 //! create a new instance of the class
320 GPUSkinningDataAttachmentTransitPtr GPUSkinningDataAttachmentBase::createLocal(BitVector bFlags)
322 GPUSkinningDataAttachmentTransitPtr fc;
324 if(getClassType().getPrototype() != NULL)
326 FieldContainerTransitPtr tmpPtr =
327 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
329 fc = dynamic_pointer_cast<GPUSkinningDataAttachment>(tmpPtr);
332 return fc;
335 //! create a new instance of the class, copy the container flags
336 GPUSkinningDataAttachmentTransitPtr GPUSkinningDataAttachmentBase::createDependent(BitVector bFlags)
338 GPUSkinningDataAttachmentTransitPtr fc;
340 if(getClassType().getPrototype() != NULL)
342 FieldContainerTransitPtr tmpPtr =
343 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
345 fc = dynamic_pointer_cast<GPUSkinningDataAttachment>(tmpPtr);
348 return fc;
351 //! create a new instance of the class
352 GPUSkinningDataAttachmentTransitPtr GPUSkinningDataAttachmentBase::create(void)
354 GPUSkinningDataAttachmentTransitPtr fc;
356 if(getClassType().getPrototype() != NULL)
358 FieldContainerTransitPtr tmpPtr =
359 getClassType().getPrototype()-> shallowCopy();
361 fc = dynamic_pointer_cast<GPUSkinningDataAttachment>(tmpPtr);
364 return fc;
367 GPUSkinningDataAttachment *GPUSkinningDataAttachmentBase::createEmptyLocal(BitVector bFlags)
369 GPUSkinningDataAttachment *returnValue;
371 newPtr<GPUSkinningDataAttachment>(returnValue, bFlags);
373 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
375 return returnValue;
378 //! create an empty new instance of the class, do not copy the prototype
379 GPUSkinningDataAttachment *GPUSkinningDataAttachmentBase::createEmpty(void)
381 GPUSkinningDataAttachment *returnValue;
383 newPtr<GPUSkinningDataAttachment>(returnValue, Thread::getCurrentLocalFlags());
385 returnValue->_pFieldFlags->_bNamespaceMask &=
386 ~Thread::getCurrentLocalFlags();
388 return returnValue;
392 FieldContainerTransitPtr GPUSkinningDataAttachmentBase::shallowCopyLocal(
393 BitVector bFlags) const
395 GPUSkinningDataAttachment *tmpPtr;
397 newPtr(tmpPtr, dynamic_cast<const GPUSkinningDataAttachment *>(this), bFlags);
399 FieldContainerTransitPtr returnValue(tmpPtr);
401 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
403 return returnValue;
406 FieldContainerTransitPtr GPUSkinningDataAttachmentBase::shallowCopyDependent(
407 BitVector bFlags) const
409 GPUSkinningDataAttachment *tmpPtr;
411 newPtr(tmpPtr, dynamic_cast<const GPUSkinningDataAttachment *>(this), ~bFlags);
413 FieldContainerTransitPtr returnValue(tmpPtr);
415 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
417 return returnValue;
420 FieldContainerTransitPtr GPUSkinningDataAttachmentBase::shallowCopy(void) const
422 GPUSkinningDataAttachment *tmpPtr;
424 newPtr(tmpPtr,
425 dynamic_cast<const GPUSkinningDataAttachment *>(this),
426 Thread::getCurrentLocalFlags());
428 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
430 FieldContainerTransitPtr returnValue(tmpPtr);
432 return returnValue;
438 /*------------------------- constructors ----------------------------------*/
440 GPUSkinningDataAttachmentBase::GPUSkinningDataAttachmentBase(void) :
441 Inherited(),
442 _sfShaderCode (NULL),
443 _sfDataValid (bool(false))
447 GPUSkinningDataAttachmentBase::GPUSkinningDataAttachmentBase(const GPUSkinningDataAttachmentBase &source) :
448 Inherited(source),
449 _sfShaderCode (NULL),
450 _sfDataValid (source._sfDataValid )
455 /*-------------------------- destructors ----------------------------------*/
457 GPUSkinningDataAttachmentBase::~GPUSkinningDataAttachmentBase(void)
461 void GPUSkinningDataAttachmentBase::onCreate(const GPUSkinningDataAttachment *source)
463 Inherited::onCreate(source);
465 if(source != NULL)
467 GPUSkinningDataAttachment *pThis = static_cast<GPUSkinningDataAttachment *>(this);
469 pThis->setShaderCode(source->getShaderCode());
473 GetFieldHandlePtr GPUSkinningDataAttachmentBase::getHandleShaderCode (void) const
475 SFUnrecShaderProgramChunkPtr::GetHandlePtr returnValue(
476 new SFUnrecShaderProgramChunkPtr::GetHandle(
477 &_sfShaderCode,
478 this->getType().getFieldDesc(ShaderCodeFieldId),
479 const_cast<GPUSkinningDataAttachmentBase *>(this)));
481 return returnValue;
484 EditFieldHandlePtr GPUSkinningDataAttachmentBase::editHandleShaderCode (void)
486 SFUnrecShaderProgramChunkPtr::EditHandlePtr returnValue(
487 new SFUnrecShaderProgramChunkPtr::EditHandle(
488 &_sfShaderCode,
489 this->getType().getFieldDesc(ShaderCodeFieldId),
490 this));
492 returnValue->setSetMethod(
493 boost::bind(&GPUSkinningDataAttachment::setShaderCode,
494 static_cast<GPUSkinningDataAttachment *>(this), _1));
496 editSField(ShaderCodeFieldMask);
498 return returnValue;
501 GetFieldHandlePtr GPUSkinningDataAttachmentBase::getHandleDataValid (void) const
503 SFBool::GetHandlePtr returnValue(
504 new SFBool::GetHandle(
505 &_sfDataValid,
506 this->getType().getFieldDesc(DataValidFieldId),
507 const_cast<GPUSkinningDataAttachmentBase *>(this)));
509 return returnValue;
512 EditFieldHandlePtr GPUSkinningDataAttachmentBase::editHandleDataValid (void)
514 SFBool::EditHandlePtr returnValue(
515 new SFBool::EditHandle(
516 &_sfDataValid,
517 this->getType().getFieldDesc(DataValidFieldId),
518 this));
521 editSField(DataValidFieldMask);
523 return returnValue;
527 #ifdef OSG_MT_CPTR_ASPECT
528 void GPUSkinningDataAttachmentBase::execSyncV( FieldContainer &oFrom,
529 ConstFieldMaskArg whichField,
530 AspectOffsetStore &oOffsets,
531 ConstFieldMaskArg syncMode,
532 const UInt32 uiSyncInfo)
534 GPUSkinningDataAttachment *pThis = static_cast<GPUSkinningDataAttachment *>(this);
536 pThis->execSync(static_cast<GPUSkinningDataAttachment *>(&oFrom),
537 whichField,
538 oOffsets,
539 syncMode,
540 uiSyncInfo);
542 #endif
545 #ifdef OSG_MT_CPTR_ASPECT
546 FieldContainer *GPUSkinningDataAttachmentBase::createAspectCopy(
547 const FieldContainer *pRefAspect) const
549 GPUSkinningDataAttachment *returnValue;
551 newAspectCopy(returnValue,
552 dynamic_cast<const GPUSkinningDataAttachment *>(pRefAspect),
553 dynamic_cast<const GPUSkinningDataAttachment *>(this));
555 return returnValue;
557 #endif
559 void GPUSkinningDataAttachmentBase::resolveLinks(void)
561 Inherited::resolveLinks();
563 static_cast<GPUSkinningDataAttachment *>(this)->setShaderCode(NULL);
569 OSG_END_NAMESPACE