changed: gcc8 base update
[opensg.git] / Source / System / State / Base / OSGMultiPropertySSBOChunkBase.cpp
blob3a1fbf77f4480fcaaf036a7d9759a4de2f826ab8
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 MultiPropertySSBOChunk!
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"
66 #include "OSGMultiPropertySSBOChunkBase.h"
67 #include "OSGMultiPropertySSBOChunk.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::MultiPropertySSBOChunk
78 See \ref PageSystemMultiPropertySSBOChunk for a description.
80 The multi property chunk allows you to easily set up a shader storage block array with a simple
81 plain struct layout in std430 buffer format.
83 This chunk is basically a specialization of the ShaderStorageBufferObjStdLayoutChunk with a simpler
84 usage pattern but at the cost of handling only a subset of the structural possibilities that the
85 general chunk allows.
87 It can for instance be perfectly used to define material databases. See the example 'multirangelight'
88 in the simple example folder for an application of this chunk.
91 /***************************************************************************\
92 * Field Documentation *
93 \***************************************************************************/
95 /*! \var UInt8 MultiPropertySSBOChunkBase::_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 MultiPropertySSBOChunkBase::_mfCardinality
100 Stores the cardinality types, i.e. the consecutive block layout members.
103 /*! \var UInt32 MultiPropertySSBOChunkBase::_mfCardinalities
104 Stores the accumulated cardinalities for each type.
107 /*! \var UInt32 MultiPropertySSBOChunkBase::_sfNumProperties
108 Stores the number of properties added to the chunk.
111 /*! \var Real32 MultiPropertySSBOChunkBase::_mfFloatValues
112 The float values.
115 /*! \var Real64 MultiPropertySSBOChunkBase::_mfDoubleValues
116 The double values.
119 /*! \var Int32 MultiPropertySSBOChunkBase::_mfIntValues
120 The int values.
123 /*! \var UInt32 MultiPropertySSBOChunkBase::_mfUIntValues
124 The unsigned int values.
127 /*! \var bool MultiPropertySSBOChunkBase::_mfBoolValues
128 The bool values.
131 /*! \var Vec3f MultiPropertySSBOChunkBase::_mfVec3Values
132 The 3D float vectors.
135 /*! \var Vec4f MultiPropertySSBOChunkBase::_mfVec4Values
136 The 4D float vectors.
139 /*! \var Matrix MultiPropertySSBOChunkBase::_mfMatrixValues
140 The matrices.
144 /***************************************************************************\
145 * FieldType/FieldTrait Instantiation *
146 \***************************************************************************/
148 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
149 PointerType FieldTraits<MultiPropertySSBOChunk *, nsOSG>::_type(
150 "MultiPropertySSBOChunkPtr",
151 "ShaderStorageBufferObjStdLayoutChunkPtr",
152 MultiPropertySSBOChunk::getClassType(),
153 nsOSG);
154 #endif
156 OSG_FIELDTRAITS_GETTYPE_NS(MultiPropertySSBOChunk *, nsOSG)
158 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
159 MultiPropertySSBOChunk *,
160 nsOSG)
162 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
163 MultiPropertySSBOChunk *,
164 nsOSG)
166 /***************************************************************************\
167 * Field Description *
168 \***************************************************************************/
170 void MultiPropertySSBOChunkBase::classDescInserter(TypeObject &oType)
172 FieldDescriptionBase *pDesc = NULL;
175 pDesc = new MFUInt8::Description(
176 MFUInt8::getClassType(),
177 "types",
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,
180 false,
181 (Field::MFDefaultFlags | Field::FStdAccess),
182 static_cast<FieldEditMethodSig>(&MultiPropertySSBOChunk::editHandleTypes),
183 static_cast<FieldGetMethodSig >(&MultiPropertySSBOChunk::getHandleTypes));
185 oType.addInitialDesc(pDesc);
187 pDesc = new MFUInt32::Description(
188 MFUInt32::getClassType(),
189 "cardinality",
190 "Stores the cardinality types, i.e. the consecutive block layout members.\n",
191 CardinalityFieldId, CardinalityFieldMask,
192 false,
193 (Field::MFDefaultFlags | Field::FStdAccess),
194 static_cast<FieldEditMethodSig>(&MultiPropertySSBOChunk::editHandleCardinality),
195 static_cast<FieldGetMethodSig >(&MultiPropertySSBOChunk::getHandleCardinality));
197 oType.addInitialDesc(pDesc);
199 pDesc = new MFUInt32::Description(
200 MFUInt32::getClassType(),
201 "cardinalities",
202 "Stores the accumulated cardinalities for each type.\n",
203 CardinalitiesFieldId, CardinalitiesFieldMask,
204 false,
205 (Field::MFDefaultFlags | Field::FStdAccess),
206 static_cast<FieldEditMethodSig>(&MultiPropertySSBOChunk::editHandleCardinalities),
207 static_cast<FieldGetMethodSig >(&MultiPropertySSBOChunk::getHandleCardinalities));
209 oType.addInitialDesc(pDesc);
211 pDesc = new SFUInt32::Description(
212 SFUInt32::getClassType(),
213 "numProperties",
214 "Stores the number of properties added to the chunk.\n",
215 NumPropertiesFieldId, NumPropertiesFieldMask,
216 false,
217 (Field::SFDefaultFlags | Field::FStdAccess),
218 static_cast<FieldEditMethodSig>(&MultiPropertySSBOChunk::editHandleNumProperties),
219 static_cast<FieldGetMethodSig >(&MultiPropertySSBOChunk::getHandleNumProperties));
221 oType.addInitialDesc(pDesc);
223 pDesc = new MFReal32::Description(
224 MFReal32::getClassType(),
225 "floatValues",
226 "The float values.\n",
227 FloatValuesFieldId, FloatValuesFieldMask,
228 false,
229 (Field::MFDefaultFlags | Field::FStdAccess),
230 static_cast<FieldEditMethodSig>(&MultiPropertySSBOChunk::editHandleFloatValues),
231 static_cast<FieldGetMethodSig >(&MultiPropertySSBOChunk::getHandleFloatValues));
233 oType.addInitialDesc(pDesc);
235 pDesc = new MFReal64::Description(
236 MFReal64::getClassType(),
237 "doubleValues",
238 "The double values.\n",
239 DoubleValuesFieldId, DoubleValuesFieldMask,
240 false,
241 (Field::MFDefaultFlags | Field::FStdAccess),
242 static_cast<FieldEditMethodSig>(&MultiPropertySSBOChunk::editHandleDoubleValues),
243 static_cast<FieldGetMethodSig >(&MultiPropertySSBOChunk::getHandleDoubleValues));
245 oType.addInitialDesc(pDesc);
247 pDesc = new MFInt32::Description(
248 MFInt32::getClassType(),
249 "intValues",
250 "The int values.\n",
251 IntValuesFieldId, IntValuesFieldMask,
252 false,
253 (Field::MFDefaultFlags | Field::FStdAccess),
254 static_cast<FieldEditMethodSig>(&MultiPropertySSBOChunk::editHandleIntValues),
255 static_cast<FieldGetMethodSig >(&MultiPropertySSBOChunk::getHandleIntValues));
257 oType.addInitialDesc(pDesc);
259 pDesc = new MFUInt32::Description(
260 MFUInt32::getClassType(),
261 "uIntValues",
262 "The unsigned int values.\n",
263 UIntValuesFieldId, UIntValuesFieldMask,
264 false,
265 (Field::MFDefaultFlags | Field::FStdAccess),
266 static_cast<FieldEditMethodSig>(&MultiPropertySSBOChunk::editHandleUIntValues),
267 static_cast<FieldGetMethodSig >(&MultiPropertySSBOChunk::getHandleUIntValues));
269 oType.addInitialDesc(pDesc);
271 pDesc = new MFBool::Description(
272 MFBool::getClassType(),
273 "boolValues",
274 "The bool values.\n",
275 BoolValuesFieldId, BoolValuesFieldMask,
276 false,
277 (Field::MFDefaultFlags | Field::FStdAccess),
278 static_cast<FieldEditMethodSig>(&MultiPropertySSBOChunk::editHandleBoolValues),
279 static_cast<FieldGetMethodSig >(&MultiPropertySSBOChunk::getHandleBoolValues));
281 oType.addInitialDesc(pDesc);
283 pDesc = new MFVec3f::Description(
284 MFVec3f::getClassType(),
285 "vec3Values",
286 "The 3D float vectors.\n",
287 Vec3ValuesFieldId, Vec3ValuesFieldMask,
288 false,
289 (Field::MFDefaultFlags | Field::FStdAccess),
290 static_cast<FieldEditMethodSig>(&MultiPropertySSBOChunk::editHandleVec3Values),
291 static_cast<FieldGetMethodSig >(&MultiPropertySSBOChunk::getHandleVec3Values));
293 oType.addInitialDesc(pDesc);
295 pDesc = new MFVec4f::Description(
296 MFVec4f::getClassType(),
297 "vec4Values",
298 "The 4D float vectors.\n",
299 Vec4ValuesFieldId, Vec4ValuesFieldMask,
300 false,
301 (Field::MFDefaultFlags | Field::FStdAccess),
302 static_cast<FieldEditMethodSig>(&MultiPropertySSBOChunk::editHandleVec4Values),
303 static_cast<FieldGetMethodSig >(&MultiPropertySSBOChunk::getHandleVec4Values));
305 oType.addInitialDesc(pDesc);
307 pDesc = new MFMatrix::Description(
308 MFMatrix::getClassType(),
309 "matrixValues",
310 "The matrices.\n",
311 MatrixValuesFieldId, MatrixValuesFieldMask,
312 false,
313 (Field::MFDefaultFlags | Field::FStdAccess),
314 static_cast<FieldEditMethodSig>(&MultiPropertySSBOChunk::editHandleMatrixValues),
315 static_cast<FieldGetMethodSig >(&MultiPropertySSBOChunk::getHandleMatrixValues));
317 oType.addInitialDesc(pDesc);
321 MultiPropertySSBOChunkBase::TypeObject MultiPropertySSBOChunkBase::_type(
322 MultiPropertySSBOChunkBase::getClassname(),
323 Inherited::getClassname(),
324 "NULL",
325 nsOSG, //Namespace
326 reinterpret_cast<PrototypeCreateF>(&MultiPropertySSBOChunkBase::createEmptyLocal),
327 reinterpret_cast<InitContainerF>(&MultiPropertySSBOChunk::initMethod),
328 reinterpret_cast<ExitContainerF>(&MultiPropertySSBOChunk::exitMethod),
329 reinterpret_cast<InitalInsertDescFunc>(
330 reinterpret_cast<void *>(&MultiPropertySSBOChunk::classDescInserter)),
331 false,
333 "<?xml version=\"1.0\"?>\n"
334 "\n"
335 "<FieldContainer\n"
336 " name=\"MultiPropertySSBOChunk\"\n"
337 " parent=\"ShaderStorageBufferObjStdLayoutChunk\"\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"
346 ">\n"
347 "See \\ref PageSystemMultiPropertySSBOChunk for a description.\n"
348 "\n"
349 "The multi property chunk allows you to easily set up a shader storage block array with a simple \n"
350 "plain struct layout in std430 buffer format.\n"
351 "\n"
352 "This chunk is basically a specialization of the ShaderStorageBufferObjStdLayoutChunk with a simpler \n"
353 "usage pattern but at the cost of handling only a subset of the structural possibilities that the \n"
354 "general chunk allows.\n"
355 "\n"
356 "It can for instance be perfectly used to define material databases. See the example 'multirangelight'\n"
357 "in the simple example folder for an application of this chunk.\n"
358 "\n"
359 " <Field\n"
360 " name=\"types\"\n"
361 " type=\"UInt8\"\n"
362 " cardinality=\"multi\"\n"
363 " visibility=\"external\"\n"
364 " access=\"protected\"\n"
365 "\t>\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"
367 " </Field>\n"
368 " <Field\n"
369 " name=\"cardinality\"\n"
370 " type=\"UInt32\"\n"
371 " cardinality=\"multi\"\n"
372 " visibility=\"external\"\n"
373 " access=\"protected\"\n"
374 "\t>\n"
375 " Stores the cardinality types, i.e. the consecutive block layout members.\n"
376 " </Field>\n"
377 " <Field\n"
378 " name=\"cardinalities\"\n"
379 " type=\"UInt32\"\n"
380 " cardinality=\"multi\"\n"
381 " visibility=\"external\"\n"
382 " access=\"protected\"\n"
383 "\t>\n"
384 " Stores the accumulated cardinalities for each type.\n"
385 " </Field>\n"
386 " <Field\n"
387 " name=\"numProperties\"\n"
388 " type=\"UInt32\"\n"
389 " cardinality=\"single\"\n"
390 " visibility=\"external\"\n"
391 " access=\"protected\"\n"
392 "\t>\n"
393 " Stores the number of properties added to the chunk.\n"
394 " </Field>\n"
395 " <Field\n"
396 " name=\"floatValues\"\n"
397 " type=\"Real32\"\n"
398 " cardinality=\"multi\"\n"
399 " visibility=\"external\"\n"
400 " access=\"protected\"\n"
401 "\t>\n"
402 " The float values.\n"
403 " </Field>\n"
404 " <Field\n"
405 " name=\"doubleValues\"\n"
406 " type=\"Real64\"\n"
407 " cardinality=\"multi\"\n"
408 " visibility=\"external\"\n"
409 " access=\"protected\"\n"
410 "\t>\n"
411 " The double values.\n"
412 " </Field>\n"
413 " <Field\n"
414 " name=\"intValues\"\n"
415 " type=\"Int32\"\n"
416 " cardinality=\"multi\"\n"
417 " visibility=\"external\"\n"
418 " access=\"protected\"\n"
419 "\t>\n"
420 " The int values.\n"
421 " </Field>\n"
422 " <Field\n"
423 " name=\"uIntValues\"\n"
424 " type=\"UInt32\"\n"
425 " cardinality=\"multi\"\n"
426 " visibility=\"external\"\n"
427 " access=\"protected\"\n"
428 "\t>\n"
429 " The unsigned int values.\n"
430 " </Field>\n"
431 " <Field\n"
432 " name=\"boolValues\"\n"
433 " type=\"bool\"\n"
434 " cardinality=\"multi\"\n"
435 " visibility=\"external\"\n"
436 " access=\"protected\"\n"
437 "\t>\n"
438 " The bool values.\n"
439 " </Field>\n"
440 " <Field\n"
441 " name=\"vec3Values\"\n"
442 " type=\"Vec3f\"\n"
443 " cardinality=\"multi\"\n"
444 " visibility=\"external\"\n"
445 " access=\"protected\"\n"
446 "\t>\n"
447 " The 3D float vectors.\n"
448 " </Field>\n"
449 " <Field\n"
450 " name=\"vec4Values\"\n"
451 " type=\"Vec4f\"\n"
452 " cardinality=\"multi\"\n"
453 " visibility=\"external\"\n"
454 " access=\"protected\"\n"
455 "\t>\n"
456 " The 4D float vectors.\n"
457 " </Field>\n"
458 " <Field\n"
459 " name=\"matrixValues\"\n"
460 " type=\"Matrix\"\n"
461 " cardinality=\"multi\"\n"
462 " visibility=\"external\"\n"
463 " access=\"protected\"\n"
464 "\t>\n"
465 " The matrices.\n"
466 " </Field>\n"
467 "\n"
468 "</FieldContainer>\n",
469 "See \\ref PageSystemMultiPropertySSBOChunk for a description.\n"
470 "\n"
471 "The multi property chunk allows you to easily set up a shader storage block array with a simple \n"
472 "plain struct layout in std430 buffer format.\n"
473 "\n"
474 "This chunk is basically a specialization of the ShaderStorageBufferObjStdLayoutChunk with a simpler \n"
475 "usage pattern but at the cost of handling only a subset of the structural possibilities that the \n"
476 "general chunk allows.\n"
477 "\n"
478 "It can for instance be perfectly used to define material databases. See the example 'multirangelight'\n"
479 "in the simple example folder for an application of this chunk.\n"
482 /*------------------------------ get -----------------------------------*/
484 FieldContainerType &MultiPropertySSBOChunkBase::getType(void)
486 return _type;
489 const FieldContainerType &MultiPropertySSBOChunkBase::getType(void) const
491 return _type;
494 UInt32 MultiPropertySSBOChunkBase::getContainerSize(void) const
496 return sizeof(MultiPropertySSBOChunk);
499 /*------------------------- decorator get ------------------------------*/
502 MFUInt8 *MultiPropertySSBOChunkBase::editMFTypes(void)
504 editMField(TypesFieldMask, _mfTypes);
506 return &_mfTypes;
509 const MFUInt8 *MultiPropertySSBOChunkBase::getMFTypes(void) const
511 return &_mfTypes;
515 MFUInt32 *MultiPropertySSBOChunkBase::editMFCardinality(void)
517 editMField(CardinalityFieldMask, _mfCardinality);
519 return &_mfCardinality;
522 const MFUInt32 *MultiPropertySSBOChunkBase::getMFCardinality(void) const
524 return &_mfCardinality;
528 MFUInt32 *MultiPropertySSBOChunkBase::editMFCardinalities(void)
530 editMField(CardinalitiesFieldMask, _mfCardinalities);
532 return &_mfCardinalities;
535 const MFUInt32 *MultiPropertySSBOChunkBase::getMFCardinalities(void) const
537 return &_mfCardinalities;
541 SFUInt32 *MultiPropertySSBOChunkBase::editSFNumProperties(void)
543 editSField(NumPropertiesFieldMask);
545 return &_sfNumProperties;
548 const SFUInt32 *MultiPropertySSBOChunkBase::getSFNumProperties(void) const
550 return &_sfNumProperties;
554 MFReal32 *MultiPropertySSBOChunkBase::editMFFloatValues(void)
556 editMField(FloatValuesFieldMask, _mfFloatValues);
558 return &_mfFloatValues;
561 const MFReal32 *MultiPropertySSBOChunkBase::getMFFloatValues(void) const
563 return &_mfFloatValues;
567 MFReal64 *MultiPropertySSBOChunkBase::editMFDoubleValues(void)
569 editMField(DoubleValuesFieldMask, _mfDoubleValues);
571 return &_mfDoubleValues;
574 const MFReal64 *MultiPropertySSBOChunkBase::getMFDoubleValues(void) const
576 return &_mfDoubleValues;
580 MFInt32 *MultiPropertySSBOChunkBase::editMFIntValues(void)
582 editMField(IntValuesFieldMask, _mfIntValues);
584 return &_mfIntValues;
587 const MFInt32 *MultiPropertySSBOChunkBase::getMFIntValues(void) const
589 return &_mfIntValues;
593 MFUInt32 *MultiPropertySSBOChunkBase::editMFUIntValues(void)
595 editMField(UIntValuesFieldMask, _mfUIntValues);
597 return &_mfUIntValues;
600 const MFUInt32 *MultiPropertySSBOChunkBase::getMFUIntValues(void) const
602 return &_mfUIntValues;
606 MFBool *MultiPropertySSBOChunkBase::editMFBoolValues(void)
608 editMField(BoolValuesFieldMask, _mfBoolValues);
610 return &_mfBoolValues;
613 const MFBool *MultiPropertySSBOChunkBase::getMFBoolValues(void) const
615 return &_mfBoolValues;
619 MFVec3f *MultiPropertySSBOChunkBase::editMFVec3Values(void)
621 editMField(Vec3ValuesFieldMask, _mfVec3Values);
623 return &_mfVec3Values;
626 const MFVec3f *MultiPropertySSBOChunkBase::getMFVec3Values(void) const
628 return &_mfVec3Values;
632 MFVec4f *MultiPropertySSBOChunkBase::editMFVec4Values(void)
634 editMField(Vec4ValuesFieldMask, _mfVec4Values);
636 return &_mfVec4Values;
639 const MFVec4f *MultiPropertySSBOChunkBase::getMFVec4Values(void) const
641 return &_mfVec4Values;
645 MFMatrix *MultiPropertySSBOChunkBase::editMFMatrixValues(void)
647 editMField(MatrixValuesFieldMask, _mfMatrixValues);
649 return &_mfMatrixValues;
652 const MFMatrix *MultiPropertySSBOChunkBase::getMFMatrixValues(void) const
654 return &_mfMatrixValues;
662 /*------------------------------ access -----------------------------------*/
664 SizeT MultiPropertySSBOChunkBase::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();
717 return returnValue;
720 void MultiPropertySSBOChunkBase::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 MultiPropertySSBOChunkBase::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 MultiPropertySSBOChunkTransitPtr MultiPropertySSBOChunkBase::createLocal(BitVector bFlags)
845 MultiPropertySSBOChunkTransitPtr fc;
847 if(getClassType().getPrototype() != NULL)
849 FieldContainerTransitPtr tmpPtr =
850 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
852 fc = dynamic_pointer_cast<MultiPropertySSBOChunk>(tmpPtr);
855 return fc;
858 //! create a new instance of the class, copy the container flags
859 MultiPropertySSBOChunkTransitPtr MultiPropertySSBOChunkBase::createDependent(BitVector bFlags)
861 MultiPropertySSBOChunkTransitPtr fc;
863 if(getClassType().getPrototype() != NULL)
865 FieldContainerTransitPtr tmpPtr =
866 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
868 fc = dynamic_pointer_cast<MultiPropertySSBOChunk>(tmpPtr);
871 return fc;
874 //! create a new instance of the class
875 MultiPropertySSBOChunkTransitPtr MultiPropertySSBOChunkBase::create(void)
877 MultiPropertySSBOChunkTransitPtr fc;
879 if(getClassType().getPrototype() != NULL)
881 FieldContainerTransitPtr tmpPtr =
882 getClassType().getPrototype()-> shallowCopy();
884 fc = dynamic_pointer_cast<MultiPropertySSBOChunk>(tmpPtr);
887 return fc;
890 MultiPropertySSBOChunk *MultiPropertySSBOChunkBase::createEmptyLocal(BitVector bFlags)
892 MultiPropertySSBOChunk *returnValue;
894 newPtr<MultiPropertySSBOChunk>(returnValue, bFlags);
896 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
898 return returnValue;
901 //! create an empty new instance of the class, do not copy the prototype
902 MultiPropertySSBOChunk *MultiPropertySSBOChunkBase::createEmpty(void)
904 MultiPropertySSBOChunk *returnValue;
906 newPtr<MultiPropertySSBOChunk>(returnValue, Thread::getCurrentLocalFlags());
908 returnValue->_pFieldFlags->_bNamespaceMask &=
909 ~Thread::getCurrentLocalFlags();
911 return returnValue;
915 FieldContainerTransitPtr MultiPropertySSBOChunkBase::shallowCopyLocal(
916 BitVector bFlags) const
918 MultiPropertySSBOChunk *tmpPtr;
920 newPtr(tmpPtr, dynamic_cast<const MultiPropertySSBOChunk *>(this), bFlags);
922 FieldContainerTransitPtr returnValue(tmpPtr);
924 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
926 return returnValue;
929 FieldContainerTransitPtr MultiPropertySSBOChunkBase::shallowCopyDependent(
930 BitVector bFlags) const
932 MultiPropertySSBOChunk *tmpPtr;
934 newPtr(tmpPtr, dynamic_cast<const MultiPropertySSBOChunk *>(this), ~bFlags);
936 FieldContainerTransitPtr returnValue(tmpPtr);
938 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
940 return returnValue;
943 FieldContainerTransitPtr MultiPropertySSBOChunkBase::shallowCopy(void) const
945 MultiPropertySSBOChunk *tmpPtr;
947 newPtr(tmpPtr,
948 dynamic_cast<const MultiPropertySSBOChunk *>(this),
949 Thread::getCurrentLocalFlags());
951 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
953 FieldContainerTransitPtr returnValue(tmpPtr);
955 return returnValue;
961 /*------------------------- constructors ----------------------------------*/
963 MultiPropertySSBOChunkBase::MultiPropertySSBOChunkBase(void) :
964 Inherited(),
965 _mfTypes (),
966 _mfCardinality (),
967 _mfCardinalities (),
968 _sfNumProperties (),
969 _mfFloatValues (),
970 _mfDoubleValues (),
971 _mfIntValues (),
972 _mfUIntValues (),
973 _mfBoolValues (),
974 _mfVec3Values (),
975 _mfVec4Values (),
976 _mfMatrixValues ()
980 MultiPropertySSBOChunkBase::MultiPropertySSBOChunkBase(const MultiPropertySSBOChunkBase &source) :
981 Inherited(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 MultiPropertySSBOChunkBase::~MultiPropertySSBOChunkBase(void)
1005 GetFieldHandlePtr MultiPropertySSBOChunkBase::getHandleTypes (void) const
1007 MFUInt8::GetHandlePtr returnValue(
1008 new MFUInt8::GetHandle(
1009 &_mfTypes,
1010 this->getType().getFieldDesc(TypesFieldId),
1011 const_cast<MultiPropertySSBOChunkBase *>(this)));
1013 return returnValue;
1016 EditFieldHandlePtr MultiPropertySSBOChunkBase::editHandleTypes (void)
1018 MFUInt8::EditHandlePtr returnValue(
1019 new MFUInt8::EditHandle(
1020 &_mfTypes,
1021 this->getType().getFieldDesc(TypesFieldId),
1022 this));
1025 editMField(TypesFieldMask, _mfTypes);
1027 return returnValue;
1030 GetFieldHandlePtr MultiPropertySSBOChunkBase::getHandleCardinality (void) const
1032 MFUInt32::GetHandlePtr returnValue(
1033 new MFUInt32::GetHandle(
1034 &_mfCardinality,
1035 this->getType().getFieldDesc(CardinalityFieldId),
1036 const_cast<MultiPropertySSBOChunkBase *>(this)));
1038 return returnValue;
1041 EditFieldHandlePtr MultiPropertySSBOChunkBase::editHandleCardinality (void)
1043 MFUInt32::EditHandlePtr returnValue(
1044 new MFUInt32::EditHandle(
1045 &_mfCardinality,
1046 this->getType().getFieldDesc(CardinalityFieldId),
1047 this));
1050 editMField(CardinalityFieldMask, _mfCardinality);
1052 return returnValue;
1055 GetFieldHandlePtr MultiPropertySSBOChunkBase::getHandleCardinalities (void) const
1057 MFUInt32::GetHandlePtr returnValue(
1058 new MFUInt32::GetHandle(
1059 &_mfCardinalities,
1060 this->getType().getFieldDesc(CardinalitiesFieldId),
1061 const_cast<MultiPropertySSBOChunkBase *>(this)));
1063 return returnValue;
1066 EditFieldHandlePtr MultiPropertySSBOChunkBase::editHandleCardinalities (void)
1068 MFUInt32::EditHandlePtr returnValue(
1069 new MFUInt32::EditHandle(
1070 &_mfCardinalities,
1071 this->getType().getFieldDesc(CardinalitiesFieldId),
1072 this));
1075 editMField(CardinalitiesFieldMask, _mfCardinalities);
1077 return returnValue;
1080 GetFieldHandlePtr MultiPropertySSBOChunkBase::getHandleNumProperties (void) const
1082 SFUInt32::GetHandlePtr returnValue(
1083 new SFUInt32::GetHandle(
1084 &_sfNumProperties,
1085 this->getType().getFieldDesc(NumPropertiesFieldId),
1086 const_cast<MultiPropertySSBOChunkBase *>(this)));
1088 return returnValue;
1091 EditFieldHandlePtr MultiPropertySSBOChunkBase::editHandleNumProperties (void)
1093 SFUInt32::EditHandlePtr returnValue(
1094 new SFUInt32::EditHandle(
1095 &_sfNumProperties,
1096 this->getType().getFieldDesc(NumPropertiesFieldId),
1097 this));
1100 editSField(NumPropertiesFieldMask);
1102 return returnValue;
1105 GetFieldHandlePtr MultiPropertySSBOChunkBase::getHandleFloatValues (void) const
1107 MFReal32::GetHandlePtr returnValue(
1108 new MFReal32::GetHandle(
1109 &_mfFloatValues,
1110 this->getType().getFieldDesc(FloatValuesFieldId),
1111 const_cast<MultiPropertySSBOChunkBase *>(this)));
1113 return returnValue;
1116 EditFieldHandlePtr MultiPropertySSBOChunkBase::editHandleFloatValues (void)
1118 MFReal32::EditHandlePtr returnValue(
1119 new MFReal32::EditHandle(
1120 &_mfFloatValues,
1121 this->getType().getFieldDesc(FloatValuesFieldId),
1122 this));
1125 editMField(FloatValuesFieldMask, _mfFloatValues);
1127 return returnValue;
1130 GetFieldHandlePtr MultiPropertySSBOChunkBase::getHandleDoubleValues (void) const
1132 MFReal64::GetHandlePtr returnValue(
1133 new MFReal64::GetHandle(
1134 &_mfDoubleValues,
1135 this->getType().getFieldDesc(DoubleValuesFieldId),
1136 const_cast<MultiPropertySSBOChunkBase *>(this)));
1138 return returnValue;
1141 EditFieldHandlePtr MultiPropertySSBOChunkBase::editHandleDoubleValues (void)
1143 MFReal64::EditHandlePtr returnValue(
1144 new MFReal64::EditHandle(
1145 &_mfDoubleValues,
1146 this->getType().getFieldDesc(DoubleValuesFieldId),
1147 this));
1150 editMField(DoubleValuesFieldMask, _mfDoubleValues);
1152 return returnValue;
1155 GetFieldHandlePtr MultiPropertySSBOChunkBase::getHandleIntValues (void) const
1157 MFInt32::GetHandlePtr returnValue(
1158 new MFInt32::GetHandle(
1159 &_mfIntValues,
1160 this->getType().getFieldDesc(IntValuesFieldId),
1161 const_cast<MultiPropertySSBOChunkBase *>(this)));
1163 return returnValue;
1166 EditFieldHandlePtr MultiPropertySSBOChunkBase::editHandleIntValues (void)
1168 MFInt32::EditHandlePtr returnValue(
1169 new MFInt32::EditHandle(
1170 &_mfIntValues,
1171 this->getType().getFieldDesc(IntValuesFieldId),
1172 this));
1175 editMField(IntValuesFieldMask, _mfIntValues);
1177 return returnValue;
1180 GetFieldHandlePtr MultiPropertySSBOChunkBase::getHandleUIntValues (void) const
1182 MFUInt32::GetHandlePtr returnValue(
1183 new MFUInt32::GetHandle(
1184 &_mfUIntValues,
1185 this->getType().getFieldDesc(UIntValuesFieldId),
1186 const_cast<MultiPropertySSBOChunkBase *>(this)));
1188 return returnValue;
1191 EditFieldHandlePtr MultiPropertySSBOChunkBase::editHandleUIntValues (void)
1193 MFUInt32::EditHandlePtr returnValue(
1194 new MFUInt32::EditHandle(
1195 &_mfUIntValues,
1196 this->getType().getFieldDesc(UIntValuesFieldId),
1197 this));
1200 editMField(UIntValuesFieldMask, _mfUIntValues);
1202 return returnValue;
1205 GetFieldHandlePtr MultiPropertySSBOChunkBase::getHandleBoolValues (void) const
1207 MFBool::GetHandlePtr returnValue(
1208 new MFBool::GetHandle(
1209 &_mfBoolValues,
1210 this->getType().getFieldDesc(BoolValuesFieldId),
1211 const_cast<MultiPropertySSBOChunkBase *>(this)));
1213 return returnValue;
1216 EditFieldHandlePtr MultiPropertySSBOChunkBase::editHandleBoolValues (void)
1218 MFBool::EditHandlePtr returnValue(
1219 new MFBool::EditHandle(
1220 &_mfBoolValues,
1221 this->getType().getFieldDesc(BoolValuesFieldId),
1222 this));
1225 editMField(BoolValuesFieldMask, _mfBoolValues);
1227 return returnValue;
1230 GetFieldHandlePtr MultiPropertySSBOChunkBase::getHandleVec3Values (void) const
1232 MFVec3f::GetHandlePtr returnValue(
1233 new MFVec3f::GetHandle(
1234 &_mfVec3Values,
1235 this->getType().getFieldDesc(Vec3ValuesFieldId),
1236 const_cast<MultiPropertySSBOChunkBase *>(this)));
1238 return returnValue;
1241 EditFieldHandlePtr MultiPropertySSBOChunkBase::editHandleVec3Values (void)
1243 MFVec3f::EditHandlePtr returnValue(
1244 new MFVec3f::EditHandle(
1245 &_mfVec3Values,
1246 this->getType().getFieldDesc(Vec3ValuesFieldId),
1247 this));
1250 editMField(Vec3ValuesFieldMask, _mfVec3Values);
1252 return returnValue;
1255 GetFieldHandlePtr MultiPropertySSBOChunkBase::getHandleVec4Values (void) const
1257 MFVec4f::GetHandlePtr returnValue(
1258 new MFVec4f::GetHandle(
1259 &_mfVec4Values,
1260 this->getType().getFieldDesc(Vec4ValuesFieldId),
1261 const_cast<MultiPropertySSBOChunkBase *>(this)));
1263 return returnValue;
1266 EditFieldHandlePtr MultiPropertySSBOChunkBase::editHandleVec4Values (void)
1268 MFVec4f::EditHandlePtr returnValue(
1269 new MFVec4f::EditHandle(
1270 &_mfVec4Values,
1271 this->getType().getFieldDesc(Vec4ValuesFieldId),
1272 this));
1275 editMField(Vec4ValuesFieldMask, _mfVec4Values);
1277 return returnValue;
1280 GetFieldHandlePtr MultiPropertySSBOChunkBase::getHandleMatrixValues (void) const
1282 MFMatrix::GetHandlePtr returnValue(
1283 new MFMatrix::GetHandle(
1284 &_mfMatrixValues,
1285 this->getType().getFieldDesc(MatrixValuesFieldId),
1286 const_cast<MultiPropertySSBOChunkBase *>(this)));
1288 return returnValue;
1291 EditFieldHandlePtr MultiPropertySSBOChunkBase::editHandleMatrixValues (void)
1293 MFMatrix::EditHandlePtr returnValue(
1294 new MFMatrix::EditHandle(
1295 &_mfMatrixValues,
1296 this->getType().getFieldDesc(MatrixValuesFieldId),
1297 this));
1300 editMField(MatrixValuesFieldMask, _mfMatrixValues);
1302 return returnValue;
1306 #ifdef OSG_MT_CPTR_ASPECT
1307 void MultiPropertySSBOChunkBase::execSyncV( FieldContainer &oFrom,
1308 ConstFieldMaskArg whichField,
1309 AspectOffsetStore &oOffsets,
1310 ConstFieldMaskArg syncMode,
1311 const UInt32 uiSyncInfo)
1313 MultiPropertySSBOChunk *pThis = static_cast<MultiPropertySSBOChunk *>(this);
1315 pThis->execSync(static_cast<MultiPropertySSBOChunk *>(&oFrom),
1316 whichField,
1317 oOffsets,
1318 syncMode,
1319 uiSyncInfo);
1321 #endif
1324 #ifdef OSG_MT_CPTR_ASPECT
1325 FieldContainer *MultiPropertySSBOChunkBase::createAspectCopy(
1326 const FieldContainer *pRefAspect) const
1328 MultiPropertySSBOChunk *returnValue;
1330 newAspectCopy(returnValue,
1331 dynamic_cast<const MultiPropertySSBOChunk *>(pRefAspect),
1332 dynamic_cast<const MultiPropertySSBOChunk *>(this));
1334 return returnValue;
1336 #endif
1338 void MultiPropertySSBOChunkBase::resolveLinks(void)
1340 Inherited::resolveLinks();
1342 #ifdef OSG_MT_CPTR_ASPECT
1343 AspectOffsetStore oOffsets;
1345 _pAspectStore->fillOffsetArray(oOffsets, this);
1346 #endif
1348 #ifdef OSG_MT_CPTR_ASPECT
1349 _mfTypes.terminateShare(Thread::getCurrentAspect(),
1350 oOffsets);
1351 #endif
1352 #ifdef OSG_MT_CPTR_ASPECT
1353 _mfCardinality.terminateShare(Thread::getCurrentAspect(),
1354 oOffsets);
1355 #endif
1356 #ifdef OSG_MT_CPTR_ASPECT
1357 _mfCardinalities.terminateShare(Thread::getCurrentAspect(),
1358 oOffsets);
1359 #endif
1360 #ifdef OSG_MT_CPTR_ASPECT
1361 _mfFloatValues.terminateShare(Thread::getCurrentAspect(),
1362 oOffsets);
1363 #endif
1364 #ifdef OSG_MT_CPTR_ASPECT
1365 _mfDoubleValues.terminateShare(Thread::getCurrentAspect(),
1366 oOffsets);
1367 #endif
1368 #ifdef OSG_MT_CPTR_ASPECT
1369 _mfIntValues.terminateShare(Thread::getCurrentAspect(),
1370 oOffsets);
1371 #endif
1372 #ifdef OSG_MT_CPTR_ASPECT
1373 _mfUIntValues.terminateShare(Thread::getCurrentAspect(),
1374 oOffsets);
1375 #endif
1376 #ifdef OSG_MT_CPTR_ASPECT
1377 _mfBoolValues.terminateShare(Thread::getCurrentAspect(),
1378 oOffsets);
1379 #endif
1380 #ifdef OSG_MT_CPTR_ASPECT
1381 _mfVec3Values.terminateShare(Thread::getCurrentAspect(),
1382 oOffsets);
1383 #endif
1384 #ifdef OSG_MT_CPTR_ASPECT
1385 _mfVec4Values.terminateShare(Thread::getCurrentAspect(),
1386 oOffsets);
1387 #endif
1388 #ifdef OSG_MT_CPTR_ASPECT
1389 _mfMatrixValues.terminateShare(Thread::getCurrentAspect(),
1390 oOffsets);
1391 #endif
1395 OSG_END_NAMESPACE