changed: gcc8 base update
[opensg.git] / Source / System / Window / FrameBufferObjects / OSGFBOViewportBase.cpp
blob1eb6c923d205bd90754c826c560f32043b1fba5a
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 FBOViewport!
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"
65 #include "OSGFrameBufferObject.h" // FrameBufferObject Class
67 #include "OSGFBOViewportBase.h"
68 #include "OSGFBOViewport.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::FBOViewport
79 \ingroup GrpSystemWindowViewports
81 A viewport using a framebuffer object for output.
84 /***************************************************************************\
85 * Field Documentation *
86 \***************************************************************************/
88 /*! \var FrameBufferObject * FBOViewportBase::_sfFrameBufferObject
89 FramebufferObject to write to.
93 /***************************************************************************\
94 * FieldType/FieldTrait Instantiation *
95 \***************************************************************************/
97 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
98 PointerType FieldTraits<FBOViewport *, nsOSG>::_type(
99 "FBOViewportPtr",
100 "ViewportPtr",
101 FBOViewport::getClassType(),
102 nsOSG);
103 #endif
105 OSG_FIELDTRAITS_GETTYPE_NS(FBOViewport *, nsOSG)
107 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
108 FBOViewport *,
109 nsOSG)
111 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
112 FBOViewport *,
113 nsOSG)
115 /***************************************************************************\
116 * Field Description *
117 \***************************************************************************/
119 void FBOViewportBase::classDescInserter(TypeObject &oType)
121 FieldDescriptionBase *pDesc = NULL;
124 pDesc = new SFUnrecFrameBufferObjectPtr::Description(
125 SFUnrecFrameBufferObjectPtr::getClassType(),
126 "frameBufferObject",
127 "FramebufferObject to write to.\n",
128 FrameBufferObjectFieldId, FrameBufferObjectFieldMask,
129 false,
130 (Field::SFDefaultFlags | Field::FStdAccess),
131 static_cast<FieldEditMethodSig>(&FBOViewport::editHandleFrameBufferObject),
132 static_cast<FieldGetMethodSig >(&FBOViewport::getHandleFrameBufferObject));
134 oType.addInitialDesc(pDesc);
138 FBOViewportBase::TypeObject FBOViewportBase::_type(
139 FBOViewportBase::getClassname(),
140 Inherited::getClassname(),
141 "NULL",
142 nsOSG, //Namespace
143 reinterpret_cast<PrototypeCreateF>(&FBOViewportBase::createEmptyLocal),
144 reinterpret_cast<InitContainerF>(&FBOViewport::initMethod),
145 reinterpret_cast<ExitContainerF>(&FBOViewport::exitMethod),
146 reinterpret_cast<InitalInsertDescFunc>(
147 reinterpret_cast<void *>(&FBOViewport::classDescInserter)),
148 false,
150 "<?xml version=\"1.0\"?>\n"
151 "\n"
152 "<FieldContainer\n"
153 " name=\"FBOViewport\"\n"
154 " parent=\"Viewport\"\n"
155 " library=\"System\"\n"
156 " pointerfieldtypes=\"both\"\n"
157 " structure=\"concrete\"\n"
158 " systemcomponent=\"true\"\n"
159 " parentsystemcomponent=\"true\"\n"
160 " decoratable=\"false\"\n"
161 " docGroupBase=\"GrpSystemWindowFBO\"\n"
162 " >\n"
163 "\\ingroup GrpSystemWindowViewports\n"
164 "\n"
165 "A viewport using a framebuffer object for output.\n"
166 "\t<Field\n"
167 "\t\tname=\"frameBufferObject\"\n"
168 "\t\ttype=\"FrameBufferObjectPtr\"\n"
169 "\t\tcardinality=\"single\"\n"
170 "\t\tvisibility=\"external\"\n"
171 "\t\taccess=\"public\"\n"
172 "\t>\n"
173 " FramebufferObject to write to.\n"
174 "\t</Field>\n"
175 "</FieldContainer>\n",
176 "\\ingroup GrpSystemWindowViewports\n"
177 "\n"
178 "A viewport using a framebuffer object for output.\n"
181 /*------------------------------ get -----------------------------------*/
183 FieldContainerType &FBOViewportBase::getType(void)
185 return _type;
188 const FieldContainerType &FBOViewportBase::getType(void) const
190 return _type;
193 UInt32 FBOViewportBase::getContainerSize(void) const
195 return sizeof(FBOViewport);
198 /*------------------------- decorator get ------------------------------*/
201 //! Get the FBOViewport::_sfFrameBufferObject field.
202 const SFUnrecFrameBufferObjectPtr *FBOViewportBase::getSFFrameBufferObject(void) const
204 return &_sfFrameBufferObject;
207 SFUnrecFrameBufferObjectPtr *FBOViewportBase::editSFFrameBufferObject(void)
209 editSField(FrameBufferObjectFieldMask);
211 return &_sfFrameBufferObject;
214 //! Get the value of the FBOViewport::_sfFrameBufferObject field.
215 FrameBufferObject * FBOViewportBase::getFrameBufferObject(void) const
217 return _sfFrameBufferObject.getValue();
220 //! Set the value of the FBOViewport::_sfFrameBufferObject field.
221 void FBOViewportBase::setFrameBufferObject(FrameBufferObject * const value)
223 editSField(FrameBufferObjectFieldMask);
225 _sfFrameBufferObject.setValue(value);
233 /*------------------------------ access -----------------------------------*/
235 SizeT FBOViewportBase::getBinSize(ConstFieldMaskArg whichField)
237 SizeT returnValue = Inherited::getBinSize(whichField);
239 if(FieldBits::NoField != (FrameBufferObjectFieldMask & whichField))
241 returnValue += _sfFrameBufferObject.getBinSize();
244 return returnValue;
247 void FBOViewportBase::copyToBin(BinaryDataHandler &pMem,
248 ConstFieldMaskArg whichField)
250 Inherited::copyToBin(pMem, whichField);
252 if(FieldBits::NoField != (FrameBufferObjectFieldMask & whichField))
254 _sfFrameBufferObject.copyToBin(pMem);
258 void FBOViewportBase::copyFromBin(BinaryDataHandler &pMem,
259 ConstFieldMaskArg whichField)
261 Inherited::copyFromBin(pMem, whichField);
263 if(FieldBits::NoField != (FrameBufferObjectFieldMask & whichField))
265 editSField(FrameBufferObjectFieldMask);
266 _sfFrameBufferObject.copyFromBin(pMem);
270 //! create a new instance of the class
271 FBOViewportTransitPtr FBOViewportBase::createLocal(BitVector bFlags)
273 FBOViewportTransitPtr fc;
275 if(getClassType().getPrototype() != NULL)
277 FieldContainerTransitPtr tmpPtr =
278 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
280 fc = dynamic_pointer_cast<FBOViewport>(tmpPtr);
283 return fc;
286 //! create a new instance of the class, copy the container flags
287 FBOViewportTransitPtr FBOViewportBase::createDependent(BitVector bFlags)
289 FBOViewportTransitPtr fc;
291 if(getClassType().getPrototype() != NULL)
293 FieldContainerTransitPtr tmpPtr =
294 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
296 fc = dynamic_pointer_cast<FBOViewport>(tmpPtr);
299 return fc;
302 //! create a new instance of the class
303 FBOViewportTransitPtr FBOViewportBase::create(void)
305 FBOViewportTransitPtr fc;
307 if(getClassType().getPrototype() != NULL)
309 FieldContainerTransitPtr tmpPtr =
310 getClassType().getPrototype()-> shallowCopy();
312 fc = dynamic_pointer_cast<FBOViewport>(tmpPtr);
315 return fc;
318 FBOViewport *FBOViewportBase::createEmptyLocal(BitVector bFlags)
320 FBOViewport *returnValue;
322 newPtr<FBOViewport>(returnValue, bFlags);
324 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
326 return returnValue;
329 //! create an empty new instance of the class, do not copy the prototype
330 FBOViewport *FBOViewportBase::createEmpty(void)
332 FBOViewport *returnValue;
334 newPtr<FBOViewport>(returnValue, Thread::getCurrentLocalFlags());
336 returnValue->_pFieldFlags->_bNamespaceMask &=
337 ~Thread::getCurrentLocalFlags();
339 return returnValue;
343 FieldContainerTransitPtr FBOViewportBase::shallowCopyLocal(
344 BitVector bFlags) const
346 FBOViewport *tmpPtr;
348 newPtr(tmpPtr, dynamic_cast<const FBOViewport *>(this), bFlags);
350 FieldContainerTransitPtr returnValue(tmpPtr);
352 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
354 return returnValue;
357 FieldContainerTransitPtr FBOViewportBase::shallowCopyDependent(
358 BitVector bFlags) const
360 FBOViewport *tmpPtr;
362 newPtr(tmpPtr, dynamic_cast<const FBOViewport *>(this), ~bFlags);
364 FieldContainerTransitPtr returnValue(tmpPtr);
366 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
368 return returnValue;
371 FieldContainerTransitPtr FBOViewportBase::shallowCopy(void) const
373 FBOViewport *tmpPtr;
375 newPtr(tmpPtr,
376 dynamic_cast<const FBOViewport *>(this),
377 Thread::getCurrentLocalFlags());
379 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
381 FieldContainerTransitPtr returnValue(tmpPtr);
383 return returnValue;
389 /*------------------------- constructors ----------------------------------*/
391 FBOViewportBase::FBOViewportBase(void) :
392 Inherited(),
393 _sfFrameBufferObject (NULL)
397 FBOViewportBase::FBOViewportBase(const FBOViewportBase &source) :
398 Inherited(source),
399 _sfFrameBufferObject (NULL)
404 /*-------------------------- destructors ----------------------------------*/
406 FBOViewportBase::~FBOViewportBase(void)
410 void FBOViewportBase::onCreate(const FBOViewport *source)
412 Inherited::onCreate(source);
414 if(source != NULL)
416 FBOViewport *pThis = static_cast<FBOViewport *>(this);
418 pThis->setFrameBufferObject(source->getFrameBufferObject());
422 GetFieldHandlePtr FBOViewportBase::getHandleFrameBufferObject (void) const
424 SFUnrecFrameBufferObjectPtr::GetHandlePtr returnValue(
425 new SFUnrecFrameBufferObjectPtr::GetHandle(
426 &_sfFrameBufferObject,
427 this->getType().getFieldDesc(FrameBufferObjectFieldId),
428 const_cast<FBOViewportBase *>(this)));
430 return returnValue;
433 EditFieldHandlePtr FBOViewportBase::editHandleFrameBufferObject(void)
435 SFUnrecFrameBufferObjectPtr::EditHandlePtr returnValue(
436 new SFUnrecFrameBufferObjectPtr::EditHandle(
437 &_sfFrameBufferObject,
438 this->getType().getFieldDesc(FrameBufferObjectFieldId),
439 this));
441 returnValue->setSetMethod(
442 boost::bind(&FBOViewport::setFrameBufferObject,
443 static_cast<FBOViewport *>(this), _1));
445 editSField(FrameBufferObjectFieldMask);
447 return returnValue;
451 #ifdef OSG_MT_CPTR_ASPECT
452 void FBOViewportBase::execSyncV( FieldContainer &oFrom,
453 ConstFieldMaskArg whichField,
454 AspectOffsetStore &oOffsets,
455 ConstFieldMaskArg syncMode,
456 const UInt32 uiSyncInfo)
458 FBOViewport *pThis = static_cast<FBOViewport *>(this);
460 pThis->execSync(static_cast<FBOViewport *>(&oFrom),
461 whichField,
462 oOffsets,
463 syncMode,
464 uiSyncInfo);
466 #endif
469 #ifdef OSG_MT_CPTR_ASPECT
470 FieldContainer *FBOViewportBase::createAspectCopy(
471 const FieldContainer *pRefAspect) const
473 FBOViewport *returnValue;
475 newAspectCopy(returnValue,
476 dynamic_cast<const FBOViewport *>(pRefAspect),
477 dynamic_cast<const FBOViewport *>(this));
479 return returnValue;
481 #endif
483 void FBOViewportBase::resolveLinks(void)
485 Inherited::resolveLinks();
487 static_cast<FBOViewport *>(this)->setFrameBufferObject(NULL);
493 OSG_END_NAMESPACE