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 TextureObjRefChunk!
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"
64 #include "OSGGL.h" // InternalFormat default header
67 #include "OSGTextureObjRefChunkBase.h"
68 #include "OSGTextureObjRefChunk.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
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
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(),
112 OSG_FIELDTRAITS_GETTYPE_NS(TextureObjRefChunk
*, nsOSG
)
114 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
115 TextureObjRefChunk
*,
118 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
119 TextureObjRefChunk
*,
122 /***************************************************************************\
123 * Field Description *
124 \***************************************************************************/
126 void TextureObjRefChunkBase::classDescInserter(TypeObject
&oType
)
128 FieldDescriptionBase
*pDesc
= NULL
;
131 pDesc
= new SFGLenum::Description(
132 SFGLenum::getClassType(),
134 "OpenSG-OpenGL id of texture object.\n",
135 OsgGLIdFieldId
, OsgGLIdFieldMask
,
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(),
146 "Native OpenGL id of texture object.\n",
147 OglGLIdFieldId
, OglGLIdFieldMask
,
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(),
158 "The internal texture format, needed if the texture is bound to an image\n"
160 InternalFormatFieldId
, InternalFormatFieldMask
,
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(),
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
)),
182 "<?xml version=\"1.0\"?>\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"
196 " name=\"osgGLId\"\n"
198 " cardinality=\"single\"\n"
199 " visibility=\"external\"\n"
200 " access=\"public\"\n"
201 " defaultValue=\"0\"\n"
202 " fieldFlags=\"FClusterLocal\"\n"
204 " OpenSG-OpenGL id of texture object.\n"
207 " name=\"oglGLId\"\n"
209 " cardinality=\"single\"\n"
210 " visibility=\"external\"\n"
211 " access=\"public\"\n"
212 " defaultValue=\"0\"\n"
213 " fieldFlags=\"FClusterLocal\"\n"
215 " Native OpenGL id of texture object.\n"
218 " name=\"internalFormat\"\n"
220 " cardinality=\"single\"\n"
221 " visibility=\"external\"\n"
222 " defaultValue=\"GL_NONE\"\n"
223 " defaultHeader=\""OSGGL.h"\"\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"
227 "\tThe internal texture format, needed if the texture is bound to an image\n"
230 "</FieldContainer>\n",
234 /*------------------------------ get -----------------------------------*/
236 FieldContainerType
&TextureObjRefChunkBase::getType(void)
241 const FieldContainerType
&TextureObjRefChunkBase::getType(void) const
246 UInt32
TextureObjRefChunkBase::getContainerSize(void) const
248 return sizeof(TextureObjRefChunk
);
251 /*------------------------- decorator get ------------------------------*/
254 SFGLenum
*TextureObjRefChunkBase::editSFOsgGLId(void)
256 editSField(OsgGLIdFieldMask
);
261 const SFGLenum
*TextureObjRefChunkBase::getSFOsgGLId(void) const
267 SFGLenum
*TextureObjRefChunkBase::editSFOglGLId(void)
269 editSField(OglGLIdFieldMask
);
274 const SFGLenum
*TextureObjRefChunkBase::getSFOglGLId(void) const
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();
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
);
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
);
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
);
408 TextureObjRefChunk
*TextureObjRefChunkBase::createEmptyLocal(BitVector bFlags
)
410 TextureObjRefChunk
*returnValue
;
412 newPtr
<TextureObjRefChunk
>(returnValue
, bFlags
);
414 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
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();
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
;
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
;
461 FieldContainerTransitPtr
TextureObjRefChunkBase::shallowCopy(void) const
463 TextureObjRefChunk
*tmpPtr
;
466 dynamic_cast<const TextureObjRefChunk
*>(this),
467 Thread::getCurrentLocalFlags());
469 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
471 FieldContainerTransitPtr
returnValue(tmpPtr
);
479 /*------------------------- constructors ----------------------------------*/
481 TextureObjRefChunkBase::TextureObjRefChunkBase(void) :
483 _sfOsgGLId (GLenum(0)),
484 _sfOglGLId (GLenum(0)),
485 _sfInternalFormat (GLenum(GL_NONE
))
489 TextureObjRefChunkBase::TextureObjRefChunkBase(const TextureObjRefChunkBase
&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(
510 this->getType().getFieldDesc(OsgGLIdFieldId
),
511 const_cast<TextureObjRefChunkBase
*>(this)));
516 EditFieldHandlePtr
TextureObjRefChunkBase::editHandleOsgGLId (void)
518 SFGLenum::EditHandlePtr
returnValue(
519 new SFGLenum::EditHandle(
521 this->getType().getFieldDesc(OsgGLIdFieldId
),
525 editSField(OsgGLIdFieldMask
);
530 GetFieldHandlePtr
TextureObjRefChunkBase::getHandleOglGLId (void) const
532 SFGLenum::GetHandlePtr
returnValue(
533 new SFGLenum::GetHandle(
535 this->getType().getFieldDesc(OglGLIdFieldId
),
536 const_cast<TextureObjRefChunkBase
*>(this)));
541 EditFieldHandlePtr
TextureObjRefChunkBase::editHandleOglGLId (void)
543 SFGLenum::EditHandlePtr
returnValue(
544 new SFGLenum::EditHandle(
546 this->getType().getFieldDesc(OglGLIdFieldId
),
550 editSField(OglGLIdFieldMask
);
555 GetFieldHandlePtr
TextureObjRefChunkBase::getHandleInternalFormat (void) const
557 SFGLenum::GetHandlePtr
returnValue(
558 new SFGLenum::GetHandle(
560 this->getType().getFieldDesc(InternalFormatFieldId
),
561 const_cast<TextureObjRefChunkBase
*>(this)));
566 EditFieldHandlePtr
TextureObjRefChunkBase::editHandleInternalFormat (void)
568 SFGLenum::EditHandlePtr
returnValue(
569 new SFGLenum::EditHandle(
571 this->getType().getFieldDesc(InternalFormatFieldId
),
575 editSField(InternalFormatFieldMask
);
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
),
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));
613 void TextureObjRefChunkBase::resolveLinks(void)
615 Inherited::resolveLinks();