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 TextureImageChunk!
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" // Access default header
65 #include "OSGGL.h" // Format default header
67 #include "OSGTextureBaseChunk.h" // Texture Class
69 #include "OSGTextureImageChunkBase.h"
70 #include "OSGTextureImageChunk.h"
72 #include <boost/bind.hpp>
76 /***************************************************************************\
78 \***************************************************************************/
80 /*! \class OSG::TextureImageChunk
81 uses glBindTextureImage
84 /***************************************************************************\
85 * Field Documentation *
86 \***************************************************************************/
88 /*! \var TextureBaseChunk * TextureImageChunkBase::_sfTexture
89 Texture chunks to choose from
92 /*! \var Int32 TextureImageChunkBase::_sfLevel
96 /*! \var Int32 TextureImageChunkBase::_sfLayer
100 /*! \var GLenum TextureImageChunkBase::_sfAccess
104 /*! \var GLenum TextureImageChunkBase::_sfFormat
109 /***************************************************************************\
110 * FieldType/FieldTrait Instantiation *
111 \***************************************************************************/
113 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
114 PointerType FieldTraits
<TextureImageChunk
*, nsOSG
>::_type(
115 "TextureImageChunkPtr",
117 TextureImageChunk::getClassType(),
121 OSG_FIELDTRAITS_GETTYPE_NS(TextureImageChunk
*, nsOSG
)
123 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
127 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
131 /***************************************************************************\
132 * Field Description *
133 \***************************************************************************/
135 void TextureImageChunkBase::classDescInserter(TypeObject
&oType
)
137 FieldDescriptionBase
*pDesc
= NULL
;
140 pDesc
= new SFUnrecTextureBaseChunkPtr::Description(
141 SFUnrecTextureBaseChunkPtr::getClassType(),
143 "Texture chunks to choose from \n",
144 TextureFieldId
, TextureFieldMask
,
146 (Field::SFDefaultFlags
| Field::FStdAccess
),
147 static_cast<FieldEditMethodSig
>(&TextureImageChunk::editHandleTexture
),
148 static_cast<FieldGetMethodSig
>(&TextureImageChunk::getHandleTexture
));
150 oType
.addInitialDesc(pDesc
);
152 pDesc
= new SFInt32::Description(
153 SFInt32::getClassType(),
156 LevelFieldId
, LevelFieldMask
,
158 (Field::SFDefaultFlags
| Field::FStdAccess
),
159 static_cast<FieldEditMethodSig
>(&TextureImageChunk::editHandleLevel
),
160 static_cast<FieldGetMethodSig
>(&TextureImageChunk::getHandleLevel
));
162 oType
.addInitialDesc(pDesc
);
164 pDesc
= new SFInt32::Description(
165 SFInt32::getClassType(),
168 LayerFieldId
, LayerFieldMask
,
170 (Field::SFDefaultFlags
| Field::FStdAccess
),
171 static_cast<FieldEditMethodSig
>(&TextureImageChunk::editHandleLayer
),
172 static_cast<FieldGetMethodSig
>(&TextureImageChunk::getHandleLayer
));
174 oType
.addInitialDesc(pDesc
);
176 pDesc
= new SFGLenum::Description(
177 SFGLenum::getClassType(),
180 AccessFieldId
, AccessFieldMask
,
182 (Field::SFDefaultFlags
| Field::FStdAccess
),
183 static_cast<FieldEditMethodSig
>(&TextureImageChunk::editHandleAccess
),
184 static_cast<FieldGetMethodSig
>(&TextureImageChunk::getHandleAccess
));
186 oType
.addInitialDesc(pDesc
);
188 pDesc
= new SFGLenum::Description(
189 SFGLenum::getClassType(),
192 FormatFieldId
, FormatFieldMask
,
194 (Field::SFDefaultFlags
| Field::FStdAccess
),
195 static_cast<FieldEditMethodSig
>(&TextureImageChunk::editHandleFormat
),
196 static_cast<FieldGetMethodSig
>(&TextureImageChunk::getHandleFormat
));
198 oType
.addInitialDesc(pDesc
);
202 TextureImageChunkBase::TypeObject
TextureImageChunkBase::_type(
203 TextureImageChunkBase::getClassname(),
204 Inherited::getClassname(),
207 reinterpret_cast<PrototypeCreateF
>(&TextureImageChunkBase::createEmptyLocal
),
208 reinterpret_cast<InitContainerF
>(&TextureImageChunk::initMethod
),
209 reinterpret_cast<ExitContainerF
>(&TextureImageChunk::exitMethod
),
210 reinterpret_cast<InitalInsertDescFunc
>(
211 reinterpret_cast<void *>(&TextureImageChunk::classDescInserter
)),
214 "<?xml version=\"1.0\"?>\n"
217 " name=\"TextureImageChunk\"\n"
218 " parent=\"StateChunk\"\n"
219 " library=\"State\"\n"
220 " pointerfieldtypes=\"both\"\n"
221 " structure=\"concrete\"\n"
222 " systemcomponent=\"true\"\n"
223 " parentsystemcomponent=\"true\"\n"
224 " decoratable=\"false\"\n"
225 " docGroupBase=\"GrpStateAuxiliary\"\n"
228 " uses glBindTextureImage\n"
231 "\t name=\"texture\"\n"
232 "\t type=\"TextureBaseChunk\"\n"
233 " category=\"pointer\"\n"
234 "\t cardinality=\"single\"\n"
235 "\t visibility=\"external\"\n"
236 "\t access=\"public\"\n"
237 " defaultValue=\"NULL\"\n"
239 "\tTexture chunks to choose from \n"
245 " cardinality=\"single\"\n"
246 " visibility=\"external\"\n"
247 " defaultValue=\"0\"\n"
248 " access=\"public\"\n"
255 " cardinality=\"single\"\n"
256 " visibility=\"external\"\n"
257 " defaultValue=\"-1\"\n"
258 " access=\"public\"\n"
265 " cardinality=\"single\"\n"
266 " visibility=\"external\"\n"
267 " defaultValue=\"GL_READ_ONLY\"\n"
268 " defaultHeader=\""OSGGL.h"\"\n"
269 " access=\"public\"\n"
270 " potential_values=\"GL_READ_ONLY, GL_WRITE_ONLY, GL_READ_WRITE\"\n"
277 " cardinality=\"single\"\n"
278 " visibility=\"external\"\n"
279 " defaultValue=\"GL_NONE\"\n"
280 " defaultHeader=\""OSGGL.h"\"\n"
281 " access=\"public\"\n"
285 "</FieldContainer>\n",
286 "uses glBindTextureImage\n"
289 /*------------------------------ get -----------------------------------*/
291 FieldContainerType
&TextureImageChunkBase::getType(void)
296 const FieldContainerType
&TextureImageChunkBase::getType(void) const
301 UInt32
TextureImageChunkBase::getContainerSize(void) const
303 return sizeof(TextureImageChunk
);
306 /*------------------------- decorator get ------------------------------*/
309 //! Get the TextureImageChunk::_sfTexture field.
310 const SFUnrecTextureBaseChunkPtr
*TextureImageChunkBase::getSFTexture(void) const
315 SFUnrecTextureBaseChunkPtr
*TextureImageChunkBase::editSFTexture (void)
317 editSField(TextureFieldMask
);
322 //! Get the value of the TextureImageChunk::_sfTexture field.
323 TextureBaseChunk
* TextureImageChunkBase::getTexture(void) const
325 return _sfTexture
.getValue();
328 //! Set the value of the TextureImageChunk::_sfTexture field.
329 void TextureImageChunkBase::setTexture(TextureBaseChunk
* const value
)
331 editSField(TextureFieldMask
);
333 _sfTexture
.setValue(value
);
337 SFInt32
*TextureImageChunkBase::editSFLevel(void)
339 editSField(LevelFieldMask
);
344 const SFInt32
*TextureImageChunkBase::getSFLevel(void) const
350 SFInt32
*TextureImageChunkBase::editSFLayer(void)
352 editSField(LayerFieldMask
);
357 const SFInt32
*TextureImageChunkBase::getSFLayer(void) const
363 SFGLenum
*TextureImageChunkBase::editSFAccess(void)
365 editSField(AccessFieldMask
);
370 const SFGLenum
*TextureImageChunkBase::getSFAccess(void) const
376 SFGLenum
*TextureImageChunkBase::editSFFormat(void)
378 editSField(FormatFieldMask
);
383 const SFGLenum
*TextureImageChunkBase::getSFFormat(void) const
393 /*------------------------------ access -----------------------------------*/
395 SizeT
TextureImageChunkBase::getBinSize(ConstFieldMaskArg whichField
)
397 SizeT returnValue
= Inherited::getBinSize(whichField
);
399 if(FieldBits::NoField
!= (TextureFieldMask
& whichField
))
401 returnValue
+= _sfTexture
.getBinSize();
403 if(FieldBits::NoField
!= (LevelFieldMask
& whichField
))
405 returnValue
+= _sfLevel
.getBinSize();
407 if(FieldBits::NoField
!= (LayerFieldMask
& whichField
))
409 returnValue
+= _sfLayer
.getBinSize();
411 if(FieldBits::NoField
!= (AccessFieldMask
& whichField
))
413 returnValue
+= _sfAccess
.getBinSize();
415 if(FieldBits::NoField
!= (FormatFieldMask
& whichField
))
417 returnValue
+= _sfFormat
.getBinSize();
423 void TextureImageChunkBase::copyToBin(BinaryDataHandler
&pMem
,
424 ConstFieldMaskArg whichField
)
426 Inherited::copyToBin(pMem
, whichField
);
428 if(FieldBits::NoField
!= (TextureFieldMask
& whichField
))
430 _sfTexture
.copyToBin(pMem
);
432 if(FieldBits::NoField
!= (LevelFieldMask
& whichField
))
434 _sfLevel
.copyToBin(pMem
);
436 if(FieldBits::NoField
!= (LayerFieldMask
& whichField
))
438 _sfLayer
.copyToBin(pMem
);
440 if(FieldBits::NoField
!= (AccessFieldMask
& whichField
))
442 _sfAccess
.copyToBin(pMem
);
444 if(FieldBits::NoField
!= (FormatFieldMask
& whichField
))
446 _sfFormat
.copyToBin(pMem
);
450 void TextureImageChunkBase::copyFromBin(BinaryDataHandler
&pMem
,
451 ConstFieldMaskArg whichField
)
453 Inherited::copyFromBin(pMem
, whichField
);
455 if(FieldBits::NoField
!= (TextureFieldMask
& whichField
))
457 editSField(TextureFieldMask
);
458 _sfTexture
.copyFromBin(pMem
);
460 if(FieldBits::NoField
!= (LevelFieldMask
& whichField
))
462 editSField(LevelFieldMask
);
463 _sfLevel
.copyFromBin(pMem
);
465 if(FieldBits::NoField
!= (LayerFieldMask
& whichField
))
467 editSField(LayerFieldMask
);
468 _sfLayer
.copyFromBin(pMem
);
470 if(FieldBits::NoField
!= (AccessFieldMask
& whichField
))
472 editSField(AccessFieldMask
);
473 _sfAccess
.copyFromBin(pMem
);
475 if(FieldBits::NoField
!= (FormatFieldMask
& whichField
))
477 editSField(FormatFieldMask
);
478 _sfFormat
.copyFromBin(pMem
);
482 //! create a new instance of the class
483 TextureImageChunkTransitPtr
TextureImageChunkBase::createLocal(BitVector bFlags
)
485 TextureImageChunkTransitPtr fc
;
487 if(getClassType().getPrototype() != NULL
)
489 FieldContainerTransitPtr tmpPtr
=
490 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
492 fc
= dynamic_pointer_cast
<TextureImageChunk
>(tmpPtr
);
498 //! create a new instance of the class, copy the container flags
499 TextureImageChunkTransitPtr
TextureImageChunkBase::createDependent(BitVector bFlags
)
501 TextureImageChunkTransitPtr fc
;
503 if(getClassType().getPrototype() != NULL
)
505 FieldContainerTransitPtr tmpPtr
=
506 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
508 fc
= dynamic_pointer_cast
<TextureImageChunk
>(tmpPtr
);
514 //! create a new instance of the class
515 TextureImageChunkTransitPtr
TextureImageChunkBase::create(void)
517 TextureImageChunkTransitPtr fc
;
519 if(getClassType().getPrototype() != NULL
)
521 FieldContainerTransitPtr tmpPtr
=
522 getClassType().getPrototype()-> shallowCopy();
524 fc
= dynamic_pointer_cast
<TextureImageChunk
>(tmpPtr
);
530 TextureImageChunk
*TextureImageChunkBase::createEmptyLocal(BitVector bFlags
)
532 TextureImageChunk
*returnValue
;
534 newPtr
<TextureImageChunk
>(returnValue
, bFlags
);
536 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
541 //! create an empty new instance of the class, do not copy the prototype
542 TextureImageChunk
*TextureImageChunkBase::createEmpty(void)
544 TextureImageChunk
*returnValue
;
546 newPtr
<TextureImageChunk
>(returnValue
, Thread::getCurrentLocalFlags());
548 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
549 ~Thread::getCurrentLocalFlags();
555 FieldContainerTransitPtr
TextureImageChunkBase::shallowCopyLocal(
556 BitVector bFlags
) const
558 TextureImageChunk
*tmpPtr
;
560 newPtr(tmpPtr
, dynamic_cast<const TextureImageChunk
*>(this), bFlags
);
562 FieldContainerTransitPtr
returnValue(tmpPtr
);
564 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
569 FieldContainerTransitPtr
TextureImageChunkBase::shallowCopyDependent(
570 BitVector bFlags
) const
572 TextureImageChunk
*tmpPtr
;
574 newPtr(tmpPtr
, dynamic_cast<const TextureImageChunk
*>(this), ~bFlags
);
576 FieldContainerTransitPtr
returnValue(tmpPtr
);
578 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
583 FieldContainerTransitPtr
TextureImageChunkBase::shallowCopy(void) const
585 TextureImageChunk
*tmpPtr
;
588 dynamic_cast<const TextureImageChunk
*>(this),
589 Thread::getCurrentLocalFlags());
591 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
593 FieldContainerTransitPtr
returnValue(tmpPtr
);
601 /*------------------------- constructors ----------------------------------*/
603 TextureImageChunkBase::TextureImageChunkBase(void) :
607 _sfLayer (Int32(-1)),
608 _sfAccess (GLenum(GL_READ_ONLY
)),
609 _sfFormat (GLenum(GL_NONE
))
613 TextureImageChunkBase::TextureImageChunkBase(const TextureImageChunkBase
&source
) :
616 _sfLevel (source
._sfLevel
),
617 _sfLayer (source
._sfLayer
),
618 _sfAccess (source
._sfAccess
),
619 _sfFormat (source
._sfFormat
)
624 /*-------------------------- destructors ----------------------------------*/
626 TextureImageChunkBase::~TextureImageChunkBase(void)
630 void TextureImageChunkBase::onCreate(const TextureImageChunk
*source
)
632 Inherited::onCreate(source
);
636 TextureImageChunk
*pThis
= static_cast<TextureImageChunk
*>(this);
638 pThis
->setTexture(source
->getTexture());
642 GetFieldHandlePtr
TextureImageChunkBase::getHandleTexture (void) const
644 SFUnrecTextureBaseChunkPtr::GetHandlePtr
returnValue(
645 new SFUnrecTextureBaseChunkPtr::GetHandle(
647 this->getType().getFieldDesc(TextureFieldId
),
648 const_cast<TextureImageChunkBase
*>(this)));
653 EditFieldHandlePtr
TextureImageChunkBase::editHandleTexture (void)
655 SFUnrecTextureBaseChunkPtr::EditHandlePtr
returnValue(
656 new SFUnrecTextureBaseChunkPtr::EditHandle(
658 this->getType().getFieldDesc(TextureFieldId
),
661 returnValue
->setSetMethod(
662 boost::bind(&TextureImageChunk::setTexture
,
663 static_cast<TextureImageChunk
*>(this), _1
));
665 editSField(TextureFieldMask
);
670 GetFieldHandlePtr
TextureImageChunkBase::getHandleLevel (void) const
672 SFInt32::GetHandlePtr
returnValue(
673 new SFInt32::GetHandle(
675 this->getType().getFieldDesc(LevelFieldId
),
676 const_cast<TextureImageChunkBase
*>(this)));
681 EditFieldHandlePtr
TextureImageChunkBase::editHandleLevel (void)
683 SFInt32::EditHandlePtr
returnValue(
684 new SFInt32::EditHandle(
686 this->getType().getFieldDesc(LevelFieldId
),
690 editSField(LevelFieldMask
);
695 GetFieldHandlePtr
TextureImageChunkBase::getHandleLayer (void) const
697 SFInt32::GetHandlePtr
returnValue(
698 new SFInt32::GetHandle(
700 this->getType().getFieldDesc(LayerFieldId
),
701 const_cast<TextureImageChunkBase
*>(this)));
706 EditFieldHandlePtr
TextureImageChunkBase::editHandleLayer (void)
708 SFInt32::EditHandlePtr
returnValue(
709 new SFInt32::EditHandle(
711 this->getType().getFieldDesc(LayerFieldId
),
715 editSField(LayerFieldMask
);
720 GetFieldHandlePtr
TextureImageChunkBase::getHandleAccess (void) const
722 SFGLenum::GetHandlePtr
returnValue(
723 new SFGLenum::GetHandle(
725 this->getType().getFieldDesc(AccessFieldId
),
726 const_cast<TextureImageChunkBase
*>(this)));
731 EditFieldHandlePtr
TextureImageChunkBase::editHandleAccess (void)
733 SFGLenum::EditHandlePtr
returnValue(
734 new SFGLenum::EditHandle(
736 this->getType().getFieldDesc(AccessFieldId
),
740 editSField(AccessFieldMask
);
745 GetFieldHandlePtr
TextureImageChunkBase::getHandleFormat (void) const
747 SFGLenum::GetHandlePtr
returnValue(
748 new SFGLenum::GetHandle(
750 this->getType().getFieldDesc(FormatFieldId
),
751 const_cast<TextureImageChunkBase
*>(this)));
756 EditFieldHandlePtr
TextureImageChunkBase::editHandleFormat (void)
758 SFGLenum::EditHandlePtr
returnValue(
759 new SFGLenum::EditHandle(
761 this->getType().getFieldDesc(FormatFieldId
),
765 editSField(FormatFieldMask
);
771 #ifdef OSG_MT_CPTR_ASPECT
772 void TextureImageChunkBase::execSyncV( FieldContainer
&oFrom
,
773 ConstFieldMaskArg whichField
,
774 AspectOffsetStore
&oOffsets
,
775 ConstFieldMaskArg syncMode
,
776 const UInt32 uiSyncInfo
)
778 TextureImageChunk
*pThis
= static_cast<TextureImageChunk
*>(this);
780 pThis
->execSync(static_cast<TextureImageChunk
*>(&oFrom
),
789 #ifdef OSG_MT_CPTR_ASPECT
790 FieldContainer
*TextureImageChunkBase::createAspectCopy(
791 const FieldContainer
*pRefAspect
) const
793 TextureImageChunk
*returnValue
;
795 newAspectCopy(returnValue
,
796 dynamic_cast<const TextureImageChunk
*>(pRefAspect
),
797 dynamic_cast<const TextureImageChunk
*>(this));
803 void TextureImageChunkBase::resolveLinks(void)
805 Inherited::resolveLinks();
807 static_cast<TextureImageChunk
*>(this)->setTexture(NULL
);