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 _OSGGEOPUMPFACTORY_H_
00040 #define _OSGGEOPUMPFACTORY_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044
00045 #include <utility>
00046 #include <OSGBaseTypes.h>
00047 #include <OSGBaseFunctions.h>
00048 #include <OSGGeometry.h>
00049
00050 OSG_BEGIN_NAMESPACE
00051
00052 class Window;
00053
00054 #ifdef OSG_SUPPORT_NO_GEO_INTERFACE
00055 class GeoPositionsInterface;
00056 class GeoNormalsInterface;
00057 class GeoColorsInterface;
00058 class GeoTexCoordsInterface;
00059 class GeoPTypesInterface;
00060 class GeoPLengthsInterface;
00061 class GeoIndicesInterface;
00062 #endif
00063
00067 class OSG_SYSTEMLIB_DLLMAPPING GeoPumpFactory
00068 {
00069
00070 public:
00071
00072 typedef UInt32 Index;
00073
00074
00078 typedef void (*GeoPump)( Window *win, Geometry * geo );
00079
00080 typedef void (*PartialGeoPump)( Window *win, Geometry * geo,
00081 UInt32 primtype, UInt32 firstvert, UInt32 nvert );
00082
00083 typedef void (*InterfacePump)( Window *win,
00084 GeoPositionsInterface *pos, GeoNormalsInterface *norm,
00085 GeoColorsInterface *col, GeoColorsInterface *seccol,
00086 GeoTexCoordsInterface *texcoords,
00087 GeoTexCoordsInterface *texcoords1,
00088 GeoTexCoordsInterface *texcoords2,
00089 GeoTexCoordsInterface *texcoords3,
00090 GeoPTypesInterface *type, GeoPLengthsInterface *len,
00091 GeoIndicesInterface *ind, UInt16 *map, UInt16 nmap );
00092
00093 typedef void (*PartialInterfacePump)( Window *win,
00094 GeoPositionsInterface *pos, GeoNormalsInterface *norm,
00095 GeoColorsInterface *col, GeoColorsInterface *seccol,
00096 GeoTexCoordsInterface *texcoords,
00097 GeoTexCoordsInterface *texcoords1,
00098 GeoTexCoordsInterface *texcoords2,
00099 GeoTexCoordsInterface *texcoords3,
00100 GeoPTypesInterface *type, GeoPLengthsInterface *len,
00101 GeoIndicesInterface *ind, UInt16 *map, UInt16 nmap,
00102 UInt32 primtype, UInt32 firstvert, UInt32 nvert );
00103
00105
00109 static const char *getClassname(void) { return "GeoPumpFactory"; }
00110
00112
00116 virtual ~GeoPumpFactory(void);
00117
00119
00123 Index getIndex (Geometry * geo );
00124
00125 GeoPump getGeoPump (Window *win, Index index);
00126
00127 PartialGeoPump getPartialGeoPump (Window *win, Index index);
00128
00129 InterfacePump getInterfacePump (Window *win, Index index);
00130
00131 PartialInterfacePump getPartialInterfacePump (Window *win, Index index);
00132
00133
00135
00139 static GeoPumpFactory *the( void );
00140
00142
00146 static UInt32 _extSecondaryColor;
00147 static UInt32 _extMultitexture;
00148 static UInt32 _extCompiledVertexArray;
00149 static UInt32 _extDrawRangeElements;
00150 static UInt32 _arbVBO;
00151
00152 static UInt32 _funcglSecondaryColorPointer;
00153 static UInt32 _funcglClientActiveTextureARB;
00154 static UInt32 _funcglLockArraysEXT;
00155 static UInt32 _funcglUnlockArraysEXT;
00156 static UInt32 _funcglDrawRangeElementsEXT;
00157
00158 static UInt32 _funcglGenBuffersARB;
00159 static UInt32 _funcglDeleteBuffersARB;
00160 static UInt32 _funcglBindBufferARB;
00161 static UInt32 _funcglBufferDataARB;
00162 static UInt32 _funcglBufferSubDataARB;
00163
00164 static UInt32 _funcglGenBuffers;
00165 static UInt32 _funcglDeleteBuffers;
00166 static UInt32 _funcglBindBuffer;
00167 static UInt32 _funcglBufferData;
00168 static UInt32 _funcglBufferSubData;
00169
00171
00172 protected:
00173
00174 virtual Index numIndices(void);
00175
00176
00180 GeoPumpFactory(void);
00181
00183
00184 private:
00185
00186 static char cvsid[];
00187
00188 static GeoPumpFactory *_the;
00189 static GeoPump GeoPumps[131];
00190
00191
00195 static bool glextInitFunction(void);
00196 static InitFuncWrapper _glextInitFuncWrapper;
00197
00199
00203 static void masterGeoPump(Window *win, Geometry *geo);
00204
00205 static void masterPartialGeoPump(Window *win, Geometry *geo,
00206 UInt32 primtype, UInt32 firstvert, UInt32 nvert);
00207
00208 static void masterInterfacePump(Window *win,
00209 GeoPositionsInterface *pos, GeoNormalsInterface *norm,
00210 GeoColorsInterface *col, GeoColorsInterface *seccol,
00211 GeoTexCoordsInterface *texcoords,
00212 GeoTexCoordsInterface *texcoords2,
00213 GeoTexCoordsInterface *texcoords3,
00214 GeoTexCoordsInterface *texcoords4,
00215 GeoPTypesInterface *type, GeoPLengthsInterface*len,
00216 GeoIndicesInterface *ind, UInt16 *map, UInt16 nmap);
00217
00218 static void masterPartialInterfacePump(Window *win,
00219 GeoPositionsInterface *pos, GeoNormalsInterface *norm,
00220 GeoColorsInterface *col, GeoColorsInterface *seccol,
00221 GeoTexCoordsInterface *texcoords,
00222 GeoTexCoordsInterface *texcoords2,
00223 GeoTexCoordsInterface *texcoords3,
00224 GeoTexCoordsInterface *texcoords4,
00225 GeoPTypesInterface *type, GeoPLengthsInterface*len,
00226 GeoIndicesInterface *ind, UInt16 *map, UInt16 nmap,
00227 UInt32 primtype, UInt32 firstvert, UInt32 nvert);
00228
00230
00234 GeoPumpFactory(const GeoPumpFactory &source);
00235
00238 void operator =(const GeoPumpFactory &source);
00239
00240 };
00241
00242 class OSG_SYSTEMLIB_DLLMAPPING GeoVBO
00243 {
00244 public:
00245
00246 GeoVBO(Window *win, Geometry *geo);
00247 ~GeoVBO();
00248
00249 void update(void);
00250 void draw(void);
00251
00252 private:
00253
00254 GLuint _positions;
00255 GLuint _normals;
00256 GLuint _colors;
00257 GLuint _secColors;
00258 GLuint _texCoords;
00259 GLuint _texCoords1;
00260 GLuint _texCoords2;
00261 GLuint _texCoords3;
00262 GLuint _texCoords4;
00263 GLuint _texCoords5;
00264 GLuint _texCoords6;
00265 GLuint _texCoords7;
00266 GLuint _indices;
00267
00268 Window *_win;
00269 Geometry *_geo;
00270 };
00271
00272 OSG_END_NAMESPACE
00273
00274 #include "OSGGeoPumpFactory.inl"
00275
00276 #define OSGGEOPUMPFACTORY_HEADER_CVSID "@(#)$Id: $"
00277
00278 #endif