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 CgFXPassChunk!
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 "OSGCgFXMaterial.h" // Material Class
67 #include "OSGCgFXPassChunkBase.h"
68 #include "OSGCgFXPassChunk.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
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(
99 CgFXPassChunk::getClassType(),
103 OSG_FIELDTRAITS_GETTYPE_NS(CgFXPassChunk
*, nsOSG
)
105 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
109 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
113 /***************************************************************************\
114 * Field Description *
115 \***************************************************************************/
117 void CgFXPassChunkBase::classDescInserter(TypeObject
&oType
)
119 FieldDescriptionBase
*pDesc
= NULL
;
122 pDesc
= new SFWeakCgFXMaterialPtr::Description(
123 SFWeakCgFXMaterialPtr::getClassType(),
126 MaterialFieldId
, MaterialFieldMask
,
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(),
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
)),
148 "<?xml version=\"1.0\"?>\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"
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"
174 "\t type=\"UInt32\"\n"
175 "\t cardinality=\"single\"\n"
176 "\t visibility=\"internal\"\n"
177 "\t access=\"public\"\n"
180 "</FieldContainer>\n",
184 /*------------------------------ get -----------------------------------*/
186 FieldContainerType
&CgFXPassChunkBase::getType(void)
191 const FieldContainerType
&CgFXPassChunkBase::getType(void) const
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
210 SFWeakCgFXMaterialPtr
*CgFXPassChunkBase::editSFMaterial (void)
212 editSField(MaterialFieldMask
);
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();
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
);
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
);
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
);
321 CgFXPassChunk
*CgFXPassChunkBase::createEmptyLocal(BitVector bFlags
)
323 CgFXPassChunk
*returnValue
;
325 newPtr
<CgFXPassChunk
>(returnValue
, bFlags
);
327 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
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();
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
;
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
;
374 FieldContainerTransitPtr
CgFXPassChunkBase::shallowCopy(void) const
376 CgFXPassChunk
*tmpPtr
;
379 dynamic_cast<const CgFXPassChunk
*>(this),
380 Thread::getCurrentLocalFlags());
382 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
384 FieldContainerTransitPtr
returnValue(tmpPtr
);
392 /*------------------------- constructors ----------------------------------*/
394 CgFXPassChunkBase::CgFXPassChunkBase(void) :
400 CgFXPassChunkBase::CgFXPassChunkBase(const CgFXPassChunkBase
&source
) :
407 /*-------------------------- destructors ----------------------------------*/
409 CgFXPassChunkBase::~CgFXPassChunkBase(void)
413 void CgFXPassChunkBase::onCreate(const CgFXPassChunk
*source
)
415 Inherited::onCreate(source
);
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(
430 this->getType().getFieldDesc(MaterialFieldId
),
431 const_cast<CgFXPassChunkBase
*>(this)));
436 EditFieldHandlePtr
CgFXPassChunkBase::editHandleMaterial (void)
438 SFWeakCgFXMaterialPtr::EditHandlePtr
returnValue(
439 new SFWeakCgFXMaterialPtr::EditHandle(
441 this->getType().getFieldDesc(MaterialFieldId
),
444 returnValue
->setSetMethod(
445 boost::bind(&CgFXPassChunk::setMaterial
,
446 static_cast<CgFXPassChunk
*>(this), _1
));
448 editSField(MaterialFieldMask
);
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
),
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));
486 void CgFXPassChunkBase::resolveLinks(void)
488 Inherited::resolveLinks();
490 static_cast<CgFXPassChunk
*>(this)->setMaterial(NULL
);