OSGGeometry.h
Go to the documentation of this file.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 #ifndef _OSGGEOMETRY_H_
00040 #define _OSGGEOMETRY_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044
00045 #include <string>
00046
00047 #include "OSGGeometryBase.h"
00048
00049 #include "OSGTypedGeoVectorProperty.h"
00050 #include "OSGGeoIntegralProperty.h"
00051 #include "OSGGeoPumpGroup.h"
00052 #include "OSGWindow.h"
00053
00054 OSG_BEGIN_NAMESPACE
00055
00056 class GeoPumpGroup;
00057
00058 class TriangleIterator;
00059 class PrimitiveIterator;
00060 class FaceIterator;
00061 class LineIterator;
00062 class EdgeIterator;
00063
00064 class DrawEnv;
00065
00070 class OSG_DRAWABLE_DLLMAPPING Geometry : public GeometryBase
00071 {
00072 private:
00073
00074
00075
00076 public:
00077
00078 typedef GeometryBase Inherited;
00079
00080
00084
00085 static const UInt16 MaxAttribs = 16;
00086
00088
00095 static const UInt16 PositionsIndex = 0;
00096 static const UInt16 NormalsIndex = 2;
00097 static const UInt16 ColorsIndex = 3;
00098 static const UInt16 SecondaryColorsIndex = 4;
00099 static const UInt16 TexCoordsIndex = 8;
00100 static const UInt16 TexCoords1Index = 9;
00101 static const UInt16 TexCoords2Index = 10;
00102 static const UInt16 TexCoords3Index = 11;
00103 static const UInt16 TexCoords4Index = 12;
00104 static const UInt16 TexCoords5Index = 13;
00105 static const UInt16 TexCoords6Index = 14;
00106 static const UInt16 TexCoords7Index = 15;
00107
00108 static const UInt16 LastIndex = 15;
00109
00111
00115 inline GeoIntegralPropertyPtr getTypes (void) const;
00116 inline GeoIntegralPropertyPtr getLengths (void) const;
00117 inline GeoVectorPropertyPtr getPositions (void) const;
00118 inline GeoVectorPropertyPtr getNormals (void) const;
00119 inline GeoVectorPropertyPtr getColors (void) const;
00120 inline GeoVectorPropertyPtr getSecondaryColors(void) const;
00121 inline GeoVectorPropertyPtr getTexCoords (void) const;
00122 inline GeoVectorPropertyPtr getTexCoords1 (void) const;
00123 inline GeoVectorPropertyPtr getTexCoords2 (void) const;
00124 inline GeoVectorPropertyPtr getTexCoords3 (void) const;
00125 inline GeoVectorPropertyPtr getTexCoords4 (void) const;
00126 inline GeoVectorPropertyPtr getTexCoords5 (void) const;
00127 inline GeoVectorPropertyPtr getTexCoords6 (void) const;
00128 inline GeoVectorPropertyPtr getTexCoords7 (void) const;
00129
00130
00131 inline void setPositions (GeoVectorPropertyPtrConstArg value);
00132 inline void setNormals (GeoVectorPropertyPtrConstArg value);
00133 inline void setColors (GeoVectorPropertyPtrConstArg value);
00134 inline void setSecondaryColors(GeoVectorPropertyPtrConstArg value);
00135 inline void setTexCoords (GeoVectorPropertyPtrConstArg value);
00136 inline void setTexCoords1 (GeoVectorPropertyPtrConstArg value);
00137 inline void setTexCoords2 (GeoVectorPropertyPtrConstArg value);
00138 inline void setTexCoords3 (GeoVectorPropertyPtrConstArg value);
00139 inline void setTexCoords4 (GeoVectorPropertyPtrConstArg value);
00140 inline void setTexCoords5 (GeoVectorPropertyPtrConstArg value);
00141 inline void setTexCoords6 (GeoVectorPropertyPtrConstArg value);
00142 inline void setTexCoords7 (GeoVectorPropertyPtrConstArg value);
00143
00144 void setMaterial (const MaterialPtr &value);
00145
00146
00147 inline void setProperty (GeoVectorPropertyPtrConstArg value, UInt16 index);
00148
00149 inline void setIndex (GeoIntegralPropertyPtrConstArg value,
00150 UInt16 index);
00151
00152 inline GeoVectorPropertyPtr getProperty(UInt16 index) const;
00153
00154 inline GeoIntegralPropertyPtr getIndex(UInt16 index) const;
00155
00156 static const char *mapType (UInt8 type);
00157
00159
00163 inline void resizeProperties(size_t newsize);
00164 inline void reserveProperties(size_t newsize);
00165
00166 inline void resizePropIndices(size_t newsize);
00167 inline void reservePropIndices(size_t newsize);
00168
00169
00171
00175 inline void setIndices(GeoIntegralPropertyPtrConstArg value);
00176
00177 inline GeoIntegralPropertyPtr getIndices(void);
00178
00180
00184 UInt32 indexOccurrence(GeoIntegralPropertyPtrConstArg value);
00185 bool isSingleIndex (void );
00186
00188
00192 TriangleIterator beginTriangles (void) const;
00193 TriangleIterator endTriangles (void) const;
00194
00195 PrimitiveIterator beginPrimitives (void) const;
00196 PrimitiveIterator endPrimitives (void) const;
00197
00198 FaceIterator beginFaces (void) const;
00199 FaceIterator endFaces (void) const;
00200
00201 LineIterator beginLines (void) const;
00202 LineIterator endLines (void) const;
00203
00204 EdgeIterator beginEdges (void) const;
00205 EdgeIterator endEdges (void) const;
00206
00208
00212 virtual Action::ResultE drawPrimitives (DrawEnv *pEnv );
00213
00214 Action::ResultE intersect (Action *action);
00215
00216 void invalidateDlistCache(void);
00217
00219
00223 void adjustVolume (Volume & volume);
00224
00226
00230 virtual void changed(ConstFieldMaskArg whichField,
00231 UInt32 origin,
00232 BitVector detail);
00233
00235
00239 virtual void dump( UInt32 uiIndent = 0,
00240 const BitVector bvFlags = 0) const;
00241
00243
00247 typedef std::vector<std::pair<GeoIntegralPropertyPtr,
00248 std::vector<UInt16> > > IndexBag;
00249
00250 IndexBag getUniqueIndexBag(void);
00251
00253
00257
00258
00259
00261
00266 typedef std::vector<GeoPumpGroup*> PumpGroupStorage;
00267
00268 static PumpGroupStorage &getPumpGroupStorage(void);
00269
00271
00272 protected:
00273
00274
00275
00276
00280 Geometry(void);
00281 Geometry(const Geometry &source);
00282
00284
00288 virtual ~Geometry(void);
00289
00291
00295 void handleClassicGL(DrawEnv *pEnv, UInt32 id, Window::GLObjectStatusE mode);
00296 static void handleClassicDestroyGL(DrawEnv *pEnv, UInt32 id, Window::GLObjectStatusE mode);
00297 void handleAttGL(DrawEnv *pEnv, UInt32 id, Window::GLObjectStatusE mode);
00298 static void handleAttDestroyGL(DrawEnv *pEnv, UInt32 id, Window::GLObjectStatusE mode);
00299
00300 void onCreate(const Geometry *source = NULL);
00301 void onDestroy(UInt32 id);
00302
00304
00308 static void initMethod(InitPhase ePhase);
00309
00311
00312
00313 private:
00314
00315 friend class FieldContainer;
00316 friend class GeometryBase;
00317
00318 static PumpGroupStorage _pumps;
00319
00320
00321 void operator =(const Geometry &source);
00322 };
00323
00324 typedef Geometry *GeometryP;
00325
00326 OSG_END_NAMESPACE
00327
00328 #include "OSGGeometryBase.inl"
00329 #include "OSGGeometry.inl"
00330
00331 #endif