fixed: compile issue
[opensg.git] / Source / System / Window / FrameBufferObjects / OSGFrameBufferObjectBase.cpp
blobb7292cb9f62b805156b7d0c6c8f1dc48447fdeeb
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 FrameBufferObject!
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 "OSGFrameBufferAttachment.h" // ColorAttachments Class
67 #include "OSGFrameBufferObjectBase.h"
68 #include "OSGFrameBufferObject.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::FrameBufferObject
79 Framebuffer object. Encapsulates FBOs as defined by the EXT_framebuffer_object
80 OpenGL extension.
83 /***************************************************************************\
84 * Field Documentation *
85 \***************************************************************************/
87 /*! \var GLenum FrameBufferObjectBase::_sfGLId
88 The OpenGL texture id for this frame buffer object.
91 /*! \var GLenum FrameBufferObjectBase::_sfMultiSampleGLId
92 The OpenGL texture id for this frame buffer object.
95 /*! \var FrameBufferAttachment * FrameBufferObjectBase::_mfColorAttachments
96 GL_COLOR_ATTACHMENTX slots, position defines X.
97 This defines the target buffers for color attachments.
100 /*! \var GLenum FrameBufferObjectBase::_mfDrawBuffers
101 The target draw buffers. ex: GL_COLOR_ATTACHMENT0.
102 These are used to call DrawBuffers to tell OpenGL what targets
103 to render into.
106 /*! \var FrameBufferAttachment * FrameBufferObjectBase::_sfDepthAttachment
107 GL_DEPTH_ATTACHMENT slot. The target for depth values.
110 /*! \var FrameBufferAttachment * FrameBufferObjectBase::_sfStencilAttachment
111 GL_STENCIL_ATTACHMENT slot.
114 /*! \var UInt16 FrameBufferObjectBase::_sfWidth
118 /*! \var UInt16 FrameBufferObjectBase::_sfHeight
122 /*! \var bool FrameBufferObjectBase::_sfPostProcessOnDeactivate
123 Enable to check and generate mipmap level or copy the texture buffer
124 result back to the image
127 /*! \var bool FrameBufferObjectBase::_sfEnableMultiSample
131 /*! \var UInt32 FrameBufferObjectBase::_sfColorSamples
135 /*! \var UInt32 FrameBufferObjectBase::_sfCoverageSamples
139 /*! \var bool FrameBufferObjectBase::_sfFixedSampleLocation
143 /*! \var FrameBufferAttachment * FrameBufferObjectBase::_mfMsaaColorAttachments
144 GL_COLOR_ATTACHMENTX slots, position defines X.
145 This defines the target buffers for color attachments.
148 /*! \var FrameBufferAttachment * FrameBufferObjectBase::_sfMsaaDepthAttachment
149 GL_DEPTH_ATTACHMENT slot. The target for depth values.
152 /*! \var FrameBufferAttachment * FrameBufferObjectBase::_sfMsaaStencilAttachment
153 GL_STENCIL_ATTACHMENT slot.
157 /***************************************************************************\
158 * FieldType/FieldTrait Instantiation *
159 \***************************************************************************/
161 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
162 PointerType FieldTraits<FrameBufferObject *, nsOSG>::_type(
163 "FrameBufferObjectPtr",
164 "AttachmentContainerPtr",
165 FrameBufferObject::getClassType(),
166 nsOSG);
167 #endif
169 OSG_FIELDTRAITS_GETTYPE_NS(FrameBufferObject *, nsOSG)
171 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
172 FrameBufferObject *,
173 nsOSG)
175 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
176 FrameBufferObject *,
177 nsOSG)
179 /***************************************************************************\
180 * Field Description *
181 \***************************************************************************/
183 void FrameBufferObjectBase::classDescInserter(TypeObject &oType)
185 FieldDescriptionBase *pDesc = NULL;
188 pDesc = new SFGLenum::Description(
189 SFGLenum::getClassType(),
190 "GLId",
191 "The OpenGL texture id for this frame buffer object.\n",
192 GLIdFieldId, GLIdFieldMask,
193 true,
194 (Field::FClusterLocal),
195 static_cast<FieldEditMethodSig>(&FrameBufferObject::editHandleGLId),
196 static_cast<FieldGetMethodSig >(&FrameBufferObject::getHandleGLId));
198 oType.addInitialDesc(pDesc);
200 pDesc = new SFGLenum::Description(
201 SFGLenum::getClassType(),
202 "multiSampleGLId",
203 "The OpenGL texture id for this frame buffer object.\n",
204 MultiSampleGLIdFieldId, MultiSampleGLIdFieldMask,
205 true,
206 (Field::FClusterLocal),
207 static_cast<FieldEditMethodSig>(&FrameBufferObject::editHandleMultiSampleGLId),
208 static_cast<FieldGetMethodSig >(&FrameBufferObject::getHandleMultiSampleGLId));
210 oType.addInitialDesc(pDesc);
212 pDesc = new MFUnrecFrameBufferAttachmentPtr::Description(
213 MFUnrecFrameBufferAttachmentPtr::getClassType(),
214 "colorAttachments",
215 "GL_COLOR_ATTACHMENTX slots, position defines X. \n"
216 "This defines the target buffers for color attachments.\n",
217 ColorAttachmentsFieldId, ColorAttachmentsFieldMask,
218 false,
219 (Field::MFDefaultFlags | Field::FStdAccess),
220 static_cast<FieldEditMethodSig>(&FrameBufferObject::editHandleColorAttachments),
221 static_cast<FieldGetMethodSig >(&FrameBufferObject::getHandleColorAttachments));
223 oType.addInitialDesc(pDesc);
225 pDesc = new MFGLenum::Description(
226 MFGLenum::getClassType(),
227 "drawBuffers",
228 "The target draw buffers. ex: GL_COLOR_ATTACHMENT0.\n"
229 "These are used to call DrawBuffers to tell OpenGL what targets\n"
230 "to render into.\n",
231 DrawBuffersFieldId, DrawBuffersFieldMask,
232 false,
233 (Field::MFDefaultFlags | Field::FStdAccess),
234 static_cast<FieldEditMethodSig>(&FrameBufferObject::editHandleDrawBuffers),
235 static_cast<FieldGetMethodSig >(&FrameBufferObject::getHandleDrawBuffers));
237 oType.addInitialDesc(pDesc);
239 pDesc = new SFUnrecFrameBufferAttachmentPtr::Description(
240 SFUnrecFrameBufferAttachmentPtr::getClassType(),
241 "depthAttachment",
242 "GL_DEPTH_ATTACHMENT slot. The target for depth values.\n",
243 DepthAttachmentFieldId, DepthAttachmentFieldMask,
244 false,
245 (Field::SFDefaultFlags | Field::FStdAccess),
246 static_cast<FieldEditMethodSig>(&FrameBufferObject::editHandleDepthAttachment),
247 static_cast<FieldGetMethodSig >(&FrameBufferObject::getHandleDepthAttachment));
249 oType.addInitialDesc(pDesc);
251 pDesc = new SFUnrecFrameBufferAttachmentPtr::Description(
252 SFUnrecFrameBufferAttachmentPtr::getClassType(),
253 "stencilAttachment",
254 "GL_STENCIL_ATTACHMENT slot.\n",
255 StencilAttachmentFieldId, StencilAttachmentFieldMask,
256 false,
257 (Field::SFDefaultFlags | Field::FStdAccess),
258 static_cast<FieldEditMethodSig>(&FrameBufferObject::editHandleStencilAttachment),
259 static_cast<FieldGetMethodSig >(&FrameBufferObject::getHandleStencilAttachment));
261 oType.addInitialDesc(pDesc);
263 pDesc = new SFUInt16::Description(
264 SFUInt16::getClassType(),
265 "width",
267 WidthFieldId, WidthFieldMask,
268 false,
269 (Field::SFDefaultFlags | Field::FStdAccess),
270 static_cast<FieldEditMethodSig>(&FrameBufferObject::editHandleWidth),
271 static_cast<FieldGetMethodSig >(&FrameBufferObject::getHandleWidth));
273 oType.addInitialDesc(pDesc);
275 pDesc = new SFUInt16::Description(
276 SFUInt16::getClassType(),
277 "height",
279 HeightFieldId, HeightFieldMask,
280 false,
281 (Field::SFDefaultFlags | Field::FStdAccess),
282 static_cast<FieldEditMethodSig>(&FrameBufferObject::editHandleHeight),
283 static_cast<FieldGetMethodSig >(&FrameBufferObject::getHandleHeight));
285 oType.addInitialDesc(pDesc);
287 pDesc = new SFBool::Description(
288 SFBool::getClassType(),
289 "postProcessOnDeactivate",
290 "Enable to check and generate mipmap level or copy the texture buffer\n"
291 "result back to the image\n",
292 PostProcessOnDeactivateFieldId, PostProcessOnDeactivateFieldMask,
293 false,
294 (Field::SFDefaultFlags | Field::FStdAccess),
295 static_cast<FieldEditMethodSig>(&FrameBufferObject::editHandlePostProcessOnDeactivate),
296 static_cast<FieldGetMethodSig >(&FrameBufferObject::getHandlePostProcessOnDeactivate));
298 oType.addInitialDesc(pDesc);
300 pDesc = new SFBool::Description(
301 SFBool::getClassType(),
302 "enableMultiSample",
304 EnableMultiSampleFieldId, EnableMultiSampleFieldMask,
305 false,
306 (Field::SFDefaultFlags | Field::FStdAccess),
307 static_cast<FieldEditMethodSig>(&FrameBufferObject::editHandleEnableMultiSample),
308 static_cast<FieldGetMethodSig >(&FrameBufferObject::getHandleEnableMultiSample));
310 oType.addInitialDesc(pDesc);
312 pDesc = new SFUInt32::Description(
313 SFUInt32::getClassType(),
314 "colorSamples",
316 ColorSamplesFieldId, ColorSamplesFieldMask,
317 false,
318 (Field::SFDefaultFlags | Field::FStdAccess),
319 static_cast<FieldEditMethodSig>(&FrameBufferObject::editHandleColorSamples),
320 static_cast<FieldGetMethodSig >(&FrameBufferObject::getHandleColorSamples));
322 oType.addInitialDesc(pDesc);
324 pDesc = new SFUInt32::Description(
325 SFUInt32::getClassType(),
326 "coverageSamples",
328 CoverageSamplesFieldId, CoverageSamplesFieldMask,
329 false,
330 (Field::SFDefaultFlags | Field::FStdAccess),
331 static_cast<FieldEditMethodSig>(&FrameBufferObject::editHandleCoverageSamples),
332 static_cast<FieldGetMethodSig >(&FrameBufferObject::getHandleCoverageSamples));
334 oType.addInitialDesc(pDesc);
336 pDesc = new SFBool::Description(
337 SFBool::getClassType(),
338 "fixedSampleLocation",
340 FixedSampleLocationFieldId, FixedSampleLocationFieldMask,
341 false,
342 (Field::SFDefaultFlags | Field::FStdAccess),
343 static_cast<FieldEditMethodSig>(&FrameBufferObject::editHandleFixedSampleLocation),
344 static_cast<FieldGetMethodSig >(&FrameBufferObject::getHandleFixedSampleLocation));
346 oType.addInitialDesc(pDesc);
348 pDesc = new MFUnrecFrameBufferAttachmentPtr::Description(
349 MFUnrecFrameBufferAttachmentPtr::getClassType(),
350 "msaaColorAttachments",
351 "GL_COLOR_ATTACHMENTX slots, position defines X. \n"
352 "This defines the target buffers for color attachments.\n",
353 MsaaColorAttachmentsFieldId, MsaaColorAttachmentsFieldMask,
354 true,
355 (Field::FClusterLocal | Field::FThreadLocal),
356 static_cast<FieldEditMethodSig>(&FrameBufferObject::editHandleMsaaColorAttachments),
357 static_cast<FieldGetMethodSig >(&FrameBufferObject::getHandleMsaaColorAttachments));
359 oType.addInitialDesc(pDesc);
361 pDesc = new SFUnrecFrameBufferAttachmentPtr::Description(
362 SFUnrecFrameBufferAttachmentPtr::getClassType(),
363 "msaaDepthAttachment",
364 "GL_DEPTH_ATTACHMENT slot. The target for depth values.\n",
365 MsaaDepthAttachmentFieldId, MsaaDepthAttachmentFieldMask,
366 true,
367 (Field::FClusterLocal | Field::FThreadLocal),
368 static_cast<FieldEditMethodSig>(&FrameBufferObject::editHandleMsaaDepthAttachment),
369 static_cast<FieldGetMethodSig >(&FrameBufferObject::getHandleMsaaDepthAttachment));
371 oType.addInitialDesc(pDesc);
373 pDesc = new SFUnrecFrameBufferAttachmentPtr::Description(
374 SFUnrecFrameBufferAttachmentPtr::getClassType(),
375 "msaaStencilAttachment",
376 "GL_STENCIL_ATTACHMENT slot.\n",
377 MsaaStencilAttachmentFieldId, MsaaStencilAttachmentFieldMask,
378 true,
379 (Field::FClusterLocal | Field::FThreadLocal),
380 static_cast<FieldEditMethodSig>(&FrameBufferObject::editHandleMsaaStencilAttachment),
381 static_cast<FieldGetMethodSig >(&FrameBufferObject::getHandleMsaaStencilAttachment));
383 oType.addInitialDesc(pDesc);
387 FrameBufferObjectBase::TypeObject FrameBufferObjectBase::_type(
388 FrameBufferObjectBase::getClassname(),
389 Inherited::getClassname(),
390 "NULL",
391 nsOSG, //Namespace
392 reinterpret_cast<PrototypeCreateF>(&FrameBufferObjectBase::createEmptyLocal),
393 reinterpret_cast<InitContainerF>(&FrameBufferObject::initMethod),
394 reinterpret_cast<ExitContainerF>(&FrameBufferObject::exitMethod),
395 reinterpret_cast<InitalInsertDescFunc>(
396 reinterpret_cast<void *>(&FrameBufferObject::classDescInserter)),
397 false,
399 "<?xml version=\"1.0\"?>\n"
400 "\n"
401 "<FieldContainer\n"
402 " name=\"FrameBufferObject\"\n"
403 " parent=\"AttachmentContainer\"\n"
404 " library=\"System\"\n"
405 " pointerfieldtypes=\"both\"\n"
406 " structure=\"concrete\"\n"
407 " systemcomponent=\"true\"\n"
408 " parentsystemcomponent=\"true\"\n"
409 " decoratable=\"false\"\n"
410 " docGroupBase=\"GrpSystemWindowFBO\"\n"
411 " >\n"
412 " Framebuffer object. Encapsulates FBOs as defined by the EXT_framebuffer_object\n"
413 " OpenGL extension.\n"
414 " <Field\n"
415 " name=\"GLId\"\n"
416 " type=\"GLenum\"\n"
417 " cardinality=\"single\"\n"
418 " visibility=\"internal\"\n"
419 " access=\"public\"\n"
420 " defaultValue=\"0\"\n"
421 " fieldFlags=\"FClusterLocal\"\n"
422 " >\n"
423 " The OpenGL texture id for this frame buffer object.\n"
424 " </Field>\n"
425 " <Field\n"
426 " name=\"multiSampleGLId\"\n"
427 " type=\"GLenum\"\n"
428 " cardinality=\"single\"\n"
429 " visibility=\"internal\"\n"
430 " access=\"public\"\n"
431 " defaultValue=\"0\"\n"
432 " fieldFlags=\"FClusterLocal\"\n"
433 " >\n"
434 " The OpenGL texture id for this frame buffer object.\n"
435 " </Field>\n"
436 " <Field\n"
437 " name=\"colorAttachments\"\n"
438 " type=\"FrameBufferAttachmentPtr\"\n"
439 " cardinality=\"multi\"\n"
440 " visibility=\"external\"\n"
441 " access=\"public\"\n"
442 " >\n"
443 " GL_COLOR_ATTACHMENTX slots, position defines X. \n"
444 " This defines the target buffers for color attachments.\n"
445 " </Field>\n"
446 " <Field\n"
447 " name=\"drawBuffers\"\n"
448 " type=\"GLenum\"\n"
449 " cardinality=\"multi\"\n"
450 " visibility=\"external\"\n"
451 " access=\"public\"\n"
452 " defaultValue=\"0\"\n"
453 " >\n"
454 " The target draw buffers. ex: GL_COLOR_ATTACHMENT0.\n"
455 " These are used to call DrawBuffers to tell OpenGL what targets\n"
456 " to render into.\n"
457 " </Field>\n"
458 " <Field\n"
459 " name=\"depthAttachment\"\n"
460 " type=\"FrameBufferAttachmentPtr\"\n"
461 " cardinality=\"single\"\n"
462 " visibility=\"external\"\n"
463 " access=\"public\"\n"
464 " >\n"
465 " GL_DEPTH_ATTACHMENT slot. The target for depth values.\n"
466 " </Field>\n"
467 " <Field\n"
468 " name=\"stencilAttachment\"\n"
469 " type=\"FrameBufferAttachmentPtr\"\n"
470 " cardinality=\"single\"\n"
471 " visibility=\"external\"\n"
472 " access=\"public\"\n"
473 " >\n"
474 " GL_STENCIL_ATTACHMENT slot.\n"
475 " </Field>\n"
476 " <Field\n"
477 " name=\"width\"\n"
478 " type=\"UInt16\"\n"
479 " cardinality=\"single\"\n"
480 " visibility=\"external\"\n"
481 " access=\"public\"\n"
482 " defaultValue=\"0\"\n"
483 " >\n"
484 " </Field>\n"
485 " <Field\n"
486 " name=\"height\"\n"
487 " type=\"UInt16\"\n"
488 " cardinality=\"single\"\n"
489 " visibility=\"external\"\n"
490 " access=\"public\"\n"
491 " defaultValue=\"0\"\n"
492 " >\n"
493 " </Field>\n"
494 "\n"
495 " <Field\n"
496 " name=\"postProcessOnDeactivate\"\n"
497 " type=\"bool\"\n"
498 " cardinality=\"single\"\n"
499 " visibility=\"external\"\n"
500 " access=\"public\"\n"
501 " defaultValue=\"false\"\n"
502 " >\n"
503 " Enable to check and generate mipmap level or copy the texture buffer\n"
504 " result back to the image\n"
505 " </Field>\n"
506 "\n"
507 "\n"
508 " <Field\n"
509 " name=\"enableMultiSample\"\n"
510 " type=\"bool\"\n"
511 " cardinality=\"single\"\n"
512 " visibility=\"external\"\n"
513 " access=\"public\"\n"
514 " defaultValue=\"false\"\n"
515 " >\n"
516 " </Field>\n"
517 "\n"
518 " <Field\n"
519 " name=\"colorSamples\"\n"
520 " type=\"UInt32\"\n"
521 " cardinality=\"single\"\n"
522 " visibility=\"external\"\n"
523 " access=\"public\"\n"
524 " defaultValue=\"4\"\n"
525 " >\n"
526 " </Field>\n"
527 "\n"
528 " <Field\n"
529 " name=\"coverageSamples\"\n"
530 " type=\"UInt32\"\n"
531 " cardinality=\"single\"\n"
532 " visibility=\"external\"\n"
533 " access=\"public\"\n"
534 " defaultValue=\"4\"\n"
535 " >\n"
536 " </Field>\n"
537 "\n"
538 " <Field\n"
539 " name=\"fixedSampleLocation\"\n"
540 " type=\"bool\"\n"
541 " cardinality=\"single\"\n"
542 " visibility=\"external\"\n"
543 " access=\"public\"\n"
544 " defaultValue=\"true\"\n"
545 " >\n"
546 " </Field>\n"
547 "\n"
548 "\n"
549 " <Field\n"
550 " name=\"msaaColorAttachments\"\n"
551 " type=\"FrameBufferAttachmentPtr\"\n"
552 " cardinality=\"multi\"\n"
553 " visibility=\"internal\"\n"
554 " access=\"protected\"\n"
555 " fieldFlags=\"FClusterLocal,FThreadLocal\"\n"
556 " >\n"
557 " GL_COLOR_ATTACHMENTX slots, position defines X. \n"
558 " This defines the target buffers for color attachments.\n"
559 " </Field>\n"
560 " <Field\n"
561 " name=\"msaaDepthAttachment\"\n"
562 " type=\"FrameBufferAttachmentPtr\"\n"
563 " cardinality=\"single\"\n"
564 " visibility=\"internal\"\n"
565 " access=\"protected\"\n"
566 " fieldFlags=\"FClusterLocal,FThreadLocal\"\n"
567 " >\n"
568 " GL_DEPTH_ATTACHMENT slot. The target for depth values.\n"
569 " </Field>\n"
570 " <Field\n"
571 " name=\"msaaStencilAttachment\"\n"
572 " type=\"FrameBufferAttachmentPtr\"\n"
573 " cardinality=\"single\"\n"
574 " visibility=\"internal\"\n"
575 " access=\"protected\"\n"
576 " fieldFlags=\"FClusterLocal,FThreadLocal\"\n"
577 " >\n"
578 " GL_STENCIL_ATTACHMENT slot.\n"
579 " </Field>\n"
580 "\n"
581 "</FieldContainer>\n",
582 "Framebuffer object. Encapsulates FBOs as defined by the EXT_framebuffer_object\n"
583 "OpenGL extension.\n"
586 /*------------------------------ get -----------------------------------*/
588 FieldContainerType &FrameBufferObjectBase::getType(void)
590 return _type;
593 const FieldContainerType &FrameBufferObjectBase::getType(void) const
595 return _type;
598 UInt32 FrameBufferObjectBase::getContainerSize(void) const
600 return sizeof(FrameBufferObject);
603 /*------------------------- decorator get ------------------------------*/
606 SFGLenum *FrameBufferObjectBase::editSFGLId(void)
608 editSField(GLIdFieldMask);
610 return &_sfGLId;
613 const SFGLenum *FrameBufferObjectBase::getSFGLId(void) const
615 return &_sfGLId;
619 SFGLenum *FrameBufferObjectBase::editSFMultiSampleGLId(void)
621 editSField(MultiSampleGLIdFieldMask);
623 return &_sfMultiSampleGLId;
626 const SFGLenum *FrameBufferObjectBase::getSFMultiSampleGLId(void) const
628 return &_sfMultiSampleGLId;
632 //! Get the FrameBufferObject::_mfColorAttachments field.
633 const MFUnrecFrameBufferAttachmentPtr *FrameBufferObjectBase::getMFColorAttachments(void) const
635 return &_mfColorAttachments;
638 MFUnrecFrameBufferAttachmentPtr *FrameBufferObjectBase::editMFColorAttachments(void)
640 editMField(ColorAttachmentsFieldMask, _mfColorAttachments);
642 return &_mfColorAttachments;
644 FrameBufferAttachment * FrameBufferObjectBase::getColorAttachments(const UInt32 index) const
646 return _mfColorAttachments[index];
649 MFGLenum *FrameBufferObjectBase::editMFDrawBuffers(void)
651 editMField(DrawBuffersFieldMask, _mfDrawBuffers);
653 return &_mfDrawBuffers;
656 const MFGLenum *FrameBufferObjectBase::getMFDrawBuffers(void) const
658 return &_mfDrawBuffers;
662 //! Get the FrameBufferObject::_sfDepthAttachment field.
663 const SFUnrecFrameBufferAttachmentPtr *FrameBufferObjectBase::getSFDepthAttachment(void) const
665 return &_sfDepthAttachment;
668 SFUnrecFrameBufferAttachmentPtr *FrameBufferObjectBase::editSFDepthAttachment(void)
670 editSField(DepthAttachmentFieldMask);
672 return &_sfDepthAttachment;
675 //! Get the value of the FrameBufferObject::_sfDepthAttachment field.
676 FrameBufferAttachment * FrameBufferObjectBase::getDepthAttachment(void) const
678 return _sfDepthAttachment.getValue();
681 //! Set the value of the FrameBufferObject::_sfDepthAttachment field.
682 void FrameBufferObjectBase::setDepthAttachment(FrameBufferAttachment * const value)
684 editSField(DepthAttachmentFieldMask);
686 _sfDepthAttachment.setValue(value);
690 //! Get the FrameBufferObject::_sfStencilAttachment field.
691 const SFUnrecFrameBufferAttachmentPtr *FrameBufferObjectBase::getSFStencilAttachment(void) const
693 return &_sfStencilAttachment;
696 SFUnrecFrameBufferAttachmentPtr *FrameBufferObjectBase::editSFStencilAttachment(void)
698 editSField(StencilAttachmentFieldMask);
700 return &_sfStencilAttachment;
703 //! Get the value of the FrameBufferObject::_sfStencilAttachment field.
704 FrameBufferAttachment * FrameBufferObjectBase::getStencilAttachment(void) const
706 return _sfStencilAttachment.getValue();
709 //! Set the value of the FrameBufferObject::_sfStencilAttachment field.
710 void FrameBufferObjectBase::setStencilAttachment(FrameBufferAttachment * const value)
712 editSField(StencilAttachmentFieldMask);
714 _sfStencilAttachment.setValue(value);
718 SFUInt16 *FrameBufferObjectBase::editSFWidth(void)
720 editSField(WidthFieldMask);
722 return &_sfWidth;
725 const SFUInt16 *FrameBufferObjectBase::getSFWidth(void) const
727 return &_sfWidth;
731 SFUInt16 *FrameBufferObjectBase::editSFHeight(void)
733 editSField(HeightFieldMask);
735 return &_sfHeight;
738 const SFUInt16 *FrameBufferObjectBase::getSFHeight(void) const
740 return &_sfHeight;
744 SFBool *FrameBufferObjectBase::editSFPostProcessOnDeactivate(void)
746 editSField(PostProcessOnDeactivateFieldMask);
748 return &_sfPostProcessOnDeactivate;
751 const SFBool *FrameBufferObjectBase::getSFPostProcessOnDeactivate(void) const
753 return &_sfPostProcessOnDeactivate;
757 SFBool *FrameBufferObjectBase::editSFEnableMultiSample(void)
759 editSField(EnableMultiSampleFieldMask);
761 return &_sfEnableMultiSample;
764 const SFBool *FrameBufferObjectBase::getSFEnableMultiSample(void) const
766 return &_sfEnableMultiSample;
770 SFUInt32 *FrameBufferObjectBase::editSFColorSamples(void)
772 editSField(ColorSamplesFieldMask);
774 return &_sfColorSamples;
777 const SFUInt32 *FrameBufferObjectBase::getSFColorSamples(void) const
779 return &_sfColorSamples;
783 SFUInt32 *FrameBufferObjectBase::editSFCoverageSamples(void)
785 editSField(CoverageSamplesFieldMask);
787 return &_sfCoverageSamples;
790 const SFUInt32 *FrameBufferObjectBase::getSFCoverageSamples(void) const
792 return &_sfCoverageSamples;
796 SFBool *FrameBufferObjectBase::editSFFixedSampleLocation(void)
798 editSField(FixedSampleLocationFieldMask);
800 return &_sfFixedSampleLocation;
803 const SFBool *FrameBufferObjectBase::getSFFixedSampleLocation(void) const
805 return &_sfFixedSampleLocation;
809 //! Get the FrameBufferObject::_mfMsaaColorAttachments field.
810 const MFUnrecFrameBufferAttachmentPtr *FrameBufferObjectBase::getMFMsaaColorAttachments(void) const
812 return &_mfMsaaColorAttachments;
815 MFUnrecFrameBufferAttachmentPtr *FrameBufferObjectBase::editMFMsaaColorAttachments(void)
817 editMField(MsaaColorAttachmentsFieldMask, _mfMsaaColorAttachments);
819 return &_mfMsaaColorAttachments;
821 FrameBufferAttachment * FrameBufferObjectBase::getMsaaColorAttachments(const UInt32 index) const
823 return _mfMsaaColorAttachments[index];
826 //! Get the FrameBufferObject::_sfMsaaDepthAttachment field.
827 const SFUnrecFrameBufferAttachmentPtr *FrameBufferObjectBase::getSFMsaaDepthAttachment(void) const
829 return &_sfMsaaDepthAttachment;
832 SFUnrecFrameBufferAttachmentPtr *FrameBufferObjectBase::editSFMsaaDepthAttachment(void)
834 editSField(MsaaDepthAttachmentFieldMask);
836 return &_sfMsaaDepthAttachment;
839 //! Get the value of the FrameBufferObject::_sfMsaaDepthAttachment field.
840 FrameBufferAttachment * FrameBufferObjectBase::getMsaaDepthAttachment(void) const
842 return _sfMsaaDepthAttachment.getValue();
845 //! Set the value of the FrameBufferObject::_sfMsaaDepthAttachment field.
846 void FrameBufferObjectBase::setMsaaDepthAttachment(FrameBufferAttachment * const value)
848 editSField(MsaaDepthAttachmentFieldMask);
850 _sfMsaaDepthAttachment.setValue(value);
854 //! Get the FrameBufferObject::_sfMsaaStencilAttachment field.
855 const SFUnrecFrameBufferAttachmentPtr *FrameBufferObjectBase::getSFMsaaStencilAttachment(void) const
857 return &_sfMsaaStencilAttachment;
860 SFUnrecFrameBufferAttachmentPtr *FrameBufferObjectBase::editSFMsaaStencilAttachment(void)
862 editSField(MsaaStencilAttachmentFieldMask);
864 return &_sfMsaaStencilAttachment;
867 //! Get the value of the FrameBufferObject::_sfMsaaStencilAttachment field.
868 FrameBufferAttachment * FrameBufferObjectBase::getMsaaStencilAttachment(void) const
870 return _sfMsaaStencilAttachment.getValue();
873 //! Set the value of the FrameBufferObject::_sfMsaaStencilAttachment field.
874 void FrameBufferObjectBase::setMsaaStencilAttachment(FrameBufferAttachment * const value)
876 editSField(MsaaStencilAttachmentFieldMask);
878 _sfMsaaStencilAttachment.setValue(value);
884 void FrameBufferObjectBase::pushToColorAttachments(FrameBufferAttachment * const value)
886 editMField(ColorAttachmentsFieldMask, _mfColorAttachments);
888 _mfColorAttachments.push_back(value);
891 void FrameBufferObjectBase::assignColorAttachments(const MFUnrecFrameBufferAttachmentPtr &value)
893 MFUnrecFrameBufferAttachmentPtr::const_iterator elemIt =
894 value.begin();
895 MFUnrecFrameBufferAttachmentPtr::const_iterator elemEnd =
896 value.end ();
898 static_cast<FrameBufferObject *>(this)->clearColorAttachments();
900 while(elemIt != elemEnd)
902 this->pushToColorAttachments(*elemIt);
904 ++elemIt;
908 void FrameBufferObjectBase::removeFromColorAttachments(UInt32 uiIndex)
910 if(uiIndex < _mfColorAttachments.size())
912 editMField(ColorAttachmentsFieldMask, _mfColorAttachments);
914 _mfColorAttachments.erase(uiIndex);
918 void FrameBufferObjectBase::removeObjFromColorAttachments(FrameBufferAttachment * const value)
920 Int32 iElemIdx = _mfColorAttachments.findIndex(value);
922 if(iElemIdx != -1)
924 editMField(ColorAttachmentsFieldMask, _mfColorAttachments);
926 _mfColorAttachments.erase(iElemIdx);
929 void FrameBufferObjectBase::clearColorAttachments(void)
931 editMField(ColorAttachmentsFieldMask, _mfColorAttachments);
934 _mfColorAttachments.clear();
937 void FrameBufferObjectBase::pushToMsaaColorAttachments(FrameBufferAttachment * const value)
939 editMField(MsaaColorAttachmentsFieldMask, _mfMsaaColorAttachments);
941 _mfMsaaColorAttachments.push_back(value);
944 void FrameBufferObjectBase::assignMsaaColorAttachments(const MFUnrecFrameBufferAttachmentPtr &value)
946 MFUnrecFrameBufferAttachmentPtr::const_iterator elemIt =
947 value.begin();
948 MFUnrecFrameBufferAttachmentPtr::const_iterator elemEnd =
949 value.end ();
951 static_cast<FrameBufferObject *>(this)->clearMsaaColorAttachments();
953 while(elemIt != elemEnd)
955 this->pushToMsaaColorAttachments(*elemIt);
957 ++elemIt;
961 void FrameBufferObjectBase::removeFromMsaaColorAttachments(UInt32 uiIndex)
963 if(uiIndex < _mfMsaaColorAttachments.size())
965 editMField(MsaaColorAttachmentsFieldMask, _mfMsaaColorAttachments);
967 _mfMsaaColorAttachments.erase(uiIndex);
971 void FrameBufferObjectBase::removeObjFromMsaaColorAttachments(FrameBufferAttachment * const value)
973 Int32 iElemIdx = _mfMsaaColorAttachments.findIndex(value);
975 if(iElemIdx != -1)
977 editMField(MsaaColorAttachmentsFieldMask, _mfMsaaColorAttachments);
979 _mfMsaaColorAttachments.erase(iElemIdx);
982 void FrameBufferObjectBase::clearMsaaColorAttachments(void)
984 editMField(MsaaColorAttachmentsFieldMask, _mfMsaaColorAttachments);
987 _mfMsaaColorAttachments.clear();
992 /*------------------------------ access -----------------------------------*/
994 SizeT FrameBufferObjectBase::getBinSize(ConstFieldMaskArg whichField)
996 SizeT returnValue = Inherited::getBinSize(whichField);
998 if(FieldBits::NoField != (GLIdFieldMask & whichField))
1000 returnValue += _sfGLId.getBinSize();
1002 if(FieldBits::NoField != (MultiSampleGLIdFieldMask & whichField))
1004 returnValue += _sfMultiSampleGLId.getBinSize();
1006 if(FieldBits::NoField != (ColorAttachmentsFieldMask & whichField))
1008 returnValue += _mfColorAttachments.getBinSize();
1010 if(FieldBits::NoField != (DrawBuffersFieldMask & whichField))
1012 returnValue += _mfDrawBuffers.getBinSize();
1014 if(FieldBits::NoField != (DepthAttachmentFieldMask & whichField))
1016 returnValue += _sfDepthAttachment.getBinSize();
1018 if(FieldBits::NoField != (StencilAttachmentFieldMask & whichField))
1020 returnValue += _sfStencilAttachment.getBinSize();
1022 if(FieldBits::NoField != (WidthFieldMask & whichField))
1024 returnValue += _sfWidth.getBinSize();
1026 if(FieldBits::NoField != (HeightFieldMask & whichField))
1028 returnValue += _sfHeight.getBinSize();
1030 if(FieldBits::NoField != (PostProcessOnDeactivateFieldMask & whichField))
1032 returnValue += _sfPostProcessOnDeactivate.getBinSize();
1034 if(FieldBits::NoField != (EnableMultiSampleFieldMask & whichField))
1036 returnValue += _sfEnableMultiSample.getBinSize();
1038 if(FieldBits::NoField != (ColorSamplesFieldMask & whichField))
1040 returnValue += _sfColorSamples.getBinSize();
1042 if(FieldBits::NoField != (CoverageSamplesFieldMask & whichField))
1044 returnValue += _sfCoverageSamples.getBinSize();
1046 if(FieldBits::NoField != (FixedSampleLocationFieldMask & whichField))
1048 returnValue += _sfFixedSampleLocation.getBinSize();
1050 if(FieldBits::NoField != (MsaaColorAttachmentsFieldMask & whichField))
1052 returnValue += _mfMsaaColorAttachments.getBinSize();
1054 if(FieldBits::NoField != (MsaaDepthAttachmentFieldMask & whichField))
1056 returnValue += _sfMsaaDepthAttachment.getBinSize();
1058 if(FieldBits::NoField != (MsaaStencilAttachmentFieldMask & whichField))
1060 returnValue += _sfMsaaStencilAttachment.getBinSize();
1063 return returnValue;
1066 void FrameBufferObjectBase::copyToBin(BinaryDataHandler &pMem,
1067 ConstFieldMaskArg whichField)
1069 Inherited::copyToBin(pMem, whichField);
1071 if(FieldBits::NoField != (GLIdFieldMask & whichField))
1073 _sfGLId.copyToBin(pMem);
1075 if(FieldBits::NoField != (MultiSampleGLIdFieldMask & whichField))
1077 _sfMultiSampleGLId.copyToBin(pMem);
1079 if(FieldBits::NoField != (ColorAttachmentsFieldMask & whichField))
1081 _mfColorAttachments.copyToBin(pMem);
1083 if(FieldBits::NoField != (DrawBuffersFieldMask & whichField))
1085 _mfDrawBuffers.copyToBin(pMem);
1087 if(FieldBits::NoField != (DepthAttachmentFieldMask & whichField))
1089 _sfDepthAttachment.copyToBin(pMem);
1091 if(FieldBits::NoField != (StencilAttachmentFieldMask & whichField))
1093 _sfStencilAttachment.copyToBin(pMem);
1095 if(FieldBits::NoField != (WidthFieldMask & whichField))
1097 _sfWidth.copyToBin(pMem);
1099 if(FieldBits::NoField != (HeightFieldMask & whichField))
1101 _sfHeight.copyToBin(pMem);
1103 if(FieldBits::NoField != (PostProcessOnDeactivateFieldMask & whichField))
1105 _sfPostProcessOnDeactivate.copyToBin(pMem);
1107 if(FieldBits::NoField != (EnableMultiSampleFieldMask & whichField))
1109 _sfEnableMultiSample.copyToBin(pMem);
1111 if(FieldBits::NoField != (ColorSamplesFieldMask & whichField))
1113 _sfColorSamples.copyToBin(pMem);
1115 if(FieldBits::NoField != (CoverageSamplesFieldMask & whichField))
1117 _sfCoverageSamples.copyToBin(pMem);
1119 if(FieldBits::NoField != (FixedSampleLocationFieldMask & whichField))
1121 _sfFixedSampleLocation.copyToBin(pMem);
1123 if(FieldBits::NoField != (MsaaColorAttachmentsFieldMask & whichField))
1125 _mfMsaaColorAttachments.copyToBin(pMem);
1127 if(FieldBits::NoField != (MsaaDepthAttachmentFieldMask & whichField))
1129 _sfMsaaDepthAttachment.copyToBin(pMem);
1131 if(FieldBits::NoField != (MsaaStencilAttachmentFieldMask & whichField))
1133 _sfMsaaStencilAttachment.copyToBin(pMem);
1137 void FrameBufferObjectBase::copyFromBin(BinaryDataHandler &pMem,
1138 ConstFieldMaskArg whichField)
1140 Inherited::copyFromBin(pMem, whichField);
1142 if(FieldBits::NoField != (GLIdFieldMask & whichField))
1144 editSField(GLIdFieldMask);
1145 _sfGLId.copyFromBin(pMem);
1147 if(FieldBits::NoField != (MultiSampleGLIdFieldMask & whichField))
1149 editSField(MultiSampleGLIdFieldMask);
1150 _sfMultiSampleGLId.copyFromBin(pMem);
1152 if(FieldBits::NoField != (ColorAttachmentsFieldMask & whichField))
1154 editMField(ColorAttachmentsFieldMask, _mfColorAttachments);
1155 _mfColorAttachments.copyFromBin(pMem);
1157 if(FieldBits::NoField != (DrawBuffersFieldMask & whichField))
1159 editMField(DrawBuffersFieldMask, _mfDrawBuffers);
1160 _mfDrawBuffers.copyFromBin(pMem);
1162 if(FieldBits::NoField != (DepthAttachmentFieldMask & whichField))
1164 editSField(DepthAttachmentFieldMask);
1165 _sfDepthAttachment.copyFromBin(pMem);
1167 if(FieldBits::NoField != (StencilAttachmentFieldMask & whichField))
1169 editSField(StencilAttachmentFieldMask);
1170 _sfStencilAttachment.copyFromBin(pMem);
1172 if(FieldBits::NoField != (WidthFieldMask & whichField))
1174 editSField(WidthFieldMask);
1175 _sfWidth.copyFromBin(pMem);
1177 if(FieldBits::NoField != (HeightFieldMask & whichField))
1179 editSField(HeightFieldMask);
1180 _sfHeight.copyFromBin(pMem);
1182 if(FieldBits::NoField != (PostProcessOnDeactivateFieldMask & whichField))
1184 editSField(PostProcessOnDeactivateFieldMask);
1185 _sfPostProcessOnDeactivate.copyFromBin(pMem);
1187 if(FieldBits::NoField != (EnableMultiSampleFieldMask & whichField))
1189 editSField(EnableMultiSampleFieldMask);
1190 _sfEnableMultiSample.copyFromBin(pMem);
1192 if(FieldBits::NoField != (ColorSamplesFieldMask & whichField))
1194 editSField(ColorSamplesFieldMask);
1195 _sfColorSamples.copyFromBin(pMem);
1197 if(FieldBits::NoField != (CoverageSamplesFieldMask & whichField))
1199 editSField(CoverageSamplesFieldMask);
1200 _sfCoverageSamples.copyFromBin(pMem);
1202 if(FieldBits::NoField != (FixedSampleLocationFieldMask & whichField))
1204 editSField(FixedSampleLocationFieldMask);
1205 _sfFixedSampleLocation.copyFromBin(pMem);
1207 if(FieldBits::NoField != (MsaaColorAttachmentsFieldMask & whichField))
1209 editMField(MsaaColorAttachmentsFieldMask, _mfMsaaColorAttachments);
1210 _mfMsaaColorAttachments.copyFromBin(pMem);
1212 if(FieldBits::NoField != (MsaaDepthAttachmentFieldMask & whichField))
1214 editSField(MsaaDepthAttachmentFieldMask);
1215 _sfMsaaDepthAttachment.copyFromBin(pMem);
1217 if(FieldBits::NoField != (MsaaStencilAttachmentFieldMask & whichField))
1219 editSField(MsaaStencilAttachmentFieldMask);
1220 _sfMsaaStencilAttachment.copyFromBin(pMem);
1224 //! create a new instance of the class
1225 FrameBufferObjectTransitPtr FrameBufferObjectBase::createLocal(BitVector bFlags)
1227 FrameBufferObjectTransitPtr fc;
1229 if(getClassType().getPrototype() != NULL)
1231 FieldContainerTransitPtr tmpPtr =
1232 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
1234 fc = dynamic_pointer_cast<FrameBufferObject>(tmpPtr);
1237 return fc;
1240 //! create a new instance of the class, copy the container flags
1241 FrameBufferObjectTransitPtr FrameBufferObjectBase::createDependent(BitVector bFlags)
1243 FrameBufferObjectTransitPtr fc;
1245 if(getClassType().getPrototype() != NULL)
1247 FieldContainerTransitPtr tmpPtr =
1248 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
1250 fc = dynamic_pointer_cast<FrameBufferObject>(tmpPtr);
1253 return fc;
1256 //! create a new instance of the class
1257 FrameBufferObjectTransitPtr FrameBufferObjectBase::create(void)
1259 FrameBufferObjectTransitPtr fc;
1261 if(getClassType().getPrototype() != NULL)
1263 FieldContainerTransitPtr tmpPtr =
1264 getClassType().getPrototype()-> shallowCopy();
1266 fc = dynamic_pointer_cast<FrameBufferObject>(tmpPtr);
1269 return fc;
1272 FrameBufferObject *FrameBufferObjectBase::createEmptyLocal(BitVector bFlags)
1274 FrameBufferObject *returnValue;
1276 newPtr<FrameBufferObject>(returnValue, bFlags);
1278 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
1280 return returnValue;
1283 //! create an empty new instance of the class, do not copy the prototype
1284 FrameBufferObject *FrameBufferObjectBase::createEmpty(void)
1286 FrameBufferObject *returnValue;
1288 newPtr<FrameBufferObject>(returnValue, Thread::getCurrentLocalFlags());
1290 returnValue->_pFieldFlags->_bNamespaceMask &=
1291 ~Thread::getCurrentLocalFlags();
1293 return returnValue;
1297 FieldContainerTransitPtr FrameBufferObjectBase::shallowCopyLocal(
1298 BitVector bFlags) const
1300 FrameBufferObject *tmpPtr;
1302 newPtr(tmpPtr, dynamic_cast<const FrameBufferObject *>(this), bFlags);
1304 FieldContainerTransitPtr returnValue(tmpPtr);
1306 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
1308 return returnValue;
1311 FieldContainerTransitPtr FrameBufferObjectBase::shallowCopyDependent(
1312 BitVector bFlags) const
1314 FrameBufferObject *tmpPtr;
1316 newPtr(tmpPtr, dynamic_cast<const FrameBufferObject *>(this), ~bFlags);
1318 FieldContainerTransitPtr returnValue(tmpPtr);
1320 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
1322 return returnValue;
1325 FieldContainerTransitPtr FrameBufferObjectBase::shallowCopy(void) const
1327 FrameBufferObject *tmpPtr;
1329 newPtr(tmpPtr,
1330 dynamic_cast<const FrameBufferObject *>(this),
1331 Thread::getCurrentLocalFlags());
1333 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
1335 FieldContainerTransitPtr returnValue(tmpPtr);
1337 return returnValue;
1343 /*------------------------- constructors ----------------------------------*/
1345 FrameBufferObjectBase::FrameBufferObjectBase(void) :
1346 Inherited(),
1347 _sfGLId (GLenum(0)),
1348 _sfMultiSampleGLId (GLenum(0)),
1349 _mfColorAttachments (),
1350 _mfDrawBuffers (GLenum(0)),
1351 _sfDepthAttachment (NULL),
1352 _sfStencilAttachment (NULL),
1353 _sfWidth (UInt16(0)),
1354 _sfHeight (UInt16(0)),
1355 _sfPostProcessOnDeactivate(bool(false)),
1356 _sfEnableMultiSample (bool(false)),
1357 _sfColorSamples (UInt32(4)),
1358 _sfCoverageSamples (UInt32(4)),
1359 _sfFixedSampleLocation (bool(true)),
1360 _mfMsaaColorAttachments (),
1361 _sfMsaaDepthAttachment (NULL),
1362 _sfMsaaStencilAttachment (NULL)
1366 FrameBufferObjectBase::FrameBufferObjectBase(const FrameBufferObjectBase &source) :
1367 Inherited(source),
1368 _sfGLId (source._sfGLId ),
1369 _sfMultiSampleGLId (source._sfMultiSampleGLId ),
1370 _mfColorAttachments (),
1371 _mfDrawBuffers (source._mfDrawBuffers ),
1372 _sfDepthAttachment (NULL),
1373 _sfStencilAttachment (NULL),
1374 _sfWidth (source._sfWidth ),
1375 _sfHeight (source._sfHeight ),
1376 _sfPostProcessOnDeactivate(source._sfPostProcessOnDeactivate),
1377 _sfEnableMultiSample (source._sfEnableMultiSample ),
1378 _sfColorSamples (source._sfColorSamples ),
1379 _sfCoverageSamples (source._sfCoverageSamples ),
1380 _sfFixedSampleLocation (source._sfFixedSampleLocation ),
1381 _mfMsaaColorAttachments (),
1382 _sfMsaaDepthAttachment (NULL),
1383 _sfMsaaStencilAttachment (NULL)
1388 /*-------------------------- destructors ----------------------------------*/
1390 FrameBufferObjectBase::~FrameBufferObjectBase(void)
1394 void FrameBufferObjectBase::onCreate(const FrameBufferObject *source)
1396 Inherited::onCreate(source);
1398 if(source != NULL)
1400 FrameBufferObject *pThis = static_cast<FrameBufferObject *>(this);
1402 MFUnrecFrameBufferAttachmentPtr::const_iterator ColorAttachmentsIt =
1403 source->_mfColorAttachments.begin();
1404 MFUnrecFrameBufferAttachmentPtr::const_iterator ColorAttachmentsEnd =
1405 source->_mfColorAttachments.end ();
1407 while(ColorAttachmentsIt != ColorAttachmentsEnd)
1409 pThis->pushToColorAttachments(*ColorAttachmentsIt);
1411 ++ColorAttachmentsIt;
1414 pThis->setDepthAttachment(source->getDepthAttachment());
1416 pThis->setStencilAttachment(source->getStencilAttachment());
1418 MFUnrecFrameBufferAttachmentPtr::const_iterator MsaaColorAttachmentsIt =
1419 source->_mfMsaaColorAttachments.begin();
1420 MFUnrecFrameBufferAttachmentPtr::const_iterator MsaaColorAttachmentsEnd =
1421 source->_mfMsaaColorAttachments.end ();
1423 while(MsaaColorAttachmentsIt != MsaaColorAttachmentsEnd)
1425 pThis->pushToMsaaColorAttachments(*MsaaColorAttachmentsIt);
1427 ++MsaaColorAttachmentsIt;
1430 pThis->setMsaaDepthAttachment(source->getMsaaDepthAttachment());
1432 pThis->setMsaaStencilAttachment(source->getMsaaStencilAttachment());
1436 GetFieldHandlePtr FrameBufferObjectBase::getHandleGLId (void) const
1438 SFGLenum::GetHandlePtr returnValue(
1439 new SFGLenum::GetHandle(
1440 &_sfGLId,
1441 this->getType().getFieldDesc(GLIdFieldId),
1442 const_cast<FrameBufferObjectBase *>(this)));
1444 return returnValue;
1447 EditFieldHandlePtr FrameBufferObjectBase::editHandleGLId (void)
1449 SFGLenum::EditHandlePtr returnValue(
1450 new SFGLenum::EditHandle(
1451 &_sfGLId,
1452 this->getType().getFieldDesc(GLIdFieldId),
1453 this));
1456 editSField(GLIdFieldMask);
1458 return returnValue;
1461 GetFieldHandlePtr FrameBufferObjectBase::getHandleMultiSampleGLId (void) const
1463 SFGLenum::GetHandlePtr returnValue(
1464 new SFGLenum::GetHandle(
1465 &_sfMultiSampleGLId,
1466 this->getType().getFieldDesc(MultiSampleGLIdFieldId),
1467 const_cast<FrameBufferObjectBase *>(this)));
1469 return returnValue;
1472 EditFieldHandlePtr FrameBufferObjectBase::editHandleMultiSampleGLId(void)
1474 SFGLenum::EditHandlePtr returnValue(
1475 new SFGLenum::EditHandle(
1476 &_sfMultiSampleGLId,
1477 this->getType().getFieldDesc(MultiSampleGLIdFieldId),
1478 this));
1481 editSField(MultiSampleGLIdFieldMask);
1483 return returnValue;
1486 GetFieldHandlePtr FrameBufferObjectBase::getHandleColorAttachments (void) const
1488 MFUnrecFrameBufferAttachmentPtr::GetHandlePtr returnValue(
1489 new MFUnrecFrameBufferAttachmentPtr::GetHandle(
1490 &_mfColorAttachments,
1491 this->getType().getFieldDesc(ColorAttachmentsFieldId),
1492 const_cast<FrameBufferObjectBase *>(this)));
1494 return returnValue;
1497 EditFieldHandlePtr FrameBufferObjectBase::editHandleColorAttachments(void)
1499 MFUnrecFrameBufferAttachmentPtr::EditHandlePtr returnValue(
1500 new MFUnrecFrameBufferAttachmentPtr::EditHandle(
1501 &_mfColorAttachments,
1502 this->getType().getFieldDesc(ColorAttachmentsFieldId),
1503 this));
1505 returnValue->setAddMethod(
1506 boost::bind(&FrameBufferObject::pushToColorAttachments,
1507 static_cast<FrameBufferObject *>(this), _1));
1508 returnValue->setRemoveMethod(
1509 boost::bind(&FrameBufferObject::removeFromColorAttachments,
1510 static_cast<FrameBufferObject *>(this), _1));
1511 returnValue->setRemoveObjMethod(
1512 boost::bind(&FrameBufferObject::removeObjFromColorAttachments,
1513 static_cast<FrameBufferObject *>(this), _1));
1514 returnValue->setClearMethod(
1515 boost::bind(&FrameBufferObject::clearColorAttachments,
1516 static_cast<FrameBufferObject *>(this)));
1518 editMField(ColorAttachmentsFieldMask, _mfColorAttachments);
1520 return returnValue;
1523 GetFieldHandlePtr FrameBufferObjectBase::getHandleDrawBuffers (void) const
1525 MFGLenum::GetHandlePtr returnValue(
1526 new MFGLenum::GetHandle(
1527 &_mfDrawBuffers,
1528 this->getType().getFieldDesc(DrawBuffersFieldId),
1529 const_cast<FrameBufferObjectBase *>(this)));
1531 return returnValue;
1534 EditFieldHandlePtr FrameBufferObjectBase::editHandleDrawBuffers (void)
1536 MFGLenum::EditHandlePtr returnValue(
1537 new MFGLenum::EditHandle(
1538 &_mfDrawBuffers,
1539 this->getType().getFieldDesc(DrawBuffersFieldId),
1540 this));
1543 editMField(DrawBuffersFieldMask, _mfDrawBuffers);
1545 return returnValue;
1548 GetFieldHandlePtr FrameBufferObjectBase::getHandleDepthAttachment (void) const
1550 SFUnrecFrameBufferAttachmentPtr::GetHandlePtr returnValue(
1551 new SFUnrecFrameBufferAttachmentPtr::GetHandle(
1552 &_sfDepthAttachment,
1553 this->getType().getFieldDesc(DepthAttachmentFieldId),
1554 const_cast<FrameBufferObjectBase *>(this)));
1556 return returnValue;
1559 EditFieldHandlePtr FrameBufferObjectBase::editHandleDepthAttachment(void)
1561 SFUnrecFrameBufferAttachmentPtr::EditHandlePtr returnValue(
1562 new SFUnrecFrameBufferAttachmentPtr::EditHandle(
1563 &_sfDepthAttachment,
1564 this->getType().getFieldDesc(DepthAttachmentFieldId),
1565 this));
1567 returnValue->setSetMethod(
1568 boost::bind(&FrameBufferObject::setDepthAttachment,
1569 static_cast<FrameBufferObject *>(this), _1));
1571 editSField(DepthAttachmentFieldMask);
1573 return returnValue;
1576 GetFieldHandlePtr FrameBufferObjectBase::getHandleStencilAttachment (void) const
1578 SFUnrecFrameBufferAttachmentPtr::GetHandlePtr returnValue(
1579 new SFUnrecFrameBufferAttachmentPtr::GetHandle(
1580 &_sfStencilAttachment,
1581 this->getType().getFieldDesc(StencilAttachmentFieldId),
1582 const_cast<FrameBufferObjectBase *>(this)));
1584 return returnValue;
1587 EditFieldHandlePtr FrameBufferObjectBase::editHandleStencilAttachment(void)
1589 SFUnrecFrameBufferAttachmentPtr::EditHandlePtr returnValue(
1590 new SFUnrecFrameBufferAttachmentPtr::EditHandle(
1591 &_sfStencilAttachment,
1592 this->getType().getFieldDesc(StencilAttachmentFieldId),
1593 this));
1595 returnValue->setSetMethod(
1596 boost::bind(&FrameBufferObject::setStencilAttachment,
1597 static_cast<FrameBufferObject *>(this), _1));
1599 editSField(StencilAttachmentFieldMask);
1601 return returnValue;
1604 GetFieldHandlePtr FrameBufferObjectBase::getHandleWidth (void) const
1606 SFUInt16::GetHandlePtr returnValue(
1607 new SFUInt16::GetHandle(
1608 &_sfWidth,
1609 this->getType().getFieldDesc(WidthFieldId),
1610 const_cast<FrameBufferObjectBase *>(this)));
1612 return returnValue;
1615 EditFieldHandlePtr FrameBufferObjectBase::editHandleWidth (void)
1617 SFUInt16::EditHandlePtr returnValue(
1618 new SFUInt16::EditHandle(
1619 &_sfWidth,
1620 this->getType().getFieldDesc(WidthFieldId),
1621 this));
1624 editSField(WidthFieldMask);
1626 return returnValue;
1629 GetFieldHandlePtr FrameBufferObjectBase::getHandleHeight (void) const
1631 SFUInt16::GetHandlePtr returnValue(
1632 new SFUInt16::GetHandle(
1633 &_sfHeight,
1634 this->getType().getFieldDesc(HeightFieldId),
1635 const_cast<FrameBufferObjectBase *>(this)));
1637 return returnValue;
1640 EditFieldHandlePtr FrameBufferObjectBase::editHandleHeight (void)
1642 SFUInt16::EditHandlePtr returnValue(
1643 new SFUInt16::EditHandle(
1644 &_sfHeight,
1645 this->getType().getFieldDesc(HeightFieldId),
1646 this));
1649 editSField(HeightFieldMask);
1651 return returnValue;
1654 GetFieldHandlePtr FrameBufferObjectBase::getHandlePostProcessOnDeactivate (void) const
1656 SFBool::GetHandlePtr returnValue(
1657 new SFBool::GetHandle(
1658 &_sfPostProcessOnDeactivate,
1659 this->getType().getFieldDesc(PostProcessOnDeactivateFieldId),
1660 const_cast<FrameBufferObjectBase *>(this)));
1662 return returnValue;
1665 EditFieldHandlePtr FrameBufferObjectBase::editHandlePostProcessOnDeactivate(void)
1667 SFBool::EditHandlePtr returnValue(
1668 new SFBool::EditHandle(
1669 &_sfPostProcessOnDeactivate,
1670 this->getType().getFieldDesc(PostProcessOnDeactivateFieldId),
1671 this));
1674 editSField(PostProcessOnDeactivateFieldMask);
1676 return returnValue;
1679 GetFieldHandlePtr FrameBufferObjectBase::getHandleEnableMultiSample (void) const
1681 SFBool::GetHandlePtr returnValue(
1682 new SFBool::GetHandle(
1683 &_sfEnableMultiSample,
1684 this->getType().getFieldDesc(EnableMultiSampleFieldId),
1685 const_cast<FrameBufferObjectBase *>(this)));
1687 return returnValue;
1690 EditFieldHandlePtr FrameBufferObjectBase::editHandleEnableMultiSample(void)
1692 SFBool::EditHandlePtr returnValue(
1693 new SFBool::EditHandle(
1694 &_sfEnableMultiSample,
1695 this->getType().getFieldDesc(EnableMultiSampleFieldId),
1696 this));
1699 editSField(EnableMultiSampleFieldMask);
1701 return returnValue;
1704 GetFieldHandlePtr FrameBufferObjectBase::getHandleColorSamples (void) const
1706 SFUInt32::GetHandlePtr returnValue(
1707 new SFUInt32::GetHandle(
1708 &_sfColorSamples,
1709 this->getType().getFieldDesc(ColorSamplesFieldId),
1710 const_cast<FrameBufferObjectBase *>(this)));
1712 return returnValue;
1715 EditFieldHandlePtr FrameBufferObjectBase::editHandleColorSamples (void)
1717 SFUInt32::EditHandlePtr returnValue(
1718 new SFUInt32::EditHandle(
1719 &_sfColorSamples,
1720 this->getType().getFieldDesc(ColorSamplesFieldId),
1721 this));
1724 editSField(ColorSamplesFieldMask);
1726 return returnValue;
1729 GetFieldHandlePtr FrameBufferObjectBase::getHandleCoverageSamples (void) const
1731 SFUInt32::GetHandlePtr returnValue(
1732 new SFUInt32::GetHandle(
1733 &_sfCoverageSamples,
1734 this->getType().getFieldDesc(CoverageSamplesFieldId),
1735 const_cast<FrameBufferObjectBase *>(this)));
1737 return returnValue;
1740 EditFieldHandlePtr FrameBufferObjectBase::editHandleCoverageSamples(void)
1742 SFUInt32::EditHandlePtr returnValue(
1743 new SFUInt32::EditHandle(
1744 &_sfCoverageSamples,
1745 this->getType().getFieldDesc(CoverageSamplesFieldId),
1746 this));
1749 editSField(CoverageSamplesFieldMask);
1751 return returnValue;
1754 GetFieldHandlePtr FrameBufferObjectBase::getHandleFixedSampleLocation (void) const
1756 SFBool::GetHandlePtr returnValue(
1757 new SFBool::GetHandle(
1758 &_sfFixedSampleLocation,
1759 this->getType().getFieldDesc(FixedSampleLocationFieldId),
1760 const_cast<FrameBufferObjectBase *>(this)));
1762 return returnValue;
1765 EditFieldHandlePtr FrameBufferObjectBase::editHandleFixedSampleLocation(void)
1767 SFBool::EditHandlePtr returnValue(
1768 new SFBool::EditHandle(
1769 &_sfFixedSampleLocation,
1770 this->getType().getFieldDesc(FixedSampleLocationFieldId),
1771 this));
1774 editSField(FixedSampleLocationFieldMask);
1776 return returnValue;
1779 GetFieldHandlePtr FrameBufferObjectBase::getHandleMsaaColorAttachments (void) const
1781 MFUnrecFrameBufferAttachmentPtr::GetHandlePtr returnValue(
1782 new MFUnrecFrameBufferAttachmentPtr::GetHandle(
1783 &_mfMsaaColorAttachments,
1784 this->getType().getFieldDesc(MsaaColorAttachmentsFieldId),
1785 const_cast<FrameBufferObjectBase *>(this)));
1787 return returnValue;
1790 EditFieldHandlePtr FrameBufferObjectBase::editHandleMsaaColorAttachments(void)
1792 MFUnrecFrameBufferAttachmentPtr::EditHandlePtr returnValue(
1793 new MFUnrecFrameBufferAttachmentPtr::EditHandle(
1794 &_mfMsaaColorAttachments,
1795 this->getType().getFieldDesc(MsaaColorAttachmentsFieldId),
1796 this));
1798 returnValue->setAddMethod(
1799 boost::bind(&FrameBufferObject::pushToMsaaColorAttachments,
1800 static_cast<FrameBufferObject *>(this), _1));
1801 returnValue->setRemoveMethod(
1802 boost::bind(&FrameBufferObject::removeFromMsaaColorAttachments,
1803 static_cast<FrameBufferObject *>(this), _1));
1804 returnValue->setRemoveObjMethod(
1805 boost::bind(&FrameBufferObject::removeObjFromMsaaColorAttachments,
1806 static_cast<FrameBufferObject *>(this), _1));
1807 returnValue->setClearMethod(
1808 boost::bind(&FrameBufferObject::clearMsaaColorAttachments,
1809 static_cast<FrameBufferObject *>(this)));
1811 editMField(MsaaColorAttachmentsFieldMask, _mfMsaaColorAttachments);
1813 return returnValue;
1816 GetFieldHandlePtr FrameBufferObjectBase::getHandleMsaaDepthAttachment (void) const
1818 SFUnrecFrameBufferAttachmentPtr::GetHandlePtr returnValue(
1819 new SFUnrecFrameBufferAttachmentPtr::GetHandle(
1820 &_sfMsaaDepthAttachment,
1821 this->getType().getFieldDesc(MsaaDepthAttachmentFieldId),
1822 const_cast<FrameBufferObjectBase *>(this)));
1824 return returnValue;
1827 EditFieldHandlePtr FrameBufferObjectBase::editHandleMsaaDepthAttachment(void)
1829 SFUnrecFrameBufferAttachmentPtr::EditHandlePtr returnValue(
1830 new SFUnrecFrameBufferAttachmentPtr::EditHandle(
1831 &_sfMsaaDepthAttachment,
1832 this->getType().getFieldDesc(MsaaDepthAttachmentFieldId),
1833 this));
1835 returnValue->setSetMethod(
1836 boost::bind(&FrameBufferObject::setMsaaDepthAttachment,
1837 static_cast<FrameBufferObject *>(this), _1));
1839 editSField(MsaaDepthAttachmentFieldMask);
1841 return returnValue;
1844 GetFieldHandlePtr FrameBufferObjectBase::getHandleMsaaStencilAttachment (void) const
1846 SFUnrecFrameBufferAttachmentPtr::GetHandlePtr returnValue(
1847 new SFUnrecFrameBufferAttachmentPtr::GetHandle(
1848 &_sfMsaaStencilAttachment,
1849 this->getType().getFieldDesc(MsaaStencilAttachmentFieldId),
1850 const_cast<FrameBufferObjectBase *>(this)));
1852 return returnValue;
1855 EditFieldHandlePtr FrameBufferObjectBase::editHandleMsaaStencilAttachment(void)
1857 SFUnrecFrameBufferAttachmentPtr::EditHandlePtr returnValue(
1858 new SFUnrecFrameBufferAttachmentPtr::EditHandle(
1859 &_sfMsaaStencilAttachment,
1860 this->getType().getFieldDesc(MsaaStencilAttachmentFieldId),
1861 this));
1863 returnValue->setSetMethod(
1864 boost::bind(&FrameBufferObject::setMsaaStencilAttachment,
1865 static_cast<FrameBufferObject *>(this), _1));
1867 editSField(MsaaStencilAttachmentFieldMask);
1869 return returnValue;
1873 #ifdef OSG_MT_CPTR_ASPECT
1874 void FrameBufferObjectBase::execSyncV( FieldContainer &oFrom,
1875 ConstFieldMaskArg whichField,
1876 AspectOffsetStore &oOffsets,
1877 ConstFieldMaskArg syncMode,
1878 const UInt32 uiSyncInfo)
1880 FrameBufferObject *pThis = static_cast<FrameBufferObject *>(this);
1882 pThis->execSync(static_cast<FrameBufferObject *>(&oFrom),
1883 whichField,
1884 oOffsets,
1885 syncMode,
1886 uiSyncInfo);
1888 #endif
1891 #ifdef OSG_MT_CPTR_ASPECT
1892 FieldContainer *FrameBufferObjectBase::createAspectCopy(
1893 const FieldContainer *pRefAspect) const
1895 FrameBufferObject *returnValue;
1897 newAspectCopy(returnValue,
1898 dynamic_cast<const FrameBufferObject *>(pRefAspect),
1899 dynamic_cast<const FrameBufferObject *>(this));
1901 return returnValue;
1903 #endif
1905 void FrameBufferObjectBase::resolveLinks(void)
1907 Inherited::resolveLinks();
1909 static_cast<FrameBufferObject *>(this)->clearColorAttachments();
1911 static_cast<FrameBufferObject *>(this)->setDepthAttachment(NULL);
1913 static_cast<FrameBufferObject *>(this)->setStencilAttachment(NULL);
1915 static_cast<FrameBufferObject *>(this)->clearMsaaColorAttachments();
1917 static_cast<FrameBufferObject *>(this)->setMsaaDepthAttachment(NULL);
1919 static_cast<FrameBufferObject *>(this)->setMsaaStencilAttachment(NULL);
1921 #ifdef OSG_MT_CPTR_ASPECT
1922 AspectOffsetStore oOffsets;
1924 _pAspectStore->fillOffsetArray(oOffsets, this);
1925 #endif
1927 #ifdef OSG_MT_CPTR_ASPECT
1928 _mfDrawBuffers.terminateShare(Thread::getCurrentAspect(),
1929 oOffsets);
1930 #endif
1934 OSG_END_NAMESPACE