osg::GeoPumpFactory Class Reference

Selects a pump function for drawing the given geometry.

#include <OSGGeoPumpFactory.h>

List of all members.

Public Types

typedef UInt32 Index
Pump Types



typedef void(* GeoPump )(Window *win, Geometry *geo)
typedef void(* PartialGeoPump )(Window *win, Geometry *geo, UInt32 primtype, UInt32 firstvert, UInt32 nvert)
typedef void(* InterfacePump )(Window *win, GeoPositionsInterface *pos, GeoNormalsInterface *norm, GeoColorsInterface *col, GeoColorsInterface *seccol, GeoTexCoordsInterface *texcoords, GeoTexCoordsInterface *texcoords1, GeoTexCoordsInterface *texcoords2, GeoTexCoordsInterface *texcoords3, GeoPTypesInterface *type, GeoPLengthsInterface *len, GeoIndicesInterface *ind, UInt16 *map, UInt16 nmap)
typedef void(* PartialInterfacePump )(Window *win, GeoPositionsInterface *pos, GeoNormalsInterface *norm, GeoColorsInterface *col, GeoColorsInterface *seccol, GeoTexCoordsInterface *texcoords, GeoTexCoordsInterface *texcoords1, GeoTexCoordsInterface *texcoords2, GeoTexCoordsInterface *texcoords3, GeoPTypesInterface *type, GeoPLengthsInterface *len, GeoIndicesInterface *ind, UInt16 *map, UInt16 nmap, UInt32 primtype, UInt32 firstvert, UInt32 nvert)

Public Member Functions

Destructors



virtual ~GeoPumpFactory (void)
Get



Index getIndex (Geometry *geo)
GeoPump getGeoPump (Window *win, Index index)
PartialGeoPump getPartialGeoPump (Window *win, Index index)
InterfacePump getInterfacePump (Window *win, Index index)
PartialInterfacePump getPartialInterfacePump (Window *win, Index index)

Static Public Member Functions

Class Get



static const char * getClassname (void)
Access



static GeoPumpFactorythe (void)

Protected Member Functions

virtual Index numIndices (void)

Private Member Functions

void operator= (const GeoPumpFactory &source)

Static Private Member Functions

The Pumps



static void masterGeoPump (Window *win, Geometry *geo)
static void masterPartialGeoPump (Window *win, Geometry *geo, UInt32 primtype, UInt32 firstvert, UInt32 nvert)
static void masterInterfacePump (Window *win, GeoPositionsInterface *pos, GeoNormalsInterface *norm, GeoColorsInterface *col, GeoColorsInterface *seccol, GeoTexCoordsInterface *texcoords, GeoTexCoordsInterface *texcoords2, GeoTexCoordsInterface *texcoords3, GeoTexCoordsInterface *texcoords4, GeoPTypesInterface *type, GeoPLengthsInterface *len, GeoIndicesInterface *ind, UInt16 *map, UInt16 nmap)
static void masterPartialInterfacePump (Window *win, GeoPositionsInterface *pos, GeoNormalsInterface *norm, GeoColorsInterface *col, GeoColorsInterface *seccol, GeoTexCoordsInterface *texcoords, GeoTexCoordsInterface *texcoords2, GeoTexCoordsInterface *texcoords3, GeoTexCoordsInterface *texcoords4, GeoPTypesInterface *type, GeoPLengthsInterface *len, GeoIndicesInterface *ind, UInt16 *map, UInt16 nmap, UInt32 primtype, UInt32 firstvert, UInt32 nvert)

Static Private Attributes

static char cvsid []
static GeoPumpFactory_the = NULL
static GeoPump GeoPumps [131]

OpenGL Extension handling



static UInt32 _extSecondaryColor
static UInt32 _extMultitexture
static UInt32 _extCompiledVertexArray
static UInt32 _extDrawRangeElements
static UInt32 _arbVBO
static UInt32 _funcglSecondaryColorPointer
static UInt32 _funcglClientActiveTextureARB
static UInt32 _funcglLockArraysEXT
static UInt32 _funcglUnlockArraysEXT
static UInt32 _funcglDrawRangeElementsEXT
static UInt32 _funcglGenBuffersARB
static UInt32 _funcglDeleteBuffersARB
static UInt32 _funcglBindBufferARB
static UInt32 _funcglBufferDataARB
static UInt32 _funcglBufferSubDataARB
static UInt32 _funcglGenBuffers
static UInt32 _funcglDeleteBuffers
static UInt32 _funcglBindBuffer
static UInt32 _funcglBufferData
static UInt32 _funcglBufferSubData
static InitFuncWrapper _glextInitFuncWrapper
static bool glextInitFunction (void)

Constructors



 GeoPumpFactory (void)
 GeoPumpFactory (const GeoPumpFactory &source)

Detailed Description

Definition at line 67 of file OSGGeoPumpFactory.h.


Member Typedef Documentation

Definition at line 72 of file OSGGeoPumpFactory.h.

typedef void(* osg::GeoPumpFactory::GeoPump)(Window *win, Geometry *geo)

Definition at line 78 of file OSGGeoPumpFactory.h.

typedef void(* osg::GeoPumpFactory::PartialGeoPump)(Window *win, Geometry *geo, UInt32 primtype, UInt32 firstvert, UInt32 nvert)

Definition at line 80 of file OSGGeoPumpFactory.h.

Definition at line 83 of file OSGGeoPumpFactory.h.

Definition at line 93 of file OSGGeoPumpFactory.h.


