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 _OSGGEOMETRYBASE_H_
55 #define _OSGGEOMETRYBASE_H_
61 #include "OSGConfig.h"
62 #include "OSGDrawableDef.h"
64 //#include "OSGBaseTypes.h"
66 #include "OSGMaterialDrawable.h" // Parent
68 #include "OSGGeoIntegralPropertyFields.h" // Types type
69 #include "OSGGeoVectorPropertyFields.h" // Properties type
70 #include "OSGSysFields.h" // PatchVertices type
72 #include "OSGGeometryFields.h"
79 //! \brief Geometry Base Class.
81 class OSG_DRAWABLE_DLLMAPPING GeometryBase
: public MaterialDrawable
85 typedef MaterialDrawable Inherited
;
86 typedef MaterialDrawable ParentContainer
;
88 typedef Inherited::TypeObject TypeObject
;
89 typedef TypeObject::InitPhase InitPhase
;
91 OSG_GEN_INTERNALPTR(Geometry
);
93 /*========================== PUBLIC =================================*/
99 TypesFieldId
= Inherited::NextFieldId
,
100 LengthsFieldId
= TypesFieldId
+ 1,
101 PropertiesFieldId
= LengthsFieldId
+ 1,
102 PropIndicesFieldId
= PropertiesFieldId
+ 1,
103 PatchVerticesFieldId
= PropIndicesFieldId
+ 1,
104 DlistCacheFieldId
= PatchVerticesFieldId
+ 1,
105 UseVAOFieldId
= DlistCacheFieldId
+ 1,
106 UseAttribCallsFieldId
= UseVAOFieldId
+ 1,
107 ClassicGLIdFieldId
= UseAttribCallsFieldId
+ 1,
108 AttGLIdFieldId
= ClassicGLIdFieldId
+ 1,
109 ClassicVaoGLIdFieldId
= AttGLIdFieldId
+ 1,
110 AttribVaoGLIdFieldId
= ClassicVaoGLIdFieldId
+ 1,
111 NextFieldId
= AttribVaoGLIdFieldId
+ 1
114 static const OSG::BitVector TypesFieldMask
=
115 (TypeTraits
<BitVector
>::One
<< TypesFieldId
);
116 static const OSG::BitVector LengthsFieldMask
=
117 (TypeTraits
<BitVector
>::One
<< LengthsFieldId
);
118 static const OSG::BitVector PropertiesFieldMask
=
119 (TypeTraits
<BitVector
>::One
<< PropertiesFieldId
);
120 static const OSG::BitVector PropIndicesFieldMask
=
121 (TypeTraits
<BitVector
>::One
<< PropIndicesFieldId
);
122 static const OSG::BitVector PatchVerticesFieldMask
=
123 (TypeTraits
<BitVector
>::One
<< PatchVerticesFieldId
);
124 static const OSG::BitVector DlistCacheFieldMask
=
125 (TypeTraits
<BitVector
>::One
<< DlistCacheFieldId
);
126 static const OSG::BitVector UseVAOFieldMask
=
127 (TypeTraits
<BitVector
>::One
<< UseVAOFieldId
);
128 static const OSG::BitVector UseAttribCallsFieldMask
=
129 (TypeTraits
<BitVector
>::One
<< UseAttribCallsFieldId
);
130 static const OSG::BitVector ClassicGLIdFieldMask
=
131 (TypeTraits
<BitVector
>::One
<< ClassicGLIdFieldId
);
132 static const OSG::BitVector AttGLIdFieldMask
=
133 (TypeTraits
<BitVector
>::One
<< AttGLIdFieldId
);
134 static const OSG::BitVector ClassicVaoGLIdFieldMask
=
135 (TypeTraits
<BitVector
>::One
<< ClassicVaoGLIdFieldId
);
136 static const OSG::BitVector AttribVaoGLIdFieldMask
=
137 (TypeTraits
<BitVector
>::One
<< AttribVaoGLIdFieldId
);
138 static const OSG::BitVector NextFieldMask
=
139 (TypeTraits
<BitVector
>::One
<< NextFieldId
);
141 typedef SFUnrecChildGeoIntegralPropertyPtr SFTypesType
;
142 typedef SFUnrecChildGeoIntegralPropertyPtr SFLengthsType
;
143 typedef MFUnrecChildGeoVectorPropertyPtr MFPropertiesType
;
144 typedef MFUnrecChildGeoIntegralPropertyPtr MFPropIndicesType
;
145 typedef SFUInt32 SFPatchVerticesType
;
146 typedef SFBool SFDlistCacheType
;
147 typedef SFBool SFUseVAOType
;
148 typedef SFBool SFUseAttribCallsType
;
149 typedef SFInt32 SFClassicGLIdType
;
150 typedef SFInt32 SFAttGLIdType
;
151 typedef SFInt32 SFClassicVaoGLIdType
;
152 typedef SFInt32 SFAttribVaoGLIdType
;
154 /*---------------------------------------------------------------------*/
155 /*! \name Class Get */
158 static FieldContainerType
&getClassType (void);
159 static UInt32
getClassTypeId (void);
160 static UInt16
getClassGroupId(void);
163 /*---------------------------------------------------------------------*/
164 /*! \name FieldContainer Get */
167 virtual FieldContainerType
&getType (void);
168 virtual const FieldContainerType
&getType (void) const;
170 virtual UInt32
getContainerSize(void) const;
173 /*---------------------------------------------------------------------*/
174 /*! \name Field Get */
177 const SFUnrecChildGeoIntegralPropertyPtr
*getSFTypes (void) const;
178 SFUnrecChildGeoIntegralPropertyPtr
*editSFTypes (void);
179 const SFUnrecChildGeoIntegralPropertyPtr
*getSFLengths (void) const;
180 SFUnrecChildGeoIntegralPropertyPtr
*editSFLengths (void);
181 const MFUnrecChildGeoVectorPropertyPtr
*getMFProperties (void) const;
182 MFUnrecChildGeoVectorPropertyPtr
*editMFProperties (void);
183 const MFUnrecChildGeoIntegralPropertyPtr
*getMFPropIndices (void) const;
184 MFUnrecChildGeoIntegralPropertyPtr
*editMFPropIndices (void);
186 SFUInt32
*editSFPatchVertices (void);
187 const SFUInt32
*getSFPatchVertices (void) const;
189 SFBool
*editSFDlistCache (void);
190 const SFBool
*getSFDlistCache (void) const;
192 SFBool
*editSFUseVAO (void);
193 const SFBool
*getSFUseVAO (void) const;
195 SFBool
*editSFUseAttribCalls (void);
196 const SFBool
*getSFUseAttribCalls (void) const;
199 GeoIntegralProperty
* getTypes (void) const;
201 GeoIntegralProperty
* getLengths (void) const;
203 GeoVectorProperty
* getProperties (const UInt32 index
) const;
205 GeoIntegralProperty
* getPropIndices (const UInt32 index
) const;
207 UInt32
&editPatchVertices (void);
208 UInt32
getPatchVertices (void) const;
210 bool &editDlistCache (void);
211 bool getDlistCache (void) const;
213 bool &editUseVAO (void);
214 bool getUseVAO (void) const;
216 bool &editUseAttribCalls (void);
217 bool getUseAttribCalls (void) const;
220 /*---------------------------------------------------------------------*/
221 /*! \name Field Set */
224 void setTypes (GeoIntegralProperty
* const value
);
225 void setLengths (GeoIntegralProperty
* const value
);
226 void setPatchVertices (const UInt32 value
);
227 void setDlistCache (const bool value
);
228 void setUseVAO (const bool value
);
229 void setUseAttribCalls (const bool value
);
232 /*---------------------------------------------------------------------*/
233 /*! \name Ptr Field Set */
237 /*---------------------------------------------------------------------*/
238 /*! \name Ptr MField Set */
241 void pushToProperties (GeoVectorProperty
* const value
);
242 void assignProperties (const MFUnrecChildGeoVectorPropertyPtr
&value
);
243 void removeFromProperties (UInt32 uiIndex
);
244 void removeObjFromProperties(GeoVectorProperty
* const value
);
245 void clearProperties (void );
247 void pushToPropIndices (GeoIntegralProperty
* const value
);
248 void assignPropIndices (const MFUnrecChildGeoIntegralPropertyPtr
&value
);
249 void removeFromPropIndices (UInt32 uiIndex
);
250 void removeObjFromPropIndices(GeoIntegralProperty
* const value
);
251 void clearPropIndices (void );
254 /*---------------------------------------------------------------------*/
255 /*! \name Binary Access */
258 virtual SizeT
getBinSize (ConstFieldMaskArg whichField
);
259 virtual void copyToBin (BinaryDataHandler
&pMem
,
260 ConstFieldMaskArg whichField
);
261 virtual void copyFromBin(BinaryDataHandler
&pMem
,
262 ConstFieldMaskArg whichField
);
266 /*---------------------------------------------------------------------*/
267 /*! \name Construction */
270 static GeometryTransitPtr
create (void);
271 static Geometry
*createEmpty (void);
273 static GeometryTransitPtr
createLocal (
274 BitVector bFlags
= FCLocal::All
);
276 static Geometry
*createEmptyLocal(
277 BitVector bFlags
= FCLocal::All
);
279 static GeometryTransitPtr
createDependent (BitVector bFlags
);
282 /*---------------------------------------------------------------------*/
286 virtual FieldContainerTransitPtr
shallowCopy (void) const;
287 virtual FieldContainerTransitPtr
shallowCopyLocal(
288 BitVector bFlags
= FCLocal::All
) const;
289 virtual FieldContainerTransitPtr
shallowCopyDependent(
290 BitVector bFlags
) const;
293 /*========================= PROTECTED ===============================*/
297 static TypeObject _type
;
299 static void classDescInserter(TypeObject
&oType
);
300 static const Char8
*getClassname (void );
302 /*---------------------------------------------------------------------*/
306 SFUnrecChildGeoIntegralPropertyPtr _sfTypes
;
307 SFUnrecChildGeoIntegralPropertyPtr _sfLengths
;
308 MFUnrecChildGeoVectorPropertyPtr _mfProperties
;
309 MFUnrecChildGeoIntegralPropertyPtr _mfPropIndices
;
310 SFUInt32 _sfPatchVertices
;
311 SFBool _sfDlistCache
;
313 SFBool _sfUseAttribCalls
;
314 SFInt32 _sfClassicGLId
;
316 SFInt32 _sfClassicVaoGLId
;
317 SFInt32 _sfAttribVaoGLId
;
320 /*---------------------------------------------------------------------*/
321 /*! \name Constructors */
325 GeometryBase(const GeometryBase
&source
);
328 /*---------------------------------------------------------------------*/
329 /*! \name Destructors */
332 virtual ~GeometryBase(void);
335 /*---------------------------------------------------------------------*/
336 /*! \name onCreate */
339 void onCreate(const Geometry
*source
= NULL
);
342 /*---------------------------------------------------------------------*/
343 /*! \name Child linking */
346 virtual bool unlinkChild(FieldContainer
* const pChild
,
347 UInt16
const childFieldId
);
350 /*---------------------------------------------------------------------*/
351 /*! \name Generic Field Access */
354 GetFieldHandlePtr
getHandleTypes (void) const;
355 EditFieldHandlePtr
editHandleTypes (void);
356 GetFieldHandlePtr
getHandleLengths (void) const;
357 EditFieldHandlePtr
editHandleLengths (void);
358 GetFieldHandlePtr
getHandleProperties (void) const;
359 EditFieldHandlePtr
editHandleProperties (void);
360 GetFieldHandlePtr
getHandlePropIndices (void) const;
361 EditFieldHandlePtr
editHandlePropIndices (void);
362 GetFieldHandlePtr
getHandlePatchVertices (void) const;
363 EditFieldHandlePtr
editHandlePatchVertices (void);
364 GetFieldHandlePtr
getHandleDlistCache (void) const;
365 EditFieldHandlePtr
editHandleDlistCache (void);
366 GetFieldHandlePtr
getHandleUseVAO (void) const;
367 EditFieldHandlePtr
editHandleUseVAO (void);
368 GetFieldHandlePtr
getHandleUseAttribCalls (void) const;
369 EditFieldHandlePtr
editHandleUseAttribCalls (void);
370 GetFieldHandlePtr
getHandleClassicGLId (void) const;
371 EditFieldHandlePtr
editHandleClassicGLId (void);
372 GetFieldHandlePtr
getHandleAttGLId (void) const;
373 EditFieldHandlePtr
editHandleAttGLId (void);
374 GetFieldHandlePtr
getHandleClassicVaoGLId (void) const;
375 EditFieldHandlePtr
editHandleClassicVaoGLId (void);
376 GetFieldHandlePtr
getHandleAttribVaoGLId (void) const;
377 EditFieldHandlePtr
editHandleAttribVaoGLId (void);
380 /*---------------------------------------------------------------------*/
381 /*! \name Field Get */
385 SFInt32
*editSFClassicGLId (void);
386 const SFInt32
*getSFClassicGLId (void) const;
388 SFInt32
*editSFAttGLId (void);
389 const SFInt32
*getSFAttGLId (void) const;
391 SFInt32
*editSFClassicVaoGLId (void);
392 const SFInt32
*getSFClassicVaoGLId (void) const;
394 SFInt32
*editSFAttribVaoGLId (void);
395 const SFInt32
*getSFAttribVaoGLId (void) const;
398 Int32
&editClassicGLId (void);
399 Int32
getClassicGLId (void) const;
401 Int32
&editAttGLId (void);
402 Int32
getAttGLId (void) const;
404 Int32
&editClassicVaoGLId (void);
405 Int32
getClassicVaoGLId (void) const;
407 Int32
&editAttribVaoGLId (void);
408 Int32
getAttribVaoGLId (void) const;
411 /*---------------------------------------------------------------------*/
412 /*! \name Field Set */
415 void setClassicGLId (const Int32 value
);
416 void setAttGLId (const Int32 value
);
417 void setClassicVaoGLId (const Int32 value
);
418 void setAttribVaoGLId (const Int32 value
);
421 /*---------------------------------------------------------------------*/
422 /*! \name Ptr MField Set */
426 /*---------------------------------------------------------------------*/
430 #ifdef OSG_MT_CPTR_ASPECT
431 virtual void execSyncV( FieldContainer
&oFrom
,
432 ConstFieldMaskArg whichField
,
433 AspectOffsetStore
&oOffsets
,
434 ConstFieldMaskArg syncMode
,
435 const UInt32 uiSyncInfo
);
437 void execSync ( GeometryBase
*pFrom
,
438 ConstFieldMaskArg whichField
,
439 AspectOffsetStore
&oOffsets
,
440 ConstFieldMaskArg syncMode
,
441 const UInt32 uiSyncInfo
);
445 /*---------------------------------------------------------------------*/
450 /*---------------------------------------------------------------------*/
451 /*! \name Aspect Create */
454 #ifdef OSG_MT_CPTR_ASPECT
455 virtual FieldContainer
*createAspectCopy(
456 const FieldContainer
*pRefAspect
) const;
460 /*---------------------------------------------------------------------*/
464 /*---------------------------------------------------------------------*/
468 virtual void resolveLinks(void);
471 /*========================== PRIVATE ================================*/
474 /*---------------------------------------------------------------------*/
476 // prohibit default functions (move to 'public' if you need one)
477 void operator =(const GeometryBase
&source
);
480 typedef GeometryBase
*GeometryBaseP
;
482 typedef CoredNodeRefPtr
<Geometry
> GeometryNodeRefPtr
;
483 typedef CoredNodeMTRefPtr
<Geometry
> GeometryNodeMTRefPtr
;
487 #endif /* _OSGGEOMETRYBASE_H_ */