changed: gcc8 base update
[opensg.git] / Source / Contrib / CgFXMaterial / OSGCgFXVariableTexObjBase.cpp
blob02d4b29fdfd1785f5f215178e6e13fb035972b59
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 CgFXVariableTexObj!
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"
66 #include "OSGCgFXVariableTexObjBase.h"
67 #include "OSGCgFXVariableTexObj.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::CgFXVariableTexObj
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var Int32 CgFXVariableTexObjBase::_sfValue
86 parameter value
89 /*! \var std::string CgFXVariableTexObjBase::_sfFilePath
90 filepath of this texture
94 /***************************************************************************\
95 * FieldType/FieldTrait Instantiation *
96 \***************************************************************************/
98 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
99 PointerType FieldTraits<CgFXVariableTexObj *, nsOSG>::_type(
100 "CgFXVariableTexObjPtr",
101 "ShaderValueVariablePtr",
102 CgFXVariableTexObj::getClassType(),
103 nsOSG);
104 #endif
106 OSG_FIELDTRAITS_GETTYPE_NS(CgFXVariableTexObj *, nsOSG)
108 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
109 CgFXVariableTexObj *,
110 nsOSG)
112 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
113 CgFXVariableTexObj *,
114 nsOSG)
116 /***************************************************************************\
117 * Field Description *
118 \***************************************************************************/
120 void CgFXVariableTexObjBase::classDescInserter(TypeObject &oType)
122 FieldDescriptionBase *pDesc = NULL;
125 pDesc = new SFInt32::Description(
126 SFInt32::getClassType(),
127 "value",
128 "parameter value\n",
129 ValueFieldId, ValueFieldMask,
130 true,
131 (Field::SFDefaultFlags | Field::FStdAccess),
132 static_cast<FieldEditMethodSig>(&CgFXVariableTexObj::editHandleValue),
133 static_cast<FieldGetMethodSig >(&CgFXVariableTexObj::getHandleValue));
135 oType.addInitialDesc(pDesc);
137 pDesc = new SFString::Description(
138 SFString::getClassType(),
139 "filePath",
140 "filepath of this texture\n",
141 FilePathFieldId, FilePathFieldMask,
142 false,
143 (Field::SFDefaultFlags | Field::FStdAccess),
144 static_cast<FieldEditMethodSig>(&CgFXVariableTexObj::editHandleFilePath),
145 static_cast<FieldGetMethodSig >(&CgFXVariableTexObj::getHandleFilePath));
147 oType.addInitialDesc(pDesc);
151 CgFXVariableTexObjBase::TypeObject CgFXVariableTexObjBase::_type(
152 CgFXVariableTexObjBase::getClassname(),
153 Inherited::getClassname(),
154 "NULL",
155 nsOSG, //Namespace
156 reinterpret_cast<PrototypeCreateF>(&CgFXVariableTexObjBase::createEmptyLocal),
157 reinterpret_cast<InitContainerF>(&CgFXVariableTexObj::initMethod),
158 reinterpret_cast<ExitContainerF>(&CgFXVariableTexObj::exitMethod),
159 reinterpret_cast<InitalInsertDescFunc>(
160 reinterpret_cast<void *>(&CgFXVariableTexObj::classDescInserter)),
161 false,
163 "<?xml version=\"1.0\"?>\n"
164 "\n"
165 "<FieldContainer\n"
166 " name=\"CgFXVariableTexObj\"\n"
167 " parent=\"ShaderValueVariable\"\n"
168 " library=\"ContribCgFX\"\n"
169 " pointerfieldtypes=\"both\"\n"
170 " structure=\"concrete\"\n"
171 " systemcomponent=\"true\"\n"
172 " parentsystemcomponent=\"true\"\n"
173 " decoratable=\"false\"\n"
174 " useLocalIncludes=\"false\"\n"
175 " docGroupBase=\"GrpSystemShader\"\n"
176 " >\n"
177 " <Field\n"
178 " name=\"value\"\n"
179 " type=\"Int32\"\n"
180 " cardinality=\"single\"\n"
181 " visibility=\"internal\"\n"
182 " access=\"public\"\n"
183 " defaultValue=\"-1\"\n"
184 " >\n"
185 " parameter value\n"
186 " </Field>\n"
187 " <Field\n"
188 " name=\"filePath\"\n"
189 " type=\"std::string\"\n"
190 " cardinality=\"single\"\n"
191 " visibility=\"external\"\n"
192 " access=\"public\"\n"
193 " >\n"
194 " filepath of this texture\n"
195 " </Field>\n"
196 "</FieldContainer>\n",
200 /*------------------------------ get -----------------------------------*/
202 FieldContainerType &CgFXVariableTexObjBase::getType(void)
204 return _type;
207 const FieldContainerType &CgFXVariableTexObjBase::getType(void) const
209 return _type;
212 UInt32 CgFXVariableTexObjBase::getContainerSize(void) const
214 return sizeof(CgFXVariableTexObj);
217 /*------------------------- decorator get ------------------------------*/
220 SFInt32 *CgFXVariableTexObjBase::editSFValue(void)
222 editSField(ValueFieldMask);
224 return &_sfValue;
227 const SFInt32 *CgFXVariableTexObjBase::getSFValue(void) const
229 return &_sfValue;
233 SFString *CgFXVariableTexObjBase::editSFFilePath(void)
235 editSField(FilePathFieldMask);
237 return &_sfFilePath;
240 const SFString *CgFXVariableTexObjBase::getSFFilePath(void) const
242 return &_sfFilePath;
250 /*------------------------------ access -----------------------------------*/
252 SizeT CgFXVariableTexObjBase::getBinSize(ConstFieldMaskArg whichField)
254 SizeT returnValue = Inherited::getBinSize(whichField);
256 if(FieldBits::NoField != (ValueFieldMask & whichField))
258 returnValue += _sfValue.getBinSize();
260 if(FieldBits::NoField != (FilePathFieldMask & whichField))
262 returnValue += _sfFilePath.getBinSize();
265 return returnValue;
268 void CgFXVariableTexObjBase::copyToBin(BinaryDataHandler &pMem,
269 ConstFieldMaskArg whichField)
271 Inherited::copyToBin(pMem, whichField);
273 if(FieldBits::NoField != (ValueFieldMask & whichField))
275 _sfValue.copyToBin(pMem);
277 if(FieldBits::NoField != (FilePathFieldMask & whichField))
279 _sfFilePath.copyToBin(pMem);
283 void CgFXVariableTexObjBase::copyFromBin(BinaryDataHandler &pMem,
284 ConstFieldMaskArg whichField)
286 Inherited::copyFromBin(pMem, whichField);
288 if(FieldBits::NoField != (ValueFieldMask & whichField))
290 editSField(ValueFieldMask);
291 _sfValue.copyFromBin(pMem);
293 if(FieldBits::NoField != (FilePathFieldMask & whichField))
295 editSField(FilePathFieldMask);
296 _sfFilePath.copyFromBin(pMem);
300 //! create a new instance of the class
301 CgFXVariableTexObjTransitPtr CgFXVariableTexObjBase::createLocal(BitVector bFlags)
303 CgFXVariableTexObjTransitPtr fc;
305 if(getClassType().getPrototype() != NULL)
307 FieldContainerTransitPtr tmpPtr =
308 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
310 fc = dynamic_pointer_cast<CgFXVariableTexObj>(tmpPtr);
313 return fc;
316 //! create a new instance of the class, copy the container flags
317 CgFXVariableTexObjTransitPtr CgFXVariableTexObjBase::createDependent(BitVector bFlags)
319 CgFXVariableTexObjTransitPtr fc;
321 if(getClassType().getPrototype() != NULL)
323 FieldContainerTransitPtr tmpPtr =
324 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
326 fc = dynamic_pointer_cast<CgFXVariableTexObj>(tmpPtr);
329 return fc;
332 //! create a new instance of the class
333 CgFXVariableTexObjTransitPtr CgFXVariableTexObjBase::create(void)
335 CgFXVariableTexObjTransitPtr fc;
337 if(getClassType().getPrototype() != NULL)
339 FieldContainerTransitPtr tmpPtr =
340 getClassType().getPrototype()-> shallowCopy();
342 fc = dynamic_pointer_cast<CgFXVariableTexObj>(tmpPtr);
345 return fc;
348 CgFXVariableTexObj *CgFXVariableTexObjBase::createEmptyLocal(BitVector bFlags)
350 CgFXVariableTexObj *returnValue;
352 newPtr<CgFXVariableTexObj>(returnValue, bFlags);
354 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
356 return returnValue;
359 //! create an empty new instance of the class, do not copy the prototype
360 CgFXVariableTexObj *CgFXVariableTexObjBase::createEmpty(void)
362 CgFXVariableTexObj *returnValue;
364 newPtr<CgFXVariableTexObj>(returnValue, Thread::getCurrentLocalFlags());
366 returnValue->_pFieldFlags->_bNamespaceMask &=
367 ~Thread::getCurrentLocalFlags();
369 return returnValue;
373 FieldContainerTransitPtr CgFXVariableTexObjBase::shallowCopyLocal(
374 BitVector bFlags) const
376 CgFXVariableTexObj *tmpPtr;
378 newPtr(tmpPtr, dynamic_cast<const CgFXVariableTexObj *>(this), bFlags);
380 FieldContainerTransitPtr returnValue(tmpPtr);
382 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
384 return returnValue;
387 FieldContainerTransitPtr CgFXVariableTexObjBase::shallowCopyDependent(
388 BitVector bFlags) const
390 CgFXVariableTexObj *tmpPtr;
392 newPtr(tmpPtr, dynamic_cast<const CgFXVariableTexObj *>(this), ~bFlags);
394 FieldContainerTransitPtr returnValue(tmpPtr);
396 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
398 return returnValue;
401 FieldContainerTransitPtr CgFXVariableTexObjBase::shallowCopy(void) const
403 CgFXVariableTexObj *tmpPtr;
405 newPtr(tmpPtr,
406 dynamic_cast<const CgFXVariableTexObj *>(this),
407 Thread::getCurrentLocalFlags());
409 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
411 FieldContainerTransitPtr returnValue(tmpPtr);
413 return returnValue;
419 /*------------------------- constructors ----------------------------------*/
421 CgFXVariableTexObjBase::CgFXVariableTexObjBase(void) :
422 Inherited(),
423 _sfValue (Int32(-1)),
424 _sfFilePath ()
428 CgFXVariableTexObjBase::CgFXVariableTexObjBase(const CgFXVariableTexObjBase &source) :
429 Inherited(source),
430 _sfValue (source._sfValue ),
431 _sfFilePath (source._sfFilePath )
436 /*-------------------------- destructors ----------------------------------*/
438 CgFXVariableTexObjBase::~CgFXVariableTexObjBase(void)
443 GetFieldHandlePtr CgFXVariableTexObjBase::getHandleValue (void) const
445 SFInt32::GetHandlePtr returnValue(
446 new SFInt32::GetHandle(
447 &_sfValue,
448 this->getType().getFieldDesc(ValueFieldId),
449 const_cast<CgFXVariableTexObjBase *>(this)));
451 return returnValue;
454 EditFieldHandlePtr CgFXVariableTexObjBase::editHandleValue (void)
456 SFInt32::EditHandlePtr returnValue(
457 new SFInt32::EditHandle(
458 &_sfValue,
459 this->getType().getFieldDesc(ValueFieldId),
460 this));
463 editSField(ValueFieldMask);
465 return returnValue;
468 GetFieldHandlePtr CgFXVariableTexObjBase::getHandleFilePath (void) const
470 SFString::GetHandlePtr returnValue(
471 new SFString::GetHandle(
472 &_sfFilePath,
473 this->getType().getFieldDesc(FilePathFieldId),
474 const_cast<CgFXVariableTexObjBase *>(this)));
476 return returnValue;
479 EditFieldHandlePtr CgFXVariableTexObjBase::editHandleFilePath (void)
481 SFString::EditHandlePtr returnValue(
482 new SFString::EditHandle(
483 &_sfFilePath,
484 this->getType().getFieldDesc(FilePathFieldId),
485 this));
488 editSField(FilePathFieldMask);
490 return returnValue;
494 #ifdef OSG_MT_CPTR_ASPECT
495 void CgFXVariableTexObjBase::execSyncV( FieldContainer &oFrom,
496 ConstFieldMaskArg whichField,
497 AspectOffsetStore &oOffsets,
498 ConstFieldMaskArg syncMode,
499 const UInt32 uiSyncInfo)
501 CgFXVariableTexObj *pThis = static_cast<CgFXVariableTexObj *>(this);
503 pThis->execSync(static_cast<CgFXVariableTexObj *>(&oFrom),
504 whichField,
505 oOffsets,
506 syncMode,
507 uiSyncInfo);
509 #endif
512 #ifdef OSG_MT_CPTR_ASPECT
513 FieldContainer *CgFXVariableTexObjBase::createAspectCopy(
514 const FieldContainer *pRefAspect) const
516 CgFXVariableTexObj *returnValue;
518 newAspectCopy(returnValue,
519 dynamic_cast<const CgFXVariableTexObj *>(pRefAspect),
520 dynamic_cast<const CgFXVariableTexObj *>(this));
522 return returnValue;
524 #endif
526 void CgFXVariableTexObjBase::resolveLinks(void)
528 Inherited::resolveLinks();
534 OSG_END_NAMESPACE