changed: gcc8 base update
[opensg.git] / Source / System / State / OpenGL / OSGTextureTransformChunkBase.cpp
blob4596864e1836dddebc2b2b55cf755779bd7fa1b2
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 TextureTransformChunk!
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 "OSGTextureTransformChunkBase.h"
67 #include "OSGTextureTransformChunk.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::TextureTransformChunk
78 See \ref PageSystemTextureTransformChunk for a description.
80 This chunk wraps glLoadMatrix() for the GL_TEXTURE matrix mode. It is derived
81 from the OSG::TransformChunk and uses its matrix.
84 /***************************************************************************\
85 * Field Documentation *
86 \***************************************************************************/
88 /*! \var bool TextureTransformChunkBase::_sfUseCameraBeacon
89 If enabled it uses the camera beacon matrix (for cube textures)
93 /***************************************************************************\
94 * FieldType/FieldTrait Instantiation *
95 \***************************************************************************/
97 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
98 PointerType FieldTraits<TextureTransformChunk *, nsOSG>::_type(
99 "TextureTransformChunkPtr",
100 "TransformChunkPtr",
101 TextureTransformChunk::getClassType(),
102 nsOSG);
103 #endif
105 OSG_FIELDTRAITS_GETTYPE_NS(TextureTransformChunk *, nsOSG)
107 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
108 TextureTransformChunk *,
109 nsOSG)
111 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
112 TextureTransformChunk *,
113 nsOSG)
115 /***************************************************************************\
116 * Field Description *
117 \***************************************************************************/
119 void TextureTransformChunkBase::classDescInserter(TypeObject &oType)
121 FieldDescriptionBase *pDesc = NULL;
124 pDesc = new SFBool::Description(
125 SFBool::getClassType(),
126 "useCameraBeacon",
127 "If enabled it uses the camera beacon matrix (for cube textures)\n",
128 UseCameraBeaconFieldId, UseCameraBeaconFieldMask,
129 false,
130 (Field::SFDefaultFlags | Field::FStdAccess),
131 static_cast<FieldEditMethodSig>(&TextureTransformChunk::editHandleUseCameraBeacon),
132 static_cast<FieldGetMethodSig >(&TextureTransformChunk::getHandleUseCameraBeacon));
134 oType.addInitialDesc(pDesc);
138 TextureTransformChunkBase::TypeObject TextureTransformChunkBase::_type(
139 TextureTransformChunkBase::getClassname(),
140 Inherited::getClassname(),
141 "NULL",
142 nsOSG, //Namespace
143 reinterpret_cast<PrototypeCreateF>(&TextureTransformChunkBase::createEmptyLocal),
144 reinterpret_cast<InitContainerF>(&TextureTransformChunk::initMethod),
145 reinterpret_cast<ExitContainerF>(&TextureTransformChunk::exitMethod),
146 reinterpret_cast<InitalInsertDescFunc>(
147 reinterpret_cast<void *>(&TextureTransformChunk::classDescInserter)),
148 false,
150 "<?xml version=\"1.0\"?>\n"
151 "\n"
152 "<FieldContainer\n"
153 " name=\"TextureTransformChunk\"\n"
154 " parent=\"TransformChunk\"\n"
155 " library=\"State\"\n"
156 " pointerfieldtypes=\"both\"\n"
157 " structure=\"concrete\"\n"
158 " systemcomponent=\"true\"\n"
159 " parentsystemcomponent=\"true\"\n"
160 " decoratable=\"false\"\n"
161 " useLocalIncludes=\"false\"\n"
162 " docGroupBase=\"GrpStateOpenGL\"\n"
163 " >\n"
164 " See \\ref PageSystemTextureTransformChunk for a description.\n"
165 "\n"
166 " This chunk wraps glLoadMatrix() for the GL_TEXTURE matrix mode. It is derived\n"
167 " from the OSG::TransformChunk and uses its matrix.\n"
168 " <Field\n"
169 "\t name=\"useCameraBeacon\"\n"
170 "\t type=\"bool\"\n"
171 "\t cardinality=\"single\"\n"
172 "\t visibility=\"external\"\n"
173 "\t defaultValue=\"false\"\n"
174 "\t access=\"public\"\n"
175 "\t >\n"
176 "\tIf enabled it uses the camera beacon matrix (for cube textures)\n"
177 " </Field>\n"
178 "</FieldContainer>\n",
179 "See \\ref PageSystemTextureTransformChunk for a description.\n"
180 "\n"
181 "This chunk wraps glLoadMatrix() for the GL_TEXTURE matrix mode. It is derived\n"
182 "from the OSG::TransformChunk and uses its matrix.\n"
185 /*------------------------------ get -----------------------------------*/
187 FieldContainerType &TextureTransformChunkBase::getType(void)
189 return _type;
192 const FieldContainerType &TextureTransformChunkBase::getType(void) const
194 return _type;
197 UInt32 TextureTransformChunkBase::getContainerSize(void) const
199 return sizeof(TextureTransformChunk);
202 /*------------------------- decorator get ------------------------------*/
205 SFBool *TextureTransformChunkBase::editSFUseCameraBeacon(void)
207 editSField(UseCameraBeaconFieldMask);
209 return &_sfUseCameraBeacon;
212 const SFBool *TextureTransformChunkBase::getSFUseCameraBeacon(void) const
214 return &_sfUseCameraBeacon;
222 /*------------------------------ access -----------------------------------*/
224 SizeT TextureTransformChunkBase::getBinSize(ConstFieldMaskArg whichField)
226 SizeT returnValue = Inherited::getBinSize(whichField);
228 if(FieldBits::NoField != (UseCameraBeaconFieldMask & whichField))
230 returnValue += _sfUseCameraBeacon.getBinSize();
233 return returnValue;
236 void TextureTransformChunkBase::copyToBin(BinaryDataHandler &pMem,
237 ConstFieldMaskArg whichField)
239 Inherited::copyToBin(pMem, whichField);
241 if(FieldBits::NoField != (UseCameraBeaconFieldMask & whichField))
243 _sfUseCameraBeacon.copyToBin(pMem);
247 void TextureTransformChunkBase::copyFromBin(BinaryDataHandler &pMem,
248 ConstFieldMaskArg whichField)
250 Inherited::copyFromBin(pMem, whichField);
252 if(FieldBits::NoField != (UseCameraBeaconFieldMask & whichField))
254 editSField(UseCameraBeaconFieldMask);
255 _sfUseCameraBeacon.copyFromBin(pMem);
259 //! create a new instance of the class
260 TextureTransformChunkTransitPtr TextureTransformChunkBase::createLocal(BitVector bFlags)
262 TextureTransformChunkTransitPtr fc;
264 if(getClassType().getPrototype() != NULL)
266 FieldContainerTransitPtr tmpPtr =
267 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
269 fc = dynamic_pointer_cast<TextureTransformChunk>(tmpPtr);
272 return fc;
275 //! create a new instance of the class, copy the container flags
276 TextureTransformChunkTransitPtr TextureTransformChunkBase::createDependent(BitVector bFlags)
278 TextureTransformChunkTransitPtr fc;
280 if(getClassType().getPrototype() != NULL)
282 FieldContainerTransitPtr tmpPtr =
283 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
285 fc = dynamic_pointer_cast<TextureTransformChunk>(tmpPtr);
288 return fc;
291 //! create a new instance of the class
292 TextureTransformChunkTransitPtr TextureTransformChunkBase::create(void)
294 TextureTransformChunkTransitPtr fc;
296 if(getClassType().getPrototype() != NULL)
298 FieldContainerTransitPtr tmpPtr =
299 getClassType().getPrototype()-> shallowCopy();
301 fc = dynamic_pointer_cast<TextureTransformChunk>(tmpPtr);
304 return fc;
307 TextureTransformChunk *TextureTransformChunkBase::createEmptyLocal(BitVector bFlags)
309 TextureTransformChunk *returnValue;
311 newPtr<TextureTransformChunk>(returnValue, bFlags);
313 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
315 return returnValue;
318 //! create an empty new instance of the class, do not copy the prototype
319 TextureTransformChunk *TextureTransformChunkBase::createEmpty(void)
321 TextureTransformChunk *returnValue;
323 newPtr<TextureTransformChunk>(returnValue, Thread::getCurrentLocalFlags());
325 returnValue->_pFieldFlags->_bNamespaceMask &=
326 ~Thread::getCurrentLocalFlags();
328 return returnValue;
332 FieldContainerTransitPtr TextureTransformChunkBase::shallowCopyLocal(
333 BitVector bFlags) const
335 TextureTransformChunk *tmpPtr;
337 newPtr(tmpPtr, dynamic_cast<const TextureTransformChunk *>(this), bFlags);
339 FieldContainerTransitPtr returnValue(tmpPtr);
341 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
343 return returnValue;
346 FieldContainerTransitPtr TextureTransformChunkBase::shallowCopyDependent(
347 BitVector bFlags) const
349 TextureTransformChunk *tmpPtr;
351 newPtr(tmpPtr, dynamic_cast<const TextureTransformChunk *>(this), ~bFlags);
353 FieldContainerTransitPtr returnValue(tmpPtr);
355 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
357 return returnValue;
360 FieldContainerTransitPtr TextureTransformChunkBase::shallowCopy(void) const
362 TextureTransformChunk *tmpPtr;
364 newPtr(tmpPtr,
365 dynamic_cast<const TextureTransformChunk *>(this),
366 Thread::getCurrentLocalFlags());
368 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
370 FieldContainerTransitPtr returnValue(tmpPtr);
372 return returnValue;
378 /*------------------------- constructors ----------------------------------*/
380 TextureTransformChunkBase::TextureTransformChunkBase(void) :
381 Inherited(),
382 _sfUseCameraBeacon (bool(false))
386 TextureTransformChunkBase::TextureTransformChunkBase(const TextureTransformChunkBase &source) :
387 Inherited(source),
388 _sfUseCameraBeacon (source._sfUseCameraBeacon )
393 /*-------------------------- destructors ----------------------------------*/
395 TextureTransformChunkBase::~TextureTransformChunkBase(void)
400 GetFieldHandlePtr TextureTransformChunkBase::getHandleUseCameraBeacon (void) const
402 SFBool::GetHandlePtr returnValue(
403 new SFBool::GetHandle(
404 &_sfUseCameraBeacon,
405 this->getType().getFieldDesc(UseCameraBeaconFieldId),
406 const_cast<TextureTransformChunkBase *>(this)));
408 return returnValue;
411 EditFieldHandlePtr TextureTransformChunkBase::editHandleUseCameraBeacon(void)
413 SFBool::EditHandlePtr returnValue(
414 new SFBool::EditHandle(
415 &_sfUseCameraBeacon,
416 this->getType().getFieldDesc(UseCameraBeaconFieldId),
417 this));
420 editSField(UseCameraBeaconFieldMask);
422 return returnValue;
426 #ifdef OSG_MT_CPTR_ASPECT
427 void TextureTransformChunkBase::execSyncV( FieldContainer &oFrom,
428 ConstFieldMaskArg whichField,
429 AspectOffsetStore &oOffsets,
430 ConstFieldMaskArg syncMode,
431 const UInt32 uiSyncInfo)
433 TextureTransformChunk *pThis = static_cast<TextureTransformChunk *>(this);
435 pThis->execSync(static_cast<TextureTransformChunk *>(&oFrom),
436 whichField,
437 oOffsets,
438 syncMode,
439 uiSyncInfo);
441 #endif
444 #ifdef OSG_MT_CPTR_ASPECT
445 FieldContainer *TextureTransformChunkBase::createAspectCopy(
446 const FieldContainer *pRefAspect) const
448 TextureTransformChunk *returnValue;
450 newAspectCopy(returnValue,
451 dynamic_cast<const TextureTransformChunk *>(pRefAspect),
452 dynamic_cast<const TextureTransformChunk *>(this));
454 return returnValue;
456 #endif
458 void TextureTransformChunkBase::resolveLinks(void)
460 Inherited::resolveLinks();
466 OSG_END_NAMESPACE