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 <OSGGeoTexCoordsFields.h>
00081 #include <OSGGeoTexCoordsFields.h>
00082 #include <OSGGeoTexCoordsFields.h>
00083 #include <OSGGeoTexCoordsFields.h>
00084 #include <OSGGeoIndicesFields.h>
00085 #include <OSGUInt16Fields.h>
00086 #include <OSGBoolFields.h>
00087 #include <OSGInt32Fields.h>
00088 #include <OSGInt32Fields.h>
00089 #include <OSGUInt32Fields.h>
00090 #include <OSGUInt32Fields.h>
00091 #include <OSGUInt32Fields.h>
00092 #include <OSGUInt32Fields.h>
00093 #include <OSGBoolFields.h>
00094
00095 #include <OSGGeometryFields.h>
00096
00097 OSG_BEGIN_NAMESPACE
00098
00099 class Geometry;
00100 class BinaryDataHandler;
00101
00103
00104 class OSG_SYSTEMLIB_DLLMAPPING GeometryBase : public MaterialDrawable
00105 {
00106 private:
00107
00108 typedef MaterialDrawable Inherited;
00109
00110
00111 public:
00112
00113 typedef GeometryPtr Ptr;
00114
00115 enum
00116 {
00117 TypesFieldId = Inherited::NextFieldId,
00118 LengthsFieldId = TypesFieldId + 1,
00119 PositionsFieldId = LengthsFieldId + 1,
00120 NormalsFieldId = PositionsFieldId + 1,
00121 ColorsFieldId = NormalsFieldId + 1,
00122 SecondaryColorsFieldId = ColorsFieldId + 1,
00123 TexCoordsFieldId = SecondaryColorsFieldId + 1,
00124 TexCoords1FieldId = TexCoordsFieldId + 1,
00125 TexCoords2FieldId = TexCoords1FieldId + 1,
00126 TexCoords3FieldId = TexCoords2FieldId + 1,
00127 TexCoords4FieldId = TexCoords3FieldId + 1,
00128 TexCoords5FieldId = TexCoords4FieldId + 1,
00129 TexCoords6FieldId = TexCoords5FieldId + 1,
00130 TexCoords7FieldId = TexCoords6FieldId + 1,
00131 IndicesFieldId = TexCoords7FieldId + 1,
00132 IndexMappingFieldId = IndicesFieldId + 1,
00133 DlistCacheFieldId = IndexMappingFieldId + 1,
00134 GLIdFieldId = DlistCacheFieldId + 1,
00135 IgnoreGLForAspectFieldId = GLIdFieldId + 1,
00136 MinindexFieldId = IgnoreGLForAspectFieldId + 1,
00137 MaxindexFieldId = MinindexFieldId + 1,
00138 LowindicesFieldId = MaxindexFieldId + 1,
00139 HighindicesFieldId = LowindicesFieldId + 1,
00140 VboFieldId = HighindicesFieldId + 1,
00141 NextFieldId = VboFieldId + 1
00142 };
00143
00144 static const OSG::BitVector TypesFieldMask;
00145 static const OSG::BitVector LengthsFieldMask;
00146 static const OSG::BitVector PositionsFieldMask;
00147 static const OSG::BitVector NormalsFieldMask;
00148 static const OSG::BitVector ColorsFieldMask;
00149 static const OSG::BitVector SecondaryColorsFieldMask;
00150 static const OSG::BitVector TexCoordsFieldMask;
00151 static const OSG::BitVector TexCoords1FieldMask;
00152 static const OSG::BitVector TexCoords2FieldMask;
00153 static const OSG::BitVector TexCoords3FieldMask;
00154 static const OSG::BitVector TexCoords4FieldMask;
00155 static const OSG::BitVector TexCoords5FieldMask;
00156 static const OSG::BitVector TexCoords6FieldMask;
00157 static const OSG::BitVector TexCoords7FieldMask;
00158 static const OSG::BitVector IndicesFieldMask;
00159 static const OSG::BitVector IndexMappingFieldMask;
00160 static const OSG::BitVector DlistCacheFieldMask;
00161 static const OSG::BitVector GLIdFieldMask;
00162 static const OSG::BitVector IgnoreGLForAspectFieldMask;
00163 static const OSG::BitVector MinindexFieldMask;
00164 static const OSG::BitVector MaxindexFieldMask;
00165 static const OSG::BitVector LowindicesFieldMask;
00166 static const OSG::BitVector HighindicesFieldMask;
00167 static const OSG::BitVector VboFieldMask;
00168
00169
00170 static const OSG::BitVector MTInfluenceMask;
00171
00172
00176 static FieldContainerType &getClassType (void);
00177 static UInt32 getClassTypeId (void);
00178
00180
00184 virtual FieldContainerType &getType (void);
00185 virtual const FieldContainerType &getType (void) const;
00186
00187 virtual UInt32 getContainerSize(void) const;
00188
00190
00194 SFGeoPTypesPtr *getSFTypes (void);
00195 SFGeoPLengthsPtr *getSFLengths (void);
00196 SFGeoPositionsPtr *getSFPositions (void);
00197 SFGeoNormalsPtr *getSFNormals (void);
00198 SFGeoColorsPtr *getSFColors (void);
00199 SFGeoColorsPtr *getSFSecondaryColors(void);
00200 SFGeoTexCoordsPtr *getSFTexCoords (void);
00201 SFGeoTexCoordsPtr *getSFTexCoords1 (void);
00202 SFGeoTexCoordsPtr *getSFTexCoords2 (void);
00203 SFGeoTexCoordsPtr *getSFTexCoords3 (void);
00204 SFGeoTexCoordsPtr *getSFTexCoords4 (void);
00205 SFGeoTexCoordsPtr *getSFTexCoords5 (void);
00206 SFGeoTexCoordsPtr *getSFTexCoords6 (void);
00207 SFGeoTexCoordsPtr *getSFTexCoords7 (void);
00208 SFGeoIndicesPtr *getSFIndices (void);
00209 MFUInt16 *getMFIndexMapping (void);
00210 SFBool *getSFDlistCache (void);
00211 SFInt32 *getSFIgnoreGLForAspect(void);
00212 SFUInt32 *getSFMinindex (void);
00213 SFUInt32 *getSFMaxindex (void);
00214 MFUInt32 *getMFLowindices (void);
00215 MFUInt32 *getMFHighindices (void);
00216 SFBool *getSFVbo (void);
00217
00218 GeoPTypesPtr &getTypes (void);
00219 const GeoPTypesPtr &getTypes (void) const;
00220 GeoPLengthsPtr &getLengths (void);
00221 const GeoPLengthsPtr &getLengths (void) const;
00222 GeoPositionsPtr &getPositions (void);
00223 const GeoPositionsPtr &getPositions (void) const;
00224 GeoNormalsPtr &getNormals (void);
00225 const GeoNormalsPtr &getNormals (void) const;
00226 GeoColorsPtr &getColors (void);
00227 const GeoColorsPtr &getColors (void) const;
00228 GeoColorsPtr &getSecondaryColors(void);
00229 const GeoColorsPtr &getSecondaryColors(void) const;
00230 GeoTexCoordsPtr &getTexCoords (void);
00231 const GeoTexCoordsPtr &getTexCoords (void) const;
00232 GeoTexCoordsPtr &getTexCoords1 (void);
00233 const GeoTexCoordsPtr &getTexCoords1 (void) const;
00234 GeoTexCoordsPtr &getTexCoords2 (void);
00235 const GeoTexCoordsPtr &getTexCoords2 (void) const;
00236 GeoTexCoordsPtr &getTexCoords3 (void);
00237 const GeoTexCoordsPtr &getTexCoords3 (void) const;
00238 GeoTexCoordsPtr &getTexCoords4 (void);
00239 const GeoTexCoordsPtr &getTexCoords4 (void) const;
00240 GeoTexCoordsPtr &getTexCoords5 (void);
00241 const GeoTexCoordsPtr &getTexCoords5 (void) const;
00242 GeoTexCoordsPtr &getTexCoords6 (void);
00243 const GeoTexCoordsPtr &getTexCoords6 (void) const;
00244 GeoTexCoordsPtr &getTexCoords7 (void);
00245 const GeoTexCoordsPtr &getTexCoords7 (void) const;
00246 GeoIndicesPtr &getIndices (void);
00247 const GeoIndicesPtr &getIndices (void) const;
00248 bool &getDlistCache (void);
00249 const bool &getDlistCache (void) const;
00250 Int32 &getIgnoreGLForAspect(void);
00251 const Int32 &getIgnoreGLForAspect(void) const;
00252 UInt32 &getMinindex (void);
00253 const UInt32 &getMinindex (void) const;
00254 UInt32 &getMaxindex (void);
00255 const UInt32 &getMaxindex (void) const;
00256 bool &getVbo (void);
00257 const bool &getVbo (void) const;
00258 UInt16 &getIndexMapping (const UInt32 index);
00259 MFUInt16 &getIndexMapping (void);
00260 const MFUInt16 &getIndexMapping (void) const;
00261 UInt32 &getLowindices (const UInt32 index);
00262 MFUInt32 &getLowindices (void);
00263 const MFUInt32 &getLowindices (void) const;
00264 UInt32 &getHighindices (const UInt32 index);
00265 MFUInt32 &getHighindices (void);
00266 const MFUInt32 &getHighindices (void) const;
00267
00269
00273 void setTypes ( const GeoPTypesPtr &value );
00274 void setLengths ( const GeoPLengthsPtr &value );
00275 void setPositions ( const GeoPositionsPtr &value );
00276 void setNormals ( const GeoNormalsPtr &value );
00277 void setColors ( const GeoColorsPtr &value );
00278 void setSecondaryColors( const GeoColorsPtr &value );
00279 void setTexCoords ( const GeoTexCoordsPtr &value );
00280 void setTexCoords1 ( const GeoTexCoordsPtr &value );
00281 void setTexCoords2 ( const GeoTexCoordsPtr &value );
00282 void setTexCoords3 ( const GeoTexCoordsPtr &value );
00283 void setTexCoords4 ( const GeoTexCoordsPtr &value );
00284 void setTexCoords5 ( const GeoTexCoordsPtr &value );
00285 void setTexCoords6 ( const GeoTexCoordsPtr &value );
00286 void setTexCoords7 ( const GeoTexCoordsPtr &value );
00287 void setIndices ( const GeoIndicesPtr &value );
00288 void setDlistCache ( const bool &value );
00289 void setIgnoreGLForAspect( const Int32 &value );
00290 void setMinindex ( const UInt32 &value );
00291 void setMaxindex ( const UInt32 &value );
00292 void setVbo ( const bool &value );
00293
00295
00300
00304 virtual UInt32 getBinSize (const BitVector &whichField);
00305 virtual void copyToBin ( BinaryDataHandler &pMem,
00306 const BitVector &whichField);
00307 virtual void copyFromBin( BinaryDataHandler &pMem,
00308 const BitVector &whichField);
00309
00310
00312
00316 static GeometryPtr create (void);
00317 static GeometryPtr createEmpty (void);
00318
00321
00325 virtual FieldContainerPtr shallowCopy (void) const;
00326
00328
00329 protected:
00330
00331
00335 SFGeoPTypesPtr _sfTypes;
00336 SFGeoPLengthsPtr _sfLengths;
00337 SFGeoPositionsPtr _sfPositions;
00338 SFGeoNormalsPtr _sfNormals;
00339 SFGeoColorsPtr _sfColors;
00340 SFGeoColorsPtr _sfSecondaryColors;
00341 SFGeoTexCoordsPtr _sfTexCoords;
00342 SFGeoTexCoordsPtr _sfTexCoords1;
00343 SFGeoTexCoordsPtr _sfTexCoords2;
00344 SFGeoTexCoordsPtr _sfTexCoords3;
00345 SFGeoTexCoordsPtr _sfTexCoords4;
00346 SFGeoTexCoordsPtr _sfTexCoords5;
00347 SFGeoTexCoordsPtr _sfTexCoords6;
00348 SFGeoTexCoordsPtr _sfTexCoords7;
00349 SFGeoIndicesPtr _sfIndices;
00350 MFUInt16 _mfIndexMapping;
00351 SFBool _sfDlistCache;
00352 SFInt32 _sfGLId;
00353 SFInt32 _sfIgnoreGLForAspect;
00354 SFUInt32 _sfMinindex;
00355 SFUInt32 _sfMaxindex;
00356 MFUInt32 _mfLowindices;
00357 MFUInt32 _mfHighindices;
00358 SFBool _sfVbo;
00359
00361
00365 GeometryBase(void);
00366 GeometryBase(const GeometryBase &source);
00367
00369
00373 virtual ~GeometryBase(void);
00374
00376
00380 SFInt32 *getSFGLId (void);
00381
00382 Int32 &getGLId (void);
00383 const Int32 &getGLId (void) const;
00384
00386
00390 void setGLId (const Int32 &value);
00391
00393
00397 #if !defined(OSG_FIXED_MFIELDSYNC)
00398 void executeSyncImpl( GeometryBase *pOther,
00399 const BitVector &whichField);
00400
00401 virtual void executeSync( FieldContainer &other,
00402 const BitVector &whichField);
00403 #else
00404 void executeSyncImpl( GeometryBase *pOther,
00405 const BitVector &whichField,
00406 const SyncInfo &sInfo );
00407
00408 virtual void executeSync( FieldContainer &other,
00409 const BitVector &whichField,
00410 const SyncInfo &sInfo);
00411
00412 virtual void execBeginEdit (const BitVector &whichField,
00413 UInt32 uiAspect,
00414 UInt32 uiContainerSize);
00415
00416 void execBeginEditImpl (const BitVector &whichField,
00417 UInt32 uiAspect,
00418 UInt32 uiContainerSize);
00419
00420 virtual void onDestroyAspect(UInt32 uiId, UInt32 uiAspect);
00421 #endif
00422
00424
00425 private:
00426
00427 friend class FieldContainer;
00428
00429 static FieldDescription *_desc[];
00430 static FieldContainerType _type;
00431
00432
00433
00434 void operator =(const GeometryBase &source);
00435 };
00436
00437
00438
00439
00440
00441
00442 typedef GeometryBase *GeometryBaseP;
00443
00444 typedef osgIF<GeometryBase::isNodeCore,
00445 CoredNodePtr<Geometry>,
00446 FieldContainer::attempt_to_create_CoredNodePtr_on_non_NodeCore_FC
00447 >::_IRet GeometryNodePtr;
00448
00449 typedef RefPtr<GeometryPtr> GeometryRefPtr;
00450
00451 OSG_END_NAMESPACE
00452
00453 #define OSGGEOMETRYBASE_HEADER_CVSID "@(#)$Id: FCBaseTemplate_h.h,v 1.40 2005/07/20 00:10:14 vossg Exp $"
00454
00455 #endif