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 DoubleTransform!
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 "OSGDoubleTransformBase.h"
67 #include "OSGDoubleTransform.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::DoubleTransform
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 Matrix4d DoubleTransformBase::_sfMatrix
87 The transformation matrix.
91 /***************************************************************************\
92 * FieldType/FieldTrait Instantiation *
93 \***************************************************************************/
95 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
96 PointerType FieldTraits
<DoubleTransform
*, nsOSG
>::_type(
99 DoubleTransform::getClassType(),
103 OSG_FIELDTRAITS_GETTYPE_NS(DoubleTransform
*, nsOSG
)
105 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
109 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
113 /***************************************************************************\
114 * Field Description *
115 \***************************************************************************/
117 void DoubleTransformBase::classDescInserter(TypeObject
&oType
)
119 FieldDescriptionBase
*pDesc
= NULL
;
122 pDesc
= new SFMatrix4d::Description(
123 SFMatrix4d::getClassType(),
125 "The transformation matrix.\n",
126 MatrixFieldId
, MatrixFieldMask
,
128 (Field::SFDefaultFlags
| Field::FStdAccess
),
129 static_cast<FieldEditMethodSig
>(&DoubleTransform::editHandleMatrix
),
130 static_cast<FieldGetMethodSig
>(&DoubleTransform::getHandleMatrix
));
132 oType
.addInitialDesc(pDesc
);
136 DoubleTransformBase::TypeObject
DoubleTransformBase::_type(
137 DoubleTransformBase::getClassname(),
138 Inherited::getClassname(),
141 reinterpret_cast<PrototypeCreateF
>(&DoubleTransformBase::createEmptyLocal
),
142 reinterpret_cast<InitContainerF
>(&DoubleTransform::initMethod
),
143 reinterpret_cast<ExitContainerF
>(&DoubleTransform::exitMethod
),
144 reinterpret_cast<InitalInsertDescFunc
>(
145 reinterpret_cast<void *>(&DoubleTransform::classDescInserter
)),
148 "<?xml version=\"1.0\" ?>\n"
151 " name=\"DoubleTransform\"\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=\"Matrix4d\"\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
&DoubleTransformBase::getType(void)
183 const FieldContainerType
&DoubleTransformBase::getType(void) const
188 UInt32
DoubleTransformBase::getContainerSize(void) const
190 return sizeof(DoubleTransform
);
193 /*------------------------- decorator get ------------------------------*/
196 SFMatrix4d
*DoubleTransformBase::editSFMatrix(void)
198 editSField(MatrixFieldMask
);
203 const SFMatrix4d
*DoubleTransformBase::getSFMatrix(void) const
213 /*------------------------------ access -----------------------------------*/
215 SizeT
DoubleTransformBase::getBinSize(ConstFieldMaskArg whichField
)
217 SizeT returnValue
= Inherited::getBinSize(whichField
);
219 if(FieldBits::NoField
!= (MatrixFieldMask
& whichField
))
221 returnValue
+= _sfMatrix
.getBinSize();
227 void DoubleTransformBase::copyToBin(BinaryDataHandler
&pMem
,
228 ConstFieldMaskArg whichField
)
230 Inherited::copyToBin(pMem
, whichField
);
232 if(FieldBits::NoField
!= (MatrixFieldMask
& whichField
))
234 _sfMatrix
.copyToBin(pMem
);
238 void DoubleTransformBase::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 DoubleTransformTransitPtr
DoubleTransformBase::createLocal(BitVector bFlags
)
253 DoubleTransformTransitPtr fc
;
255 if(getClassType().getPrototype() != NULL
)
257 FieldContainerTransitPtr tmpPtr
=
258 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
260 fc
= dynamic_pointer_cast
<DoubleTransform
>(tmpPtr
);
266 //! create a new instance of the class, copy the container flags
267 DoubleTransformTransitPtr
DoubleTransformBase::createDependent(BitVector bFlags
)
269 DoubleTransformTransitPtr fc
;
271 if(getClassType().getPrototype() != NULL
)
273 FieldContainerTransitPtr tmpPtr
=
274 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
276 fc
= dynamic_pointer_cast
<DoubleTransform
>(tmpPtr
);
282 //! create a new instance of the class
283 DoubleTransformTransitPtr
DoubleTransformBase::create(void)
285 DoubleTransformTransitPtr fc
;
287 if(getClassType().getPrototype() != NULL
)
289 FieldContainerTransitPtr tmpPtr
=
290 getClassType().getPrototype()-> shallowCopy();
292 fc
= dynamic_pointer_cast
<DoubleTransform
>(tmpPtr
);
298 DoubleTransform
*DoubleTransformBase::createEmptyLocal(BitVector bFlags
)
300 DoubleTransform
*returnValue
;
302 newPtr
<DoubleTransform
>(returnValue
, bFlags
);
304 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
309 //! create an empty new instance of the class, do not copy the prototype
310 DoubleTransform
*DoubleTransformBase::createEmpty(void)
312 DoubleTransform
*returnValue
;
314 newPtr
<DoubleTransform
>(returnValue
, Thread::getCurrentLocalFlags());
316 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
317 ~Thread::getCurrentLocalFlags();
323 FieldContainerTransitPtr
DoubleTransformBase::shallowCopyLocal(
324 BitVector bFlags
) const
326 DoubleTransform
*tmpPtr
;
328 newPtr(tmpPtr
, dynamic_cast<const DoubleTransform
*>(this), bFlags
);
330 FieldContainerTransitPtr
returnValue(tmpPtr
);
332 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
337 FieldContainerTransitPtr
DoubleTransformBase::shallowCopyDependent(
338 BitVector bFlags
) const
340 DoubleTransform
*tmpPtr
;
342 newPtr(tmpPtr
, dynamic_cast<const DoubleTransform
*>(this), ~bFlags
);
344 FieldContainerTransitPtr
returnValue(tmpPtr
);
346 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
351 FieldContainerTransitPtr
DoubleTransformBase::shallowCopy(void) const
353 DoubleTransform
*tmpPtr
;
356 dynamic_cast<const DoubleTransform
*>(this),
357 Thread::getCurrentLocalFlags());
359 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
361 FieldContainerTransitPtr
returnValue(tmpPtr
);
369 /*------------------------- constructors ----------------------------------*/
371 DoubleTransformBase::DoubleTransformBase(void) :
377 DoubleTransformBase::DoubleTransformBase(const DoubleTransformBase
&source
) :
379 _sfMatrix (source
._sfMatrix
)
384 /*-------------------------- destructors ----------------------------------*/
386 DoubleTransformBase::~DoubleTransformBase(void)
391 GetFieldHandlePtr
DoubleTransformBase::getHandleMatrix (void) const
393 SFMatrix4d::GetHandlePtr
returnValue(
394 new SFMatrix4d::GetHandle(
396 this->getType().getFieldDesc(MatrixFieldId
),
397 const_cast<DoubleTransformBase
*>(this)));
402 EditFieldHandlePtr
DoubleTransformBase::editHandleMatrix (void)
404 SFMatrix4d::EditHandlePtr
returnValue(
405 new SFMatrix4d::EditHandle(
407 this->getType().getFieldDesc(MatrixFieldId
),
411 editSField(MatrixFieldMask
);
417 #ifdef OSG_MT_CPTR_ASPECT
418 void DoubleTransformBase::execSyncV( FieldContainer
&oFrom
,
419 ConstFieldMaskArg whichField
,
420 AspectOffsetStore
&oOffsets
,
421 ConstFieldMaskArg syncMode
,
422 const UInt32 uiSyncInfo
)
424 DoubleTransform
*pThis
= static_cast<DoubleTransform
*>(this);
426 pThis
->execSync(static_cast<DoubleTransform
*>(&oFrom
),
435 #ifdef OSG_MT_CPTR_ASPECT
436 FieldContainer
*DoubleTransformBase::createAspectCopy(
437 const FieldContainer
*pRefAspect
) const
439 DoubleTransform
*returnValue
;
441 newAspectCopy(returnValue
,
442 dynamic_cast<const DoubleTransform
*>(pRefAspect
),
443 dynamic_cast<const DoubleTransform
*>(this));
449 void DoubleTransformBase::resolveLinks(void)
451 Inherited::resolveLinks();