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 **
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 "OSGTransformBase.h"
67 #include "OSGTransform.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::Transform
78 The basic Transformation class. Just keeps a single matrix. For more complex
79 behaviour, see its descendents.
82 /***************************************************************************\
83 * Field Documentation *
84 \***************************************************************************/
86 /*! \var Matrix TransformBase::_sfMatrix
87 The transformation matrix.
91 /***************************************************************************\
92 * FieldType/FieldTrait Instantiation *
93 \***************************************************************************/
95 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
96 PointerType FieldTraits
<Transform
*, nsOSG
>::_type(
99 Transform::getClassType(),
103 OSG_FIELDTRAITS_GETTYPE_NS(Transform
*, nsOSG
)
105 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
109 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
113 /***************************************************************************\
114 * Field Description *
115 \***************************************************************************/
117 void TransformBase::classDescInserter(TypeObject
&oType
)
119 FieldDescriptionBase
*pDesc
= NULL
;
122 pDesc
= new SFMatrix::Description(
123 SFMatrix::getClassType(),
125 "The transformation matrix.\n",
126 MatrixFieldId
, MatrixFieldMask
,
128 (Field::SFDefaultFlags
| Field::FStdAccess
),
129 static_cast<FieldEditMethodSig
>(&Transform::editHandleMatrix
),
130 static_cast<FieldGetMethodSig
>(&Transform::getHandleMatrix
));
132 oType
.addInitialDesc(pDesc
);
136 TransformBase::TypeObject
TransformBase::_type(
137 TransformBase::getClassname(),
138 Inherited::getClassname(),
141 reinterpret_cast<PrototypeCreateF
>(&TransformBase::createEmptyLocal
),
142 reinterpret_cast<InitContainerF
>(&Transform::initMethod
),
143 reinterpret_cast<ExitContainerF
>(&Transform::exitMethod
),
144 reinterpret_cast<InitalInsertDescFunc
>(
145 reinterpret_cast<void *>(&Transform::classDescInserter
)),
148 "<?xml version=\"1.0\" ?>\n"
151 " name=\"Transform\"\n"
152 " parent=\"Group\"\n"
153 " library=\"Group\"\n"
154 " structure=\"concrete\"\n"
155 " pointerfieldtypes=\"both\"\n"
156 " systemcomponent=\"true\"\n"
157 " parentsystemcomponent=\"true\"\n"
158 " isNodeCore=\"true\"\n"
159 " docGroupBase=\"GrpGroupMisc\"\n"
161 " The basic Transformation class. Just keeps a single matrix. For more complex\n"
162 " behaviour, see its descendents.\n"
164 "\t name=\"matrix\"\n"
165 "\t type=\"Matrix\"\n"
166 "\t cardinality=\"single\"\n"
167 "\t visibility=\"external\"\n"
169 "\tThe transformation matrix.\n"
171 "</FieldContainer>\n",
172 "The basic Transformation class. Just keeps a single matrix. For more complex\n"
173 "behaviour, see its descendents.\n"
176 /*------------------------------ get -----------------------------------*/
178 FieldContainerType
&TransformBase::getType(void)
183 const FieldContainerType
&TransformBase::getType(void) const
188 UInt32
TransformBase::getContainerSize(void) const
190 return sizeof(Transform
);
193 /*------------------------- decorator get ------------------------------*/
196 SFMatrix
*TransformBase::editSFMatrix(void)
198 editSField(MatrixFieldMask
);
203 const SFMatrix
*TransformBase::getSFMatrix(void) const
213 /*------------------------------ access -----------------------------------*/
215 SizeT
TransformBase::getBinSize(ConstFieldMaskArg whichField
)
217 SizeT returnValue
= Inherited::getBinSize(whichField
);
219 if(FieldBits::NoField
!= (MatrixFieldMask
& whichField
))
221 returnValue
+= _sfMatrix
.getBinSize();
227 void TransformBase::copyToBin(BinaryDataHandler
&pMem
,
228 ConstFieldMaskArg whichField
)
230 Inherited::copyToBin(pMem
, whichField
);
232 if(FieldBits::NoField
!= (MatrixFieldMask
& whichField
))
234 _sfMatrix
.copyToBin(pMem
);
238 void TransformBase::copyFromBin(BinaryDataHandler
&pMem
,
239 ConstFieldMaskArg whichField
)
241 Inherited::copyFromBin(pMem
, whichField
);
243 if(FieldBits::NoField
!= (MatrixFieldMask
& whichField
))
245 editSField(MatrixFieldMask
);
246 _sfMatrix
.copyFromBin(pMem
);
250 //! create a new instance of the class
251 TransformTransitPtr
TransformBase::createLocal(BitVector bFlags
)
253 TransformTransitPtr fc
;
255 if(getClassType().getPrototype() != NULL
)
257 FieldContainerTransitPtr tmpPtr
=
258 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
260 fc
= dynamic_pointer_cast
<Transform
>(tmpPtr
);
266 //! create a new instance of the class, copy the container flags
267 TransformTransitPtr
TransformBase::createDependent(BitVector bFlags
)
269 TransformTransitPtr fc
;
271 if(getClassType().getPrototype() != NULL
)
273 FieldContainerTransitPtr tmpPtr
=
274 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
276 fc
= dynamic_pointer_cast
<Transform
>(tmpPtr
);
282 //! create a new instance of the class
283 TransformTransitPtr
TransformBase::create(void)
285 TransformTransitPtr fc
;
287 if(getClassType().getPrototype() != NULL
)
289 FieldContainerTransitPtr tmpPtr
=
290 getClassType().getPrototype()-> shallowCopy();
292 fc
= dynamic_pointer_cast
<Transform
>(tmpPtr
);
298 Transform
*TransformBase::createEmptyLocal(BitVector bFlags
)
300 Transform
*returnValue
;
302 newPtr
<Transform
>(returnValue
, bFlags
);
304 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
309 //! create an empty new instance of the class, do not copy the prototype
310 Transform
*TransformBase::createEmpty(void)
312 Transform
*returnValue
;
314 newPtr
<Transform
>(returnValue
, Thread::getCurrentLocalFlags());
316 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
317 ~Thread::getCurrentLocalFlags();
323 FieldContainerTransitPtr
TransformBase::shallowCopyLocal(
324 BitVector bFlags
) const
328 newPtr(tmpPtr
, dynamic_cast<const Transform
*>(this), bFlags
);
330 FieldContainerTransitPtr
returnValue(tmpPtr
);
332 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
337 FieldContainerTransitPtr
TransformBase::shallowCopyDependent(
338 BitVector bFlags
) const
342 newPtr(tmpPtr
, dynamic_cast<const Transform
*>(this), ~bFlags
);
344 FieldContainerTransitPtr
returnValue(tmpPtr
);
346 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
351 FieldContainerTransitPtr
TransformBase::shallowCopy(void) const
356 dynamic_cast<const Transform
*>(this),
357 Thread::getCurrentLocalFlags());
359 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
361 FieldContainerTransitPtr
returnValue(tmpPtr
);
369 /*------------------------- constructors ----------------------------------*/
371 TransformBase::TransformBase(void) :
377 TransformBase::TransformBase(const TransformBase
&source
) :
379 _sfMatrix (source
._sfMatrix
)
384 /*-------------------------- destructors ----------------------------------*/
386 TransformBase::~TransformBase(void)
391 GetFieldHandlePtr
TransformBase::getHandleMatrix (void) const
393 SFMatrix::GetHandlePtr
returnValue(
394 new SFMatrix::GetHandle(
396 this->getType().getFieldDesc(MatrixFieldId
),
397 const_cast<TransformBase
*>(this)));
402 EditFieldHandlePtr
TransformBase::editHandleMatrix (void)
404 SFMatrix::EditHandlePtr
returnValue(
405 new SFMatrix::EditHandle(
407 this->getType().getFieldDesc(MatrixFieldId
),
411 editSField(MatrixFieldMask
);
417 #ifdef OSG_MT_CPTR_ASPECT
418 void TransformBase::execSyncV( FieldContainer
&oFrom
,
419 ConstFieldMaskArg whichField
,
420 AspectOffsetStore
&oOffsets
,
421 ConstFieldMaskArg syncMode
,
422 const UInt32 uiSyncInfo
)
424 Transform
*pThis
= static_cast<Transform
*>(this);
426 pThis
->execSync(static_cast<Transform
*>(&oFrom
),
435 #ifdef OSG_MT_CPTR_ASPECT
436 FieldContainer
*TransformBase::createAspectCopy(
437 const FieldContainer
*pRefAspect
) const
439 Transform
*returnValue
;
441 newAspectCopy(returnValue
,
442 dynamic_cast<const Transform
*>(pRefAspect
),
443 dynamic_cast<const Transform
*>(this));
449 void TransformBase::resolveLinks(void)
451 Inherited::resolveLinks();