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 PassiveBackground!
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 "OSGPassiveBackgroundBase.h"
67 #include "OSGPassiveBackground.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::PassiveBackground
78 A background that does nothing within the clear call, thus it also has no
79 Fields at all. It is mainly used to stack viewports on top of each other,
80 i.e. it makes it possible to have two viewports on top of each other to
81 generate a single combined image. See \ref
82 PageSystemWindowBackgroundPassive
85 /***************************************************************************\
86 * Field Documentation *
87 \***************************************************************************/
89 /*! \var bool PassiveBackgroundBase::_sfClearFrameBufferObject
90 If used inside an FBO blit from the framebuffer
93 /*! \var RenderFunctorCallback PassiveBackgroundBase::_sfClearCallback
94 Inherited the parent target if none is set
98 /***************************************************************************\
99 * FieldType/FieldTrait Instantiation *
100 \***************************************************************************/
102 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
103 PointerType FieldTraits
<PassiveBackground
*, nsOSG
>::_type(
104 "PassiveBackgroundPtr",
106 PassiveBackground::getClassType(),
110 OSG_FIELDTRAITS_GETTYPE_NS(PassiveBackground
*, nsOSG
)
112 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
117 /***************************************************************************\
118 * Field Description *
119 \***************************************************************************/
121 void PassiveBackgroundBase::classDescInserter(TypeObject
&oType
)
123 FieldDescriptionBase
*pDesc
= NULL
;
126 pDesc
= new SFBool::Description(
127 SFBool::getClassType(),
128 "clearFrameBufferObject",
129 "If used inside an FBO blit from the framebuffer\n",
130 ClearFrameBufferObjectFieldId
, ClearFrameBufferObjectFieldMask
,
132 (Field::SFDefaultFlags
| Field::FStdAccess
),
133 static_cast<FieldEditMethodSig
>(&PassiveBackground::editHandleClearFrameBufferObject
),
134 static_cast<FieldGetMethodSig
>(&PassiveBackground::getHandleClearFrameBufferObject
));
136 oType
.addInitialDesc(pDesc
);
138 pDesc
= new SFRenderFunctorCallback::Description(
139 SFRenderFunctorCallback::getClassType(),
141 "Inherited the parent target if none is set \n",
142 ClearCallbackFieldId
, ClearCallbackFieldMask
,
144 (Field::SFDefaultFlags
| Field::FStdAccess
),
145 static_cast <FieldEditMethodSig
>(&PassiveBackground::invalidEditField
),
146 static_cast <FieldGetMethodSig
>(&PassiveBackground::invalidGetField
));
148 oType
.addInitialDesc(pDesc
);
152 PassiveBackgroundBase::TypeObject
PassiveBackgroundBase::_type(
153 PassiveBackgroundBase::getClassname(),
154 Inherited::getClassname(),
157 reinterpret_cast<PrototypeCreateF
>(&PassiveBackgroundBase::createEmptyLocal
),
158 reinterpret_cast<InitContainerF
>(&PassiveBackground::initMethod
),
159 reinterpret_cast<ExitContainerF
>(&PassiveBackground::exitMethod
),
160 reinterpret_cast<InitalInsertDescFunc
>(
161 reinterpret_cast<void *>(&PassiveBackground::classDescInserter
)),
164 "<?xml version=\"1.0\" ?>\n"
167 " name=\"PassiveBackground\"\n"
168 " parent=\"Background\"\n"
169 " library=\"Window\"\n"
170 " structure=\"concrete\"\n"
171 " pointerfieldtypes=\"single\"\n"
172 " systemcomponent=\"true\"\n"
173 " parentsystemcomponent=\"true\"\n"
174 " docGroupBase=\"GrpWindowPassive\"\n"
176 " A background that does nothing within the clear call, thus it also has no\n"
177 " Fields at all. It is mainly used to stack viewports on top of each other,\n"
178 " i.e. it makes it possible to have two viewports on top of each other to\n"
179 " generate a single combined image. See \\ref\n"
180 " PageSystemWindowBackgroundPassive \n"
183 " name=\"clearFrameBufferObject\"\n"
185 " cardinality=\"single\"\n"
186 " visibility=\"external\"\n"
187 " defaultValue=\"false\"\n"
188 " access=\"public\"\n"
190 " If used inside an FBO blit from the framebuffer\n"
193 " name=\"clearCallback\"\n"
194 " type=\"RenderFunctorCallback\"\n"
195 " cardinality=\"single\"\n"
196 " visibility=\"external\"\n"
199 " Inherited the parent target if none is set \n"
201 "</FieldContainer>\n",
202 "A background that does nothing within the clear call, thus it also has no\n"
203 "Fields at all. It is mainly used to stack viewports on top of each other,\n"
204 "i.e. it makes it possible to have two viewports on top of each other to\n"
205 "generate a single combined image. See \\ref\n"
206 "PageSystemWindowBackgroundPassive \n"
209 /*------------------------------ get -----------------------------------*/
211 FieldContainerType
&PassiveBackgroundBase::getType(void)
216 const FieldContainerType
&PassiveBackgroundBase::getType(void) const
221 UInt32
PassiveBackgroundBase::getContainerSize(void) const
223 return sizeof(PassiveBackground
);
226 /*------------------------- decorator get ------------------------------*/
229 SFBool
*PassiveBackgroundBase::editSFClearFrameBufferObject(void)
231 editSField(ClearFrameBufferObjectFieldMask
);
233 return &_sfClearFrameBufferObject
;
236 const SFBool
*PassiveBackgroundBase::getSFClearFrameBufferObject(void) const
238 return &_sfClearFrameBufferObject
;
247 /*------------------------------ access -----------------------------------*/
249 SizeT
PassiveBackgroundBase::getBinSize(ConstFieldMaskArg whichField
)
251 SizeT returnValue
= Inherited::getBinSize(whichField
);
253 if(FieldBits::NoField
!= (ClearFrameBufferObjectFieldMask
& whichField
))
255 returnValue
+= _sfClearFrameBufferObject
.getBinSize();
257 if(FieldBits::NoField
!= (ClearCallbackFieldMask
& whichField
))
259 returnValue
+= _sfClearCallback
.getBinSize();
265 void PassiveBackgroundBase::copyToBin(BinaryDataHandler
&pMem
,
266 ConstFieldMaskArg whichField
)
268 Inherited::copyToBin(pMem
, whichField
);
270 if(FieldBits::NoField
!= (ClearFrameBufferObjectFieldMask
& whichField
))
272 _sfClearFrameBufferObject
.copyToBin(pMem
);
274 if(FieldBits::NoField
!= (ClearCallbackFieldMask
& whichField
))
276 _sfClearCallback
.copyToBin(pMem
);
280 void PassiveBackgroundBase::copyFromBin(BinaryDataHandler
&pMem
,
281 ConstFieldMaskArg whichField
)
283 Inherited::copyFromBin(pMem
, whichField
);
285 if(FieldBits::NoField
!= (ClearFrameBufferObjectFieldMask
& whichField
))
287 editSField(ClearFrameBufferObjectFieldMask
);
288 _sfClearFrameBufferObject
.copyFromBin(pMem
);
290 if(FieldBits::NoField
!= (ClearCallbackFieldMask
& whichField
))
292 editSField(ClearCallbackFieldMask
);
293 _sfClearCallback
.copyFromBin(pMem
);
297 //! create a new instance of the class
298 PassiveBackgroundTransitPtr
PassiveBackgroundBase::createLocal(BitVector bFlags
)
300 PassiveBackgroundTransitPtr fc
;
302 if(getClassType().getPrototype() != NULL
)
304 FieldContainerTransitPtr tmpPtr
=
305 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
307 fc
= dynamic_pointer_cast
<PassiveBackground
>(tmpPtr
);
313 //! create a new instance of the class, copy the container flags
314 PassiveBackgroundTransitPtr
PassiveBackgroundBase::createDependent(BitVector bFlags
)
316 PassiveBackgroundTransitPtr fc
;
318 if(getClassType().getPrototype() != NULL
)
320 FieldContainerTransitPtr tmpPtr
=
321 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
323 fc
= dynamic_pointer_cast
<PassiveBackground
>(tmpPtr
);
329 //! create a new instance of the class
330 PassiveBackgroundTransitPtr
PassiveBackgroundBase::create(void)
332 PassiveBackgroundTransitPtr fc
;
334 if(getClassType().getPrototype() != NULL
)
336 FieldContainerTransitPtr tmpPtr
=
337 getClassType().getPrototype()-> shallowCopy();
339 fc
= dynamic_pointer_cast
<PassiveBackground
>(tmpPtr
);
345 PassiveBackground
*PassiveBackgroundBase::createEmptyLocal(BitVector bFlags
)
347 PassiveBackground
*returnValue
;
349 newPtr
<PassiveBackground
>(returnValue
, bFlags
);
351 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
356 //! create an empty new instance of the class, do not copy the prototype
357 PassiveBackground
*PassiveBackgroundBase::createEmpty(void)
359 PassiveBackground
*returnValue
;
361 newPtr
<PassiveBackground
>(returnValue
, Thread::getCurrentLocalFlags());
363 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
364 ~Thread::getCurrentLocalFlags();
370 FieldContainerTransitPtr
PassiveBackgroundBase::shallowCopyLocal(
371 BitVector bFlags
) const
373 PassiveBackground
*tmpPtr
;
375 newPtr(tmpPtr
, dynamic_cast<const PassiveBackground
*>(this), bFlags
);
377 FieldContainerTransitPtr
returnValue(tmpPtr
);
379 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
384 FieldContainerTransitPtr
PassiveBackgroundBase::shallowCopyDependent(
385 BitVector bFlags
) const
387 PassiveBackground
*tmpPtr
;
389 newPtr(tmpPtr
, dynamic_cast<const PassiveBackground
*>(this), ~bFlags
);
391 FieldContainerTransitPtr
returnValue(tmpPtr
);
393 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
398 FieldContainerTransitPtr
PassiveBackgroundBase::shallowCopy(void) const
400 PassiveBackground
*tmpPtr
;
403 dynamic_cast<const PassiveBackground
*>(this),
404 Thread::getCurrentLocalFlags());
406 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
408 FieldContainerTransitPtr
returnValue(tmpPtr
);
416 /*------------------------- constructors ----------------------------------*/
418 PassiveBackgroundBase::PassiveBackgroundBase(void) :
420 _sfClearFrameBufferObject (bool(false)),
425 PassiveBackgroundBase::PassiveBackgroundBase(const PassiveBackgroundBase
&source
) :
427 _sfClearFrameBufferObject (source
._sfClearFrameBufferObject
),
428 _sfClearCallback (source
._sfClearCallback
)
433 /*-------------------------- destructors ----------------------------------*/
435 PassiveBackgroundBase::~PassiveBackgroundBase(void)
440 GetFieldHandlePtr
PassiveBackgroundBase::getHandleClearFrameBufferObject (void) const
442 SFBool::GetHandlePtr
returnValue(
443 new SFBool::GetHandle(
444 &_sfClearFrameBufferObject
,
445 this->getType().getFieldDesc(ClearFrameBufferObjectFieldId
),
446 const_cast<PassiveBackgroundBase
*>(this)));
451 EditFieldHandlePtr
PassiveBackgroundBase::editHandleClearFrameBufferObject(void)
453 SFBool::EditHandlePtr
returnValue(
454 new SFBool::EditHandle(
455 &_sfClearFrameBufferObject
,
456 this->getType().getFieldDesc(ClearFrameBufferObjectFieldId
),
460 editSField(ClearFrameBufferObjectFieldMask
);
465 GetFieldHandlePtr
PassiveBackgroundBase::getHandleClearCallback (void) const
467 SFRenderFunctorCallback::GetHandlePtr returnValue
;
472 EditFieldHandlePtr
PassiveBackgroundBase::editHandleClearCallback (void)
474 EditFieldHandlePtr returnValue
;
480 #ifdef OSG_MT_CPTR_ASPECT
481 void PassiveBackgroundBase::execSyncV( FieldContainer
&oFrom
,
482 ConstFieldMaskArg whichField
,
483 AspectOffsetStore
&oOffsets
,
484 ConstFieldMaskArg syncMode
,
485 const UInt32 uiSyncInfo
)
487 PassiveBackground
*pThis
= static_cast<PassiveBackground
*>(this);
489 pThis
->execSync(static_cast<PassiveBackground
*>(&oFrom
),
498 #ifdef OSG_MT_CPTR_ASPECT
499 FieldContainer
*PassiveBackgroundBase::createAspectCopy(
500 const FieldContainer
*pRefAspect
) const
502 PassiveBackground
*returnValue
;
504 newAspectCopy(returnValue
,
505 dynamic_cast<const PassiveBackground
*>(pRefAspect
),
506 dynamic_cast<const PassiveBackground
*>(this));
512 void PassiveBackgroundBase::resolveLinks(void)
514 Inherited::resolveLinks();