Constructor & Destructor Documentation

GeoPumpFactory::~GeoPumpFactory ( void   )  [virtual]

Definition at line 140 of file OSGGeoPumpFactory.cpp.

00141 {
00142 }

GeoPumpFactory::GeoPumpFactory ( void   )  [protected]

Definition at line 136 of file OSGGeoPumpFactory.cpp.

Referenced by the().

00137 {
00138 }

osg::GeoPumpFactory::GeoPumpFactory ( const GeoPumpFactory source  )  [private]

Member Function Documentation

static const char* osg::GeoPumpFactory::getClassname ( void   )  [inline, static]

Definition at line 109 of file OSGGeoPumpFactory.h.

00109 { return "GeoPumpFactory"; }

GeoPumpFactory::Index GeoPumpFactory::getIndex ( Geometry geo  ) 

Access the index of the given Geometry. Needed to access the Pump.

Dev: The index is organised as follows:

  • there are 2^7-1+3 different functions
  • the first (0) is for invalid (empty) geometry
  • the next 127 define all multi-indexed functions
  • the last 2 define non-indexed and single-indexed geometries

Definition at line 155 of file OSGGeoPumpFactory.cpp.

References osg::GeometryBase::getColors(), osg::GeometryBase::getIndexMapping(), osg::GeometryBase::getIndices(), osg::GeometryBase::getLengths(), osg::GeometryBase::getMFIndexMapping(), osg::GeometryBase::getNormals(), osg::GeometryBase::getPositions(), osg::GeometryBase::getSecondaryColors(), osg::GeometryBase::getTexCoords(), osg::GeometryBase::getTexCoords1(), osg::GeometryBase::getTexCoords2(), osg::GeometryBase::getTexCoords3(), osg::GeometryBase::getTexCoords4(), osg::GeometryBase::getTexCoords5(), osg::GeometryBase::getTexCoords6(), osg::GeometryBase::getTexCoords7(), osg::GeometryBase::getTypes(), osg::Geometry::MapColor, osg::Geometry::MapNormal, osg::Geometry::MapSecondaryColor, osg::Geometry::MapTexCoords, osg::Geometry::MapTexCoords1, osg::Geometry::MapTexCoords2, osg::Geometry::MapTexCoords3, osg::Geometry::MapTexCoords4, osg::Geometry::MapTexCoords5, osg::Geometry::MapTexCoords6, osg::Geometry::MapTexCoords7, osg::NullFC, and osg::MField< FieldTypeT, fieldNameSpace >::size().

Referenced by osg::Geometry::drawPrimitives(), and osg::Geometry::handleGL().

00156 {
00157     if (geo->getPositions() == NullFC ||
00158        !geo->getPositions()->editData() ) return 0; //INVALID
00159 
00160     if (geo->getTypes() == NullFC || !geo->getTypes()->editData() ||
00161         geo->getTypes()->getSize() == 0) return 0; //INVALID
00162 
00163     if (geo->getIndices() == NullFC) return 128; //NON_INDEXED
00164     if (geo->getMFIndexMapping()->size() < 2) return 129; //SINGLE_INDEXED
00165 
00166     if ((geo->getIndices() != NullFC && 
00167          geo->getIndices()->getFormatSize() != 4) ||
00168         (geo->getLengths() != NullFC && 
00169          geo->getLengths()->getFormatSize() != 4)
00170         )
00171         return 130; // Needd to use the master pump
00172     
00173     UInt32 uiIndexMask = 0;
00174 
00175     for(UInt32 i = 0; i < geo->getMFIndexMapping()->size(); ++i)
00176     {
00177         uiIndexMask |= geo->getIndexMapping(i);
00178     }
00179 
00180     // ok the multi index table supports only 4 texcoord units!
00181     if((uiIndexMask & Geometry::MapTexCoords4 &&
00182        geo->getTexCoords4() != NullFC         &&
00183        geo->getTexCoords4()->editData()          ) ||
00184        (uiIndexMask & Geometry::MapTexCoords5 &&
00185        geo->getTexCoords5() != NullFC         &&
00186        geo->getTexCoords5()->editData()          ) ||
00187        (uiIndexMask & Geometry::MapTexCoords6 &&
00188        geo->getTexCoords6() != NullFC         &&
00189        geo->getTexCoords6()->editData()          ) ||
00190        (uiIndexMask & Geometry::MapTexCoords7 &&
00191        geo->getTexCoords7() != NullFC         &&
00192        geo->getTexCoords7()->editData()          ))
00193     {
00194         return 130; // Needd to use the master pump
00195     }
00196 
00197     int a[7];
00198 
00199     if(uiIndexMask & Geometry::MapColor &&
00200        geo->getColors() != NullFC       &&
00201        geo->getColors()->editData()        ) 
00202     {
00203         a[0]=1;
00204     } 
00205     else 
00206     {
00207         a[0] = 0;
00208     }
00209     
00210     if(uiIndexMask & Geometry::MapSecondaryColor &&
00211        geo->getSecondaryColors() != NullFC       &&
00212        geo->getSecondaryColors()->editData()       ) 
00213     {
00214         a[1]=1;
00215     }
00216     else 
00217     {
00218         a[1]=0;
00219     }
00220 
00221     if(uiIndexMask & Geometry::MapNormal &&
00222        geo->getNormals() != NullFC       &&
00223        geo->getNormals()->editData()        ) 
00224     {
00225         a[2]=1;
00226     }
00227     else
00228     {
00229         a[2]=0;
00230     }
00231 
00232     if(uiIndexMask & Geometry::MapTexCoords &&
00233        geo->getTexCoords() != NullFC        &&
00234        geo->getTexCoords()->editData()        ) 
00235     {
00236         a[3]=1; 
00237     }
00238     else
00239     {
00240         a[3]=0;
00241     }
00242 
00243     if(uiIndexMask & Geometry::MapTexCoords1 &&
00244        geo->getTexCoords1() != NullFC        &&
00245        geo->getTexCoords1()->editData()        ) 
00246     {
00247         a[4]=1; 
00248     }
00249     else
00250     {
00251         a[4]=0;
00252     }
00253 
00254     if(uiIndexMask & Geometry::MapTexCoords2 &&
00255        geo->getTexCoords2() != NullFC        &&
00256        geo->getTexCoords2()->editData()        ) 
00257     {
00258         a[5]=1;
00259     }
00260     else 
00261     {
00262         a[5]=0;
00263     }
00264 
00265     if(uiIndexMask & Geometry::MapTexCoords3 &&
00266        geo->getTexCoords3() != NullFC        &&
00267        geo->getTexCoords3()->editData()        ) 
00268     {
00269         a[6]=1;
00270     }
00271     else
00272     {
00273         a[6]=0;
00274     }
00275 
00276     int index=0;
00277 
00278     for (int i=0; i<7; i++)
00279         if (a[i]) index=index|(1<<i);
00280 
00281     /* if the geometry was detected as multi-indexed,but
00282        there was no index data, then index will be 0, which
00283        corresponds to invalid geometry.
00284      */
00285 
00286     return index;
00287 }

