changed: gcc8 base update
[opensg.git] / Source / System / State / Auxiliary / OSGTextureObjRefChunkBase.cpp
blobaaa986a563210d62ce07d1291b70ed4d0c871c75
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 TextureObjRefChunk!
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"
64 #include "OSGGL.h" // InternalFormat default header
67 #include "OSGTextureObjRefChunkBase.h"
68 #include "OSGTextureObjRefChunk.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::TextureObjRefChunk
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var GLenum TextureObjRefChunkBase::_sfOsgGLId
87 OpenSG-OpenGL id of texture object.
90 /*! \var GLenum TextureObjRefChunkBase::_sfOglGLId
91 Native OpenGL id of texture object.
94 /*! \var GLenum TextureObjRefChunkBase::_sfInternalFormat
95 The internal texture format, needed if the texture is bound to an image
96 unit
100 /***************************************************************************\
101 * FieldType/FieldTrait Instantiation *
102 \***************************************************************************/
104 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
105 PointerType FieldTraits<TextureObjRefChunk *, nsOSG>::_type(
106 "TextureObjRefChunkPtr",
107 "TextureBaseChunkPtr",
108 TextureObjRefChunk::getClassType(),
109 nsOSG);
110 #endif
112 OSG_FIELDTRAITS_GETTYPE_NS(TextureObjRefChunk *, nsOSG)
114 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
115 TextureObjRefChunk *,
116 nsOSG)
118 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
119 TextureObjRefChunk *,
120 nsOSG)
122 /***************************************************************************\
123 * Field Description *
124 \***************************************************************************/
126 void TextureObjRefChunkBase::classDescInserter(TypeObject &oType)
128 FieldDescriptionBase *pDesc = NULL;
131 pDesc = new SFGLenum::Description(
132 SFGLenum::getClassType(),
133 "osgGLId",
134 "OpenSG-OpenGL id of texture object.\n",
135 OsgGLIdFieldId, OsgGLIdFieldMask,
136 false,
137 (Field::FClusterLocal),
138 static_cast<FieldEditMethodSig>(&TextureObjRefChunk::editHandleOsgGLId),
139 static_cast<FieldGetMethodSig >(&TextureObjRefChunk::getHandleOsgGLId));
141 oType.addInitialDesc(pDesc);
143 pDesc = new SFGLenum::Description(
144 SFGLenum::getClassType(),
145 "oglGLId",
146 "Native OpenGL id of texture object.\n",
147 OglGLIdFieldId, OglGLIdFieldMask,
148 false,
149 (Field::FClusterLocal),
150 static_cast<FieldEditMethodSig>(&TextureObjRefChunk::editHandleOglGLId),
151 static_cast<FieldGetMethodSig >(&TextureObjRefChunk::getHandleOglGLId));
153 oType.addInitialDesc(pDesc);
155 pDesc = new SFGLenum::Description(
156 SFGLenum::getClassType(),
157 "internalFormat",
158 "The internal texture format, needed if the texture is bound to an image\n"
159 "unit\n",
160 InternalFormatFieldId, InternalFormatFieldMask,
161 false,
162 (Field::SFDefaultFlags | Field::FStdAccess),
163 static_cast<FieldEditMethodSig>(&TextureObjRefChunk::editHandleInternalFormat),
164 static_cast<FieldGetMethodSig >(&TextureObjRefChunk::getHandleInternalFormat));
166 oType.addInitialDesc(pDesc);
170 TextureObjRefChunkBase::TypeObject TextureObjRefChunkBase::_type(
171 TextureObjRefChunkBase::getClassname(),
172 Inherited::getClassname(),
173 "NULL",
174 nsOSG, //Namespace
175 reinterpret_cast<PrototypeCreateF>(&TextureObjRefChunkBase::createEmptyLocal),
176 reinterpret_cast<InitContainerF>(&TextureObjRefChunk::initMethod),
177 reinterpret_cast<ExitContainerF>(&TextureObjRefChunk::exitMethod),
178 reinterpret_cast<InitalInsertDescFunc>(
179 reinterpret_cast<void *>(&TextureObjRefChunk::classDescInserter)),
180 false,
182 "<?xml version=\"1.0\"?>\n"
183 "\n"
184 "<FieldContainer\n"
185 " name=\"TextureObjRefChunk\"\n"
186 " parent=\"TextureBaseChunk\"\n"
187 " library=\"State\"\n"
188 " pointerfieldtypes=\"both\"\n"
189 " structure=\"concrete\"\n"
190 " systemcomponent=\"true\"\n"
191 " parentsystemcomponent=\"true\"\n"
192 " decoratable=\"false\"\n"
193 " docGroupBase=\"GrpStateAuxiliary\"\n"
194 " >\n"
195 " <Field\n"
196 " name=\"osgGLId\"\n"
197 " type=\"GLenum\"\n"
198 " cardinality=\"single\"\n"
199 " visibility=\"external\"\n"
200 " access=\"public\"\n"
201 " defaultValue=\"0\"\n"
202 " fieldFlags=\"FClusterLocal\"\n"
203 " >\n"
204 " OpenSG-OpenGL id of texture object.\n"
205 " </Field>\n"
206 " <Field\n"
207 " name=\"oglGLId\"\n"
208 " type=\"GLenum\"\n"
209 " cardinality=\"single\"\n"
210 " visibility=\"external\"\n"
211 " access=\"public\"\n"
212 " defaultValue=\"0\"\n"
213 " fieldFlags=\"FClusterLocal\"\n"
214 " >\n"
215 " Native OpenGL id of texture object.\n"
216 " </Field>\n"
217 " <Field\n"
218 " name=\"internalFormat\"\n"
219 " type=\"GLenum\"\n"
220 " cardinality=\"single\"\n"
221 " visibility=\"external\"\n"
222 " defaultValue=\"GL_NONE\"\n"
223 " defaultHeader=\"&quot;OSGGL.h&quot;\"\n"
224 " access=\"public\"\n"
225 " potential_values=\"GL_NONE,GL_ALPHA, GL_DEPTH_COMPONENT, GL_LUMINANCE, GL_LUMINANCE_ALPH, GL_INTENSITY, GL_RGB, GL_RGBA, COMPRESSED_ALPHA, COMPRESSED_LUMINANCE, COMPRESSED_LUMINANCE_ALPHA, COMPRESSED_RGB, COMPRESSED_RGBA\"\n"
226 "\t>\n"
227 "\tThe internal texture format, needed if the texture is bound to an image\n"
228 " unit\n"
229 " </Field>\n"
230 "</FieldContainer>\n",
234 /*------------------------------ get -----------------------------------*/
236 FieldContainerType &TextureObjRefChunkBase::getType(void)
238 return _type;
241 const FieldContainerType &TextureObjRefChunkBase::getType(void) const
243 return _type;
246 UInt32 TextureObjRefChunkBase::getContainerSize(void) const
248 return sizeof(TextureObjRefChunk);
251 /*------------------------- decorator get ------------------------------*/
254 SFGLenum *TextureObjRefChunkBase::editSFOsgGLId(void)
256 editSField(OsgGLIdFieldMask);
258 return &_sfOsgGLId;
261 const SFGLenum *TextureObjRefChunkBase::getSFOsgGLId(void) const
263 return &_sfOsgGLId;
267 SFGLenum *TextureObjRefChunkBase::editSFOglGLId(void)
269 editSField(OglGLIdFieldMask);
271 return &_sfOglGLId;
274 const SFGLenum *TextureObjRefChunkBase::getSFOglGLId(void) const
276 return &_sfOglGLId;
280 SFGLenum *TextureObjRefChunkBase::editSFInternalFormat(void)
282 editSField(InternalFormatFieldMask);
284 return &_sfInternalFormat;
287 const SFGLenum *TextureObjRefChunkBase::getSFInternalFormat(void) const
289 return &_sfInternalFormat;
297 /*------------------------------ access -----------------------------------*/
299 SizeT TextureObjRefChunkBase::getBinSize(ConstFieldMaskArg whichField)
301 SizeT returnValue = Inherited::getBinSize(whichField);
303 if(FieldBits::NoField != (OsgGLIdFieldMask & whichField))
305 returnValue += _sfOsgGLId.getBinSize();
307 if(FieldBits::NoField != (OglGLIdFieldMask & whichField))
309 returnValue += _sfOglGLId.getBinSize();
311 if(FieldBits::NoField != (InternalFormatFieldMask & whichField))
313 returnValue += _sfInternalFormat.getBinSize();
316 return returnValue;
319 void TextureObjRefChunkBase::copyToBin(BinaryDataHandler &pMem,
320 ConstFieldMaskArg whichField)
322 Inherited::copyToBin(pMem, whichField);
324 if(FieldBits::NoField != (OsgGLIdFieldMask & whichField))
326 _sfOsgGLId.copyToBin(pMem);
328 if(FieldBits::NoField != (OglGLIdFieldMask & whichField))
330 _sfOglGLId.copyToBin(pMem);
332 if(FieldBits::NoField != (InternalFormatFieldMask & whichField))
334 _sfInternalFormat.copyToBin(pMem);
338 void TextureObjRefChunkBase::copyFromBin(BinaryDataHandler &pMem,
339 ConstFieldMaskArg whichField)
341 Inherited::copyFromBin(pMem, whichField);
343 if(FieldBits::NoField != (OsgGLIdFieldMask & whichField))
345 editSField(OsgGLIdFieldMask);
346 _sfOsgGLId.copyFromBin(pMem);
348 if(FieldBits::NoField != (OglGLIdFieldMask & whichField))
350 editSField(OglGLIdFieldMask);
351 _sfOglGLId.copyFromBin(pMem);
353 if(FieldBits::NoField != (InternalFormatFieldMask & whichField))
355 editSField(InternalFormatFieldMask);
356 _sfInternalFormat.copyFromBin(pMem);
360 //! create a new instance of the class
361 TextureObjRefChunkTransitPtr TextureObjRefChunkBase::createLocal(BitVector bFlags)
363 TextureObjRefChunkTransitPtr fc;
365 if(getClassType().getPrototype() != NULL)
367 FieldContainerTransitPtr tmpPtr =
368 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
370 fc = dynamic_pointer_cast<TextureObjRefChunk>(tmpPtr);
373 return fc;
376 //! create a new instance of the class, copy the container flags
377 TextureObjRefChunkTransitPtr TextureObjRefChunkBase::createDependent(BitVector bFlags)
379 TextureObjRefChunkTransitPtr fc;
381 if(getClassType().getPrototype() != NULL)
383 FieldContainerTransitPtr tmpPtr =
384 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
386 fc = dynamic_pointer_cast<TextureObjRefChunk>(tmpPtr);
389 return fc;
392 //! create a new instance of the class
393 TextureObjRefChunkTransitPtr TextureObjRefChunkBase::create(void)
395 TextureObjRefChunkTransitPtr fc;
397 if(getClassType().getPrototype() != NULL)
399 FieldContainerTransitPtr tmpPtr =
400 getClassType().getPrototype()-> shallowCopy();
402 fc = dynamic_pointer_cast<TextureObjRefChunk>(tmpPtr);
405 return fc;
408 TextureObjRefChunk *TextureObjRefChunkBase::createEmptyLocal(BitVector bFlags)
410 TextureObjRefChunk *returnValue;
412 newPtr<TextureObjRefChunk>(returnValue, bFlags);
414 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
416 return returnValue;
419 //! create an empty new instance of the class, do not copy the prototype
420 TextureObjRefChunk *TextureObjRefChunkBase::createEmpty(void)
422 TextureObjRefChunk *returnValue;
424 newPtr<TextureObjRefChunk>(returnValue, Thread::getCurrentLocalFlags());
426 returnValue->_pFieldFlags->_bNamespaceMask &=
427 ~Thread::getCurrentLocalFlags();
429 return returnValue;
433 FieldContainerTransitPtr TextureObjRefChunkBase::shallowCopyLocal(
434 BitVector bFlags) const
436 TextureObjRefChunk *tmpPtr;
438 newPtr(tmpPtr, dynamic_cast<const TextureObjRefChunk *>(this), bFlags);
440 FieldContainerTransitPtr returnValue(tmpPtr);
442 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
444 return returnValue;
447 FieldContainerTransitPtr TextureObjRefChunkBase::shallowCopyDependent(
448 BitVector bFlags) const
450 TextureObjRefChunk *tmpPtr;
452 newPtr(tmpPtr, dynamic_cast<const TextureObjRefChunk *>(this), ~bFlags);
454 FieldContainerTransitPtr returnValue(tmpPtr);
456 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
458 return returnValue;
461 FieldContainerTransitPtr TextureObjRefChunkBase::shallowCopy(void) const
463 TextureObjRefChunk *tmpPtr;
465 newPtr(tmpPtr,
466 dynamic_cast<const TextureObjRefChunk *>(this),
467 Thread::getCurrentLocalFlags());
469 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
471 FieldContainerTransitPtr returnValue(tmpPtr);
473 return returnValue;
479 /*------------------------- constructors ----------------------------------*/
481 TextureObjRefChunkBase::TextureObjRefChunkBase(void) :
482 Inherited(),
483 _sfOsgGLId (GLenum(0)),
484 _sfOglGLId (GLenum(0)),
485 _sfInternalFormat (GLenum(GL_NONE))
489 TextureObjRefChunkBase::TextureObjRefChunkBase(const TextureObjRefChunkBase &source) :
490 Inherited(source),
491 _sfOsgGLId (source._sfOsgGLId ),
492 _sfOglGLId (source._sfOglGLId ),
493 _sfInternalFormat (source._sfInternalFormat )
498 /*-------------------------- destructors ----------------------------------*/
500 TextureObjRefChunkBase::~TextureObjRefChunkBase(void)
505 GetFieldHandlePtr TextureObjRefChunkBase::getHandleOsgGLId (void) const
507 SFGLenum::GetHandlePtr returnValue(
508 new SFGLenum::GetHandle(
509 &_sfOsgGLId,
510 this->getType().getFieldDesc(OsgGLIdFieldId),
511 const_cast<TextureObjRefChunkBase *>(this)));
513 return returnValue;
516 EditFieldHandlePtr TextureObjRefChunkBase::editHandleOsgGLId (void)
518 SFGLenum::EditHandlePtr returnValue(
519 new SFGLenum::EditHandle(
520 &_sfOsgGLId,
521 this->getType().getFieldDesc(OsgGLIdFieldId),
522 this));
525 editSField(OsgGLIdFieldMask);
527 return returnValue;
530 GetFieldHandlePtr TextureObjRefChunkBase::getHandleOglGLId (void) const
532 SFGLenum::GetHandlePtr returnValue(
533 new SFGLenum::GetHandle(
534 &_sfOglGLId,
535 this->getType().getFieldDesc(OglGLIdFieldId),
536 const_cast<TextureObjRefChunkBase *>(this)));
538 return returnValue;
541 EditFieldHandlePtr TextureObjRefChunkBase::editHandleOglGLId (void)
543 SFGLenum::EditHandlePtr returnValue(
544 new SFGLenum::EditHandle(
545 &_sfOglGLId,
546 this->getType().getFieldDesc(OglGLIdFieldId),
547 this));
550 editSField(OglGLIdFieldMask);
552 return returnValue;
555 GetFieldHandlePtr TextureObjRefChunkBase::getHandleInternalFormat (void) const
557 SFGLenum::GetHandlePtr returnValue(
558 new SFGLenum::GetHandle(
559 &_sfInternalFormat,
560 this->getType().getFieldDesc(InternalFormatFieldId),
561 const_cast<TextureObjRefChunkBase *>(this)));
563 return returnValue;
566 EditFieldHandlePtr TextureObjRefChunkBase::editHandleInternalFormat (void)
568 SFGLenum::EditHandlePtr returnValue(
569 new SFGLenum::EditHandle(
570 &_sfInternalFormat,
571 this->getType().getFieldDesc(InternalFormatFieldId),
572 this));
575 editSField(InternalFormatFieldMask);
577 return returnValue;
581 #ifdef OSG_MT_CPTR_ASPECT
582 void TextureObjRefChunkBase::execSyncV( FieldContainer &oFrom,
583 ConstFieldMaskArg whichField,
584 AspectOffsetStore &oOffsets,
585 ConstFieldMaskArg syncMode,
586 const UInt32 uiSyncInfo)
588 TextureObjRefChunk *pThis = static_cast<TextureObjRefChunk *>(this);
590 pThis->execSync(static_cast<TextureObjRefChunk *>(&oFrom),
591 whichField,
592 oOffsets,
593 syncMode,
594 uiSyncInfo);
596 #endif
599 #ifdef OSG_MT_CPTR_ASPECT
600 FieldContainer *TextureObjRefChunkBase::createAspectCopy(
601 const FieldContainer *pRefAspect) const
603 TextureObjRefChunk *returnValue;
605 newAspectCopy(returnValue,
606 dynamic_cast<const TextureObjRefChunk *>(pRefAspect),
607 dynamic_cast<const TextureObjRefChunk *>(this));
609 return returnValue;
611 #endif
613 void TextureObjRefChunkBase::resolveLinks(void)
615 Inherited::resolveLinks();
621 OSG_END_NAMESPACE