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 ShaderVariableOSG!
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"
66 #include "OSGShaderVariableOSGBase.h"
67 #include "OSGShaderVariableOSG.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::ShaderVariableOSG
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var UInt32 ShaderVariableOSGBase::_sfOsgVarType
90 /***************************************************************************\
91 * FieldType/FieldTrait Instantiation *
92 \***************************************************************************/
94 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
95 PointerType FieldTraits
<ShaderVariableOSG
*, nsOSG
>::_type(
96 "ShaderVariableOSGPtr",
97 "ShaderProcVariablePtr",
98 ShaderVariableOSG::getClassType(),
102 OSG_FIELDTRAITS_GETTYPE_NS(ShaderVariableOSG
*, nsOSG
)
104 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
108 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
112 /***************************************************************************\
113 * Field Description *
114 \***************************************************************************/
116 void ShaderVariableOSGBase::classDescInserter(TypeObject
&oType
)
118 FieldDescriptionBase
*pDesc
= NULL
;
121 pDesc
= new SFUInt32::Description(
122 SFUInt32::getClassType(),
125 OsgVarTypeFieldId
, OsgVarTypeFieldMask
,
127 (Field::SFDefaultFlags
| Field::FStdAccess
),
128 static_cast<FieldEditMethodSig
>(&ShaderVariableOSG::editHandleOsgVarType
),
129 static_cast<FieldGetMethodSig
>(&ShaderVariableOSG::getHandleOsgVarType
));
131 oType
.addInitialDesc(pDesc
);
135 ShaderVariableOSGBase::TypeObject
ShaderVariableOSGBase::_type(
136 ShaderVariableOSGBase::getClassname(),
137 Inherited::getClassname(),
140 reinterpret_cast<PrototypeCreateF
>(&ShaderVariableOSGBase::createEmptyLocal
),
141 reinterpret_cast<InitContainerF
>(&ShaderVariableOSG::initMethod
),
142 reinterpret_cast<ExitContainerF
>(&ShaderVariableOSG::exitMethod
),
143 reinterpret_cast<InitalInsertDescFunc
>(
144 reinterpret_cast<void *>(&ShaderVariableOSG::classDescInserter
)),
147 "<?xml version=\"1.0\"?>\n"
150 " name=\"ShaderVariableOSG\"\n"
151 " parent=\"ShaderProcVariable\"\n"
152 " library=\"System\"\n"
153 " pointerfieldtypes=\"both\"\n"
154 " structure=\"concrete\"\n"
155 " systemcomponent=\"true\"\n"
156 " parentsystemcomponent=\"true\"\n"
157 " decoratable=\"false\"\n"
158 " useLocalIncludes=\"false\"\n"
159 " docGroupBase=\"GrpSystemShader\"\n"
162 " name=\"osgVarType\"\n"
164 " cardinality=\"single\"\n"
165 " visibility=\"external\"\n"
166 " access=\"protected\"\n"
167 " defaultValue=\"0\"\n"
171 "</FieldContainer>\n",
175 /*------------------------------ get -----------------------------------*/
177 FieldContainerType
&ShaderVariableOSGBase::getType(void)
182 const FieldContainerType
&ShaderVariableOSGBase::getType(void) const
187 UInt32
ShaderVariableOSGBase::getContainerSize(void) const
189 return sizeof(ShaderVariableOSG
);
192 /*------------------------- decorator get ------------------------------*/
195 SFUInt32
*ShaderVariableOSGBase::editSFOsgVarType(void)
197 editSField(OsgVarTypeFieldMask
);
199 return &_sfOsgVarType
;
202 const SFUInt32
*ShaderVariableOSGBase::getSFOsgVarType(void) const
204 return &_sfOsgVarType
;
212 /*------------------------------ access -----------------------------------*/
214 SizeT
ShaderVariableOSGBase::getBinSize(ConstFieldMaskArg whichField
)
216 SizeT returnValue
= Inherited::getBinSize(whichField
);
218 if(FieldBits::NoField
!= (OsgVarTypeFieldMask
& whichField
))
220 returnValue
+= _sfOsgVarType
.getBinSize();
226 void ShaderVariableOSGBase::copyToBin(BinaryDataHandler
&pMem
,
227 ConstFieldMaskArg whichField
)
229 Inherited::copyToBin(pMem
, whichField
);
231 if(FieldBits::NoField
!= (OsgVarTypeFieldMask
& whichField
))
233 _sfOsgVarType
.copyToBin(pMem
);
237 void ShaderVariableOSGBase::copyFromBin(BinaryDataHandler
&pMem
,
238 ConstFieldMaskArg whichField
)
240 Inherited::copyFromBin(pMem
, whichField
);
242 if(FieldBits::NoField
!= (OsgVarTypeFieldMask
& whichField
))
244 editSField(OsgVarTypeFieldMask
);
245 _sfOsgVarType
.copyFromBin(pMem
);
249 //! create a new instance of the class
250 ShaderVariableOSGTransitPtr
ShaderVariableOSGBase::createLocal(BitVector bFlags
)
252 ShaderVariableOSGTransitPtr fc
;
254 if(getClassType().getPrototype() != NULL
)
256 FieldContainerTransitPtr tmpPtr
=
257 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
259 fc
= dynamic_pointer_cast
<ShaderVariableOSG
>(tmpPtr
);
265 //! create a new instance of the class, copy the container flags
266 ShaderVariableOSGTransitPtr
ShaderVariableOSGBase::createDependent(BitVector bFlags
)
268 ShaderVariableOSGTransitPtr fc
;
270 if(getClassType().getPrototype() != NULL
)
272 FieldContainerTransitPtr tmpPtr
=
273 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
275 fc
= dynamic_pointer_cast
<ShaderVariableOSG
>(tmpPtr
);
281 //! create a new instance of the class
282 ShaderVariableOSGTransitPtr
ShaderVariableOSGBase::create(void)
284 ShaderVariableOSGTransitPtr fc
;
286 if(getClassType().getPrototype() != NULL
)
288 FieldContainerTransitPtr tmpPtr
=
289 getClassType().getPrototype()-> shallowCopy();
291 fc
= dynamic_pointer_cast
<ShaderVariableOSG
>(tmpPtr
);
297 ShaderVariableOSG
*ShaderVariableOSGBase::createEmptyLocal(BitVector bFlags
)
299 ShaderVariableOSG
*returnValue
;
301 newPtr
<ShaderVariableOSG
>(returnValue
, bFlags
);
303 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
308 //! create an empty new instance of the class, do not copy the prototype
309 ShaderVariableOSG
*ShaderVariableOSGBase::createEmpty(void)
311 ShaderVariableOSG
*returnValue
;
313 newPtr
<ShaderVariableOSG
>(returnValue
, Thread::getCurrentLocalFlags());
315 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
316 ~Thread::getCurrentLocalFlags();
322 FieldContainerTransitPtr
ShaderVariableOSGBase::shallowCopyLocal(
323 BitVector bFlags
) const
325 ShaderVariableOSG
*tmpPtr
;
327 newPtr(tmpPtr
, dynamic_cast<const ShaderVariableOSG
*>(this), bFlags
);
329 FieldContainerTransitPtr
returnValue(tmpPtr
);
331 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
336 FieldContainerTransitPtr
ShaderVariableOSGBase::shallowCopyDependent(
337 BitVector bFlags
) const
339 ShaderVariableOSG
*tmpPtr
;
341 newPtr(tmpPtr
, dynamic_cast<const ShaderVariableOSG
*>(this), ~bFlags
);
343 FieldContainerTransitPtr
returnValue(tmpPtr
);
345 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
350 FieldContainerTransitPtr
ShaderVariableOSGBase::shallowCopy(void) const
352 ShaderVariableOSG
*tmpPtr
;
355 dynamic_cast<const ShaderVariableOSG
*>(this),
356 Thread::getCurrentLocalFlags());
358 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
360 FieldContainerTransitPtr
returnValue(tmpPtr
);
368 /*------------------------- constructors ----------------------------------*/
370 ShaderVariableOSGBase::ShaderVariableOSGBase(void) :
372 _sfOsgVarType (UInt32(0))
376 ShaderVariableOSGBase::ShaderVariableOSGBase(const ShaderVariableOSGBase
&source
) :
378 _sfOsgVarType (source
._sfOsgVarType
)
383 /*-------------------------- destructors ----------------------------------*/
385 ShaderVariableOSGBase::~ShaderVariableOSGBase(void)
390 GetFieldHandlePtr
ShaderVariableOSGBase::getHandleOsgVarType (void) const
392 SFUInt32::GetHandlePtr
returnValue(
393 new SFUInt32::GetHandle(
395 this->getType().getFieldDesc(OsgVarTypeFieldId
),
396 const_cast<ShaderVariableOSGBase
*>(this)));
401 EditFieldHandlePtr
ShaderVariableOSGBase::editHandleOsgVarType (void)
403 SFUInt32::EditHandlePtr
returnValue(
404 new SFUInt32::EditHandle(
406 this->getType().getFieldDesc(OsgVarTypeFieldId
),
410 editSField(OsgVarTypeFieldMask
);
416 #ifdef OSG_MT_CPTR_ASPECT
417 void ShaderVariableOSGBase::execSyncV( FieldContainer
&oFrom
,
418 ConstFieldMaskArg whichField
,
419 AspectOffsetStore
&oOffsets
,
420 ConstFieldMaskArg syncMode
,
421 const UInt32 uiSyncInfo
)
423 ShaderVariableOSG
*pThis
= static_cast<ShaderVariableOSG
*>(this);
425 pThis
->execSync(static_cast<ShaderVariableOSG
*>(&oFrom
),
434 #ifdef OSG_MT_CPTR_ASPECT
435 FieldContainer
*ShaderVariableOSGBase::createAspectCopy(
436 const FieldContainer
*pRefAspect
) const
438 ShaderVariableOSG
*returnValue
;
440 newAspectCopy(returnValue
,
441 dynamic_cast<const ShaderVariableOSG
*>(pRefAspect
),
442 dynamic_cast<const ShaderVariableOSG
*>(this));
448 void ShaderVariableOSGBase::resolveLinks(void)
450 Inherited::resolveLinks();