00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 #ifndef _OSGGEOMETRYBASE_H_
00055 #define _OSGGEOMETRYBASE_H_
00056 #ifdef __sgi
00057 #pragma once
00058 #endif
00059
00060
00061 #include <OSGConfig.h>
00062 #include <OSGSystemDef.h>
00063
00064 #include <OSGBaseTypes.h>
00065 #include <OSGRefPtr.h>
00066 #include <OSGCoredNodePtr.h>
00067
00068 #include <OSGMaterialDrawable.h>
00069
00070 #include <OSGGeoPTypesFields.h>
00071 #include <OSGGeoPLengthsFields.h>
00072 #include <OSGGeoPositionsFields.h>
00073 #include <OSGGeoNormalsFields.h>
00074 #include <OSGGeoColorsFields.h>
00075 #include <OSGGeoColorsFields.h>
00076 #include <OSGGeoTexCoordsFields.h>
00077 #include <OSGGeoTexCoordsFields.h>
00078 #include <OSGGeoTexCoordsFields.h>
00079 #include <OSGGeoTexCoordsFields.h>
00080 #include <OSGGeoIndicesFields.h>
00081 #include <OSGUInt16Fields.h>
00082 #include <OSGBoolFields.h>
00083 #include <OSGInt32Fields.h>
00084
00085 #include <OSGGeometryFields.h>
00086
00087 OSG_BEGIN_NAMESPACE
00088
00089 class Geometry;
00090 class BinaryDataHandler;
00091
00093
00094 class OSG_SYSTEMLIB_DLLMAPPING GeometryBase : public MaterialDrawable
00095 {
00096 private:
00097
00098 typedef MaterialDrawable Inherited;
00099
00100
00101 public:
00102
00103 typedef GeometryPtr Ptr;
00104
00105 enum
00106 {
00107 TypesFieldId = Inherited::NextFieldId,
00108 LengthsFieldId = TypesFieldId + 1,
00109 PositionsFieldId = LengthsFieldId + 1,
00110 NormalsFieldId = PositionsFieldId + 1,
00111 ColorsFieldId = NormalsFieldId + 1,
00112 SecondaryColorsFieldId = ColorsFieldId + 1,
00113 TexCoordsFieldId = SecondaryColorsFieldId + 1,
00114 TexCoords1FieldId = TexCoordsFieldId + 1,
00115 TexCoords2FieldId = TexCoords1FieldId + 1,
00116 TexCoords3FieldId = TexCoords2FieldId + 1,
00117 IndicesFieldId = TexCoords3FieldId + 1,
00118 IndexMappingFieldId = IndicesFieldId + 1,
00119 DlistCacheFieldId = IndexMappingFieldId + 1,
00120 GLIdFieldId = DlistCacheFieldId + 1,
00121 NextFieldId = GLIdFieldId + 1
00122 };
00123
00124 static const OSG::BitVector TypesFieldMask;
00125 static const OSG::BitVector LengthsFieldMask;
00126 static const OSG::BitVector PositionsFieldMask;
00127 static const OSG::BitVector NormalsFieldMask;
00128 static const OSG::BitVector ColorsFieldMask;
00129 static const OSG::BitVector SecondaryColorsFieldMask;
00130 static const OSG::BitVector TexCoordsFieldMask;
00131 static const OSG::BitVector TexCoords1FieldMask;
00132 static const OSG::BitVector TexCoords2FieldMask;
00133 static const OSG::BitVector TexCoords3FieldMask;
00134 static const OSG::BitVector IndicesFieldMask;
00135 static const OSG::BitVector IndexMappingFieldMask;
00136 static const OSG::BitVector DlistCacheFieldMask;
00137 static const OSG::BitVector GLIdFieldMask;
00138
00139
00140 static const OSG::BitVector MTInfluenceMask;
00141
00142
00146 static FieldContainerType &getClassType (void);
00147 static UInt32 getClassTypeId (void);
00148
00150
00154 virtual FieldContainerType &getType (void);
00155 virtual const FieldContainerType &getType (void) const;
00156
00157 virtual UInt32 getContainerSize(void) const;
00158
00160
00164 SFGeoPTypesPtr *getSFTypes (void);
00165 SFGeoPLengthsPtr *getSFLengths (void);
00166 SFGeoPositionsPtr *getSFPositions (void);
00167 SFGeoNormalsPtr *getSFNormals (void);
00168 SFGeoColorsPtr *getSFColors (void);
00169 SFGeoColorsPtr *getSFSecondaryColors(void);
00170 SFGeoTexCoordsPtr *getSFTexCoords (void);
00171 SFGeoTexCoordsPtr *getSFTexCoords1 (void);
00172 SFGeoTexCoordsPtr *getSFTexCoords2 (void);
00173 SFGeoTexCoordsPtr *getSFTexCoords3 (void);
00174 SFGeoIndicesPtr *getSFIndices (void);
00175 MFUInt16 *getMFIndexMapping (void);
00176 SFBool *getSFDlistCache (void);
00177
00178 GeoPTypesPtr &getTypes (void);
00179 const GeoPTypesPtr &getTypes (void) const;
00180 GeoPLengthsPtr &getLengths (void);
00181 const GeoPLengthsPtr &getLengths (void) const;
00182 GeoPositionsPtr &getPositions (void);
00183 const GeoPositionsPtr &getPositions (void) const;
00184 GeoNormalsPtr &getNormals (void);
00185 const GeoNormalsPtr &getNormals (void) const;
00186 GeoColorsPtr &getColors (void);
00187 const GeoColorsPtr &getColors (void) const;
00188 GeoColorsPtr &getSecondaryColors(void);
00189 const GeoColorsPtr &getSecondaryColors(void) const;
00190 GeoTexCoordsPtr &getTexCoords (void);
00191 const GeoTexCoordsPtr &getTexCoords (void) const;
00192 GeoTexCoordsPtr &getTexCoords1 (void);
00193 const GeoTexCoordsPtr &getTexCoords1 (void) const;
00194 GeoTexCoordsPtr &getTexCoords2 (void);
00195 const GeoTexCoordsPtr &getTexCoords2 (void) const;
00196 GeoTexCoordsPtr &getTexCoords3 (void);
00197 const GeoTexCoordsPtr &getTexCoords3 (void) const;
00198 GeoIndicesPtr &getIndices (void);
00199 const GeoIndicesPtr &getIndices (void) const;
00200 bool &getDlistCache (void);
00201 const bool &getDlistCache (void) const;
00202 UInt16 &getIndexMapping (const UInt32 index);
00203 MFUInt16 &getIndexMapping (void);
00204 const MFUInt16 &getIndexMapping (void) const;
00205
00207
00211 void setTypes ( const GeoPTypesPtr &value );
00212 void setLengths ( const GeoPLengthsPtr &value );
00213 void setPositions ( const GeoPositionsPtr &value );
00214 void setNormals ( const GeoNormalsPtr &value );
00215 void setColors ( const GeoColorsPtr &value );
00216 void setSecondaryColors( const GeoColorsPtr &value );
00217 void setTexCoords ( const GeoTexCoordsPtr &value );
00218 void setTexCoords1 ( const GeoTexCoordsPtr &value );
00219 void setTexCoords2 ( const GeoTexCoordsPtr &value );
00220 void setTexCoords3 ( const GeoTexCoordsPtr &value );
00221 void setIndices ( const GeoIndicesPtr &value );
00222 void setDlistCache ( const bool &value );
00223
00225
00230
00234 virtual UInt32 getBinSize (const BitVector &whichField);
00235 virtual void copyToBin ( BinaryDataHandler &pMem,
00236 const BitVector &whichField);
00237 virtual void copyFromBin( BinaryDataHandler &pMem,
00238 const BitVector &whichField);
00239
00240
00242
00246 static GeometryPtr create (void);
00247 static GeometryPtr createEmpty (void);
00248
00251
00255 virtual FieldContainerPtr shallowCopy (void) const;
00256
00258
00259 protected:
00260
00261
00265 SFGeoPTypesPtr _sfTypes;
00266 SFGeoPLengthsPtr _sfLengths;
00267 SFGeoPositionsPtr _sfPositions;
00268 SFGeoNormalsPtr _sfNormals;
00269 SFGeoColorsPtr _sfColors;
00270 SFGeoColorsPtr _sfSecondaryColors;
00271 SFGeoTexCoordsPtr _sfTexCoords;
00272 SFGeoTexCoordsPtr _sfTexCoords1;
00273 SFGeoTexCoordsPtr _sfTexCoords2;
00274 SFGeoTexCoordsPtr _sfTexCoords3;
00275 SFGeoIndicesPtr _sfIndices;
00276 MFUInt16 _mfIndexMapping;
00277 SFBool _sfDlistCache;
00278 SFInt32 _sfGLId;
00279
00281
00285 GeometryBase(void);
00286 GeometryBase(const GeometryBase &source);
00287
00289
00293 virtual ~GeometryBase(void);
00294
00296
00300 SFInt32 *getSFGLId (void);
00301
00302 Int32 &getGLId (void);
00303 const Int32 &getGLId (void) const;
00304
00306
00310 void setGLId (const Int32 &value);
00311
00313
00317 #if !defined(OSG_FIXED_MFIELDSYNC)
00318 void executeSyncImpl( GeometryBase *pOther,
00319 const BitVector &whichField);
00320
00321 virtual void executeSync( FieldContainer &other,
00322 const BitVector &whichField);
00323 #else
00324 void executeSyncImpl( GeometryBase *pOther,
00325 const BitVector &whichField,
00326 const SyncInfo &sInfo );
00327
00328 virtual void executeSync( FieldContainer &other,
00329 const BitVector &whichField,
00330 const SyncInfo &sInfo);
00331
00332 virtual void execBeginEdit (const BitVector &whichField,
00333 UInt32 uiAspect,
00334 UInt32 uiContainerSize);
00335
00336 void execBeginEditImpl (const BitVector &whichField,
00337 UInt32 uiAspect,
00338 UInt32 uiContainerSize);
00339
00340 virtual void onDestroyAspect(UInt32 uiId, UInt32 uiAspect);
00341 #endif
00342
00344
00345 private:
00346
00347 friend class FieldContainer;
00348
00349 static FieldDescription *_desc[];
00350 static FieldContainerType _type;
00351
00352
00353
00354 void operator =(const GeometryBase &source);
00355 };
00356
00357
00358
00359
00360
00361
00362 typedef GeometryBase *GeometryBaseP;
00363
00364 typedef osgIF<GeometryBase::isNodeCore,
00365 CoredNodePtr<Geometry>,
00366 FieldContainer::attempt_to_create_CoredNodePtr_on_non_NodeCore_FC
00367 >::_IRet GeometryNodePtr;
00368
00369 typedef RefPtr<GeometryPtr> GeometryRefPtr;
00370
00371 OSG_END_NAMESPACE
00372
00373 #define OSGGEOMETRYBASE_HEADER_CVSID "@(#)$Id: FCBaseTemplate_h.h,v 1.38 2005/07/08 06:37:35 vossg Exp $"
00374
00375 #endif