GeoPumpFactory::GeoPump GeoPumpFactory::getGeoPump ( Window win,
GeoPumpFactory::Index  index 
)

Get the full Geometry pump for the given index.

Definition at line 292 of file OSGGeoPumpFactory.cpp.

References GeoPumps.

Referenced by osg::Geometry::drawPrimitives(), and osg::Geometry::handleGL().

00295 {
00296     //FWARNING(("GeoPump%d used\n",index));
00297     return GeoPumps[index]; //crashed windows while testing, watch it.
00298     //return &masterGeoPump;
00299 }

GeoPumpFactory::PartialGeoPump GeoPumpFactory::getPartialGeoPump ( Window win,
GeoPumpFactory::Index  index 
)

Access the index of the given Geometry. Needed to access the Pump.

Dev: The index is organised as follows:

  • there are 2^7-1+3 different functions
  • the first (0) is for invalid (empty) geometry
  • the next 127 define all multi-indexed functions
  • the last 2 define non-indexed and single-indexed geometries

Definition at line 301 of file OSGGeoPumpFactory.cpp.

References FWARNING.

00304 {
00305     FWARNING(("GeoPumpFactory::getPartialGeoPump: not implemented yet!\n"));
00306     return NULL;
00307 }

GeoPumpFactory::InterfacePump GeoPumpFactory::getInterfacePump ( Window win,
GeoPumpFactory::Index  index 
)

Access the index of the given Geometry. Needed to access the Pump.

Dev: The index is organised as follows:

  • there are 2^7-1+3 different functions
  • the first (0) is for invalid (empty) geometry
  • the next 127 define all multi-indexed functions
  • the last 2 define non-indexed and single-indexed geometries

Definition at line 309 of file OSGGeoPumpFactory.cpp.

References FWARNING.

00312 {
00313     FWARNING(("GeoPumpFactory::getInterfacePump: not implemented yet!\n"));
00314     return NULL;
00315 }

GeoPumpFactory::PartialInterfacePump GeoPumpFactory::getPartialInterfacePump ( Window win,
GeoPumpFactory::Index  index 
)

Access the index of the given Geometry. Needed to access the Pump.

Dev: The index is organised as follows:

  • there are 2^7-1+3 different functions
  • the first (0) is for invalid (empty) geometry
  • the next 127 define all multi-indexed functions
  • the last 2 define non-indexed and single-indexed geometries

Definition at line 317 of file OSGGeoPumpFactory.cpp.

References FWARNING.

00320 {
00321     FWARNING(("GeoPumpFactory::getPartialInterfacePump: not "
00322                 "implemented yet!\n"));
00323     return NULL;
00324 }

GeoPumpFactory * osg::GeoPumpFactory::the ( void   )  [inline, static]

Access the GeoPumpFactory Singleton.

Definition at line 54 of file OSGGeoPumpFactory.inl.

References _the, and GeoPumpFactory().

Referenced by osg::Geometry::drawPrimitives(), and osg::Geometry::handleGL().

00055 {
00056     if(_the == NULL)
00057     {
00058         _the = new GeoPumpFactory();
00059     }
00060 
00061     return _the;
00062 }

GeoPumpFactory::Index GeoPumpFactory::numIndices ( void   )  [protected, virtual]

Definition at line 331 of file OSGGeoPumpFactory.cpp.

00332 {
00333     return 131;
00334 }

bool GeoPumpFactory::glextInitFunction ( void   )  [static, private]

Definition at line 2288 of file OSGGeoPumpFactory.cpp.

References _arbVBO, _extCompiledVertexArray, _extDrawRangeElements, _extMultitexture, _extSecondaryColor, _funcglBindBuffer, _funcglBindBufferARB, _funcglBufferData, _funcglBufferDataARB, _funcglBufferSubData, _funcglBufferSubDataARB, _funcglClientActiveTextureARB, _funcglDeleteBuffers, _funcglDeleteBuffersARB, _funcglDrawRangeElementsEXT, _funcglGenBuffers, _funcglGenBuffersARB, _funcglLockArraysEXT, _funcglSecondaryColorPointer, _funcglUnlockArraysEXT, osg::Window::invalidFunctionID, numFormats, OSG_DLSYM_UNDERSCORE, osg::Window::registerExtension(), and osg::Window::registerFunction().

