1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
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. *
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. *
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. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
42 ** This file is automatically generated. **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
47 ** Do not change this file, changes should be done in the derived **
48 ** class MatrixCamera!
50 *****************************************************************************
51 \*****************************************************************************/
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
61 #include "OSGConfig.h"
66 #include "OSGMatrixCameraBase.h"
67 #include "OSGMatrixCamera.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::MatrixCamera
78 The Matrix Camera class, see \ref PageSystemWindowCameraMatrix for
81 The used matrices are stored in the _sfModelviewMatrix and
82 _sfProjectionMatrix Fields.
85 /***************************************************************************\
86 * Field Documentation *
87 \***************************************************************************/
89 /*! \var Matrix MatrixCameraBase::_sfProjectionMatrix
93 /*! \var Matrix MatrixCameraBase::_sfModelviewMatrix
97 /*! \var bool MatrixCameraBase::_sfUseBeacon
98 Use beacon if set to get the modelview matrix
102 /***************************************************************************\
103 * FieldType/FieldTrait Instantiation *
104 \***************************************************************************/
106 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
107 PointerType FieldTraits
<MatrixCamera
*, nsOSG
>::_type(
110 MatrixCamera::getClassType(),
114 OSG_FIELDTRAITS_GETTYPE_NS(MatrixCamera
*, nsOSG
)
116 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
120 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
124 /***************************************************************************\
125 * Field Description *
126 \***************************************************************************/
128 void MatrixCameraBase::classDescInserter(TypeObject
&oType
)
130 FieldDescriptionBase
*pDesc
= NULL
;
133 pDesc
= new SFMatrix::Description(
134 SFMatrix::getClassType(),
137 ProjectionMatrixFieldId
, ProjectionMatrixFieldMask
,
139 (Field::SFDefaultFlags
| Field::FStdAccess
),
140 static_cast<FieldEditMethodSig
>(&MatrixCamera::editHandleProjectionMatrix
),
141 static_cast<FieldGetMethodSig
>(&MatrixCamera::getHandleProjectionMatrix
));
143 oType
.addInitialDesc(pDesc
);
145 pDesc
= new SFMatrix::Description(
146 SFMatrix::getClassType(),
149 ModelviewMatrixFieldId
, ModelviewMatrixFieldMask
,
151 (Field::SFDefaultFlags
| Field::FStdAccess
),
152 static_cast<FieldEditMethodSig
>(&MatrixCamera::editHandleModelviewMatrix
),
153 static_cast<FieldGetMethodSig
>(&MatrixCamera::getHandleModelviewMatrix
));
155 oType
.addInitialDesc(pDesc
);
157 pDesc
= new SFBool::Description(
158 SFBool::getClassType(),
160 "Use beacon if set to get the modelview matrix\n",
161 UseBeaconFieldId
, UseBeaconFieldMask
,
163 (Field::SFDefaultFlags
| Field::FStdAccess
),
164 static_cast<FieldEditMethodSig
>(&MatrixCamera::editHandleUseBeacon
),
165 static_cast<FieldGetMethodSig
>(&MatrixCamera::getHandleUseBeacon
));
167 oType
.addInitialDesc(pDesc
);
171 MatrixCameraBase::TypeObject
MatrixCameraBase::_type(
172 MatrixCameraBase::getClassname(),
173 Inherited::getClassname(),
176 reinterpret_cast<PrototypeCreateF
>(&MatrixCameraBase::createEmptyLocal
),
177 reinterpret_cast<InitContainerF
>(&MatrixCamera::initMethod
),
178 reinterpret_cast<ExitContainerF
>(&MatrixCamera::exitMethod
),
179 reinterpret_cast<InitalInsertDescFunc
>(
180 reinterpret_cast<void *>(&MatrixCamera::classDescInserter
)),
183 "<?xml version=\"1.0\"?>\n"
186 " name=\"MatrixCamera\"\n"
187 " parent=\"Camera\"\n"
188 " library=\"System\"\n"
189 " pointerfieldtypes=\"both\"\n"
190 " structure=\"concrete\"\n"
191 " systemcomponent=\"true\"\n"
192 " parentsystemcomponent=\"true\"\n"
193 " docGroupBase=\"GrpSystemWindow\"\n"
196 " The Matrix Camera class, see \\ref PageSystemWindowCameraMatrix for\n"
199 " The used matrices are stored in the _sfModelviewMatrix and\n"
200 " _sfProjectionMatrix Fields.\n"
202 "\t name=\"ProjectionMatrix\"\n"
203 "\t type=\"Matrix\"\n"
204 "\t cardinality=\"single\"\n"
205 "\t visibility=\"external\"\n"
206 "\t access=\"public\"\n"
210 "\t name=\"ModelviewMatrix\"\n"
211 "\t type=\"Matrix\"\n"
212 "\t cardinality=\"single\"\n"
213 "\t visibility=\"external\"\n"
214 "\t access=\"public\"\n"
218 " name=\"useBeacon\"\n"
220 " cardinality=\"single\"\n"
221 " visibility=\"external\"\n"
222 " access=\"public\"\n"
224 " Use beacon if set to get the modelview matrix\n"
226 "</FieldContainer>\n",
227 "The Matrix Camera class, see \\ref PageSystemWindowCameraMatrix for\n"
230 "The used matrices are stored in the _sfModelviewMatrix and\n"
231 "_sfProjectionMatrix Fields.\n"
234 /*------------------------------ get -----------------------------------*/
236 FieldContainerType
&MatrixCameraBase::getType(void)
241 const FieldContainerType
&MatrixCameraBase::getType(void) const
246 UInt32
MatrixCameraBase::getContainerSize(void) const
248 return sizeof(MatrixCamera
);
251 /*------------------------- decorator get ------------------------------*/
254 SFMatrix
*MatrixCameraBase::editSFProjectionMatrix(void)
256 editSField(ProjectionMatrixFieldMask
);
258 return &_sfProjectionMatrix
;
261 const SFMatrix
*MatrixCameraBase::getSFProjectionMatrix(void) const
263 return &_sfProjectionMatrix
;
267 SFMatrix
*MatrixCameraBase::editSFModelviewMatrix(void)
269 editSField(ModelviewMatrixFieldMask
);
271 return &_sfModelviewMatrix
;
274 const SFMatrix
*MatrixCameraBase::getSFModelviewMatrix(void) const
276 return &_sfModelviewMatrix
;
280 SFBool
*MatrixCameraBase::editSFUseBeacon(void)
282 editSField(UseBeaconFieldMask
);
284 return &_sfUseBeacon
;
287 const SFBool
*MatrixCameraBase::getSFUseBeacon(void) const
289 return &_sfUseBeacon
;
297 /*------------------------------ access -----------------------------------*/
299 SizeT
MatrixCameraBase::getBinSize(ConstFieldMaskArg whichField
)
301 SizeT returnValue
= Inherited::getBinSize(whichField
);
303 if(FieldBits::NoField
!= (ProjectionMatrixFieldMask
& whichField
))
305 returnValue
+= _sfProjectionMatrix
.getBinSize();
307 if(FieldBits::NoField
!= (ModelviewMatrixFieldMask
& whichField
))
309 returnValue
+= _sfModelviewMatrix
.getBinSize();
311 if(FieldBits::NoField
!= (UseBeaconFieldMask
& whichField
))
313 returnValue
+= _sfUseBeacon
.getBinSize();
319 void MatrixCameraBase::copyToBin(BinaryDataHandler
&pMem
,
320 ConstFieldMaskArg whichField
)
322 Inherited::copyToBin(pMem
, whichField
);
324 if(FieldBits::NoField
!= (ProjectionMatrixFieldMask
& whichField
))
326 _sfProjectionMatrix
.copyToBin(pMem
);
328 if(FieldBits::NoField
!= (ModelviewMatrixFieldMask
& whichField
))
330 _sfModelviewMatrix
.copyToBin(pMem
);
332 if(FieldBits::NoField
!= (UseBeaconFieldMask
& whichField
))
334 _sfUseBeacon
.copyToBin(pMem
);
338 void MatrixCameraBase::copyFromBin(BinaryDataHandler
&pMem
,
339 ConstFieldMaskArg whichField
)
341 Inherited::copyFromBin(pMem
, whichField
);
343 if(FieldBits::NoField
!= (ProjectionMatrixFieldMask
& whichField
))
345 editSField(ProjectionMatrixFieldMask
);
346 _sfProjectionMatrix
.copyFromBin(pMem
);
348 if(FieldBits::NoField
!= (ModelviewMatrixFieldMask
& whichField
))
350 editSField(ModelviewMatrixFieldMask
);
351 _sfModelviewMatrix
.copyFromBin(pMem
);
353 if(FieldBits::NoField
!= (UseBeaconFieldMask
& whichField
))
355 editSField(UseBeaconFieldMask
);
356 _sfUseBeacon
.copyFromBin(pMem
);
360 //! create a new instance of the class
361 MatrixCameraTransitPtr
MatrixCameraBase::createLocal(BitVector bFlags
)
363 MatrixCameraTransitPtr fc
;
365 if(getClassType().getPrototype() != NULL
)
367 FieldContainerTransitPtr tmpPtr
=
368 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
370 fc
= dynamic_pointer_cast
<MatrixCamera
>(tmpPtr
);
376 //! create a new instance of the class, copy the container flags
377 MatrixCameraTransitPtr
MatrixCameraBase::createDependent(BitVector bFlags
)
379 MatrixCameraTransitPtr fc
;
381 if(getClassType().getPrototype() != NULL
)
383 FieldContainerTransitPtr tmpPtr
=
384 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
386 fc
= dynamic_pointer_cast
<MatrixCamera
>(tmpPtr
);
392 //! create a new instance of the class
393 MatrixCameraTransitPtr
MatrixCameraBase::create(void)
395 MatrixCameraTransitPtr fc
;
397 if(getClassType().getPrototype() != NULL
)
399 FieldContainerTransitPtr tmpPtr
=
400 getClassType().getPrototype()-> shallowCopy();
402 fc
= dynamic_pointer_cast
<MatrixCamera
>(tmpPtr
);
408 MatrixCamera
*MatrixCameraBase::createEmptyLocal(BitVector bFlags
)
410 MatrixCamera
*returnValue
;
412 newPtr
<MatrixCamera
>(returnValue
, bFlags
);
414 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
419 //! create an empty new instance of the class, do not copy the prototype
420 MatrixCamera
*MatrixCameraBase::createEmpty(void)
422 MatrixCamera
*returnValue
;
424 newPtr
<MatrixCamera
>(returnValue
, Thread::getCurrentLocalFlags());
426 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
427 ~Thread::getCurrentLocalFlags();
433 FieldContainerTransitPtr
MatrixCameraBase::shallowCopyLocal(
434 BitVector bFlags
) const
436 MatrixCamera
*tmpPtr
;
438 newPtr(tmpPtr
, dynamic_cast<const MatrixCamera
*>(this), bFlags
);
440 FieldContainerTransitPtr
returnValue(tmpPtr
);
442 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
447 FieldContainerTransitPtr
MatrixCameraBase::shallowCopyDependent(
448 BitVector bFlags
) const
450 MatrixCamera
*tmpPtr
;
452 newPtr(tmpPtr
, dynamic_cast<const MatrixCamera
*>(this), ~bFlags
);
454 FieldContainerTransitPtr
returnValue(tmpPtr
);
456 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
461 FieldContainerTransitPtr
MatrixCameraBase::shallowCopy(void) const
463 MatrixCamera
*tmpPtr
;
466 dynamic_cast<const MatrixCamera
*>(this),
467 Thread::getCurrentLocalFlags());
469 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
471 FieldContainerTransitPtr
returnValue(tmpPtr
);
479 /*------------------------- constructors ----------------------------------*/
481 MatrixCameraBase::MatrixCameraBase(void) :
483 _sfProjectionMatrix (),
484 _sfModelviewMatrix (),
489 MatrixCameraBase::MatrixCameraBase(const MatrixCameraBase
&source
) :
491 _sfProjectionMatrix (source
._sfProjectionMatrix
),
492 _sfModelviewMatrix (source
._sfModelviewMatrix
),
493 _sfUseBeacon (source
._sfUseBeacon
)
498 /*-------------------------- destructors ----------------------------------*/
500 MatrixCameraBase::~MatrixCameraBase(void)
505 GetFieldHandlePtr
MatrixCameraBase::getHandleProjectionMatrix (void) const
507 SFMatrix::GetHandlePtr
returnValue(
508 new SFMatrix::GetHandle(
509 &_sfProjectionMatrix
,
510 this->getType().getFieldDesc(ProjectionMatrixFieldId
),
511 const_cast<MatrixCameraBase
*>(this)));
516 EditFieldHandlePtr
MatrixCameraBase::editHandleProjectionMatrix(void)
518 SFMatrix::EditHandlePtr
returnValue(
519 new SFMatrix::EditHandle(
520 &_sfProjectionMatrix
,
521 this->getType().getFieldDesc(ProjectionMatrixFieldId
),
525 editSField(ProjectionMatrixFieldMask
);
530 GetFieldHandlePtr
MatrixCameraBase::getHandleModelviewMatrix (void) const
532 SFMatrix::GetHandlePtr
returnValue(
533 new SFMatrix::GetHandle(
535 this->getType().getFieldDesc(ModelviewMatrixFieldId
),
536 const_cast<MatrixCameraBase
*>(this)));
541 EditFieldHandlePtr
MatrixCameraBase::editHandleModelviewMatrix(void)
543 SFMatrix::EditHandlePtr
returnValue(
544 new SFMatrix::EditHandle(
546 this->getType().getFieldDesc(ModelviewMatrixFieldId
),
550 editSField(ModelviewMatrixFieldMask
);
555 GetFieldHandlePtr
MatrixCameraBase::getHandleUseBeacon (void) const
557 SFBool::GetHandlePtr
returnValue(
558 new SFBool::GetHandle(
560 this->getType().getFieldDesc(UseBeaconFieldId
),
561 const_cast<MatrixCameraBase
*>(this)));
566 EditFieldHandlePtr
MatrixCameraBase::editHandleUseBeacon (void)
568 SFBool::EditHandlePtr
returnValue(
569 new SFBool::EditHandle(
571 this->getType().getFieldDesc(UseBeaconFieldId
),
575 editSField(UseBeaconFieldMask
);
581 #ifdef OSG_MT_CPTR_ASPECT
582 void MatrixCameraBase::execSyncV( FieldContainer
&oFrom
,
583 ConstFieldMaskArg whichField
,
584 AspectOffsetStore
&oOffsets
,
585 ConstFieldMaskArg syncMode
,
586 const UInt32 uiSyncInfo
)
588 MatrixCamera
*pThis
= static_cast<MatrixCamera
*>(this);
590 pThis
->execSync(static_cast<MatrixCamera
*>(&oFrom
),
599 #ifdef OSG_MT_CPTR_ASPECT
600 FieldContainer
*MatrixCameraBase::createAspectCopy(
601 const FieldContainer
*pRefAspect
) const
603 MatrixCamera
*returnValue
;
605 newAspectCopy(returnValue
,
606 dynamic_cast<const MatrixCamera
*>(pRefAspect
),
607 dynamic_cast<const MatrixCamera
*>(this));
613 void MatrixCameraBase::resolveLinks(void)
615 Inherited::resolveLinks();