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 FBOBackground!
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"
65 #include "OSGFrameBufferObject.h" // FrameBufferObject Class
67 #include "OSGFBOBackgroundBase.h"
68 #include "OSGFBOBackground.h"
70 #include <boost/bind.hpp>
74 /***************************************************************************\
76 \***************************************************************************/
78 /*! \class OSG::FBOBackground
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var FrameBufferObject * FBOBackgroundBase::_sfFrameBufferObject
87 The FramebufferObject to clear from.
91 /***************************************************************************\
92 * FieldType/FieldTrait Instantiation *
93 \***************************************************************************/
95 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
96 PointerType FieldTraits
<FBOBackground
*, nsOSG
>::_type(
99 FBOBackground::getClassType(),
103 OSG_FIELDTRAITS_GETTYPE_NS(FBOBackground
*, nsOSG
)
105 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
110 /***************************************************************************\
111 * Field Description *
112 \***************************************************************************/
114 void FBOBackgroundBase::classDescInserter(TypeObject
&oType
)
116 FieldDescriptionBase
*pDesc
= NULL
;
119 pDesc
= new SFUnrecFrameBufferObjectPtr::Description(
120 SFUnrecFrameBufferObjectPtr::getClassType(),
122 "The FramebufferObject to clear from.\n",
123 FrameBufferObjectFieldId
, FrameBufferObjectFieldMask
,
125 (Field::SFDefaultFlags
| Field::FStdAccess
),
126 static_cast<FieldEditMethodSig
>(&FBOBackground::editHandleFrameBufferObject
),
127 static_cast<FieldGetMethodSig
>(&FBOBackground::getHandleFrameBufferObject
));
129 oType
.addInitialDesc(pDesc
);
133 FBOBackgroundBase::TypeObject
FBOBackgroundBase::_type(
134 FBOBackgroundBase::getClassname(),
135 Inherited::getClassname(),
138 reinterpret_cast<PrototypeCreateF
>(&FBOBackgroundBase::createEmptyLocal
),
139 reinterpret_cast<InitContainerF
>(&FBOBackground::initMethod
),
140 reinterpret_cast<ExitContainerF
>(&FBOBackground::exitMethod
),
141 reinterpret_cast<InitalInsertDescFunc
>(
142 reinterpret_cast<void *>(&FBOBackground::classDescInserter
)),
145 "<?xml version=\"1.0\" ?>\n"
148 " name=\"FBOBackground\"\n"
149 " parent=\"Background\"\n"
150 " library=\"Window\"\n"
151 " structure=\"concrete\"\n"
152 " pointerfieldtypes=\"single\"\n"
153 " systemcomponent=\"true\"\n"
154 " parentsystemcomponent=\"true\"\n"
155 " docGroupBase=\"GrpWindowPassive\"\n"
158 "\t name=\"frameBufferObject\"\n"
159 "\t type=\"FrameBufferObjectPtr\"\n"
160 "\t cardinality=\"single\"\n"
161 "\t visibility=\"external\"\n"
162 "\t access=\"public\"\n"
164 " The FramebufferObject to clear from.\n"
166 "</FieldContainer>\n",
170 /*------------------------------ get -----------------------------------*/
172 FieldContainerType
&FBOBackgroundBase::getType(void)
177 const FieldContainerType
&FBOBackgroundBase::getType(void) const
182 UInt32
FBOBackgroundBase::getContainerSize(void) const
184 return sizeof(FBOBackground
);
187 /*------------------------- decorator get ------------------------------*/
190 //! Get the FBOBackground::_sfFrameBufferObject field.
191 const SFUnrecFrameBufferObjectPtr
*FBOBackgroundBase::getSFFrameBufferObject(void) const
193 return &_sfFrameBufferObject
;
196 SFUnrecFrameBufferObjectPtr
*FBOBackgroundBase::editSFFrameBufferObject(void)
198 editSField(FrameBufferObjectFieldMask
);
200 return &_sfFrameBufferObject
;
203 //! Get the value of the FBOBackground::_sfFrameBufferObject field.
204 FrameBufferObject
* FBOBackgroundBase::getFrameBufferObject(void) const
206 return _sfFrameBufferObject
.getValue();
209 //! Set the value of the FBOBackground::_sfFrameBufferObject field.
210 void FBOBackgroundBase::setFrameBufferObject(FrameBufferObject
* const value
)
212 editSField(FrameBufferObjectFieldMask
);
214 _sfFrameBufferObject
.setValue(value
);
222 /*------------------------------ access -----------------------------------*/
224 SizeT
FBOBackgroundBase::getBinSize(ConstFieldMaskArg whichField
)
226 SizeT returnValue
= Inherited::getBinSize(whichField
);
228 if(FieldBits::NoField
!= (FrameBufferObjectFieldMask
& whichField
))
230 returnValue
+= _sfFrameBufferObject
.getBinSize();
236 void FBOBackgroundBase::copyToBin(BinaryDataHandler
&pMem
,
237 ConstFieldMaskArg whichField
)
239 Inherited::copyToBin(pMem
, whichField
);
241 if(FieldBits::NoField
!= (FrameBufferObjectFieldMask
& whichField
))
243 _sfFrameBufferObject
.copyToBin(pMem
);
247 void FBOBackgroundBase::copyFromBin(BinaryDataHandler
&pMem
,
248 ConstFieldMaskArg whichField
)
250 Inherited::copyFromBin(pMem
, whichField
);
252 if(FieldBits::NoField
!= (FrameBufferObjectFieldMask
& whichField
))
254 editSField(FrameBufferObjectFieldMask
);
255 _sfFrameBufferObject
.copyFromBin(pMem
);
259 //! create a new instance of the class
260 FBOBackgroundTransitPtr
FBOBackgroundBase::createLocal(BitVector bFlags
)
262 FBOBackgroundTransitPtr fc
;
264 if(getClassType().getPrototype() != NULL
)
266 FieldContainerTransitPtr tmpPtr
=
267 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
269 fc
= dynamic_pointer_cast
<FBOBackground
>(tmpPtr
);
275 //! create a new instance of the class, copy the container flags
276 FBOBackgroundTransitPtr
FBOBackgroundBase::createDependent(BitVector bFlags
)
278 FBOBackgroundTransitPtr fc
;
280 if(getClassType().getPrototype() != NULL
)
282 FieldContainerTransitPtr tmpPtr
=
283 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
285 fc
= dynamic_pointer_cast
<FBOBackground
>(tmpPtr
);
291 //! create a new instance of the class
292 FBOBackgroundTransitPtr
FBOBackgroundBase::create(void)
294 FBOBackgroundTransitPtr fc
;
296 if(getClassType().getPrototype() != NULL
)
298 FieldContainerTransitPtr tmpPtr
=
299 getClassType().getPrototype()-> shallowCopy();
301 fc
= dynamic_pointer_cast
<FBOBackground
>(tmpPtr
);
307 FBOBackground
*FBOBackgroundBase::createEmptyLocal(BitVector bFlags
)
309 FBOBackground
*returnValue
;
311 newPtr
<FBOBackground
>(returnValue
, bFlags
);
313 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
318 //! create an empty new instance of the class, do not copy the prototype
319 FBOBackground
*FBOBackgroundBase::createEmpty(void)
321 FBOBackground
*returnValue
;
323 newPtr
<FBOBackground
>(returnValue
, Thread::getCurrentLocalFlags());
325 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
326 ~Thread::getCurrentLocalFlags();
332 FieldContainerTransitPtr
FBOBackgroundBase::shallowCopyLocal(
333 BitVector bFlags
) const
335 FBOBackground
*tmpPtr
;
337 newPtr(tmpPtr
, dynamic_cast<const FBOBackground
*>(this), bFlags
);
339 FieldContainerTransitPtr
returnValue(tmpPtr
);
341 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
346 FieldContainerTransitPtr
FBOBackgroundBase::shallowCopyDependent(
347 BitVector bFlags
) const
349 FBOBackground
*tmpPtr
;
351 newPtr(tmpPtr
, dynamic_cast<const FBOBackground
*>(this), ~bFlags
);
353 FieldContainerTransitPtr
returnValue(tmpPtr
);
355 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
360 FieldContainerTransitPtr
FBOBackgroundBase::shallowCopy(void) const
362 FBOBackground
*tmpPtr
;
365 dynamic_cast<const FBOBackground
*>(this),
366 Thread::getCurrentLocalFlags());
368 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
370 FieldContainerTransitPtr
returnValue(tmpPtr
);
378 /*------------------------- constructors ----------------------------------*/
380 FBOBackgroundBase::FBOBackgroundBase(void) :
382 _sfFrameBufferObject (NULL
)
386 FBOBackgroundBase::FBOBackgroundBase(const FBOBackgroundBase
&source
) :
388 _sfFrameBufferObject (NULL
)
393 /*-------------------------- destructors ----------------------------------*/
395 FBOBackgroundBase::~FBOBackgroundBase(void)
399 void FBOBackgroundBase::onCreate(const FBOBackground
*source
)
401 Inherited::onCreate(source
);
405 FBOBackground
*pThis
= static_cast<FBOBackground
*>(this);
407 pThis
->setFrameBufferObject(source
->getFrameBufferObject());
411 GetFieldHandlePtr
FBOBackgroundBase::getHandleFrameBufferObject (void) const
413 SFUnrecFrameBufferObjectPtr::GetHandlePtr
returnValue(
414 new SFUnrecFrameBufferObjectPtr::GetHandle(
415 &_sfFrameBufferObject
,
416 this->getType().getFieldDesc(FrameBufferObjectFieldId
),
417 const_cast<FBOBackgroundBase
*>(this)));
422 EditFieldHandlePtr
FBOBackgroundBase::editHandleFrameBufferObject(void)
424 SFUnrecFrameBufferObjectPtr::EditHandlePtr
returnValue(
425 new SFUnrecFrameBufferObjectPtr::EditHandle(
426 &_sfFrameBufferObject
,
427 this->getType().getFieldDesc(FrameBufferObjectFieldId
),
430 returnValue
->setSetMethod(
431 boost::bind(&FBOBackground::setFrameBufferObject
,
432 static_cast<FBOBackground
*>(this), _1
));
434 editSField(FrameBufferObjectFieldMask
);
440 #ifdef OSG_MT_CPTR_ASPECT
441 void FBOBackgroundBase::execSyncV( FieldContainer
&oFrom
,
442 ConstFieldMaskArg whichField
,
443 AspectOffsetStore
&oOffsets
,
444 ConstFieldMaskArg syncMode
,
445 const UInt32 uiSyncInfo
)
447 FBOBackground
*pThis
= static_cast<FBOBackground
*>(this);
449 pThis
->execSync(static_cast<FBOBackground
*>(&oFrom
),
458 #ifdef OSG_MT_CPTR_ASPECT
459 FieldContainer
*FBOBackgroundBase::createAspectCopy(
460 const FieldContainer
*pRefAspect
) const
462 FBOBackground
*returnValue
;
464 newAspectCopy(returnValue
,
465 dynamic_cast<const FBOBackground
*>(pRefAspect
),
466 dynamic_cast<const FBOBackground
*>(this));
472 void FBOBackgroundBase::resolveLinks(void)
474 Inherited::resolveLinks();
476 static_cast<FBOBackground
*>(this)->setFrameBufferObject(NULL
);