02289 {
02290     _extSecondaryColor      = 
02291         Window::registerExtension("GL_EXT_secondary_color");
02292     _extMultitexture        = 
02293         Window::registerExtension("GL_ARB_multitexture");
02294     _extCompiledVertexArray = 
02295         Window::registerExtension("GL_EXT_compiled_vertex_array");
02296     _extDrawRangeElements   = 
02297         Window::registerExtension("GL_EXT_draw_range_elements");
02298     _arbVBO =
02299         Window::registerExtension("GL_ARB_vertex_buffer_object");
02300 
02301     UInt16 i,j;
02302     for(i = 0; i < numFormats; i++)
02303     {
02304         for(j = 0; j < 4; j++)
02305         {
02306             SecColorIDs  [i][j] = Window::invalidFunctionID;
02307             TexCoords1IDs[i][j] = Window::invalidFunctionID;
02308         }
02309     }
02310 
02311     for(i = 0; i < 8; i++)
02312         secondaryColorInitFuncs[i].init(SecColorIDs, _extSecondaryColor);
02313 
02314     for(i = 0; i < 16; i++)
02315         multiTexCoordsInitFuncs[i].init(TexCoords1IDs, _extMultitexture);
02316 
02317     _funcglSecondaryColorPointer  = Window::registerFunction(
02318                             OSG_DLSYM_UNDERSCORE"glSecondaryColorPointerEXT",
02319                             _extSecondaryColor);
02320     _funcglClientActiveTextureARB = Window::registerFunction(
02321                             OSG_DLSYM_UNDERSCORE"glClientActiveTextureARB",
02322                             _extMultitexture);
02323     _funcglLockArraysEXT          = Window::registerFunction(
02324                                 OSG_DLSYM_UNDERSCORE"glLockArraysEXT",
02325                                 _extCompiledVertexArray);
02326     _funcglUnlockArraysEXT        = Window::registerFunction(
02327                                 OSG_DLSYM_UNDERSCORE"glUnlockArraysEXT",
02328                                 _extCompiledVertexArray);
02329     _funcglDrawRangeElementsEXT   = Window::registerFunction(
02330                                 OSG_DLSYM_UNDERSCORE"glDrawRangeElementsEXT",
02331                                 _extDrawRangeElements);
02332 
02333     _funcglGenBuffers           = Window::registerFunction(
02334                                 OSG_DLSYM_UNDERSCORE"glGenBuffers",
02335                                 _arbVBO);
02336     _funcglDeleteBuffers         = Window::registerFunction(
02337                                 OSG_DLSYM_UNDERSCORE"glDeleteBuffers",
02338                                 _arbVBO);
02339     _funcglBindBuffer           = Window::registerFunction(
02340                                 OSG_DLSYM_UNDERSCORE"glBindBuffer",
02341                                 _arbVBO);
02342     _funcglBufferData           = Window::registerFunction(
02343                                 OSG_DLSYM_UNDERSCORE"glBufferData",
02344                                 _arbVBO);
02345     _funcglBufferSubData         = Window::registerFunction(
02346                                 OSG_DLSYM_UNDERSCORE"glBufferSubData",
02347                                 _arbVBO);
02348 
02349     _funcglGenBuffersARB        = Window::registerFunction(
02350                                 OSG_DLSYM_UNDERSCORE"glGenBuffersARB",
02351                                 _arbVBO);
02352     _funcglDeleteBuffersARB     = Window::registerFunction(
02353                                 OSG_DLSYM_UNDERSCORE"glDeleteBuffersARB",
02354                                 _arbVBO);
02355     _funcglBindBufferARB        = Window::registerFunction(
02356                                 OSG_DLSYM_UNDERSCORE"glBindBufferARB",
02357                                 _arbVBO);
02358     _funcglBufferDataARB        = Window::registerFunction(
02359                                 OSG_DLSYM_UNDERSCORE"glBufferDataARB",
02360                                 _arbVBO);
02361     _funcglBufferSubDataARB     = Window::registerFunction(
02362                                 OSG_DLSYM_UNDERSCORE"glBufferSubDataARB",
02363                                 _arbVBO);
02364 
02365     return true;
02366 }

void GeoPumpFactory::masterGeoPump ( Window win,
Geometry geo 
) [static, private]

Definition at line 1845 of file OSGGeoPumpFactory.cpp.

References osg::Geometry::calcMappingIndex(), osg::GeometryBase::getMFIndexMapping(), GL_TEXTURE1_ARB, GL_TEXTURE2_ARB, GL_TEXTURE3_ARB, GL_TEXTURE4_ARB, GL_TEXTURE5_ARB, GL_TEXTURE6_ARB, GL_TEXTURE7_ARB, osg::Geometry::MapColor, osg::Geometry::MapNormal, osg::Geometry::MapPosition, osg::Geometry::MapSecondaryColor, osg::Geometry::MapTexCoords, osg::Geometry::MapTexCoords1, osg::Geometry::MapTexCoords2, osg::Geometry::MapTexCoords3, osg::Geometry::MapTexCoords4, osg::Geometry::MapTexCoords5, osg::Geometry::MapTexCoords6, osg::Geometry::MapTexCoords7, osg::NullFC, pumpGLExtSetup, pumpGLSetup, pumpInternalSetup, pumpMultiGLExtSetup, osg::MField< FieldTypeT, fieldNameSpace >::size(), and SWARNING.

