fixed: compile issue
[opensg.git] / Source / System / Window / FrameBufferObjects / OSGFrameBufferAttachmentBase.cpp
blob44566370f1eb4c4c264fdb358097359414d37afc
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 FrameBufferAttachment!
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 "OSGFrameBufferAttachmentBase.h"
67 #include "OSGFrameBufferAttachment.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::FrameBufferAttachment
78 FramebufferAttachment base class.
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var UInt16 FrameBufferAttachmentBase::_sfWidth
89 /*! \var UInt16 FrameBufferAttachmentBase::_sfHeight
93 /*! \var bool FrameBufferAttachmentBase::_sfReadBack
94 read back the render result into the texture image obj on
95 framebuffer object deactivate
99 /***************************************************************************\
100 * FieldType/FieldTrait Instantiation *
101 \***************************************************************************/
103 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
104 PointerType FieldTraits<FrameBufferAttachment *, nsOSG>::_type(
105 "FrameBufferAttachmentPtr",
106 "AttachmentContainerPtr",
107 FrameBufferAttachment::getClassType(),
108 nsOSG);
109 #endif
111 OSG_FIELDTRAITS_GETTYPE_NS(FrameBufferAttachment *, nsOSG)
113 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
114 FrameBufferAttachment *,
115 nsOSG)
117 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
118 FrameBufferAttachment *,
119 nsOSG)
121 /***************************************************************************\
122 * Field Description *
123 \***************************************************************************/
125 void FrameBufferAttachmentBase::classDescInserter(TypeObject &oType)
127 FieldDescriptionBase *pDesc = NULL;
130 pDesc = new SFUInt16::Description(
131 SFUInt16::getClassType(),
132 "width",
134 WidthFieldId, WidthFieldMask,
135 true,
136 (Field::SFDefaultFlags | Field::FStdAccess),
137 static_cast<FieldEditMethodSig>(&FrameBufferAttachment::editHandleWidth),
138 static_cast<FieldGetMethodSig >(&FrameBufferAttachment::getHandleWidth));
140 oType.addInitialDesc(pDesc);
142 pDesc = new SFUInt16::Description(
143 SFUInt16::getClassType(),
144 "height",
146 HeightFieldId, HeightFieldMask,
147 true,
148 (Field::SFDefaultFlags | Field::FStdAccess),
149 static_cast<FieldEditMethodSig>(&FrameBufferAttachment::editHandleHeight),
150 static_cast<FieldGetMethodSig >(&FrameBufferAttachment::getHandleHeight));
152 oType.addInitialDesc(pDesc);
154 pDesc = new SFBool::Description(
155 SFBool::getClassType(),
156 "readBack",
157 "read back the render result into the texture image obj on \n"
158 "framebuffer object deactivate\n",
159 ReadBackFieldId, ReadBackFieldMask,
160 false,
161 (Field::SFDefaultFlags | Field::FStdAccess),
162 static_cast<FieldEditMethodSig>(&FrameBufferAttachment::editHandleReadBack),
163 static_cast<FieldGetMethodSig >(&FrameBufferAttachment::getHandleReadBack));
165 oType.addInitialDesc(pDesc);
169 FrameBufferAttachmentBase::TypeObject FrameBufferAttachmentBase::_type(
170 FrameBufferAttachmentBase::getClassname(),
171 Inherited::getClassname(),
172 "FrameBufferAttachment",
173 nsOSG, //Namespace
174 NULL,
175 reinterpret_cast<InitContainerF>(&FrameBufferAttachment::initMethod),
176 reinterpret_cast<ExitContainerF>(&FrameBufferAttachment::exitMethod),
177 reinterpret_cast<InitalInsertDescFunc>(
178 reinterpret_cast<void *>(&FrameBufferAttachment::classDescInserter)),
179 false,
181 "<?xml version=\"1.0\"?>\n"
182 "\n"
183 "<FieldContainer\n"
184 " name=\"FrameBufferAttachment\"\n"
185 " parent=\"AttachmentContainer\"\n"
186 " library=\"System\"\n"
187 " pointerfieldtypes=\"both\"\n"
188 " structure=\"abstract\"\n"
189 " systemcomponent=\"true\"\n"
190 " parentsystemcomponent=\"true\"\n"
191 " decoratable=\"false\"\n"
192 " docGroupBase=\"GrpSystemWindowFBO\"\n"
193 ">\n"
194 "FramebufferAttachment base class.\n"
195 "\t<Field\n"
196 "\t\tname=\"width\"\n"
197 "\t\ttype=\"UInt16\"\n"
198 "\t\tcardinality=\"single\"\n"
199 "\t\tvisibility=\"internal\"\n"
200 "\t\taccess=\"protected\"\n"
201 "\t>\n"
202 "\t</Field>\n"
203 "\t<Field\n"
204 "\t\tname=\"height\"\n"
205 "\t\ttype=\"UInt16\"\n"
206 "\t\tcardinality=\"single\"\n"
207 "\t\tvisibility=\"internal\"\n"
208 "\t\taccess=\"protected\"\n"
209 "\t>\n"
210 "\t</Field>\n"
211 " <Field\n"
212 " name=\"readBack\"\n"
213 " type=\"bool\"\n"
214 " cardinality=\"single\"\n"
215 " visibility=\"external\"\n"
216 " access=\"public\"\n"
217 " defaultValue=\"false\"\n"
218 " >\n"
219 " read back the render result into the texture image obj on \n"
220 " framebuffer object deactivate\n"
221 " </Field>\n"
222 "</FieldContainer>\n",
223 "FramebufferAttachment base class.\n"
226 /*------------------------------ get -----------------------------------*/
228 FieldContainerType &FrameBufferAttachmentBase::getType(void)
230 return _type;
233 const FieldContainerType &FrameBufferAttachmentBase::getType(void) const
235 return _type;
238 UInt32 FrameBufferAttachmentBase::getContainerSize(void) const
240 return sizeof(FrameBufferAttachment);
243 /*------------------------- decorator get ------------------------------*/
246 SFUInt16 *FrameBufferAttachmentBase::editSFWidth(void)
248 editSField(WidthFieldMask);
250 return &_sfWidth;
253 const SFUInt16 *FrameBufferAttachmentBase::getSFWidth(void) const
255 return &_sfWidth;
259 SFUInt16 *FrameBufferAttachmentBase::editSFHeight(void)
261 editSField(HeightFieldMask);
263 return &_sfHeight;
266 const SFUInt16 *FrameBufferAttachmentBase::getSFHeight(void) const
268 return &_sfHeight;
272 SFBool *FrameBufferAttachmentBase::editSFReadBack(void)
274 editSField(ReadBackFieldMask);
276 return &_sfReadBack;
279 const SFBool *FrameBufferAttachmentBase::getSFReadBack(void) const
281 return &_sfReadBack;
289 /*------------------------------ access -----------------------------------*/
291 SizeT FrameBufferAttachmentBase::getBinSize(ConstFieldMaskArg whichField)
293 SizeT returnValue = Inherited::getBinSize(whichField);
295 if(FieldBits::NoField != (WidthFieldMask & whichField))
297 returnValue += _sfWidth.getBinSize();
299 if(FieldBits::NoField != (HeightFieldMask & whichField))
301 returnValue += _sfHeight.getBinSize();
303 if(FieldBits::NoField != (ReadBackFieldMask & whichField))
305 returnValue += _sfReadBack.getBinSize();
308 return returnValue;
311 void FrameBufferAttachmentBase::copyToBin(BinaryDataHandler &pMem,
312 ConstFieldMaskArg whichField)
314 Inherited::copyToBin(pMem, whichField);
316 if(FieldBits::NoField != (WidthFieldMask & whichField))
318 _sfWidth.copyToBin(pMem);
320 if(FieldBits::NoField != (HeightFieldMask & whichField))
322 _sfHeight.copyToBin(pMem);
324 if(FieldBits::NoField != (ReadBackFieldMask & whichField))
326 _sfReadBack.copyToBin(pMem);
330 void FrameBufferAttachmentBase::copyFromBin(BinaryDataHandler &pMem,
331 ConstFieldMaskArg whichField)
333 Inherited::copyFromBin(pMem, whichField);
335 if(FieldBits::NoField != (WidthFieldMask & whichField))
337 editSField(WidthFieldMask);
338 _sfWidth.copyFromBin(pMem);
340 if(FieldBits::NoField != (HeightFieldMask & whichField))
342 editSField(HeightFieldMask);
343 _sfHeight.copyFromBin(pMem);
345 if(FieldBits::NoField != (ReadBackFieldMask & whichField))
347 editSField(ReadBackFieldMask);
348 _sfReadBack.copyFromBin(pMem);
355 /*------------------------- constructors ----------------------------------*/
357 FrameBufferAttachmentBase::FrameBufferAttachmentBase(void) :
358 Inherited(),
359 _sfWidth (),
360 _sfHeight (),
361 _sfReadBack (bool(false))
365 FrameBufferAttachmentBase::FrameBufferAttachmentBase(const FrameBufferAttachmentBase &source) :
366 Inherited(source),
367 _sfWidth (source._sfWidth ),
368 _sfHeight (source._sfHeight ),
369 _sfReadBack (source._sfReadBack )
374 /*-------------------------- destructors ----------------------------------*/
376 FrameBufferAttachmentBase::~FrameBufferAttachmentBase(void)
381 GetFieldHandlePtr FrameBufferAttachmentBase::getHandleWidth (void) const
383 SFUInt16::GetHandlePtr returnValue(
384 new SFUInt16::GetHandle(
385 &_sfWidth,
386 this->getType().getFieldDesc(WidthFieldId),
387 const_cast<FrameBufferAttachmentBase *>(this)));
389 return returnValue;
392 EditFieldHandlePtr FrameBufferAttachmentBase::editHandleWidth (void)
394 SFUInt16::EditHandlePtr returnValue(
395 new SFUInt16::EditHandle(
396 &_sfWidth,
397 this->getType().getFieldDesc(WidthFieldId),
398 this));
401 editSField(WidthFieldMask);
403 return returnValue;
406 GetFieldHandlePtr FrameBufferAttachmentBase::getHandleHeight (void) const
408 SFUInt16::GetHandlePtr returnValue(
409 new SFUInt16::GetHandle(
410 &_sfHeight,
411 this->getType().getFieldDesc(HeightFieldId),
412 const_cast<FrameBufferAttachmentBase *>(this)));
414 return returnValue;
417 EditFieldHandlePtr FrameBufferAttachmentBase::editHandleHeight (void)
419 SFUInt16::EditHandlePtr returnValue(
420 new SFUInt16::EditHandle(
421 &_sfHeight,
422 this->getType().getFieldDesc(HeightFieldId),
423 this));
426 editSField(HeightFieldMask);
428 return returnValue;
431 GetFieldHandlePtr FrameBufferAttachmentBase::getHandleReadBack (void) const
433 SFBool::GetHandlePtr returnValue(
434 new SFBool::GetHandle(
435 &_sfReadBack,
436 this->getType().getFieldDesc(ReadBackFieldId),
437 const_cast<FrameBufferAttachmentBase *>(this)));
439 return returnValue;
442 EditFieldHandlePtr FrameBufferAttachmentBase::editHandleReadBack (void)
444 SFBool::EditHandlePtr returnValue(
445 new SFBool::EditHandle(
446 &_sfReadBack,
447 this->getType().getFieldDesc(ReadBackFieldId),
448 this));
451 editSField(ReadBackFieldMask);
453 return returnValue;
457 #ifdef OSG_MT_CPTR_ASPECT
458 void FrameBufferAttachmentBase::execSyncV( FieldContainer &oFrom,
459 ConstFieldMaskArg whichField,
460 AspectOffsetStore &oOffsets,
461 ConstFieldMaskArg syncMode,
462 const UInt32 uiSyncInfo)
464 FrameBufferAttachment *pThis = static_cast<FrameBufferAttachment *>(this);
466 pThis->execSync(static_cast<FrameBufferAttachment *>(&oFrom),
467 whichField,
468 oOffsets,
469 syncMode,
470 uiSyncInfo);
472 #endif
476 void FrameBufferAttachmentBase::resolveLinks(void)
478 Inherited::resolveLinks();
484 OSG_END_NAMESPACE