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 TextureTransformChunk!
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"
66 #include "OSGTextureTransformChunkBase.h"
67 #include "OSGTextureTransformChunk.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
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",
101 TextureTransformChunk::getClassType(),
105 OSG_FIELDTRAITS_GETTYPE_NS(TextureTransformChunk
*, nsOSG
)
107 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
108 TextureTransformChunk
*,
111 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
112 TextureTransformChunk
*,
115 /***************************************************************************\
116 * Field Description *
117 \***************************************************************************/
119 void TextureTransformChunkBase::classDescInserter(TypeObject
&oType
)
121 FieldDescriptionBase
*pDesc
= NULL
;
124 pDesc
= new SFBool::Description(
125 SFBool::getClassType(),
127 "If enabled it uses the camera beacon matrix (for cube textures)\n",
128 UseCameraBeaconFieldId
, UseCameraBeaconFieldMask
,
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(),
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
)),
150 "<?xml version=\"1.0\"?>\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"
164 " See \\ref PageSystemTextureTransformChunk for a description.\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"
169 "\t name=\"useCameraBeacon\"\n"
171 "\t cardinality=\"single\"\n"
172 "\t visibility=\"external\"\n"
173 "\t defaultValue=\"false\"\n"
174 "\t access=\"public\"\n"
176 "\tIf enabled it uses the camera beacon matrix (for cube textures)\n"
178 "</FieldContainer>\n",
179 "See \\ref PageSystemTextureTransformChunk for a description.\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)
192 const FieldContainerType
&TextureTransformChunkBase::getType(void) const
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();
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
);
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
);
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
);
307 TextureTransformChunk
*TextureTransformChunkBase::createEmptyLocal(BitVector bFlags
)
309 TextureTransformChunk
*returnValue
;
311 newPtr
<TextureTransformChunk
>(returnValue
, bFlags
);
313 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
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();
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
;
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
;
360 FieldContainerTransitPtr
TextureTransformChunkBase::shallowCopy(void) const
362 TextureTransformChunk
*tmpPtr
;
365 dynamic_cast<const TextureTransformChunk
*>(this),
366 Thread::getCurrentLocalFlags());
368 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
370 FieldContainerTransitPtr
returnValue(tmpPtr
);
378 /*------------------------- constructors ----------------------------------*/
380 TextureTransformChunkBase::TextureTransformChunkBase(void) :
382 _sfUseCameraBeacon (bool(false))
386 TextureTransformChunkBase::TextureTransformChunkBase(const TextureTransformChunkBase
&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(
405 this->getType().getFieldDesc(UseCameraBeaconFieldId
),
406 const_cast<TextureTransformChunkBase
*>(this)));
411 EditFieldHandlePtr
TextureTransformChunkBase::editHandleUseCameraBeacon(void)
413 SFBool::EditHandlePtr
returnValue(
414 new SFBool::EditHandle(
416 this->getType().getFieldDesc(UseCameraBeaconFieldId
),
420 editSField(UseCameraBeaconFieldMask
);
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
),
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));
458 void TextureTransformChunkBase::resolveLinks(void)
460 Inherited::resolveLinks();