Referenced by defMultiGeoPump().

01847 {
01848     // Setup: get all the data
01849 
01850     pumpInternalSetup( Type, GeoPTypesPtr, getTypes, true );
01851     pumpInternalSetup( Length, GeoPLengthsPtr, getLengths, false );
01852     pumpInternalSetup( Index, GeoIndicesPtr, getIndices, false );
01853 
01854     pumpGLSetup        ( Position,   GeoPositionsPtr, getPositions      );
01855     pumpGLSetup        ( Color,      GeoColorsPtr,    getColors         );
01856     pumpGLExtSetup     ( SecColor,   GeoColorsPtr,    getSecondaryColors);
01857     pumpGLSetup        ( Normal,     GeoNormalsPtr,   getNormals        );
01858     pumpGLSetup        ( TexCoords,  GeoTexCoordsPtr, getTexCoords      );
01859     pumpMultiGLExtSetup( TexCoords1, GeoTexCoordsPtr, getTexCoords1     );
01860     pumpMultiGLExtSetup( TexCoords2, GeoTexCoordsPtr, getTexCoords2     );
01861     pumpMultiGLExtSetup( TexCoords3, GeoTexCoordsPtr, getTexCoords3     );
01862     pumpMultiGLExtSetup( TexCoords4, GeoTexCoordsPtr, getTexCoords4     );
01863     pumpMultiGLExtSetup( TexCoords5, GeoTexCoordsPtr, getTexCoords5     );
01864     pumpMultiGLExtSetup( TexCoords6, GeoTexCoordsPtr, getTexCoords6     );
01865     pumpMultiGLExtSetup( TexCoords7, GeoTexCoordsPtr, getTexCoords7     );
01866 
01867     // check if the node is empty
01868     if(! TypeData || TypePtr->getSize() == 0)
01869         return;
01870 
01871     // if it's not empty we need positions
01872     if(! PositionData)
01873     {
01874         SWARNING << "masterPump: Geometry " << geo << " has no positions!?!"
01875                  << std::endl;
01876         return;
01877     }
01878 
01879     // find the mapping indices
01880     UInt16 nmappings = geo->getMFIndexMapping()->size();
01881     Int16 PositionIndex   = -1,
01882           NormalIndex     = -1,
01883           ColorIndex      = -1,
01884           SecColorIndex   = -1,
01885           TexCoordsIndex  = -1,
01886           TexCoords1Index = -1,
01887           TexCoords2Index = -1,
01888           TexCoords3Index = -1,
01889           TexCoords4Index = -1,
01890           TexCoords5Index = -1,
01891           TexCoords6Index = -1,
01892           TexCoords7Index = -1;
01893 
01894     if(nmappings)
01895     {
01896         PositionIndex   = geo->calcMappingIndex(Geometry::MapPosition      );
01897         NormalIndex     = geo->calcMappingIndex(Geometry::MapNormal        );
01898         ColorIndex      = geo->calcMappingIndex(Geometry::MapColor         );
01899         SecColorIndex   = geo->calcMappingIndex(Geometry::MapSecondaryColor);
01900         TexCoordsIndex  = geo->calcMappingIndex(Geometry::MapTexCoords     );
01901         TexCoords1Index = geo->calcMappingIndex(Geometry::MapTexCoords1    );
01902         TexCoords2Index = geo->calcMappingIndex(Geometry::MapTexCoords2    );
01903         TexCoords3Index = geo->calcMappingIndex(Geometry::MapTexCoords3    );
01904         TexCoords4Index = geo->calcMappingIndex(Geometry::MapTexCoords4    );
01905         TexCoords5Index = geo->calcMappingIndex(Geometry::MapTexCoords5    );
01906         TexCoords6Index = geo->calcMappingIndex(Geometry::MapTexCoords6    );
01907         TexCoords7Index = geo->calcMappingIndex(Geometry::MapTexCoords7    );
01908 
01909         if(! PositionData)
01910         {
01911             SWARNING << "masterPump: Geometry " 
01912                      << geo 
01913                      << "has no position index!?!"
01914                      << std::endl;
01915             return;
01916         }
01917 
01918     }
01919     else if(IndexData)
01920     {
01921         nmappings = 1;
01922         PositionIndex =
01923         NormalIndex =
01924         ColorIndex =
01925         SecColorIndex =
01926         TexCoordsIndex =
01927         TexCoords1Index =
01928         TexCoords2Index =
01929         TexCoords3Index = 
01930         TexCoords4Index =
01931         TexCoords5Index =
01932         TexCoords6Index =
01933         TexCoords7Index = 0;
01934     }
01935 
01936     // overall color?
01937     if(ColorData && ColorPtr->getSize() == 1)
01938         ColorFunc(ColorData);
01939 
01940     // Length handling. Special case: no length given
01941 
01942     UInt32 lendummy;
01943     UInt32 LengthSize;
01944     bool len16 = false;
01945     
01946     // no lengths? use all available data for the first type
01947     if(! LengthData)
01948     {
01949         LengthSize = 1;
01950         LengthData = reinterpret_cast<UChar8*>(&lendummy);
01951         if(IndexData)
01952         {
01953             lendummy = IndexPtr->getSize() / nmappings;
01954         }
01955         else
01956         {
01957             lendummy = PositionPtr->getSize();
01958         }
01959     }
01960     else
01961     {
01962         LengthSize = LengthPtr->getSize();
01963         len16 = (LengthPtr->getFormatSize() == 2);
01964     }
01965 
01966     bool ind16 = false;
01967     ind16 = (IndexPtr != NullFC && IndexPtr->getFormatSize() == 2);
01968     
01969     UInt32 l;
01970     
01971     for(LengthInd = 0; LengthInd < LengthSize; LengthInd++)
01972     {
01973         glBegin(*(TypeData + TypeInd++ * TypeStride));
01974 
01975         if(len16)
01976         {
01977             l = *reinterpret_cast<UInt16*>(LengthData + 
01978                                            LengthInd * LengthStride);
01979         }
01980         else
01981         {
01982             l = *reinterpret_cast<UInt32*>(LengthData + 
01983                                            LengthInd * LengthStride);
01984         }
01985         
01986         for( ; l > 0; l--)
01987         {
01988             if(IndexData && !ind16)
01989             {
01990                 UInt32 * vind;
01991 
01992                 vind = reinterpret_cast<UInt32*>(IndexData + 
01993                                                  IndexStride * IndexInd);
01994                 IndexInd += nmappings;
01995 
01996                 if(ColorData && ColorIndex >= 0)
01997                 {
01998                     ColorFunc(ColorData + ColorStride * vind[ColorIndex]);
01999                 }
02000 
02001                 if(SecColorData && SecColorIndex >= 0)
02002                 {
02003                     SecColorFunc(SecColorData + SecColorStride *
02004                                     vind[SecColorIndex]);
02005                 }
02006 
02007                 if(NormalData && NormalIndex >= 0)
02008                 {
02009                     NormalFunc(NormalData + NormalStride * vind[NormalIndex]);
02010                 }
02011 
02012                 if(TexCoordsData && TexCoordsIndex >= 0)
02013                 {
02014                     TexCoordsFunc(TexCoordsData + TexCoordsStride *
02015                                     vind[TexCoordsIndex]);
02016                 }
02017 
02018                 if(TexCoords1Data && TexCoords1Index >= 0)
02019                 {
02020                     TexCoords1Func(GL_TEXTURE1_ARB,
02021                                    TexCoords1Data + TexCoords1Stride *
02022                                    vind[TexCoords1Index]);
02023                 }
02024 
02025                 if(TexCoords2Data && TexCoords2Index >= 0)
02026                 {
02027                     TexCoords2Func(GL_TEXTURE2_ARB,
02028                                      TexCoords2Data + TexCoords2Stride *
02029                                      vind[TexCoords2Index]);
02030                 }
02031 
02032                 if(TexCoords3Data && TexCoords3Index >= 0)
02033                 {
02034                     TexCoords3Func(GL_TEXTURE3_ARB,
02035                                      TexCoords3Data + TexCoords3Stride *
02036                                      vind[TexCoords3Index]);
02037                 }
02038 
02039                 if(TexCoords4Data && TexCoords4Index >= 0)
02040                 {
02041                     TexCoords4Func(GL_TEXTURE4_ARB,
02042                                      TexCoords4Data + TexCoords4Stride *
02043                                      vind[TexCoords4Index]);
02044                 }
02045 
02046                 if(TexCoords5Data && TexCoords5Index >= 0)
02047                 {
02048                     TexCoords5Func(GL_TEXTURE5_ARB,
02049                                      TexCoords5Data + TexCoords5Stride *
02050                                      vind[TexCoords5Index]);
02051                 }
02052 
02053                 if(TexCoords6Data && TexCoords6Index >= 0)
02054                 {
02055                     TexCoords6Func(GL_TEXTURE6_ARB,
02056                                      TexCoords6Data + TexCoords6Stride *
02057                                      vind[TexCoords6Index]);
02058                 }
02059 
02060                 if(TexCoords7Data && TexCoords7Index >= 0)
02061                 {
02062                     TexCoords7Func(GL_TEXTURE7_ARB,
02063                                      TexCoords7Data + TexCoords7Stride *
02064                                      vind[TexCoords7Index]);
02065                 }
02066 
02067                 PositionFunc(PositionData + PositionStride * vind[PositionIndex]);
02068             }
02069             else if(IndexData && ind16)
02070             {
02071                 UInt16 * vind;
02072 
02073                 vind = reinterpret_cast<UInt16*>(IndexData + 
02074                                                  IndexStride * IndexInd);
02075                 IndexInd += nmappings;
02076 
02077                 if(ColorData && ColorIndex >= 0)
02078                 {
02079                     ColorFunc(ColorData + ColorStride * vind[ColorIndex]);
02080                 }
02081 
02082                 if(SecColorData && SecColorIndex >= 0)
02083                 {
02084                     SecColorFunc(SecColorData + SecColorStride *
02085                                     vind[SecColorIndex]);
02086                 }
02087 
02088                 if(NormalData && NormalIndex >= 0)
02089                 {
02090                     NormalFunc(NormalData + NormalStride * vind[NormalIndex]);
02091                 }
02092 
02093                 if(TexCoordsData && TexCoordsIndex >= 0)
02094                 {
02095                     TexCoordsFunc(TexCoordsData + TexCoordsStride *
02096                                     vind[TexCoordsIndex]);
02097                 }
02098 
02099                 if(TexCoords1Data && TexCoords1Index >= 0)
02100                 {
02101                     TexCoords1Func(GL_TEXTURE1_ARB,
02102                                    TexCoords1Data + TexCoords1Stride *
02103                                    vind[TexCoords1Index]);
02104                 }
02105 
02106                 if(TexCoords2Data && TexCoords2Index >= 0)
02107                 {
02108                     TexCoords2Func(GL_TEXTURE2_ARB,
02109                                      TexCoords2Data + TexCoords2Stride *
02110                                      vind[TexCoords2Index]);
02111                 }
02112 
02113                 if(TexCoords3Data && TexCoords3Index >= 0)
02114                 {
02115                     TexCoords3Func(GL_TEXTURE3_ARB,
02116                                      TexCoords3Data + TexCoords3Stride *
02117                                      vind[TexCoords3Index]);
02118                 }
02119 
02120                 if(TexCoords4Data && TexCoords4Index >= 0)
02121                 {
02122                     TexCoords4Func(GL_TEXTURE4_ARB,
02123                                      TexCoords4Data + TexCoords4Stride *
02124                                      vind[TexCoords4Index]);
02125                 }
02126 
02127                 if(TexCoords5Data && TexCoords5Index >= 0)
02128                 {
02129                     TexCoords5Func(GL_TEXTURE5_ARB,
02130                                      TexCoords5Data + TexCoords5Stride *
02131                                      vind[TexCoords5Index]);
02132                 }
02133 
02134                 if(TexCoords6Data && TexCoords6Index >= 0)
02135                 {
02136                     TexCoords6Func(GL_TEXTURE6_ARB,
02137                                      TexCoords6Data + TexCoords6Stride *
02138                                      vind[TexCoords6Index]);
02139                 }
02140 
02141                 if(TexCoords7Data && TexCoords7Index >= 0)
02142                 {
02143                     TexCoords7Func(GL_TEXTURE7_ARB,
02144                                      TexCoords7Data + TexCoords7Stride *
02145                                      vind[TexCoords7Index]);
02146                 }
02147 
02148                 PositionFunc(PositionData + PositionStride * vind[PositionIndex]);
02149             }
02150             else
02151             {
02152                 if(ColorData)
02153                 {
02154                     ColorFunc(ColorData + ColorStride * PositionInd);
02155                 }
02156 
02157                 if(SecColorData)
02158                 {
02159                     SecColorFunc(SecColorData + SecColorStride * PositionInd);
02160                 }
02161 
02162                 if(NormalData)
02163                 {
02164                     NormalFunc(NormalData + NormalStride * PositionInd);
02165                 }
02166 
02167                 if(TexCoordsData)
02168                 {
02169                     TexCoordsFunc(TexCoordsData + TexCoordsStride *
02170                                                     PositionInd);
02171                 }
02172 
02173                 if(TexCoords1Data)
02174                 {
02175                     TexCoords1Func(GL_TEXTURE1_ARB,
02176                                    TexCoords1Data + TexCoords1Stride *
02177                                                     PositionInd);
02178                 }
02179 
02180                 if(TexCoords2Data)
02181                 {
02182                     TexCoords2Func(GL_TEXTURE2_ARB,
02183                                    TexCoords2Data + TexCoords2Stride *
02184                                                     PositionInd);
02185                 }
02186 
02187                 if(TexCoords3Data)
02188                 {
02189                     TexCoords3Func(GL_TEXTURE3_ARB,
02190                                    TexCoords3Data + TexCoords3Stride *
02191                                                     PositionInd);
02192                 }
02193 
02194                 if(TexCoords4Data)
02195                 {
02196                     TexCoords4Func(GL_TEXTURE4_ARB,
02197                                    TexCoords4Data + TexCoords4Stride *
02198                                                     PositionInd);
02199                 }
02200 
02201                 if(TexCoords5Data)
02202                 {
02203                     TexCoords5Func(GL_TEXTURE5_ARB,
02204                                    TexCoords5Data + TexCoords5Stride *
02205                                                     PositionInd);
02206                 }
02207 
02208                 if(TexCoords6Data)
02209                 {
02210                     TexCoords6Func(GL_TEXTURE6_ARB,
02211                                    TexCoords6Data + TexCoords6Stride *
02212                                                     PositionInd);
02213                 }
02214 
02215                 if(TexCoords7Data)
02216                 {
02217                     TexCoords7Func(GL_TEXTURE7_ARB,
02218                                    TexCoords7Data + TexCoords7Stride *
02219                                                     PositionInd);
02220                 }
02221 
02222                 PositionFunc(PositionData + PositionStride * PositionInd);
02223 
02224                 PositionInd++;
02225             }
02226         }
02227 
02228         glEnd();
02229     }
02230 }

