fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / Window / Camera / OSGProjectionCameraDecoratorBase.cpp
blobaf742e983c470f0533ed9c614a0aefbaab2fadaa
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 ProjectionCameraDecorator!
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 "OSGNode.h" // User Class
67 #include "OSGProjectionCameraDecoratorBase.h"
68 #include "OSGProjectionCameraDecorator.h"
70 #include <boost/bind.hpp>
72 OSG_BEGIN_NAMESPACE
74 /***************************************************************************\
75 * Description *
76 \***************************************************************************/
78 /*! \class OSG::ProjectionCameraDecorator
79 The decorator for tracked projection screens, see \ref
80 PageSystemWindowCameraDecoratorsStereoProjection for a description.
82 The parameters are defined by the _sfUser and _mfSurface fields.
84 \dev
86 The derived parameters used to actually calculate the matrix are stored in the
87 _sfLeft, _sfBottom, _sfNormal, sfWidth and _sfHeight fields.
89 \enddev
92 /***************************************************************************\
93 * Field Documentation *
94 \***************************************************************************/
96 /*! \var Node * ProjectionCameraDecoratorBase::_sfUser
97 The coordinate system relative to the camera.
100 /*! \var Pnt3f ProjectionCameraDecoratorBase::_mfSurface
101 4 points describing the rectangular projection surface, in the camera
102 coordinate system. Counterclockwise, starting at lower left corner of the
103 screen.
106 /*! \var Plane ProjectionCameraDecoratorBase::_sfLeft
107 The left edge direction vector.
110 /*! \var Plane ProjectionCameraDecoratorBase::_sfBottom
111 The bottom edge direction vector.
114 /*! \var Plane ProjectionCameraDecoratorBase::_sfNormal
115 The normal of the projection surface.
118 /*! \var Real32 ProjectionCameraDecoratorBase::_sfWidth
119 The width of the projection screen.
122 /*! \var Real32 ProjectionCameraDecoratorBase::_sfHeight
123 The height of the projection screen.
127 /***************************************************************************\
128 * FieldType/FieldTrait Instantiation *
129 \***************************************************************************/
131 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
132 PointerType FieldTraits<ProjectionCameraDecorator *, nsOSG>::_type(
133 "ProjectionCameraDecoratorPtr",
134 "StereoCameraDecoratorPtr",
135 ProjectionCameraDecorator::getClassType(),
136 nsOSG);
137 #endif
139 OSG_FIELDTRAITS_GETTYPE_NS(ProjectionCameraDecorator *, nsOSG)
141 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
142 ProjectionCameraDecorator *,
143 nsOSG)
145 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
146 ProjectionCameraDecorator *,
147 nsOSG)
149 /***************************************************************************\
150 * Field Description *
151 \***************************************************************************/
153 void ProjectionCameraDecoratorBase::classDescInserter(TypeObject &oType)
155 FieldDescriptionBase *pDesc = NULL;
158 pDesc = new SFUnrecNodePtr::Description(
159 SFUnrecNodePtr::getClassType(),
160 "user",
161 "The coordinate system relative to the camera.\n",
162 UserFieldId, UserFieldMask,
163 false,
164 (Field::SFDefaultFlags | Field::FStdAccess),
165 static_cast<FieldEditMethodSig>(&ProjectionCameraDecorator::editHandleUser),
166 static_cast<FieldGetMethodSig >(&ProjectionCameraDecorator::getHandleUser));
168 oType.addInitialDesc(pDesc);
170 pDesc = new MFPnt3f::Description(
171 MFPnt3f::getClassType(),
172 "surface",
173 "4 points describing the rectangular projection surface, in the camera\n"
174 "coordinate system. Counterclockwise, starting at lower left corner of the\n"
175 "screen. \n",
176 SurfaceFieldId, SurfaceFieldMask,
177 false,
178 (Field::MFDefaultFlags | Field::FStdAccess),
179 static_cast<FieldEditMethodSig>(&ProjectionCameraDecorator::editHandleSurface),
180 static_cast<FieldGetMethodSig >(&ProjectionCameraDecorator::getHandleSurface));
182 oType.addInitialDesc(pDesc);
184 pDesc = new SFPlane::Description(
185 SFPlane::getClassType(),
186 "left",
187 "The left edge direction vector.\n",
188 LeftFieldId, LeftFieldMask,
189 true,
190 (Field::SFDefaultFlags | Field::FStdAccess),
191 static_cast<FieldEditMethodSig>(&ProjectionCameraDecorator::editHandleLeft),
192 static_cast<FieldGetMethodSig >(&ProjectionCameraDecorator::getHandleLeft));
194 oType.addInitialDesc(pDesc);
196 pDesc = new SFPlane::Description(
197 SFPlane::getClassType(),
198 "bottom",
199 "The bottom edge direction vector.\n",
200 BottomFieldId, BottomFieldMask,
201 true,
202 (Field::SFDefaultFlags | Field::FStdAccess),
203 static_cast<FieldEditMethodSig>(&ProjectionCameraDecorator::editHandleBottom),
204 static_cast<FieldGetMethodSig >(&ProjectionCameraDecorator::getHandleBottom));
206 oType.addInitialDesc(pDesc);
208 pDesc = new SFPlane::Description(
209 SFPlane::getClassType(),
210 "normal",
211 "The normal of the projection surface.\n",
212 NormalFieldId, NormalFieldMask,
213 true,
214 (Field::SFDefaultFlags | Field::FStdAccess),
215 static_cast<FieldEditMethodSig>(&ProjectionCameraDecorator::editHandleNormal),
216 static_cast<FieldGetMethodSig >(&ProjectionCameraDecorator::getHandleNormal));
218 oType.addInitialDesc(pDesc);
220 pDesc = new SFReal32::Description(
221 SFReal32::getClassType(),
222 "width",
223 "The width of the projection screen.\n",
224 WidthFieldId, WidthFieldMask,
225 true,
226 (Field::SFDefaultFlags | Field::FStdAccess),
227 static_cast<FieldEditMethodSig>(&ProjectionCameraDecorator::editHandleWidth),
228 static_cast<FieldGetMethodSig >(&ProjectionCameraDecorator::getHandleWidth));
230 oType.addInitialDesc(pDesc);
232 pDesc = new SFReal32::Description(
233 SFReal32::getClassType(),
234 "height",
235 "The height of the projection screen.\n",
236 HeightFieldId, HeightFieldMask,
237 true,
238 (Field::SFDefaultFlags | Field::FStdAccess),
239 static_cast<FieldEditMethodSig>(&ProjectionCameraDecorator::editHandleHeight),
240 static_cast<FieldGetMethodSig >(&ProjectionCameraDecorator::getHandleHeight));
242 oType.addInitialDesc(pDesc);
246 ProjectionCameraDecoratorBase::TypeObject ProjectionCameraDecoratorBase::_type(
247 ProjectionCameraDecoratorBase::getClassname(),
248 Inherited::getClassname(),
249 "NULL",
250 nsOSG, //Namespace
251 reinterpret_cast<PrototypeCreateF>(&ProjectionCameraDecoratorBase::createEmptyLocal),
252 reinterpret_cast<InitContainerF>(&ProjectionCameraDecorator::initMethod),
253 reinterpret_cast<ExitContainerF>(&ProjectionCameraDecorator::exitMethod),
254 reinterpret_cast<InitalInsertDescFunc>(
255 reinterpret_cast<void *>(&ProjectionCameraDecorator::classDescInserter)),
256 false,
258 "<?xml version=\"1.0\"?>\n"
259 "\n"
260 "<FieldContainer\n"
261 " name=\"ProjectionCameraDecorator\"\n"
262 " parent=\"StereoCameraDecorator\"\n"
263 " library=\"Window\"\n"
264 " pointerfieldtypes=\"both\"\n"
265 " structure=\"concrete\"\n"
266 " systemcomponent=\"true\"\n"
267 " parentsystemcomponent=\"true\"\n"
268 " decoratable=\"false\"\n"
269 " docGroupBase=\"GrpWindowCamera\"\n"
270 " >\n"
271 " The decorator for tracked projection screens, see \\ref\n"
272 " PageSystemWindowCameraDecoratorsStereoProjection for a description.\n"
273 "\n"
274 " The parameters are defined by the _sfUser and _mfSurface fields.\n"
275 "\n"
276 " \\dev\n"
277 "\n"
278 " The derived parameters used to actually calculate the matrix are stored in the\n"
279 " _sfLeft, _sfBottom, _sfNormal, sfWidth and _sfHeight fields.\n"
280 "\n"
281 " \\enddev\n"
282 " <Field\n"
283 "\t name=\"user\"\n"
284 "\t type=\"NodePtr\"\n"
285 "\t cardinality=\"single\"\n"
286 "\t visibility=\"external\"\n"
287 "\t access=\"public\"\n"
288 "\t >\n"
289 "\tThe coordinate system relative to the camera.\n"
290 " </Field>\n"
291 " <Field\n"
292 "\t name=\"surface\"\n"
293 "\t type=\"Pnt3f\"\n"
294 "\t cardinality=\"multi\"\n"
295 "\t visibility=\"external\"\n"
296 "\t access=\"public\"\n"
297 "\t >\n"
298 "\t4 points describing the rectangular projection surface, in the camera\n"
299 " coordinate system. Counterclockwise, starting at lower left corner of the\n"
300 "\tscreen. \n"
301 " </Field>\n"
302 " <Field\n"
303 "\t name=\"left\"\n"
304 "\t type=\"Plane\"\n"
305 "\t cardinality=\"single\"\n"
306 "\t visibility=\"internal\"\n"
307 "\t access=\"protected\"\n"
308 "\t >\n"
309 "\tThe left edge direction vector.\n"
310 " </Field>\n"
311 " <Field\n"
312 "\t name=\"bottom\"\n"
313 "\t type=\"Plane\"\n"
314 "\t cardinality=\"single\"\n"
315 "\t visibility=\"internal\"\n"
316 "\t access=\"protected\"\n"
317 "\t >\n"
318 "\tThe bottom edge direction vector.\n"
319 " </Field>\n"
320 " <Field\n"
321 "\t name=\"normal\"\n"
322 "\t type=\"Plane\"\n"
323 "\t cardinality=\"single\"\n"
324 "\t visibility=\"internal\"\n"
325 "\t access=\"protected\"\n"
326 "\t >\n"
327 "\tThe normal of the projection surface.\n"
328 " </Field>\n"
329 " <Field\n"
330 "\t name=\"width\"\n"
331 "\t type=\"Real32\"\n"
332 "\t cardinality=\"single\"\n"
333 "\t visibility=\"internal\"\n"
334 "\t access=\"public\"\n"
335 "\t >\n"
336 "\tThe width of the projection screen.\n"
337 " </Field>\n"
338 " <Field\n"
339 "\t name=\"height\"\n"
340 "\t type=\"Real32\"\n"
341 "\t cardinality=\"single\"\n"
342 "\t visibility=\"internal\"\n"
343 "\t access=\"public\"\n"
344 "\t >\n"
345 "\tThe height of the projection screen.\n"
346 " </Field>\n"
347 "</FieldContainer>\n",
348 "The decorator for tracked projection screens, see \\ref\n"
349 "PageSystemWindowCameraDecoratorsStereoProjection for a description.\n"
350 "\n"
351 "The parameters are defined by the _sfUser and _mfSurface fields.\n"
352 "\n"
353 "\\dev\n"
354 "\n"
355 "The derived parameters used to actually calculate the matrix are stored in the\n"
356 "_sfLeft, _sfBottom, _sfNormal, sfWidth and _sfHeight fields.\n"
357 "\n"
358 "\\enddev\n"
361 /*------------------------------ get -----------------------------------*/
363 FieldContainerType &ProjectionCameraDecoratorBase::getType(void)
365 return _type;
368 const FieldContainerType &ProjectionCameraDecoratorBase::getType(void) const
370 return _type;
373 UInt32 ProjectionCameraDecoratorBase::getContainerSize(void) const
375 return sizeof(ProjectionCameraDecorator);
378 /*------------------------- decorator get ------------------------------*/
381 //! Get the ProjectionCameraDecorator::_sfUser field.
382 const SFUnrecNodePtr *ProjectionCameraDecoratorBase::getSFUser(void) const
384 return &_sfUser;
387 SFUnrecNodePtr *ProjectionCameraDecoratorBase::editSFUser (void)
389 editSField(UserFieldMask);
391 return &_sfUser;
394 //! Get the value of the ProjectionCameraDecorator::_sfUser field.
395 Node * ProjectionCameraDecoratorBase::getUser(void) const
397 return _sfUser.getValue();
400 //! Set the value of the ProjectionCameraDecorator::_sfUser field.
401 void ProjectionCameraDecoratorBase::setUser(Node * const value)
403 editSField(UserFieldMask);
405 _sfUser.setValue(value);
409 MFPnt3f *ProjectionCameraDecoratorBase::editMFSurface(void)
411 editMField(SurfaceFieldMask, _mfSurface);
413 return &_mfSurface;
416 const MFPnt3f *ProjectionCameraDecoratorBase::getMFSurface(void) const
418 return &_mfSurface;
422 SFPlane *ProjectionCameraDecoratorBase::editSFLeft(void)
424 editSField(LeftFieldMask);
426 return &_sfLeft;
429 const SFPlane *ProjectionCameraDecoratorBase::getSFLeft(void) const
431 return &_sfLeft;
435 SFPlane *ProjectionCameraDecoratorBase::editSFBottom(void)
437 editSField(BottomFieldMask);
439 return &_sfBottom;
442 const SFPlane *ProjectionCameraDecoratorBase::getSFBottom(void) const
444 return &_sfBottom;
448 SFPlane *ProjectionCameraDecoratorBase::editSFNormal(void)
450 editSField(NormalFieldMask);
452 return &_sfNormal;
455 const SFPlane *ProjectionCameraDecoratorBase::getSFNormal(void) const
457 return &_sfNormal;
461 SFReal32 *ProjectionCameraDecoratorBase::editSFWidth(void)
463 editSField(WidthFieldMask);
465 return &_sfWidth;
468 const SFReal32 *ProjectionCameraDecoratorBase::getSFWidth(void) const
470 return &_sfWidth;
474 SFReal32 *ProjectionCameraDecoratorBase::editSFHeight(void)
476 editSField(HeightFieldMask);
478 return &_sfHeight;
481 const SFReal32 *ProjectionCameraDecoratorBase::getSFHeight(void) const
483 return &_sfHeight;
491 /*------------------------------ access -----------------------------------*/
493 SizeT ProjectionCameraDecoratorBase::getBinSize(ConstFieldMaskArg whichField)
495 SizeT returnValue = Inherited::getBinSize(whichField);
497 if(FieldBits::NoField != (UserFieldMask & whichField))
499 returnValue += _sfUser.getBinSize();
501 if(FieldBits::NoField != (SurfaceFieldMask & whichField))
503 returnValue += _mfSurface.getBinSize();
505 if(FieldBits::NoField != (LeftFieldMask & whichField))
507 returnValue += _sfLeft.getBinSize();
509 if(FieldBits::NoField != (BottomFieldMask & whichField))
511 returnValue += _sfBottom.getBinSize();
513 if(FieldBits::NoField != (NormalFieldMask & whichField))
515 returnValue += _sfNormal.getBinSize();
517 if(FieldBits::NoField != (WidthFieldMask & whichField))
519 returnValue += _sfWidth.getBinSize();
521 if(FieldBits::NoField != (HeightFieldMask & whichField))
523 returnValue += _sfHeight.getBinSize();
526 return returnValue;
529 void ProjectionCameraDecoratorBase::copyToBin(BinaryDataHandler &pMem,
530 ConstFieldMaskArg whichField)
532 Inherited::copyToBin(pMem, whichField);
534 if(FieldBits::NoField != (UserFieldMask & whichField))
536 _sfUser.copyToBin(pMem);
538 if(FieldBits::NoField != (SurfaceFieldMask & whichField))
540 _mfSurface.copyToBin(pMem);
542 if(FieldBits::NoField != (LeftFieldMask & whichField))
544 _sfLeft.copyToBin(pMem);
546 if(FieldBits::NoField != (BottomFieldMask & whichField))
548 _sfBottom.copyToBin(pMem);
550 if(FieldBits::NoField != (NormalFieldMask & whichField))
552 _sfNormal.copyToBin(pMem);
554 if(FieldBits::NoField != (WidthFieldMask & whichField))
556 _sfWidth.copyToBin(pMem);
558 if(FieldBits::NoField != (HeightFieldMask & whichField))
560 _sfHeight.copyToBin(pMem);
564 void ProjectionCameraDecoratorBase::copyFromBin(BinaryDataHandler &pMem,
565 ConstFieldMaskArg whichField)
567 Inherited::copyFromBin(pMem, whichField);
569 if(FieldBits::NoField != (UserFieldMask & whichField))
571 editSField(UserFieldMask);
572 _sfUser.copyFromBin(pMem);
574 if(FieldBits::NoField != (SurfaceFieldMask & whichField))
576 editMField(SurfaceFieldMask, _mfSurface);
577 _mfSurface.copyFromBin(pMem);
579 if(FieldBits::NoField != (LeftFieldMask & whichField))
581 editSField(LeftFieldMask);
582 _sfLeft.copyFromBin(pMem);
584 if(FieldBits::NoField != (BottomFieldMask & whichField))
586 editSField(BottomFieldMask);
587 _sfBottom.copyFromBin(pMem);
589 if(FieldBits::NoField != (NormalFieldMask & whichField))
591 editSField(NormalFieldMask);
592 _sfNormal.copyFromBin(pMem);
594 if(FieldBits::NoField != (WidthFieldMask & whichField))
596 editSField(WidthFieldMask);
597 _sfWidth.copyFromBin(pMem);
599 if(FieldBits::NoField != (HeightFieldMask & whichField))
601 editSField(HeightFieldMask);
602 _sfHeight.copyFromBin(pMem);
606 //! create a new instance of the class
607 ProjectionCameraDecoratorTransitPtr ProjectionCameraDecoratorBase::createLocal(BitVector bFlags)
609 ProjectionCameraDecoratorTransitPtr fc;
611 if(getClassType().getPrototype() != NULL)
613 FieldContainerTransitPtr tmpPtr =
614 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
616 fc = dynamic_pointer_cast<ProjectionCameraDecorator>(tmpPtr);
619 return fc;
622 //! create a new instance of the class, copy the container flags
623 ProjectionCameraDecoratorTransitPtr ProjectionCameraDecoratorBase::createDependent(BitVector bFlags)
625 ProjectionCameraDecoratorTransitPtr fc;
627 if(getClassType().getPrototype() != NULL)
629 FieldContainerTransitPtr tmpPtr =
630 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
632 fc = dynamic_pointer_cast<ProjectionCameraDecorator>(tmpPtr);
635 return fc;
638 //! create a new instance of the class
639 ProjectionCameraDecoratorTransitPtr ProjectionCameraDecoratorBase::create(void)
641 ProjectionCameraDecoratorTransitPtr fc;
643 if(getClassType().getPrototype() != NULL)
645 FieldContainerTransitPtr tmpPtr =
646 getClassType().getPrototype()-> shallowCopy();
648 fc = dynamic_pointer_cast<ProjectionCameraDecorator>(tmpPtr);
651 return fc;
654 ProjectionCameraDecorator *ProjectionCameraDecoratorBase::createEmptyLocal(BitVector bFlags)
656 ProjectionCameraDecorator *returnValue;
658 newPtr<ProjectionCameraDecorator>(returnValue, bFlags);
660 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
662 return returnValue;
665 //! create an empty new instance of the class, do not copy the prototype
666 ProjectionCameraDecorator *ProjectionCameraDecoratorBase::createEmpty(void)
668 ProjectionCameraDecorator *returnValue;
670 newPtr<ProjectionCameraDecorator>(returnValue, Thread::getCurrentLocalFlags());
672 returnValue->_pFieldFlags->_bNamespaceMask &=
673 ~Thread::getCurrentLocalFlags();
675 return returnValue;
679 FieldContainerTransitPtr ProjectionCameraDecoratorBase::shallowCopyLocal(
680 BitVector bFlags) const
682 ProjectionCameraDecorator *tmpPtr;
684 newPtr(tmpPtr, dynamic_cast<const ProjectionCameraDecorator *>(this), bFlags);
686 FieldContainerTransitPtr returnValue(tmpPtr);
688 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
690 return returnValue;
693 FieldContainerTransitPtr ProjectionCameraDecoratorBase::shallowCopyDependent(
694 BitVector bFlags) const
696 ProjectionCameraDecorator *tmpPtr;
698 newPtr(tmpPtr, dynamic_cast<const ProjectionCameraDecorator *>(this), ~bFlags);
700 FieldContainerTransitPtr returnValue(tmpPtr);
702 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
704 return returnValue;
707 FieldContainerTransitPtr ProjectionCameraDecoratorBase::shallowCopy(void) const
709 ProjectionCameraDecorator *tmpPtr;
711 newPtr(tmpPtr,
712 dynamic_cast<const ProjectionCameraDecorator *>(this),
713 Thread::getCurrentLocalFlags());
715 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
717 FieldContainerTransitPtr returnValue(tmpPtr);
719 return returnValue;
725 /*------------------------- constructors ----------------------------------*/
727 ProjectionCameraDecoratorBase::ProjectionCameraDecoratorBase(void) :
728 Inherited(),
729 _sfUser (NULL),
730 _mfSurface (),
731 _sfLeft (),
732 _sfBottom (),
733 _sfNormal (),
734 _sfWidth (),
735 _sfHeight ()
739 ProjectionCameraDecoratorBase::ProjectionCameraDecoratorBase(const ProjectionCameraDecoratorBase &source) :
740 Inherited(source),
741 _sfUser (NULL),
742 _mfSurface (source._mfSurface ),
743 _sfLeft (source._sfLeft ),
744 _sfBottom (source._sfBottom ),
745 _sfNormal (source._sfNormal ),
746 _sfWidth (source._sfWidth ),
747 _sfHeight (source._sfHeight )
752 /*-------------------------- destructors ----------------------------------*/
754 ProjectionCameraDecoratorBase::~ProjectionCameraDecoratorBase(void)
758 void ProjectionCameraDecoratorBase::onCreate(const ProjectionCameraDecorator *source)
760 Inherited::onCreate(source);
762 if(source != NULL)
764 ProjectionCameraDecorator *pThis = static_cast<ProjectionCameraDecorator *>(this);
766 pThis->setUser(source->getUser());
770 GetFieldHandlePtr ProjectionCameraDecoratorBase::getHandleUser (void) const
772 SFUnrecNodePtr::GetHandlePtr returnValue(
773 new SFUnrecNodePtr::GetHandle(
774 &_sfUser,
775 this->getType().getFieldDesc(UserFieldId),
776 const_cast<ProjectionCameraDecoratorBase *>(this)));
778 return returnValue;
781 EditFieldHandlePtr ProjectionCameraDecoratorBase::editHandleUser (void)
783 SFUnrecNodePtr::EditHandlePtr returnValue(
784 new SFUnrecNodePtr::EditHandle(
785 &_sfUser,
786 this->getType().getFieldDesc(UserFieldId),
787 this));
789 returnValue->setSetMethod(
790 boost::bind(&ProjectionCameraDecorator::setUser,
791 static_cast<ProjectionCameraDecorator *>(this), _1));
793 editSField(UserFieldMask);
795 return returnValue;
798 GetFieldHandlePtr ProjectionCameraDecoratorBase::getHandleSurface (void) const
800 MFPnt3f::GetHandlePtr returnValue(
801 new MFPnt3f::GetHandle(
802 &_mfSurface,
803 this->getType().getFieldDesc(SurfaceFieldId),
804 const_cast<ProjectionCameraDecoratorBase *>(this)));
806 return returnValue;
809 EditFieldHandlePtr ProjectionCameraDecoratorBase::editHandleSurface (void)
811 MFPnt3f::EditHandlePtr returnValue(
812 new MFPnt3f::EditHandle(
813 &_mfSurface,
814 this->getType().getFieldDesc(SurfaceFieldId),
815 this));
818 editMField(SurfaceFieldMask, _mfSurface);
820 return returnValue;
823 GetFieldHandlePtr ProjectionCameraDecoratorBase::getHandleLeft (void) const
825 SFPlane::GetHandlePtr returnValue(
826 new SFPlane::GetHandle(
827 &_sfLeft,
828 this->getType().getFieldDesc(LeftFieldId),
829 const_cast<ProjectionCameraDecoratorBase *>(this)));
831 return returnValue;
834 EditFieldHandlePtr ProjectionCameraDecoratorBase::editHandleLeft (void)
836 SFPlane::EditHandlePtr returnValue(
837 new SFPlane::EditHandle(
838 &_sfLeft,
839 this->getType().getFieldDesc(LeftFieldId),
840 this));
843 editSField(LeftFieldMask);
845 return returnValue;
848 GetFieldHandlePtr ProjectionCameraDecoratorBase::getHandleBottom (void) const
850 SFPlane::GetHandlePtr returnValue(
851 new SFPlane::GetHandle(
852 &_sfBottom,
853 this->getType().getFieldDesc(BottomFieldId),
854 const_cast<ProjectionCameraDecoratorBase *>(this)));
856 return returnValue;
859 EditFieldHandlePtr ProjectionCameraDecoratorBase::editHandleBottom (void)
861 SFPlane::EditHandlePtr returnValue(
862 new SFPlane::EditHandle(
863 &_sfBottom,
864 this->getType().getFieldDesc(BottomFieldId),
865 this));
868 editSField(BottomFieldMask);
870 return returnValue;
873 GetFieldHandlePtr ProjectionCameraDecoratorBase::getHandleNormal (void) const
875 SFPlane::GetHandlePtr returnValue(
876 new SFPlane::GetHandle(
877 &_sfNormal,
878 this->getType().getFieldDesc(NormalFieldId),
879 const_cast<ProjectionCameraDecoratorBase *>(this)));
881 return returnValue;
884 EditFieldHandlePtr ProjectionCameraDecoratorBase::editHandleNormal (void)
886 SFPlane::EditHandlePtr returnValue(
887 new SFPlane::EditHandle(
888 &_sfNormal,
889 this->getType().getFieldDesc(NormalFieldId),
890 this));
893 editSField(NormalFieldMask);
895 return returnValue;
898 GetFieldHandlePtr ProjectionCameraDecoratorBase::getHandleWidth (void) const
900 SFReal32::GetHandlePtr returnValue(
901 new SFReal32::GetHandle(
902 &_sfWidth,
903 this->getType().getFieldDesc(WidthFieldId),
904 const_cast<ProjectionCameraDecoratorBase *>(this)));
906 return returnValue;
909 EditFieldHandlePtr ProjectionCameraDecoratorBase::editHandleWidth (void)
911 SFReal32::EditHandlePtr returnValue(
912 new SFReal32::EditHandle(
913 &_sfWidth,
914 this->getType().getFieldDesc(WidthFieldId),
915 this));
918 editSField(WidthFieldMask);
920 return returnValue;
923 GetFieldHandlePtr ProjectionCameraDecoratorBase::getHandleHeight (void) const
925 SFReal32::GetHandlePtr returnValue(
926 new SFReal32::GetHandle(
927 &_sfHeight,
928 this->getType().getFieldDesc(HeightFieldId),
929 const_cast<ProjectionCameraDecoratorBase *>(this)));
931 return returnValue;
934 EditFieldHandlePtr ProjectionCameraDecoratorBase::editHandleHeight (void)
936 SFReal32::EditHandlePtr returnValue(
937 new SFReal32::EditHandle(
938 &_sfHeight,
939 this->getType().getFieldDesc(HeightFieldId),
940 this));
943 editSField(HeightFieldMask);
945 return returnValue;
949 #ifdef OSG_MT_CPTR_ASPECT
950 void ProjectionCameraDecoratorBase::execSyncV( FieldContainer &oFrom,
951 ConstFieldMaskArg whichField,
952 AspectOffsetStore &oOffsets,
953 ConstFieldMaskArg syncMode,
954 const UInt32 uiSyncInfo)
956 ProjectionCameraDecorator *pThis = static_cast<ProjectionCameraDecorator *>(this);
958 pThis->execSync(static_cast<ProjectionCameraDecorator *>(&oFrom),
959 whichField,
960 oOffsets,
961 syncMode,
962 uiSyncInfo);
964 #endif
967 #ifdef OSG_MT_CPTR_ASPECT
968 FieldContainer *ProjectionCameraDecoratorBase::createAspectCopy(
969 const FieldContainer *pRefAspect) const
971 ProjectionCameraDecorator *returnValue;
973 newAspectCopy(returnValue,
974 dynamic_cast<const ProjectionCameraDecorator *>(pRefAspect),
975 dynamic_cast<const ProjectionCameraDecorator *>(this));
977 return returnValue;
979 #endif
981 void ProjectionCameraDecoratorBase::resolveLinks(void)
983 Inherited::resolveLinks();
985 static_cast<ProjectionCameraDecorator *>(this)->setUser(NULL);
987 #ifdef OSG_MT_CPTR_ASPECT
988 AspectOffsetStore oOffsets;
990 _pAspectStore->fillOffsetArray(oOffsets, this);
991 #endif
993 #ifdef OSG_MT_CPTR_ASPECT
994 _mfSurface.terminateShare(Thread::getCurrentAspect(),
995 oOffsets);
996 #endif
1000 OSG_END_NAMESPACE