changed: gcc8 base update
[opensg.git] / Source / System / Window / Passive / OSGPassiveBackgroundBase.cpp
blob0fdb674eae235071a0fa0ea13fc03070d5669e53
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
41 ** **
42 ** This file is automatically generated. **
43 ** **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
46 ** **
47 ** Do not change this file, changes should be done in the derived **
48 ** class PassiveBackground!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #ifdef WIN32
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
59 #endif
61 #include "OSGConfig.h"
66 #include "OSGPassiveBackgroundBase.h"
67 #include "OSGPassiveBackground.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
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",
105 "BackgroundPtr",
106 PassiveBackground::getClassType(),
107 nsOSG);
108 #endif
110 OSG_FIELDTRAITS_GETTYPE_NS(PassiveBackground *, nsOSG)
112 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
113 PassiveBackground *,
114 nsOSG)
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,
131 false,
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(),
140 "clearCallback",
141 "Inherited the parent target if none is set \n",
142 ClearCallbackFieldId, ClearCallbackFieldMask,
143 false,
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(),
155 "NULL",
156 nsOSG, //Namespace
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)),
162 false,
164 "<?xml version=\"1.0\" ?>\n"
165 "\n"
166 "<FieldContainer\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"
175 " >\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"
181 "\n"
182 " <Field\n"
183 " name=\"clearFrameBufferObject\"\n"
184 " type=\"bool\"\n"
185 " cardinality=\"single\"\n"
186 " visibility=\"external\"\n"
187 " defaultValue=\"false\"\n"
188 " access=\"public\"\n"
189 " >\n"
190 " If used inside an FBO blit from the framebuffer\n"
191 " </Field>\n"
192 " <Field\n"
193 " name=\"clearCallback\"\n"
194 " type=\"RenderFunctorCallback\"\n"
195 " cardinality=\"single\"\n"
196 " visibility=\"external\"\n"
197 " access=\"none\"\n"
198 " >\n"
199 " Inherited the parent target if none is set \n"
200 " </Field>\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)
213 return _type;
216 const FieldContainerType &PassiveBackgroundBase::getType(void) const
218 return _type;
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();
262 return returnValue;
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);
310 return fc;
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);
326 return fc;
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);
342 return fc;
345 PassiveBackground *PassiveBackgroundBase::createEmptyLocal(BitVector bFlags)
347 PassiveBackground *returnValue;
349 newPtr<PassiveBackground>(returnValue, bFlags);
351 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
353 return returnValue;
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();
366 return returnValue;
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;
381 return returnValue;
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;
395 return returnValue;
398 FieldContainerTransitPtr PassiveBackgroundBase::shallowCopy(void) const
400 PassiveBackground *tmpPtr;
402 newPtr(tmpPtr,
403 dynamic_cast<const PassiveBackground *>(this),
404 Thread::getCurrentLocalFlags());
406 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
408 FieldContainerTransitPtr returnValue(tmpPtr);
410 return returnValue;
416 /*------------------------- constructors ----------------------------------*/
418 PassiveBackgroundBase::PassiveBackgroundBase(void) :
419 Inherited(),
420 _sfClearFrameBufferObject (bool(false)),
421 _sfClearCallback ()
425 PassiveBackgroundBase::PassiveBackgroundBase(const PassiveBackgroundBase &source) :
426 Inherited(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)));
448 return returnValue;
451 EditFieldHandlePtr PassiveBackgroundBase::editHandleClearFrameBufferObject(void)
453 SFBool::EditHandlePtr returnValue(
454 new SFBool::EditHandle(
455 &_sfClearFrameBufferObject,
456 this->getType().getFieldDesc(ClearFrameBufferObjectFieldId),
457 this));
460 editSField(ClearFrameBufferObjectFieldMask);
462 return returnValue;
465 GetFieldHandlePtr PassiveBackgroundBase::getHandleClearCallback (void) const
467 SFRenderFunctorCallback::GetHandlePtr returnValue;
469 return returnValue;
472 EditFieldHandlePtr PassiveBackgroundBase::editHandleClearCallback (void)
474 EditFieldHandlePtr returnValue;
476 return 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),
490 whichField,
491 oOffsets,
492 syncMode,
493 uiSyncInfo);
495 #endif
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));
508 return returnValue;
510 #endif
512 void PassiveBackgroundBase::resolveLinks(void)
514 Inherited::resolveLinks();
520 OSG_END_NAMESPACE