void GeoPumpFactory::masterPartialGeoPump ( Window win,
Geometry geo,
UInt32  primtype,
UInt32  firstvert,
UInt32  nvert 
) [static, private]

Definition at line 2233 of file OSGGeoPumpFactory.cpp.

References FWARNING.

02238 {
02239     FWARNING(("GeoPumpFactory::masterPartialGeoPump: not implemented yet!\n"));
02240 }

void GeoPumpFactory::masterInterfacePump ( Window win,
GeoPositionsInterface pos,
GeoNormalsInterface norm,
GeoColorsInterface col,
GeoColorsInterface seccol,
GeoTexCoordsInterface texcoords,
GeoTexCoordsInterface texcoords2,
GeoTexCoordsInterface texcoords3,
GeoTexCoordsInterface texcoords4,
GeoPTypesInterface type,
GeoPLengthsInterface len,
GeoIndicesInterface ind,
UInt16 map,
UInt16  nmap 
) [static, private]

Definition at line 2242 of file OSGGeoPumpFactory.cpp.

References FWARNING.

02257 {
02258     FWARNING(("GeoPumpFactory::masterInterfacePump: not implemented yet!\n"));
02259 }

void GeoPumpFactory::masterPartialInterfacePump ( Window win,
GeoPositionsInterface pos,
GeoNormalsInterface norm,
GeoColorsInterface col,
GeoColorsInterface seccol,
GeoTexCoordsInterface texcoords,
GeoTexCoordsInterface texcoords2,
GeoTexCoordsInterface texcoords3,
GeoTexCoordsInterface texcoords4,
GeoPTypesInterface type,
GeoPLengthsInterface len,
GeoIndicesInterface ind,
UInt16 map,
UInt16  nmap,
UInt32  primtype,
UInt32  firstvert,
UInt32  nvert 
) [static, private]

