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 GPUSkinningDataAttachment!
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"
65 #include "OSGShaderProgramChunk.h" // ShaderCode Class
67 #include "OSGGPUSkinningDataAttachmentBase.h"
68 #include "OSGGPUSkinningDataAttachment.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
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",
103 GPUSkinningDataAttachment::getClassType(),
107 OSG_FIELDTRAITS_GETTYPE_NS(GPUSkinningDataAttachment
*, nsOSG
)
109 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
110 GPUSkinningDataAttachment
*,
113 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
114 GPUSkinningDataAttachment
*,
117 /***************************************************************************\
118 * Field Description *
119 \***************************************************************************/
121 void GPUSkinningDataAttachmentBase::classDescInserter(TypeObject
&oType
)
123 FieldDescriptionBase
*pDesc
= NULL
;
126 pDesc
= new SFUnrecShaderProgramChunkPtr::Description(
127 SFUnrecShaderProgramChunkPtr::getClassType(),
130 ShaderCodeFieldId
, ShaderCodeFieldMask
,
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(),
142 DataValidFieldId
, DataValidFieldMask
,
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",
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
)),
164 "<?xml version=\"1.0\"?>\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"
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"
190 " name=\"dataValid\"\n"
192 " category=\"data\"\n"
193 " cardinality=\"single\"\n"
194 " visibility=\"external\"\n"
195 " access=\"public\"\n"
196 " defaultValue=\"false\"\n"
200 "</FieldContainer>\n",
204 /*------------------------------ get -----------------------------------*/
206 FieldContainerType
&GPUSkinningDataAttachmentBase::getType(void)
211 const FieldContainerType
&GPUSkinningDataAttachmentBase::getType(void) const
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();
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
);
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
);
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
);
367 GPUSkinningDataAttachment
*GPUSkinningDataAttachmentBase::createEmptyLocal(BitVector bFlags
)
369 GPUSkinningDataAttachment
*returnValue
;
371 newPtr
<GPUSkinningDataAttachment
>(returnValue
, bFlags
);
373 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
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();
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
;
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
;
420 FieldContainerTransitPtr
GPUSkinningDataAttachmentBase::shallowCopy(void) const
422 GPUSkinningDataAttachment
*tmpPtr
;
425 dynamic_cast<const GPUSkinningDataAttachment
*>(this),
426 Thread::getCurrentLocalFlags());
428 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
430 FieldContainerTransitPtr
returnValue(tmpPtr
);
438 /*------------------------- constructors ----------------------------------*/
440 GPUSkinningDataAttachmentBase::GPUSkinningDataAttachmentBase(void) :
442 _sfShaderCode (NULL
),
443 _sfDataValid (bool(false))
447 GPUSkinningDataAttachmentBase::GPUSkinningDataAttachmentBase(const GPUSkinningDataAttachmentBase
&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
);
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(
478 this->getType().getFieldDesc(ShaderCodeFieldId
),
479 const_cast<GPUSkinningDataAttachmentBase
*>(this)));
484 EditFieldHandlePtr
GPUSkinningDataAttachmentBase::editHandleShaderCode (void)
486 SFUnrecShaderProgramChunkPtr::EditHandlePtr
returnValue(
487 new SFUnrecShaderProgramChunkPtr::EditHandle(
489 this->getType().getFieldDesc(ShaderCodeFieldId
),
492 returnValue
->setSetMethod(
493 boost::bind(&GPUSkinningDataAttachment::setShaderCode
,
494 static_cast<GPUSkinningDataAttachment
*>(this), _1
));
496 editSField(ShaderCodeFieldMask
);
501 GetFieldHandlePtr
GPUSkinningDataAttachmentBase::getHandleDataValid (void) const
503 SFBool::GetHandlePtr
returnValue(
504 new SFBool::GetHandle(
506 this->getType().getFieldDesc(DataValidFieldId
),
507 const_cast<GPUSkinningDataAttachmentBase
*>(this)));
512 EditFieldHandlePtr
GPUSkinningDataAttachmentBase::editHandleDataValid (void)
514 SFBool::EditHandlePtr
returnValue(
515 new SFBool::EditHandle(
517 this->getType().getFieldDesc(DataValidFieldId
),
521 editSField(DataValidFieldMask
);
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
),
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));
559 void GPUSkinningDataAttachmentBase::resolveLinks(void)
561 Inherited::resolveLinks();
563 static_cast<GPUSkinningDataAttachment
*>(this)->setShaderCode(NULL
);