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 MultiPropertyUBOChunk!
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 "OSGMultiPropertyUBOChunkBase.h"
67 #include "OSGMultiPropertyUBOChunk.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::MultiPropertyUBOChunk
78 See \ref PageSystemMultiPropertyUBOChunk for a description.
80 The multi property chunk allows you to easily set up a uniform block array with a simple
81 plain struct layout in std140 buffer format.
83 This chunk is basically a specialization of the UniformBufferObjStd140Chunk with a simpler
84 usage pattern but at the cost of handling only a subset of the structural possibilities
85 that the general chunk allows.
87 It can for instance be perfectly used to define the geometry state. See the example 'multirangelight'
88 in the simple example folder for an application of this chunk.
91 /***************************************************************************\
92 * Field Documentation *
93 \***************************************************************************/
95 /*! \var UInt8 MultiPropertyUBOChunkBase::_mfTypes
96 Stores the type of a block entry. This can be any of the set {FLOAT_T, DOUBLE_T, INT_T, UINT_T, BOOL_T, VEC3_T, VEC4_T, MAT4_T}.
99 /*! \var UInt32 MultiPropertyUBOChunkBase::_mfCardinality
100 Stores the cardinality types, i.e. the consecutive block layout members.
103 /*! \var UInt32 MultiPropertyUBOChunkBase::_mfCardinalities
104 Stores the accumulated cardinalities for each type.
107 /*! \var UInt32 MultiPropertyUBOChunkBase::_sfNumProperties
108 Stores the number of properties added to the chunk.
111 /*! \var Real32 MultiPropertyUBOChunkBase::_mfFloatValues
115 /*! \var Real64 MultiPropertyUBOChunkBase::_mfDoubleValues
119 /*! \var Int32 MultiPropertyUBOChunkBase::_mfIntValues
123 /*! \var UInt32 MultiPropertyUBOChunkBase::_mfUIntValues
124 The unsigned int values.
127 /*! \var bool MultiPropertyUBOChunkBase::_mfBoolValues
131 /*! \var Vec3f MultiPropertyUBOChunkBase::_mfVec3Values
132 The 3D float vectors.
135 /*! \var Vec4f MultiPropertyUBOChunkBase::_mfVec4Values
136 The 4D float vectors.
139 /*! \var Matrix MultiPropertyUBOChunkBase::_mfMatrixValues
144 /***************************************************************************\
145 * FieldType/FieldTrait Instantiation *
146 \***************************************************************************/
148 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
149 PointerType FieldTraits
<MultiPropertyUBOChunk
*, nsOSG
>::_type(
150 "MultiPropertyUBOChunkPtr",
151 "UniformBufferObjStd140ChunkPtr",
152 MultiPropertyUBOChunk::getClassType(),
156 OSG_FIELDTRAITS_GETTYPE_NS(MultiPropertyUBOChunk
*, nsOSG
)
158 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
159 MultiPropertyUBOChunk
*,
162 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
163 MultiPropertyUBOChunk
*,
166 /***************************************************************************\
167 * Field Description *
168 \***************************************************************************/
170 void MultiPropertyUBOChunkBase::classDescInserter(TypeObject
&oType
)
172 FieldDescriptionBase
*pDesc
= NULL
;
175 pDesc
= new MFUInt8::Description(
176 MFUInt8::getClassType(),
178 "Stores the type of a block entry. This can be any of the set {FLOAT_T, DOUBLE_T, INT_T, UINT_T, BOOL_T, VEC3_T, VEC4_T, MAT4_T}.\n",
179 TypesFieldId
, TypesFieldMask
,
181 (Field::MFDefaultFlags
| Field::FStdAccess
),
182 static_cast<FieldEditMethodSig
>(&MultiPropertyUBOChunk::editHandleTypes
),
183 static_cast<FieldGetMethodSig
>(&MultiPropertyUBOChunk::getHandleTypes
));
185 oType
.addInitialDesc(pDesc
);
187 pDesc
= new MFUInt32::Description(
188 MFUInt32::getClassType(),
190 "Stores the cardinality types, i.e. the consecutive block layout members.\n",
191 CardinalityFieldId
, CardinalityFieldMask
,
193 (Field::MFDefaultFlags
| Field::FStdAccess
),
194 static_cast<FieldEditMethodSig
>(&MultiPropertyUBOChunk::editHandleCardinality
),
195 static_cast<FieldGetMethodSig
>(&MultiPropertyUBOChunk::getHandleCardinality
));
197 oType
.addInitialDesc(pDesc
);
199 pDesc
= new MFUInt32::Description(
200 MFUInt32::getClassType(),
202 "Stores the accumulated cardinalities for each type.\n",
203 CardinalitiesFieldId
, CardinalitiesFieldMask
,
205 (Field::MFDefaultFlags
| Field::FStdAccess
),
206 static_cast<FieldEditMethodSig
>(&MultiPropertyUBOChunk::editHandleCardinalities
),
207 static_cast<FieldGetMethodSig
>(&MultiPropertyUBOChunk::getHandleCardinalities
));
209 oType
.addInitialDesc(pDesc
);
211 pDesc
= new SFUInt32::Description(
212 SFUInt32::getClassType(),
214 "Stores the number of properties added to the chunk.\n",
215 NumPropertiesFieldId
, NumPropertiesFieldMask
,
217 (Field::SFDefaultFlags
| Field::FStdAccess
),
218 static_cast<FieldEditMethodSig
>(&MultiPropertyUBOChunk::editHandleNumProperties
),
219 static_cast<FieldGetMethodSig
>(&MultiPropertyUBOChunk::getHandleNumProperties
));
221 oType
.addInitialDesc(pDesc
);
223 pDesc
= new MFReal32::Description(
224 MFReal32::getClassType(),
226 "The float values.\n",
227 FloatValuesFieldId
, FloatValuesFieldMask
,
229 (Field::MFDefaultFlags
| Field::FStdAccess
),
230 static_cast<FieldEditMethodSig
>(&MultiPropertyUBOChunk::editHandleFloatValues
),
231 static_cast<FieldGetMethodSig
>(&MultiPropertyUBOChunk::getHandleFloatValues
));
233 oType
.addInitialDesc(pDesc
);
235 pDesc
= new MFReal64::Description(
236 MFReal64::getClassType(),
238 "The double values.\n",
239 DoubleValuesFieldId
, DoubleValuesFieldMask
,
241 (Field::MFDefaultFlags
| Field::FStdAccess
),
242 static_cast<FieldEditMethodSig
>(&MultiPropertyUBOChunk::editHandleDoubleValues
),
243 static_cast<FieldGetMethodSig
>(&MultiPropertyUBOChunk::getHandleDoubleValues
));
245 oType
.addInitialDesc(pDesc
);
247 pDesc
= new MFInt32::Description(
248 MFInt32::getClassType(),
251 IntValuesFieldId
, IntValuesFieldMask
,
253 (Field::MFDefaultFlags
| Field::FStdAccess
),
254 static_cast<FieldEditMethodSig
>(&MultiPropertyUBOChunk::editHandleIntValues
),
255 static_cast<FieldGetMethodSig
>(&MultiPropertyUBOChunk::getHandleIntValues
));
257 oType
.addInitialDesc(pDesc
);
259 pDesc
= new MFUInt32::Description(
260 MFUInt32::getClassType(),
262 "The unsigned int values.\n",
263 UIntValuesFieldId
, UIntValuesFieldMask
,
265 (Field::MFDefaultFlags
| Field::FStdAccess
),
266 static_cast<FieldEditMethodSig
>(&MultiPropertyUBOChunk::editHandleUIntValues
),
267 static_cast<FieldGetMethodSig
>(&MultiPropertyUBOChunk::getHandleUIntValues
));
269 oType
.addInitialDesc(pDesc
);
271 pDesc
= new MFBool::Description(
272 MFBool::getClassType(),
274 "The bool values.\n",
275 BoolValuesFieldId
, BoolValuesFieldMask
,
277 (Field::MFDefaultFlags
| Field::FStdAccess
),
278 static_cast<FieldEditMethodSig
>(&MultiPropertyUBOChunk::editHandleBoolValues
),
279 static_cast<FieldGetMethodSig
>(&MultiPropertyUBOChunk::getHandleBoolValues
));
281 oType
.addInitialDesc(pDesc
);
283 pDesc
= new MFVec3f::Description(
284 MFVec3f::getClassType(),
286 "The 3D float vectors.\n",
287 Vec3ValuesFieldId
, Vec3ValuesFieldMask
,
289 (Field::MFDefaultFlags
| Field::FStdAccess
),
290 static_cast<FieldEditMethodSig
>(&MultiPropertyUBOChunk::editHandleVec3Values
),
291 static_cast<FieldGetMethodSig
>(&MultiPropertyUBOChunk::getHandleVec3Values
));
293 oType
.addInitialDesc(pDesc
);
295 pDesc
= new MFVec4f::Description(
296 MFVec4f::getClassType(),
298 "The 4D float vectors.\n",
299 Vec4ValuesFieldId
, Vec4ValuesFieldMask
,
301 (Field::MFDefaultFlags
| Field::FStdAccess
),
302 static_cast<FieldEditMethodSig
>(&MultiPropertyUBOChunk::editHandleVec4Values
),
303 static_cast<FieldGetMethodSig
>(&MultiPropertyUBOChunk::getHandleVec4Values
));
305 oType
.addInitialDesc(pDesc
);
307 pDesc
= new MFMatrix::Description(
308 MFMatrix::getClassType(),
311 MatrixValuesFieldId
, MatrixValuesFieldMask
,
313 (Field::MFDefaultFlags
| Field::FStdAccess
),
314 static_cast<FieldEditMethodSig
>(&MultiPropertyUBOChunk::editHandleMatrixValues
),
315 static_cast<FieldGetMethodSig
>(&MultiPropertyUBOChunk::getHandleMatrixValues
));
317 oType
.addInitialDesc(pDesc
);
321 MultiPropertyUBOChunkBase::TypeObject
MultiPropertyUBOChunkBase::_type(
322 MultiPropertyUBOChunkBase::getClassname(),
323 Inherited::getClassname(),
326 reinterpret_cast<PrototypeCreateF
>(&MultiPropertyUBOChunkBase::createEmptyLocal
),
327 reinterpret_cast<InitContainerF
>(&MultiPropertyUBOChunk::initMethod
),
328 reinterpret_cast<ExitContainerF
>(&MultiPropertyUBOChunk::exitMethod
),
329 reinterpret_cast<InitalInsertDescFunc
>(
330 reinterpret_cast<void *>(&MultiPropertyUBOChunk::classDescInserter
)),
333 "<?xml version=\"1.0\"?>\n"
336 " name=\"MultiPropertyUBOChunk\"\n"
337 " parent=\"UniformBufferObjStd140Chunk\"\n"
338 " library=\"System\"\n"
339 " pointerfieldtypes=\"both\"\n"
340 " structure=\"concrete\"\n"
341 " systemcomponent=\"true\"\n"
342 " parentsystemcomponent=\"true\"\n"
343 " decoratable=\"false\"\n"
344 " useLocalIncludes=\"false\"\n"
345 " docGroupBase=\"GrpSystemState\"\n"
347 "See \\ref PageSystemMultiPropertyUBOChunk for a description.\n"
349 "The multi property chunk allows you to easily set up a uniform block array with a simple \n"
350 "plain struct layout in std140 buffer format.\n"
352 "This chunk is basically a specialization of the UniformBufferObjStd140Chunk with a simpler \n"
353 "usage pattern but at the cost of handling only a subset of the structural possibilities \n"
354 "that the general chunk allows.\n"
356 "It can for instance be perfectly used to define the geometry state. See the example 'multirangelight'\n"
357 "in the simple example folder for an application of this chunk.\n"
362 " cardinality=\"multi\"\n"
363 " visibility=\"external\"\n"
364 " access=\"protected\"\n"
366 " Stores the type of a block entry. This can be any of the set {FLOAT_T, DOUBLE_T, INT_T, UINT_T, BOOL_T, VEC3_T, VEC4_T, MAT4_T}.\n"
369 " name=\"cardinality\"\n"
371 " cardinality=\"multi\"\n"
372 " visibility=\"external\"\n"
373 " access=\"protected\"\n"
375 " Stores the cardinality types, i.e. the consecutive block layout members.\n"
378 " name=\"cardinalities\"\n"
380 " cardinality=\"multi\"\n"
381 " visibility=\"external\"\n"
382 " access=\"protected\"\n"
384 " Stores the accumulated cardinalities for each type.\n"
387 " name=\"numProperties\"\n"
389 " cardinality=\"single\"\n"
390 " visibility=\"external\"\n"
391 " access=\"protected\"\n"
393 " Stores the number of properties added to the chunk.\n"
396 " name=\"floatValues\"\n"
398 " cardinality=\"multi\"\n"
399 " visibility=\"external\"\n"
400 " access=\"protected\"\n"
402 " The float values.\n"
405 " name=\"doubleValues\"\n"
407 " cardinality=\"multi\"\n"
408 " visibility=\"external\"\n"
409 " access=\"protected\"\n"
411 " The double values.\n"
414 " name=\"intValues\"\n"
416 " cardinality=\"multi\"\n"
417 " visibility=\"external\"\n"
418 " access=\"protected\"\n"
423 " name=\"uIntValues\"\n"
425 " cardinality=\"multi\"\n"
426 " visibility=\"external\"\n"
427 " access=\"protected\"\n"
429 " The unsigned int values.\n"
432 " name=\"boolValues\"\n"
434 " cardinality=\"multi\"\n"
435 " visibility=\"external\"\n"
436 " access=\"protected\"\n"
438 " The bool values.\n"
441 " name=\"vec3Values\"\n"
443 " cardinality=\"multi\"\n"
444 " visibility=\"external\"\n"
445 " access=\"protected\"\n"
447 " The 3D float vectors.\n"
450 " name=\"vec4Values\"\n"
452 " cardinality=\"multi\"\n"
453 " visibility=\"external\"\n"
454 " access=\"protected\"\n"
456 " The 4D float vectors.\n"
459 " name=\"matrixValues\"\n"
461 " cardinality=\"multi\"\n"
462 " visibility=\"external\"\n"
463 " access=\"protected\"\n"
468 "</FieldContainer>\n",
469 "See \\ref PageSystemMultiPropertyUBOChunk for a description.\n"
471 "The multi property chunk allows you to easily set up a uniform block array with a simple \n"
472 "plain struct layout in std140 buffer format.\n"
474 "This chunk is basically a specialization of the UniformBufferObjStd140Chunk with a simpler \n"
475 "usage pattern but at the cost of handling only a subset of the structural possibilities \n"
476 "that the general chunk allows.\n"
478 "It can for instance be perfectly used to define the geometry state. See the example 'multirangelight'\n"
479 "in the simple example folder for an application of this chunk.\n"
482 /*------------------------------ get -----------------------------------*/
484 FieldContainerType
&MultiPropertyUBOChunkBase::getType(void)
489 const FieldContainerType
&MultiPropertyUBOChunkBase::getType(void) const
494 UInt32
MultiPropertyUBOChunkBase::getContainerSize(void) const
496 return sizeof(MultiPropertyUBOChunk
);
499 /*------------------------- decorator get ------------------------------*/
502 MFUInt8
*MultiPropertyUBOChunkBase::editMFTypes(void)
504 editMField(TypesFieldMask
, _mfTypes
);
509 const MFUInt8
*MultiPropertyUBOChunkBase::getMFTypes(void) const
515 MFUInt32
*MultiPropertyUBOChunkBase::editMFCardinality(void)
517 editMField(CardinalityFieldMask
, _mfCardinality
);
519 return &_mfCardinality
;
522 const MFUInt32
*MultiPropertyUBOChunkBase::getMFCardinality(void) const
524 return &_mfCardinality
;
528 MFUInt32
*MultiPropertyUBOChunkBase::editMFCardinalities(void)
530 editMField(CardinalitiesFieldMask
, _mfCardinalities
);
532 return &_mfCardinalities
;
535 const MFUInt32
*MultiPropertyUBOChunkBase::getMFCardinalities(void) const
537 return &_mfCardinalities
;
541 SFUInt32
*MultiPropertyUBOChunkBase::editSFNumProperties(void)
543 editSField(NumPropertiesFieldMask
);
545 return &_sfNumProperties
;
548 const SFUInt32
*MultiPropertyUBOChunkBase::getSFNumProperties(void) const
550 return &_sfNumProperties
;
554 MFReal32
*MultiPropertyUBOChunkBase::editMFFloatValues(void)
556 editMField(FloatValuesFieldMask
, _mfFloatValues
);
558 return &_mfFloatValues
;
561 const MFReal32
*MultiPropertyUBOChunkBase::getMFFloatValues(void) const
563 return &_mfFloatValues
;
567 MFReal64
*MultiPropertyUBOChunkBase::editMFDoubleValues(void)
569 editMField(DoubleValuesFieldMask
, _mfDoubleValues
);
571 return &_mfDoubleValues
;
574 const MFReal64
*MultiPropertyUBOChunkBase::getMFDoubleValues(void) const
576 return &_mfDoubleValues
;
580 MFInt32
*MultiPropertyUBOChunkBase::editMFIntValues(void)
582 editMField(IntValuesFieldMask
, _mfIntValues
);
584 return &_mfIntValues
;
587 const MFInt32
*MultiPropertyUBOChunkBase::getMFIntValues(void) const
589 return &_mfIntValues
;
593 MFUInt32
*MultiPropertyUBOChunkBase::editMFUIntValues(void)
595 editMField(UIntValuesFieldMask
, _mfUIntValues
);
597 return &_mfUIntValues
;
600 const MFUInt32
*MultiPropertyUBOChunkBase::getMFUIntValues(void) const
602 return &_mfUIntValues
;
606 MFBool
*MultiPropertyUBOChunkBase::editMFBoolValues(void)
608 editMField(BoolValuesFieldMask
, _mfBoolValues
);
610 return &_mfBoolValues
;
613 const MFBool
*MultiPropertyUBOChunkBase::getMFBoolValues(void) const
615 return &_mfBoolValues
;
619 MFVec3f
*MultiPropertyUBOChunkBase::editMFVec3Values(void)
621 editMField(Vec3ValuesFieldMask
, _mfVec3Values
);
623 return &_mfVec3Values
;
626 const MFVec3f
*MultiPropertyUBOChunkBase::getMFVec3Values(void) const
628 return &_mfVec3Values
;
632 MFVec4f
*MultiPropertyUBOChunkBase::editMFVec4Values(void)
634 editMField(Vec4ValuesFieldMask
, _mfVec4Values
);
636 return &_mfVec4Values
;
639 const MFVec4f
*MultiPropertyUBOChunkBase::getMFVec4Values(void) const
641 return &_mfVec4Values
;
645 MFMatrix
*MultiPropertyUBOChunkBase::editMFMatrixValues(void)
647 editMField(MatrixValuesFieldMask
, _mfMatrixValues
);
649 return &_mfMatrixValues
;
652 const MFMatrix
*MultiPropertyUBOChunkBase::getMFMatrixValues(void) const
654 return &_mfMatrixValues
;
662 /*------------------------------ access -----------------------------------*/
664 SizeT
MultiPropertyUBOChunkBase::getBinSize(ConstFieldMaskArg whichField
)
666 SizeT returnValue
= Inherited::getBinSize(whichField
);
668 if(FieldBits::NoField
!= (TypesFieldMask
& whichField
))
670 returnValue
+= _mfTypes
.getBinSize();
672 if(FieldBits::NoField
!= (CardinalityFieldMask
& whichField
))
674 returnValue
+= _mfCardinality
.getBinSize();
676 if(FieldBits::NoField
!= (CardinalitiesFieldMask
& whichField
))
678 returnValue
+= _mfCardinalities
.getBinSize();
680 if(FieldBits::NoField
!= (NumPropertiesFieldMask
& whichField
))
682 returnValue
+= _sfNumProperties
.getBinSize();
684 if(FieldBits::NoField
!= (FloatValuesFieldMask
& whichField
))
686 returnValue
+= _mfFloatValues
.getBinSize();
688 if(FieldBits::NoField
!= (DoubleValuesFieldMask
& whichField
))
690 returnValue
+= _mfDoubleValues
.getBinSize();
692 if(FieldBits::NoField
!= (IntValuesFieldMask
& whichField
))
694 returnValue
+= _mfIntValues
.getBinSize();
696 if(FieldBits::NoField
!= (UIntValuesFieldMask
& whichField
))
698 returnValue
+= _mfUIntValues
.getBinSize();
700 if(FieldBits::NoField
!= (BoolValuesFieldMask
& whichField
))
702 returnValue
+= _mfBoolValues
.getBinSize();
704 if(FieldBits::NoField
!= (Vec3ValuesFieldMask
& whichField
))
706 returnValue
+= _mfVec3Values
.getBinSize();
708 if(FieldBits::NoField
!= (Vec4ValuesFieldMask
& whichField
))
710 returnValue
+= _mfVec4Values
.getBinSize();
712 if(FieldBits::NoField
!= (MatrixValuesFieldMask
& whichField
))
714 returnValue
+= _mfMatrixValues
.getBinSize();
720 void MultiPropertyUBOChunkBase::copyToBin(BinaryDataHandler
&pMem
,
721 ConstFieldMaskArg whichField
)
723 Inherited::copyToBin(pMem
, whichField
);
725 if(FieldBits::NoField
!= (TypesFieldMask
& whichField
))
727 _mfTypes
.copyToBin(pMem
);
729 if(FieldBits::NoField
!= (CardinalityFieldMask
& whichField
))
731 _mfCardinality
.copyToBin(pMem
);
733 if(FieldBits::NoField
!= (CardinalitiesFieldMask
& whichField
))
735 _mfCardinalities
.copyToBin(pMem
);
737 if(FieldBits::NoField
!= (NumPropertiesFieldMask
& whichField
))
739 _sfNumProperties
.copyToBin(pMem
);
741 if(FieldBits::NoField
!= (FloatValuesFieldMask
& whichField
))
743 _mfFloatValues
.copyToBin(pMem
);
745 if(FieldBits::NoField
!= (DoubleValuesFieldMask
& whichField
))
747 _mfDoubleValues
.copyToBin(pMem
);
749 if(FieldBits::NoField
!= (IntValuesFieldMask
& whichField
))
751 _mfIntValues
.copyToBin(pMem
);
753 if(FieldBits::NoField
!= (UIntValuesFieldMask
& whichField
))
755 _mfUIntValues
.copyToBin(pMem
);
757 if(FieldBits::NoField
!= (BoolValuesFieldMask
& whichField
))
759 _mfBoolValues
.copyToBin(pMem
);
761 if(FieldBits::NoField
!= (Vec3ValuesFieldMask
& whichField
))
763 _mfVec3Values
.copyToBin(pMem
);
765 if(FieldBits::NoField
!= (Vec4ValuesFieldMask
& whichField
))
767 _mfVec4Values
.copyToBin(pMem
);
769 if(FieldBits::NoField
!= (MatrixValuesFieldMask
& whichField
))
771 _mfMatrixValues
.copyToBin(pMem
);
775 void MultiPropertyUBOChunkBase::copyFromBin(BinaryDataHandler
&pMem
,
776 ConstFieldMaskArg whichField
)
778 Inherited::copyFromBin(pMem
, whichField
);
780 if(FieldBits::NoField
!= (TypesFieldMask
& whichField
))
782 editMField(TypesFieldMask
, _mfTypes
);
783 _mfTypes
.copyFromBin(pMem
);
785 if(FieldBits::NoField
!= (CardinalityFieldMask
& whichField
))
787 editMField(CardinalityFieldMask
, _mfCardinality
);
788 _mfCardinality
.copyFromBin(pMem
);
790 if(FieldBits::NoField
!= (CardinalitiesFieldMask
& whichField
))
792 editMField(CardinalitiesFieldMask
, _mfCardinalities
);
793 _mfCardinalities
.copyFromBin(pMem
);
795 if(FieldBits::NoField
!= (NumPropertiesFieldMask
& whichField
))
797 editSField(NumPropertiesFieldMask
);
798 _sfNumProperties
.copyFromBin(pMem
);
800 if(FieldBits::NoField
!= (FloatValuesFieldMask
& whichField
))
802 editMField(FloatValuesFieldMask
, _mfFloatValues
);
803 _mfFloatValues
.copyFromBin(pMem
);
805 if(FieldBits::NoField
!= (DoubleValuesFieldMask
& whichField
))
807 editMField(DoubleValuesFieldMask
, _mfDoubleValues
);
808 _mfDoubleValues
.copyFromBin(pMem
);
810 if(FieldBits::NoField
!= (IntValuesFieldMask
& whichField
))
812 editMField(IntValuesFieldMask
, _mfIntValues
);
813 _mfIntValues
.copyFromBin(pMem
);
815 if(FieldBits::NoField
!= (UIntValuesFieldMask
& whichField
))
817 editMField(UIntValuesFieldMask
, _mfUIntValues
);
818 _mfUIntValues
.copyFromBin(pMem
);
820 if(FieldBits::NoField
!= (BoolValuesFieldMask
& whichField
))
822 editMField(BoolValuesFieldMask
, _mfBoolValues
);
823 _mfBoolValues
.copyFromBin(pMem
);
825 if(FieldBits::NoField
!= (Vec3ValuesFieldMask
& whichField
))
827 editMField(Vec3ValuesFieldMask
, _mfVec3Values
);
828 _mfVec3Values
.copyFromBin(pMem
);
830 if(FieldBits::NoField
!= (Vec4ValuesFieldMask
& whichField
))
832 editMField(Vec4ValuesFieldMask
, _mfVec4Values
);
833 _mfVec4Values
.copyFromBin(pMem
);
835 if(FieldBits::NoField
!= (MatrixValuesFieldMask
& whichField
))
837 editMField(MatrixValuesFieldMask
, _mfMatrixValues
);
838 _mfMatrixValues
.copyFromBin(pMem
);
842 //! create a new instance of the class
843 MultiPropertyUBOChunkTransitPtr
MultiPropertyUBOChunkBase::createLocal(BitVector bFlags
)
845 MultiPropertyUBOChunkTransitPtr fc
;
847 if(getClassType().getPrototype() != NULL
)
849 FieldContainerTransitPtr tmpPtr
=
850 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
852 fc
= dynamic_pointer_cast
<MultiPropertyUBOChunk
>(tmpPtr
);
858 //! create a new instance of the class, copy the container flags
859 MultiPropertyUBOChunkTransitPtr
MultiPropertyUBOChunkBase::createDependent(BitVector bFlags
)
861 MultiPropertyUBOChunkTransitPtr fc
;
863 if(getClassType().getPrototype() != NULL
)
865 FieldContainerTransitPtr tmpPtr
=
866 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
868 fc
= dynamic_pointer_cast
<MultiPropertyUBOChunk
>(tmpPtr
);
874 //! create a new instance of the class
875 MultiPropertyUBOChunkTransitPtr
MultiPropertyUBOChunkBase::create(void)
877 MultiPropertyUBOChunkTransitPtr fc
;
879 if(getClassType().getPrototype() != NULL
)
881 FieldContainerTransitPtr tmpPtr
=
882 getClassType().getPrototype()-> shallowCopy();
884 fc
= dynamic_pointer_cast
<MultiPropertyUBOChunk
>(tmpPtr
);
890 MultiPropertyUBOChunk
*MultiPropertyUBOChunkBase::createEmptyLocal(BitVector bFlags
)
892 MultiPropertyUBOChunk
*returnValue
;
894 newPtr
<MultiPropertyUBOChunk
>(returnValue
, bFlags
);
896 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
901 //! create an empty new instance of the class, do not copy the prototype
902 MultiPropertyUBOChunk
*MultiPropertyUBOChunkBase::createEmpty(void)
904 MultiPropertyUBOChunk
*returnValue
;
906 newPtr
<MultiPropertyUBOChunk
>(returnValue
, Thread::getCurrentLocalFlags());
908 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
909 ~Thread::getCurrentLocalFlags();
915 FieldContainerTransitPtr
MultiPropertyUBOChunkBase::shallowCopyLocal(
916 BitVector bFlags
) const
918 MultiPropertyUBOChunk
*tmpPtr
;
920 newPtr(tmpPtr
, dynamic_cast<const MultiPropertyUBOChunk
*>(this), bFlags
);
922 FieldContainerTransitPtr
returnValue(tmpPtr
);
924 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
929 FieldContainerTransitPtr
MultiPropertyUBOChunkBase::shallowCopyDependent(
930 BitVector bFlags
) const
932 MultiPropertyUBOChunk
*tmpPtr
;
934 newPtr(tmpPtr
, dynamic_cast<const MultiPropertyUBOChunk
*>(this), ~bFlags
);
936 FieldContainerTransitPtr
returnValue(tmpPtr
);
938 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
943 FieldContainerTransitPtr
MultiPropertyUBOChunkBase::shallowCopy(void) const
945 MultiPropertyUBOChunk
*tmpPtr
;
948 dynamic_cast<const MultiPropertyUBOChunk
*>(this),
949 Thread::getCurrentLocalFlags());
951 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
953 FieldContainerTransitPtr
returnValue(tmpPtr
);
961 /*------------------------- constructors ----------------------------------*/
963 MultiPropertyUBOChunkBase::MultiPropertyUBOChunkBase(void) :
980 MultiPropertyUBOChunkBase::MultiPropertyUBOChunkBase(const MultiPropertyUBOChunkBase
&source
) :
982 _mfTypes (source
._mfTypes
),
983 _mfCardinality (source
._mfCardinality
),
984 _mfCardinalities (source
._mfCardinalities
),
985 _sfNumProperties (source
._sfNumProperties
),
986 _mfFloatValues (source
._mfFloatValues
),
987 _mfDoubleValues (source
._mfDoubleValues
),
988 _mfIntValues (source
._mfIntValues
),
989 _mfUIntValues (source
._mfUIntValues
),
990 _mfBoolValues (source
._mfBoolValues
),
991 _mfVec3Values (source
._mfVec3Values
),
992 _mfVec4Values (source
._mfVec4Values
),
993 _mfMatrixValues (source
._mfMatrixValues
)
998 /*-------------------------- destructors ----------------------------------*/
1000 MultiPropertyUBOChunkBase::~MultiPropertyUBOChunkBase(void)
1005 GetFieldHandlePtr
MultiPropertyUBOChunkBase::getHandleTypes (void) const
1007 MFUInt8::GetHandlePtr
returnValue(
1008 new MFUInt8::GetHandle(
1010 this->getType().getFieldDesc(TypesFieldId
),
1011 const_cast<MultiPropertyUBOChunkBase
*>(this)));
1016 EditFieldHandlePtr
MultiPropertyUBOChunkBase::editHandleTypes (void)
1018 MFUInt8::EditHandlePtr
returnValue(
1019 new MFUInt8::EditHandle(
1021 this->getType().getFieldDesc(TypesFieldId
),
1025 editMField(TypesFieldMask
, _mfTypes
);
1030 GetFieldHandlePtr
MultiPropertyUBOChunkBase::getHandleCardinality (void) const
1032 MFUInt32::GetHandlePtr
returnValue(
1033 new MFUInt32::GetHandle(
1035 this->getType().getFieldDesc(CardinalityFieldId
),
1036 const_cast<MultiPropertyUBOChunkBase
*>(this)));
1041 EditFieldHandlePtr
MultiPropertyUBOChunkBase::editHandleCardinality (void)
1043 MFUInt32::EditHandlePtr
returnValue(
1044 new MFUInt32::EditHandle(
1046 this->getType().getFieldDesc(CardinalityFieldId
),
1050 editMField(CardinalityFieldMask
, _mfCardinality
);
1055 GetFieldHandlePtr
MultiPropertyUBOChunkBase::getHandleCardinalities (void) const
1057 MFUInt32::GetHandlePtr
returnValue(
1058 new MFUInt32::GetHandle(
1060 this->getType().getFieldDesc(CardinalitiesFieldId
),
1061 const_cast<MultiPropertyUBOChunkBase
*>(this)));
1066 EditFieldHandlePtr
MultiPropertyUBOChunkBase::editHandleCardinalities (void)
1068 MFUInt32::EditHandlePtr
returnValue(
1069 new MFUInt32::EditHandle(
1071 this->getType().getFieldDesc(CardinalitiesFieldId
),
1075 editMField(CardinalitiesFieldMask
, _mfCardinalities
);
1080 GetFieldHandlePtr
MultiPropertyUBOChunkBase::getHandleNumProperties (void) const
1082 SFUInt32::GetHandlePtr
returnValue(
1083 new SFUInt32::GetHandle(
1085 this->getType().getFieldDesc(NumPropertiesFieldId
),
1086 const_cast<MultiPropertyUBOChunkBase
*>(this)));
1091 EditFieldHandlePtr
MultiPropertyUBOChunkBase::editHandleNumProperties (void)
1093 SFUInt32::EditHandlePtr
returnValue(
1094 new SFUInt32::EditHandle(
1096 this->getType().getFieldDesc(NumPropertiesFieldId
),
1100 editSField(NumPropertiesFieldMask
);
1105 GetFieldHandlePtr
MultiPropertyUBOChunkBase::getHandleFloatValues (void) const
1107 MFReal32::GetHandlePtr
returnValue(
1108 new MFReal32::GetHandle(
1110 this->getType().getFieldDesc(FloatValuesFieldId
),
1111 const_cast<MultiPropertyUBOChunkBase
*>(this)));
1116 EditFieldHandlePtr
MultiPropertyUBOChunkBase::editHandleFloatValues (void)
1118 MFReal32::EditHandlePtr
returnValue(
1119 new MFReal32::EditHandle(
1121 this->getType().getFieldDesc(FloatValuesFieldId
),
1125 editMField(FloatValuesFieldMask
, _mfFloatValues
);
1130 GetFieldHandlePtr
MultiPropertyUBOChunkBase::getHandleDoubleValues (void) const
1132 MFReal64::GetHandlePtr
returnValue(
1133 new MFReal64::GetHandle(
1135 this->getType().getFieldDesc(DoubleValuesFieldId
),
1136 const_cast<MultiPropertyUBOChunkBase
*>(this)));
1141 EditFieldHandlePtr
MultiPropertyUBOChunkBase::editHandleDoubleValues (void)
1143 MFReal64::EditHandlePtr
returnValue(
1144 new MFReal64::EditHandle(
1146 this->getType().getFieldDesc(DoubleValuesFieldId
),
1150 editMField(DoubleValuesFieldMask
, _mfDoubleValues
);
1155 GetFieldHandlePtr
MultiPropertyUBOChunkBase::getHandleIntValues (void) const
1157 MFInt32::GetHandlePtr
returnValue(
1158 new MFInt32::GetHandle(
1160 this->getType().getFieldDesc(IntValuesFieldId
),
1161 const_cast<MultiPropertyUBOChunkBase
*>(this)));
1166 EditFieldHandlePtr
MultiPropertyUBOChunkBase::editHandleIntValues (void)
1168 MFInt32::EditHandlePtr
returnValue(
1169 new MFInt32::EditHandle(
1171 this->getType().getFieldDesc(IntValuesFieldId
),
1175 editMField(IntValuesFieldMask
, _mfIntValues
);
1180 GetFieldHandlePtr
MultiPropertyUBOChunkBase::getHandleUIntValues (void) const
1182 MFUInt32::GetHandlePtr
returnValue(
1183 new MFUInt32::GetHandle(
1185 this->getType().getFieldDesc(UIntValuesFieldId
),
1186 const_cast<MultiPropertyUBOChunkBase
*>(this)));
1191 EditFieldHandlePtr
MultiPropertyUBOChunkBase::editHandleUIntValues (void)
1193 MFUInt32::EditHandlePtr
returnValue(
1194 new MFUInt32::EditHandle(
1196 this->getType().getFieldDesc(UIntValuesFieldId
),
1200 editMField(UIntValuesFieldMask
, _mfUIntValues
);
1205 GetFieldHandlePtr
MultiPropertyUBOChunkBase::getHandleBoolValues (void) const
1207 MFBool::GetHandlePtr
returnValue(
1208 new MFBool::GetHandle(
1210 this->getType().getFieldDesc(BoolValuesFieldId
),
1211 const_cast<MultiPropertyUBOChunkBase
*>(this)));
1216 EditFieldHandlePtr
MultiPropertyUBOChunkBase::editHandleBoolValues (void)
1218 MFBool::EditHandlePtr
returnValue(
1219 new MFBool::EditHandle(
1221 this->getType().getFieldDesc(BoolValuesFieldId
),
1225 editMField(BoolValuesFieldMask
, _mfBoolValues
);
1230 GetFieldHandlePtr
MultiPropertyUBOChunkBase::getHandleVec3Values (void) const
1232 MFVec3f::GetHandlePtr
returnValue(
1233 new MFVec3f::GetHandle(
1235 this->getType().getFieldDesc(Vec3ValuesFieldId
),
1236 const_cast<MultiPropertyUBOChunkBase
*>(this)));
1241 EditFieldHandlePtr
MultiPropertyUBOChunkBase::editHandleVec3Values (void)
1243 MFVec3f::EditHandlePtr
returnValue(
1244 new MFVec3f::EditHandle(
1246 this->getType().getFieldDesc(Vec3ValuesFieldId
),
1250 editMField(Vec3ValuesFieldMask
, _mfVec3Values
);
1255 GetFieldHandlePtr
MultiPropertyUBOChunkBase::getHandleVec4Values (void) const
1257 MFVec4f::GetHandlePtr
returnValue(
1258 new MFVec4f::GetHandle(
1260 this->getType().getFieldDesc(Vec4ValuesFieldId
),
1261 const_cast<MultiPropertyUBOChunkBase
*>(this)));
1266 EditFieldHandlePtr
MultiPropertyUBOChunkBase::editHandleVec4Values (void)
1268 MFVec4f::EditHandlePtr
returnValue(
1269 new MFVec4f::EditHandle(
1271 this->getType().getFieldDesc(Vec4ValuesFieldId
),
1275 editMField(Vec4ValuesFieldMask
, _mfVec4Values
);
1280 GetFieldHandlePtr
MultiPropertyUBOChunkBase::getHandleMatrixValues (void) const
1282 MFMatrix::GetHandlePtr
returnValue(
1283 new MFMatrix::GetHandle(
1285 this->getType().getFieldDesc(MatrixValuesFieldId
),
1286 const_cast<MultiPropertyUBOChunkBase
*>(this)));
1291 EditFieldHandlePtr
MultiPropertyUBOChunkBase::editHandleMatrixValues (void)
1293 MFMatrix::EditHandlePtr
returnValue(
1294 new MFMatrix::EditHandle(
1296 this->getType().getFieldDesc(MatrixValuesFieldId
),
1300 editMField(MatrixValuesFieldMask
, _mfMatrixValues
);
1306 #ifdef OSG_MT_CPTR_ASPECT
1307 void MultiPropertyUBOChunkBase::execSyncV( FieldContainer
&oFrom
,
1308 ConstFieldMaskArg whichField
,
1309 AspectOffsetStore
&oOffsets
,
1310 ConstFieldMaskArg syncMode
,
1311 const UInt32 uiSyncInfo
)
1313 MultiPropertyUBOChunk
*pThis
= static_cast<MultiPropertyUBOChunk
*>(this);
1315 pThis
->execSync(static_cast<MultiPropertyUBOChunk
*>(&oFrom
),
1324 #ifdef OSG_MT_CPTR_ASPECT
1325 FieldContainer
*MultiPropertyUBOChunkBase::createAspectCopy(
1326 const FieldContainer
*pRefAspect
) const
1328 MultiPropertyUBOChunk
*returnValue
;
1330 newAspectCopy(returnValue
,
1331 dynamic_cast<const MultiPropertyUBOChunk
*>(pRefAspect
),
1332 dynamic_cast<const MultiPropertyUBOChunk
*>(this));
1338 void MultiPropertyUBOChunkBase::resolveLinks(void)
1340 Inherited::resolveLinks();
1342 #ifdef OSG_MT_CPTR_ASPECT
1343 AspectOffsetStore oOffsets
;
1345 _pAspectStore
->fillOffsetArray(oOffsets
, this);
1348 #ifdef OSG_MT_CPTR_ASPECT
1349 _mfTypes
.terminateShare(Thread::getCurrentAspect(),
1352 #ifdef OSG_MT_CPTR_ASPECT
1353 _mfCardinality
.terminateShare(Thread::getCurrentAspect(),
1356 #ifdef OSG_MT_CPTR_ASPECT
1357 _mfCardinalities
.terminateShare(Thread::getCurrentAspect(),
1360 #ifdef OSG_MT_CPTR_ASPECT
1361 _mfFloatValues
.terminateShare(Thread::getCurrentAspect(),
1364 #ifdef OSG_MT_CPTR_ASPECT
1365 _mfDoubleValues
.terminateShare(Thread::getCurrentAspect(),
1368 #ifdef OSG_MT_CPTR_ASPECT
1369 _mfIntValues
.terminateShare(Thread::getCurrentAspect(),
1372 #ifdef OSG_MT_CPTR_ASPECT
1373 _mfUIntValues
.terminateShare(Thread::getCurrentAspect(),
1376 #ifdef OSG_MT_CPTR_ASPECT
1377 _mfBoolValues
.terminateShare(Thread::getCurrentAspect(),
1380 #ifdef OSG_MT_CPTR_ASPECT
1381 _mfVec3Values
.terminateShare(Thread::getCurrentAspect(),
1384 #ifdef OSG_MT_CPTR_ASPECT
1385 _mfVec4Values
.terminateShare(Thread::getCurrentAspect(),
1388 #ifdef OSG_MT_CPTR_ASPECT
1389 _mfMatrixValues
.terminateShare(Thread::getCurrentAspect(),