Definition at line 2261 of file OSGGeoPumpFactory.cpp.

References FWARNING.

02279 {
02280     FWARNING(
02281         ("GeoPumpFactory::masterPartialInterfacePump not implemented yet!\n"));
02282 }

void osg::GeoPumpFactory::operator= ( const GeoPumpFactory source  )  [private]

Member Data Documentation

OpenGL extension indices.

Definition at line 146 of file OSGGeoPumpFactory.h.

Referenced by GeoPump128(), GeoPump129(), and glextInitFunction().

OpenGL extension indices.

Definition at line 147 of file OSGGeoPumpFactory.h.

Referenced by GeoPump128(), GeoPump129(), and glextInitFunction().

OpenGL extension indices.

Definition at line 148 of file OSGGeoPumpFactory.h.

Referenced by GeoPump129(), and glextInitFunction().

OpenGL extension indices.

Definition at line 149 of file OSGGeoPumpFactory.h.

Referenced by GeoPump129(), and glextInitFunction().

OpenGL extension indices.

Definition at line 150 of file OSGGeoPumpFactory.h.

Referenced by glextInitFunction(), and osg::Geometry::handleGL().

OpenGL extension function indices.

Definition at line 152 of file OSGGeoPumpFactory.h.

Referenced by osg::GeoVBO::draw(), GeoPump128(), GeoPump129(), and glextInitFunction().

