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 \*****************************************************************************/
56 #include "OSGConfig.h"
59 #include "OSGGL.h" // InternalFormat default header
62 #include "OSGTextureObjRefChunkBase.h"
63 #include "OSGTextureObjRefChunk.h"
65 #include <boost/bind.hpp>
67 #ifdef WIN32 // turn off 'this' : used in base member initializer list warning
68 #pragma warning(disable:4355)
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::TextureObjRefChunk
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var GLenum TextureObjRefChunkBase::_sfOsgGLId
86 OpenSG-OpenGL id of texture object.
89 /*! \var GLenum TextureObjRefChunkBase::_sfOglGLId
90 Native OpenGL id of texture object.
93 /*! \var GLenum TextureObjRefChunkBase::_sfInternalFormat
94 The internal texture format, needed if the texture is bound to an image
99 /***************************************************************************\
100 * FieldType/FieldTrait Instantiation *
101 \***************************************************************************/
103 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
104 PointerType FieldTraits
<TextureObjRefChunk
*, nsOSG
>::_type(
105 "TextureObjRefChunkPtr",
106 "TextureBaseChunkPtr",
107 TextureObjRefChunk::getClassType(),
111 OSG_FIELDTRAITS_GETTYPE_NS(TextureObjRefChunk
*, nsOSG
)
113 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
114 TextureObjRefChunk
*,
117 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
118 TextureObjRefChunk
*,
121 /***************************************************************************\
122 * Field Description *
123 \***************************************************************************/
125 void TextureObjRefChunkBase::classDescInserter(TypeObject
&oType
)
127 FieldDescriptionBase
*pDesc
= NULL
;
130 pDesc
= new SFGLenum::Description(
131 SFGLenum::getClassType(),
133 "OpenSG-OpenGL id of texture object.\n",
134 OsgGLIdFieldId
, OsgGLIdFieldMask
,
136 (Field::FClusterLocal
),
137 static_cast<FieldEditMethodSig
>(&TextureObjRefChunk::editHandleOsgGLId
),
138 static_cast<FieldGetMethodSig
>(&TextureObjRefChunk::getHandleOsgGLId
));
140 oType
.addInitialDesc(pDesc
);
142 pDesc
= new SFGLenum::Description(
143 SFGLenum::getClassType(),
145 "Native OpenGL id of texture object.\n",
146 OglGLIdFieldId
, OglGLIdFieldMask
,
148 (Field::FClusterLocal
),
149 static_cast<FieldEditMethodSig
>(&TextureObjRefChunk::editHandleOglGLId
),
150 static_cast<FieldGetMethodSig
>(&TextureObjRefChunk::getHandleOglGLId
));
152 oType
.addInitialDesc(pDesc
);
154 pDesc
= new SFGLenum::Description(
155 SFGLenum::getClassType(),
157 "The internal texture format, needed if the texture is bound to an image\n"
159 InternalFormatFieldId
, InternalFormatFieldMask
,
161 (Field::SFDefaultFlags
| Field::FStdAccess
),
162 static_cast<FieldEditMethodSig
>(&TextureObjRefChunk::editHandleInternalFormat
),
163 static_cast<FieldGetMethodSig
>(&TextureObjRefChunk::getHandleInternalFormat
));
165 oType
.addInitialDesc(pDesc
);
169 TextureObjRefChunkBase::TypeObject
TextureObjRefChunkBase::_type(
170 TextureObjRefChunkBase::getClassname(),
171 Inherited::getClassname(),
174 reinterpret_cast<PrototypeCreateF
>(&TextureObjRefChunkBase::createEmptyLocal
),
175 TextureObjRefChunk::initMethod
,
176 TextureObjRefChunk::exitMethod
,
177 reinterpret_cast<InitalInsertDescFunc
>(&TextureObjRefChunk::classDescInserter
),
180 "<?xml version=\"1.0\"?>\n"
183 " name=\"TextureObjRefChunk\"\n"
184 " parent=\"TextureBaseChunk\"\n"
185 " library=\"State\"\n"
186 " pointerfieldtypes=\"both\"\n"
187 " structure=\"concrete\"\n"
188 " systemcomponent=\"true\"\n"
189 " parentsystemcomponent=\"true\"\n"
190 " decoratable=\"false\"\n"
191 " docGroupBase=\"GrpStateAuxiliary\"\n"
194 " name=\"osgGLId\"\n"
196 " cardinality=\"single\"\n"
197 " visibility=\"external\"\n"
198 " access=\"public\"\n"
199 " defaultValue=\"0\"\n"
200 " fieldFlags=\"FClusterLocal\"\n"
202 " OpenSG-OpenGL id of texture object.\n"
205 " name=\"oglGLId\"\n"
207 " cardinality=\"single\"\n"
208 " visibility=\"external\"\n"
209 " access=\"public\"\n"
210 " defaultValue=\"0\"\n"
211 " fieldFlags=\"FClusterLocal\"\n"
213 " Native OpenGL id of texture object.\n"
216 " name=\"internalFormat\"\n"
218 " cardinality=\"single\"\n"
219 " visibility=\"external\"\n"
220 " defaultValue=\"GL_NONE\"\n"
221 " defaultHeader=\""OSGGL.h"\"\n"
222 " access=\"public\"\n"
223 " 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"
225 "\tThe internal texture format, needed if the texture is bound to an image\n"
228 "</FieldContainer>\n",
232 /*------------------------------ get -----------------------------------*/
234 FieldContainerType
&TextureObjRefChunkBase::getType(void)
239 const FieldContainerType
&TextureObjRefChunkBase::getType(void) const
244 UInt32
TextureObjRefChunkBase::getContainerSize(void) const
246 return sizeof(TextureObjRefChunk
);
249 /*------------------------- decorator get ------------------------------*/
252 SFGLenum
*TextureObjRefChunkBase::editSFOsgGLId(void)
254 editSField(OsgGLIdFieldMask
);
259 const SFGLenum
*TextureObjRefChunkBase::getSFOsgGLId(void) const
265 SFGLenum
*TextureObjRefChunkBase::editSFOglGLId(void)
267 editSField(OglGLIdFieldMask
);
272 const SFGLenum
*TextureObjRefChunkBase::getSFOglGLId(void) const
278 SFGLenum
*TextureObjRefChunkBase::editSFInternalFormat(void)
280 editSField(InternalFormatFieldMask
);
282 return &_sfInternalFormat
;
285 const SFGLenum
*TextureObjRefChunkBase::getSFInternalFormat(void) const
287 return &_sfInternalFormat
;
295 /*------------------------------ access -----------------------------------*/
297 SizeT
TextureObjRefChunkBase::getBinSize(ConstFieldMaskArg whichField
)
299 SizeT returnValue
= Inherited::getBinSize(whichField
);
301 if(FieldBits::NoField
!= (OsgGLIdFieldMask
& whichField
))
303 returnValue
+= _sfOsgGLId
.getBinSize();
305 if(FieldBits::NoField
!= (OglGLIdFieldMask
& whichField
))
307 returnValue
+= _sfOglGLId
.getBinSize();
309 if(FieldBits::NoField
!= (InternalFormatFieldMask
& whichField
))
311 returnValue
+= _sfInternalFormat
.getBinSize();
317 void TextureObjRefChunkBase::copyToBin(BinaryDataHandler
&pMem
,
318 ConstFieldMaskArg whichField
)
320 Inherited::copyToBin(pMem
, whichField
);
322 if(FieldBits::NoField
!= (OsgGLIdFieldMask
& whichField
))
324 _sfOsgGLId
.copyToBin(pMem
);
326 if(FieldBits::NoField
!= (OglGLIdFieldMask
& whichField
))
328 _sfOglGLId
.copyToBin(pMem
);
330 if(FieldBits::NoField
!= (InternalFormatFieldMask
& whichField
))
332 _sfInternalFormat
.copyToBin(pMem
);
336 void TextureObjRefChunkBase::copyFromBin(BinaryDataHandler
&pMem
,
337 ConstFieldMaskArg whichField
)
339 Inherited::copyFromBin(pMem
, whichField
);
341 if(FieldBits::NoField
!= (OsgGLIdFieldMask
& whichField
))
343 editSField(OsgGLIdFieldMask
);
344 _sfOsgGLId
.copyFromBin(pMem
);
346 if(FieldBits::NoField
!= (OglGLIdFieldMask
& whichField
))
348 editSField(OglGLIdFieldMask
);
349 _sfOglGLId
.copyFromBin(pMem
);
351 if(FieldBits::NoField
!= (InternalFormatFieldMask
& whichField
))
353 editSField(InternalFormatFieldMask
);
354 _sfInternalFormat
.copyFromBin(pMem
);
358 //! create a new instance of the class
359 TextureObjRefChunkTransitPtr
TextureObjRefChunkBase::createLocal(BitVector bFlags
)
361 TextureObjRefChunkTransitPtr fc
;
363 if(getClassType().getPrototype() != NULL
)
365 FieldContainerTransitPtr tmpPtr
=
366 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
368 fc
= dynamic_pointer_cast
<TextureObjRefChunk
>(tmpPtr
);
374 //! create a new instance of the class, copy the container flags
375 TextureObjRefChunkTransitPtr
TextureObjRefChunkBase::createDependent(BitVector bFlags
)
377 TextureObjRefChunkTransitPtr fc
;
379 if(getClassType().getPrototype() != NULL
)
381 FieldContainerTransitPtr tmpPtr
=
382 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
384 fc
= dynamic_pointer_cast
<TextureObjRefChunk
>(tmpPtr
);
390 //! create a new instance of the class
391 TextureObjRefChunkTransitPtr
TextureObjRefChunkBase::create(void)
393 TextureObjRefChunkTransitPtr fc
;
395 if(getClassType().getPrototype() != NULL
)
397 FieldContainerTransitPtr tmpPtr
=
398 getClassType().getPrototype()-> shallowCopy();
400 fc
= dynamic_pointer_cast
<TextureObjRefChunk
>(tmpPtr
);
406 TextureObjRefChunk
*TextureObjRefChunkBase::createEmptyLocal(BitVector bFlags
)
408 TextureObjRefChunk
*returnValue
;
410 newPtr
<TextureObjRefChunk
>(returnValue
, bFlags
);
412 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
417 //! create an empty new instance of the class, do not copy the prototype
418 TextureObjRefChunk
*TextureObjRefChunkBase::createEmpty(void)
420 TextureObjRefChunk
*returnValue
;
422 newPtr
<TextureObjRefChunk
>(returnValue
, Thread::getCurrentLocalFlags());
424 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
425 ~Thread::getCurrentLocalFlags();
431 FieldContainerTransitPtr
TextureObjRefChunkBase::shallowCopyLocal(
432 BitVector bFlags
) const
434 TextureObjRefChunk
*tmpPtr
;
436 newPtr(tmpPtr
, dynamic_cast<const TextureObjRefChunk
*>(this), bFlags
);
438 FieldContainerTransitPtr
returnValue(tmpPtr
);
440 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
445 FieldContainerTransitPtr
TextureObjRefChunkBase::shallowCopyDependent(
446 BitVector bFlags
) const
448 TextureObjRefChunk
*tmpPtr
;
450 newPtr(tmpPtr
, dynamic_cast<const TextureObjRefChunk
*>(this), ~bFlags
);
452 FieldContainerTransitPtr
returnValue(tmpPtr
);
454 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
459 FieldContainerTransitPtr
TextureObjRefChunkBase::shallowCopy(void) const
461 TextureObjRefChunk
*tmpPtr
;
464 dynamic_cast<const TextureObjRefChunk
*>(this),
465 Thread::getCurrentLocalFlags());
467 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
469 FieldContainerTransitPtr
returnValue(tmpPtr
);
477 /*------------------------- constructors ----------------------------------*/
479 TextureObjRefChunkBase::TextureObjRefChunkBase(void) :
481 _sfOsgGLId (GLenum(0)),
482 _sfOglGLId (GLenum(0)),
483 _sfInternalFormat (GLenum(GL_NONE
))
487 TextureObjRefChunkBase::TextureObjRefChunkBase(const TextureObjRefChunkBase
&source
) :
489 _sfOsgGLId (source
._sfOsgGLId
),
490 _sfOglGLId (source
._sfOglGLId
),
491 _sfInternalFormat (source
._sfInternalFormat
)
496 /*-------------------------- destructors ----------------------------------*/
498 TextureObjRefChunkBase::~TextureObjRefChunkBase(void)
503 GetFieldHandlePtr
TextureObjRefChunkBase::getHandleOsgGLId (void) const
505 SFGLenum::GetHandlePtr
returnValue(
506 new SFGLenum::GetHandle(
508 this->getType().getFieldDesc(OsgGLIdFieldId
),
509 const_cast<TextureObjRefChunkBase
*>(this)));
514 EditFieldHandlePtr
TextureObjRefChunkBase::editHandleOsgGLId (void)
516 SFGLenum::EditHandlePtr
returnValue(
517 new SFGLenum::EditHandle(
519 this->getType().getFieldDesc(OsgGLIdFieldId
),
523 editSField(OsgGLIdFieldMask
);
528 GetFieldHandlePtr
TextureObjRefChunkBase::getHandleOglGLId (void) const
530 SFGLenum::GetHandlePtr
returnValue(
531 new SFGLenum::GetHandle(
533 this->getType().getFieldDesc(OglGLIdFieldId
),
534 const_cast<TextureObjRefChunkBase
*>(this)));
539 EditFieldHandlePtr
TextureObjRefChunkBase::editHandleOglGLId (void)
541 SFGLenum::EditHandlePtr
returnValue(
542 new SFGLenum::EditHandle(
544 this->getType().getFieldDesc(OglGLIdFieldId
),
548 editSField(OglGLIdFieldMask
);
553 GetFieldHandlePtr
TextureObjRefChunkBase::getHandleInternalFormat (void) const
555 SFGLenum::GetHandlePtr
returnValue(
556 new SFGLenum::GetHandle(
558 this->getType().getFieldDesc(InternalFormatFieldId
),
559 const_cast<TextureObjRefChunkBase
*>(this)));
564 EditFieldHandlePtr
TextureObjRefChunkBase::editHandleInternalFormat (void)
566 SFGLenum::EditHandlePtr
returnValue(
567 new SFGLenum::EditHandle(
569 this->getType().getFieldDesc(InternalFormatFieldId
),
573 editSField(InternalFormatFieldMask
);
579 #ifdef OSG_MT_CPTR_ASPECT
580 void TextureObjRefChunkBase::execSyncV( FieldContainer
&oFrom
,
581 ConstFieldMaskArg whichField
,
582 AspectOffsetStore
&oOffsets
,
583 ConstFieldMaskArg syncMode
,
584 const UInt32 uiSyncInfo
)
586 TextureObjRefChunk
*pThis
= static_cast<TextureObjRefChunk
*>(this);
588 pThis
->execSync(static_cast<TextureObjRefChunk
*>(&oFrom
),
597 #ifdef OSG_MT_CPTR_ASPECT
598 FieldContainer
*TextureObjRefChunkBase::createAspectCopy(
599 const FieldContainer
*pRefAspect
) const
601 TextureObjRefChunk
*returnValue
;
603 newAspectCopy(returnValue
,
604 dynamic_cast<const TextureObjRefChunk
*>(pRefAspect
),
605 dynamic_cast<const TextureObjRefChunk
*>(this));
611 void TextureObjRefChunkBase::resolveLinks(void)
613 Inherited::resolveLinks();