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 \*****************************************************************************/
54 #ifndef _OSGPARTICLESBASE_H_
55 #define _OSGPARTICLESBASE_H_
61 #include "OSGConfig.h"
62 #include "OSGDrawableDef.h"
64 //#include "OSGBaseTypes.h"
66 #include "OSGMaterialDrawable.h" // Parent
68 #include "OSGSysFields.h" // Mode type
69 #include "OSGGeoVectorPropertyFields.h" // Positions type
70 #include "OSGVecFields.h" // Sizes type
71 #include "OSGParticleBSP.h" // Bsp type
73 #include "OSGParticlesFields.h"
80 //! \brief Particles Base Class.
82 class OSG_DRAWABLE_DLLMAPPING ParticlesBase
: public MaterialDrawable
86 typedef MaterialDrawable Inherited
;
87 typedef MaterialDrawable ParentContainer
;
89 typedef Inherited::TypeObject TypeObject
;
90 typedef TypeObject::InitPhase InitPhase
;
92 OSG_GEN_INTERNALPTR(Particles
);
94 /*========================== PUBLIC =================================*/
100 ModeFieldId
= Inherited::NextFieldId
,
101 PositionsFieldId
= ModeFieldId
+ 1,
102 SizesFieldId
= PositionsFieldId
+ 1,
103 SecPositionsFieldId
= SizesFieldId
+ 1,
104 ColorsFieldId
= SecPositionsFieldId
+ 1,
105 NormalsFieldId
= ColorsFieldId
+ 1,
106 IndicesFieldId
= NormalsFieldId
+ 1,
107 TextureZsFieldId
= IndicesFieldId
+ 1,
108 DrawOrderFieldId
= TextureZsFieldId
+ 1,
109 DynamicFieldId
= DrawOrderFieldId
+ 1,
110 PumpFieldId
= DynamicFieldId
+ 1,
111 BspFieldId
= PumpFieldId
+ 1,
112 NumParticlesFieldId
= BspFieldId
+ 1,
113 NextFieldId
= NumParticlesFieldId
+ 1
116 static const OSG::BitVector ModeFieldMask
=
117 (TypeTraits
<BitVector
>::One
<< ModeFieldId
);
118 static const OSG::BitVector PositionsFieldMask
=
119 (TypeTraits
<BitVector
>::One
<< PositionsFieldId
);
120 static const OSG::BitVector SizesFieldMask
=
121 (TypeTraits
<BitVector
>::One
<< SizesFieldId
);
122 static const OSG::BitVector SecPositionsFieldMask
=
123 (TypeTraits
<BitVector
>::One
<< SecPositionsFieldId
);
124 static const OSG::BitVector ColorsFieldMask
=
125 (TypeTraits
<BitVector
>::One
<< ColorsFieldId
);
126 static const OSG::BitVector NormalsFieldMask
=
127 (TypeTraits
<BitVector
>::One
<< NormalsFieldId
);
128 static const OSG::BitVector IndicesFieldMask
=
129 (TypeTraits
<BitVector
>::One
<< IndicesFieldId
);
130 static const OSG::BitVector TextureZsFieldMask
=
131 (TypeTraits
<BitVector
>::One
<< TextureZsFieldId
);
132 static const OSG::BitVector DrawOrderFieldMask
=
133 (TypeTraits
<BitVector
>::One
<< DrawOrderFieldId
);
134 static const OSG::BitVector DynamicFieldMask
=
135 (TypeTraits
<BitVector
>::One
<< DynamicFieldId
);
136 static const OSG::BitVector PumpFieldMask
=
137 (TypeTraits
<BitVector
>::One
<< PumpFieldId
);
138 static const OSG::BitVector BspFieldMask
=
139 (TypeTraits
<BitVector
>::One
<< BspFieldId
);
140 static const OSG::BitVector NumParticlesFieldMask
=
141 (TypeTraits
<BitVector
>::One
<< NumParticlesFieldId
);
142 static const OSG::BitVector NextFieldMask
=
143 (TypeTraits
<BitVector
>::One
<< NextFieldId
);
145 typedef SFUInt32 SFModeType
;
146 typedef SFUnrecChildGeoVectorPropertyPtr SFPositionsType
;
147 typedef MFVec3f MFSizesType
;
148 typedef SFUnrecChildGeoVectorPropertyPtr SFSecPositionsType
;
149 typedef SFUnrecChildGeoVectorPropertyPtr SFColorsType
;
150 typedef SFUnrecChildGeoVectorPropertyPtr SFNormalsType
;
151 typedef MFInt32 MFIndicesType
;
152 typedef MFReal32 MFTextureZsType
;
153 typedef SFUInt32 SFDrawOrderType
;
154 typedef SFBool SFDynamicType
;
155 typedef SFUInt32 SFPumpType
;
156 typedef SFParticleBSPTree SFBspType
;
157 typedef SFInt32 SFNumParticlesType
;
159 /*---------------------------------------------------------------------*/
160 /*! \name Class Get */
163 static FieldContainerType
&getClassType (void);
164 static UInt32
getClassTypeId (void);
165 static UInt16
getClassGroupId(void);
168 /*---------------------------------------------------------------------*/
169 /*! \name FieldContainer Get */
172 virtual FieldContainerType
&getType (void);
173 virtual const FieldContainerType
&getType (void) const;
175 virtual UInt32
getContainerSize(void) const;
178 /*---------------------------------------------------------------------*/
179 /*! \name Field Get */
183 SFUInt32
*editSFMode (void);
184 const SFUInt32
*getSFMode (void) const;
185 const SFUnrecChildGeoVectorPropertyPtr
*getSFPositions (void) const;
186 SFUnrecChildGeoVectorPropertyPtr
*editSFPositions (void);
188 MFVec3f
*editMFSizes (void);
189 const MFVec3f
*getMFSizes (void) const;
190 const SFUnrecChildGeoVectorPropertyPtr
*getSFSecPositions (void) const;
191 SFUnrecChildGeoVectorPropertyPtr
*editSFSecPositions (void);
192 const SFUnrecChildGeoVectorPropertyPtr
*getSFColors (void) const;
193 SFUnrecChildGeoVectorPropertyPtr
*editSFColors (void);
194 const SFUnrecChildGeoVectorPropertyPtr
*getSFNormals (void) const;
195 SFUnrecChildGeoVectorPropertyPtr
*editSFNormals (void);
197 MFInt32
*editMFIndices (void);
198 const MFInt32
*getMFIndices (void) const;
200 MFReal32
*editMFTextureZs (void);
201 const MFReal32
*getMFTextureZs (void) const;
203 SFUInt32
*editSFDrawOrder (void);
204 const SFUInt32
*getSFDrawOrder (void) const;
206 SFBool
*editSFDynamic (void);
207 const SFBool
*getSFDynamic (void) const;
209 SFParticleBSPTree
*editSFBsp (void);
210 const SFParticleBSPTree
*getSFBsp (void) const;
212 SFInt32
*editSFNumParticles (void);
213 const SFInt32
*getSFNumParticles (void) const;
216 UInt32
&editMode (void);
217 UInt32
getMode (void) const;
219 GeoVectorProperty
* getPositions (void) const;
221 MFVec3f ::reference
editSizes (const UInt32 index
);
222 const Vec3f
&getSizes (const UInt32 index
) const;
224 GeoVectorProperty
* getSecPositions (void) const;
226 GeoVectorProperty
* getColors (void) const;
228 GeoVectorProperty
* getNormals (void) const;
230 MFInt32 ::reference
editIndices (const UInt32 index
);
231 Int32
getIndices (const UInt32 index
) const;
233 MFReal32 ::reference
editTextureZs (const UInt32 index
);
234 Real32
getTextureZs (const UInt32 index
) const;
236 UInt32
&editDrawOrder (void);
237 UInt32
getDrawOrder (void) const;
239 bool &editDynamic (void);
240 bool getDynamic (void) const;
242 ParticleBSPTree
&editBsp (void);
243 const ParticleBSPTree
&getBsp (void) const;
245 Int32
&editNumParticles (void);
246 Int32
getNumParticles (void) const;
249 /*---------------------------------------------------------------------*/
250 /*! \name Field Set */
253 void setMode (const UInt32 value
);
254 void setPositions (GeoVectorProperty
* const value
);
255 void setSecPositions (GeoVectorProperty
* const value
);
256 void setColors (GeoVectorProperty
* const value
);
257 void setNormals (GeoVectorProperty
* const value
);
258 void setDrawOrder (const UInt32 value
);
259 void setDynamic (const bool value
);
260 void setBsp (const ParticleBSPTree
&value
);
261 void setNumParticles (const Int32 value
);
264 /*---------------------------------------------------------------------*/
265 /*! \name Ptr Field Set */
269 /*---------------------------------------------------------------------*/
270 /*! \name Ptr MField Set */
274 /*---------------------------------------------------------------------*/
275 /*! \name Binary Access */
278 virtual SizeT
getBinSize (ConstFieldMaskArg whichField
);
279 virtual void copyToBin (BinaryDataHandler
&pMem
,
280 ConstFieldMaskArg whichField
);
281 virtual void copyFromBin(BinaryDataHandler
&pMem
,
282 ConstFieldMaskArg whichField
);
286 /*---------------------------------------------------------------------*/
287 /*! \name Construction */
290 static ParticlesTransitPtr
create (void);
291 static Particles
*createEmpty (void);
293 static ParticlesTransitPtr
createLocal (
294 BitVector bFlags
= FCLocal::All
);
296 static Particles
*createEmptyLocal(
297 BitVector bFlags
= FCLocal::All
);
299 static ParticlesTransitPtr
createDependent (BitVector bFlags
);
302 /*---------------------------------------------------------------------*/
306 virtual FieldContainerTransitPtr
shallowCopy (void) const;
307 virtual FieldContainerTransitPtr
shallowCopyLocal(
308 BitVector bFlags
= FCLocal::All
) const;
309 virtual FieldContainerTransitPtr
shallowCopyDependent(
310 BitVector bFlags
) const;
313 /*========================= PROTECTED ===============================*/
317 static TypeObject _type
;
319 static void classDescInserter(TypeObject
&oType
);
320 static const Char8
*getClassname (void );
322 /*---------------------------------------------------------------------*/
327 SFUnrecChildGeoVectorPropertyPtr _sfPositions
;
329 SFUnrecChildGeoVectorPropertyPtr _sfSecPositions
;
330 SFUnrecChildGeoVectorPropertyPtr _sfColors
;
331 SFUnrecChildGeoVectorPropertyPtr _sfNormals
;
333 MFReal32 _mfTextureZs
;
334 SFUInt32 _sfDrawOrder
;
337 SFParticleBSPTree _sfBsp
;
338 SFInt32 _sfNumParticles
;
341 /*---------------------------------------------------------------------*/
342 /*! \name Constructors */
346 ParticlesBase(const ParticlesBase
&source
);
349 /*---------------------------------------------------------------------*/
350 /*! \name Destructors */
353 virtual ~ParticlesBase(void);
356 /*---------------------------------------------------------------------*/
357 /*! \name onCreate */
360 void onCreate(const Particles
*source
= NULL
);
363 /*---------------------------------------------------------------------*/
364 /*! \name Child linking */
367 virtual bool unlinkChild(FieldContainer
* const pChild
,
368 UInt16
const childFieldId
);
371 /*---------------------------------------------------------------------*/
372 /*! \name Generic Field Access */
375 GetFieldHandlePtr
getHandleMode (void) const;
376 EditFieldHandlePtr
editHandleMode (void);
377 GetFieldHandlePtr
getHandlePositions (void) const;
378 EditFieldHandlePtr
editHandlePositions (void);
379 GetFieldHandlePtr
getHandleSizes (void) const;
380 EditFieldHandlePtr
editHandleSizes (void);
381 GetFieldHandlePtr
getHandleSecPositions (void) const;
382 EditFieldHandlePtr
editHandleSecPositions (void);
383 GetFieldHandlePtr
getHandleColors (void) const;
384 EditFieldHandlePtr
editHandleColors (void);
385 GetFieldHandlePtr
getHandleNormals (void) const;
386 EditFieldHandlePtr
editHandleNormals (void);
387 GetFieldHandlePtr
getHandleIndices (void) const;
388 EditFieldHandlePtr
editHandleIndices (void);
389 GetFieldHandlePtr
getHandleTextureZs (void) const;
390 EditFieldHandlePtr
editHandleTextureZs (void);
391 GetFieldHandlePtr
getHandleDrawOrder (void) const;
392 EditFieldHandlePtr
editHandleDrawOrder (void);
393 GetFieldHandlePtr
getHandleDynamic (void) const;
394 EditFieldHandlePtr
editHandleDynamic (void);
395 GetFieldHandlePtr
getHandlePump (void) const;
396 EditFieldHandlePtr
editHandlePump (void);
397 GetFieldHandlePtr
getHandleBsp (void) const;
398 EditFieldHandlePtr
editHandleBsp (void);
399 GetFieldHandlePtr
getHandleNumParticles (void) const;
400 EditFieldHandlePtr
editHandleNumParticles (void);
403 /*---------------------------------------------------------------------*/
404 /*! \name Field Get */
408 SFUInt32
*editSFPump (void);
409 const SFUInt32
*getSFPump (void) const;
412 UInt32
&editPump (void);
413 UInt32
getPump (void) const;
416 /*---------------------------------------------------------------------*/
417 /*! \name Field Set */
420 void setPump (const UInt32 value
);
423 /*---------------------------------------------------------------------*/
424 /*! \name Ptr MField Set */
428 /*---------------------------------------------------------------------*/
432 #ifdef OSG_MT_CPTR_ASPECT
433 virtual void execSyncV( FieldContainer
&oFrom
,
434 ConstFieldMaskArg whichField
,
435 AspectOffsetStore
&oOffsets
,
436 ConstFieldMaskArg syncMode
,
437 const UInt32 uiSyncInfo
);
439 void execSync ( ParticlesBase
*pFrom
,
440 ConstFieldMaskArg whichField
,
441 AspectOffsetStore
&oOffsets
,
442 ConstFieldMaskArg syncMode
,
443 const UInt32 uiSyncInfo
);
447 /*---------------------------------------------------------------------*/
452 /*---------------------------------------------------------------------*/
453 /*! \name Aspect Create */
456 #ifdef OSG_MT_CPTR_ASPECT
457 virtual FieldContainer
*createAspectCopy(
458 const FieldContainer
*pRefAspect
) const;
462 /*---------------------------------------------------------------------*/
466 /*---------------------------------------------------------------------*/
470 virtual void resolveLinks(void);
473 /*========================== PRIVATE ================================*/
476 /*---------------------------------------------------------------------*/
478 // prohibit default functions (move to 'public' if you need one)
479 void operator =(const ParticlesBase
&source
);
482 typedef ParticlesBase
*ParticlesBaseP
;
486 #endif /* _OSGPARTICLESBASE_H_ */