OpenGL extension indices.

Definition at line 153 of file OSGGeoPumpFactory.h.

Referenced by osg::GeoVBO::draw(), GeoPump128(), GeoPump129(), and glextInitFunction().

OpenGL extension indices.

Definition at line 154 of file OSGGeoPumpFactory.h.

Referenced by GeoPump129(), and glextInitFunction().

OpenGL extension indices.

Definition at line 155 of file OSGGeoPumpFactory.h.

Referenced by GeoPump129(), and glextInitFunction().

OpenGL extension indices.

Definition at line 156 of file OSGGeoPumpFactory.h.

Referenced by osg::GeoVBO::draw(), GeoPump129(), and glextInitFunction().

OpenGL extension indices.

Definition at line 158 of file OSGGeoPumpFactory.h.

Referenced by glextInitFunction(), and osg::GeoVBO::update().

OpenGL extension indices.

Definition at line 159 of file OSGGeoPumpFactory.h.

Referenced by osg::GeoVBO::clear(), glextInitFunction(), and osg::GeoVBO::update().

OpenGL extension indices.

Definition at line 160 of file OSGGeoPumpFactory.h.

Referenced by osg::GeoVBO::draw(), glextInitFunction(), and osg::GeoVBO::update().

OpenGL extension indices.

Definition at line 161 of file OSGGeoPumpFactory.h.

Referenced by glextInitFunction(), and osg::GeoVBO::update().

OpenGL extension indices.

Definition at line 162 of file OSGGeoPumpFactory.h.

Referenced by glextInitFunction(), and osg::GeoVBO::update().

OpenGL extension indices.

Definition at line 164 of file OSGGeoPumpFactory.h.

Referenced by glextInitFunction(), and osg::GeoVBO::update().

OpenGL extension indices.

Definition at line 165 of file OSGGeoPumpFactory.h.

Referenced by osg::GeoVBO::clear(), glextInitFunction(), and osg::GeoVBO::update().

OpenGL extension indices.

Definition at line 166 of file OSGGeoPumpFactory.h.

Referenced by osg::GeoVBO::draw(), glextInitFunction(), and osg::GeoVBO::update().

OpenGL extension indices.

Definition at line 167 of file OSGGeoPumpFactory.h.

Referenced by glextInitFunction(), and osg::GeoVBO::update().

OpenGL extension indices.

Definition at line 168 of file OSGGeoPumpFactory.h.

Referenced by glextInitFunction().

char osg::GeoPumpFactory::cvsid[] [static, private]

Definition at line 186 of file OSGGeoPumpFactory.h.

GeoPumpFactory * GeoPumpFactory::_the = NULL [static, private]

The Singleton instance of the GeoPumpFactory.

Definition at line 188 of file OSGGeoPumpFactory.h.

Referenced by the().

GeoPump osg::GeoPumpFactory::GeoPumps[131] [static, private]

Definition at line 189 of file OSGGeoPumpFactory.h.

Referenced by getGeoPump().

An InitFuncWrapper to initialize the GeoPumpFactory.

Definition at line 196 of file OSGGeoPumpFactory.h.


The documentation for this class was generated from the following files:

Generated on 8 Feb 2010 for OpenSG by  doxygen 1.6.1