OSG::GeoPumpGroup Class Reference

A group of geometry pumps.

#include <OSGGeoPumpGroup.h>

Inheritance diagram for OSG::GeoPumpGroup:

OSG::GeoIgnorePumpGroup OSG::GeoImmediatePumpGroup OSG::GeoVertexArrayPumpGroup List of all members.

Property Characteristics Handling



enum  {
  NonIndexed = 0x00000001L, SingleIndexed = 0x00000002L, MultiIndexed = 0x00000004L, Indexing = 0x00000007L,
  NonTraditionalProperties = 0x00000008L, UsesShader = 0x00000010L
}
typedef UInt32 PropertyCharacteristics
static std::string describePropertyCharacteristics (PropertyCharacteristics ac)
static PropertyCharacteristics characterizeGeometry (Geometry *geo)

Public Types

Pump Types


typedef void(*) GeoPump (DrawEnv *pEnv, Geometry *geo)
typedef void(*) PartialGeoPump (DrawEnv *pEnv, Geometry *geo, UInt32 primtype, UInt32 firstvert, UInt32 nvert)
typedef void(*) ExtIndexGeoPump (DrawEnv *pEnv, Geometry *geo, UInt32 *indices, UInt32 nvert)

Static Public Member Functions

Global Get


static GeoPump findGeoPump (DrawEnv *pEnv, PropertyCharacteristics acset)
static PartialGeoPump findPartialGeoPump (DrawEnv *pEnv, PropertyCharacteristics acset)
static ExtIndexGeoPump findExtIndexGeoPump (DrawEnv *pEnv, PropertyCharacteristics acset)
Pump Group Handling


static std::vector< GeoPumpGroup * > & getActiveGroups (void)

Protected Member Functions

virtual ~GeoPumpGroup (void)
Single Group Get


virtual GeoPump getGeoPump (DrawEnv *pEnv, PropertyCharacteristics acset)=0
virtual PartialGeoPump getPartialGeoPump (DrawEnv *pEnv, PropertyCharacteristics acset)=0
virtual ExtIndexGeoPump getExtIndexGeoPump (DrawEnv *pEnv, PropertyCharacteristics acset)=0

Static Private Member Functions

static bool initActiveGroups (void)
static bool terminateActiveGroups (void)

Static Private Attributes

static std::vector< GeoPumpGroup * > * _activeGroups
static InitFuncWrapper actInit

Detailed Description

Definition at line 58 of file OSGGeoPumpGroup.h.


Member Typedef Documentation

Definition at line 67 of file OSGGeoPumpGroup.h.

typedef void(*) OSG::GeoPumpGroup::GeoPump(DrawEnv *pEnv, Geometry *geo)

Definition at line 91 of file OSGGeoPumpGroup.h.

typedef void(*) OSG::GeoPumpGroup::PartialGeoPump(DrawEnv *pEnv, Geometry *geo, UInt32 primtype, UInt32 firstvert, UInt32 nvert)

Definition at line 94 of file OSGGeoPumpGroup.h.

typedef void(*) OSG::GeoPumpGroup::ExtIndexGeoPump(DrawEnv *pEnv, Geometry *geo, UInt32 *indices, UInt32 nvert)

Definition at line 100 of file OSGGeoPumpGroup.h.


Member Enumeration Documentation

anonymous enum

Enumerator:
NonIndexed 
SingleIndexed 
MultiIndexed 
Indexing 
NonTraditionalProperties 
UsesShader 

Definition at line 69 of file OSGGeoPumpGroup.h.

00070     {
00071         NonIndexed               = 0x00000001L,    
00072         SingleIndexed            = 0x00000002L,    
00073         MultiIndexed             = 0x00000004L,
00074         Indexing                 = 0x00000007L,
00075         NonTraditionalProperties = 0x00000008L,
00076         // this is actually set at render time dynamically
00077         UsesShader               = 0x00000010L 
00078     };


Constructor & Destructor Documentation

GeoPumpGroup::~GeoPumpGroup ( void   )  [protected, virtual]

Definition at line 242 of file OSGGeoPumpGroup.cpp.

00243 {
00244 }


Member Function Documentation

std::string GeoPumpGroup::describePropertyCharacteristics ( PropertyCharacteristics  ac  )  [static]

PropertyCharacteristics handling.

Definition at line 122 of file OSGGeoPumpGroup.cpp.

References MultiIndexed, NonIndexed, NonTraditionalProperties, and SingleIndexed.

Referenced by findGeoPump().

00124 {
00125     std::string result;
00126     
00127     if(ac & GeoPumpGroup::NonIndexed)    result += "NonIndexed,";
00128     if(ac & GeoPumpGroup::SingleIndexed) result += "SingleIndexed,";
00129     if(ac & GeoPumpGroup::MultiIndexed)  result += "MultiIndexed,";
00130     if(ac & GeoPumpGroup::NonTraditionalProperties) 
00131         result += "NonTraditionalProperties,";
00132 
00133     result.resize(result.length()-1);
00134     
00135     return result;
00136 }

GeoPumpGroup::PropertyCharacteristics GeoPumpGroup::characterizeGeometry ( Geometry geo  )  [static]

Definition at line 139 of file OSGGeoPumpGroup.cpp.

References OSG::Geometry::getIndex(), OSG::GeometryBase::getProperties(), OSG::Geometry::getProperty(), OSG::GeometryBase::getPropIndices(), MultiIndexed, NonIndexed, NonTraditionalProperties, NullFC, and SingleIndexed.

Referenced by OSG::Geometry::drawPrimitives(), OSG::Geometry::handleAttGL(), and OSG::Geometry::handleClassicGL().

00141 {
00142     PropertyCharacteristics val = 0;
00143     
00144     Int16 natt = geo->getProperties().size();
00145     Int16 nind = geo->getPropIndices().size();
00146     
00147     // Check for single- and multi-indexed
00148     GeoIntegralPropertyPtr ind = NullFC;
00149     
00150     bool single = true;
00151     bool multi  = true;
00152     bool nonind = true;
00153 
00154     for(Int16 i = 0; i < natt; ++i)
00155     {
00156         // Only count actual attributes
00157         if(geo->getProperty(i) != NullFC)
00158         {
00159             if(i < nind)
00160             {
00161                 if(geo->getIndex(i) == NullFC)
00162                 {
00163                     single = false;
00164                     multi = false;
00165                 }
00166                 else
00167                 {
00168                     nonind = false;
00169                     
00170                     if(ind == NullFC)
00171                         ind = geo->getIndex(i);
00172                     
00173                     if(geo->getIndex(i) != ind)
00174                         single = false;
00175                 }
00176             }
00177             else
00178             {
00179                single = false;
00180                multi = false; 
00181             }
00182         }
00183     }
00184     
00185          if(nonind)  val |= GeoPumpGroup::NonIndexed;
00186     else if(single)  val |= GeoPumpGroup::SingleIndexed;
00187     else if(multi)   val |= GeoPumpGroup::MultiIndexed;
00188     
00189     // Check for non-traditional properties.
00190     // Right now just check existence of attribs 6&7
00191     // To be complete this would also have to check 
00192     // type compatibility! *DR*
00193     
00194     if(natt > 6 && geo->getProperty(6) != NullFC)
00195         val |= GeoPumpGroup::NonTraditionalProperties;
00196     if(natt > 7 && geo->getProperty(7) != NullFC)
00197         val |= GeoPumpGroup::NonTraditionalProperties;
00198         
00199     return val;
00200 }

GeoPumpGroup::GeoPump GeoPumpGroup::findGeoPump ( DrawEnv pEnv,
PropertyCharacteristics  acset 
) [static]

Definition at line 205 of file OSGGeoPumpGroup.cpp.

References _activeGroups, describePropertyCharacteristics(), FWARNING, and OSG::DrawEnv::getWindow().

Referenced by OSG::Geometry::drawPrimitives(), OSG::Geometry::handleAttGL(), and OSG::Geometry::handleClassicGL().

00207 {
00208     GeoPump pump = NULL;
00209     
00210     Window *win = pEnv->getWindow();
00211     
00212     for(std::vector<GeoPumpGroup*>::iterator it = _activeGroups->begin();
00213         it != _activeGroups->end() && pump == NULL;
00214         ++it)
00215     {
00216         pump = (*it)->getGeoPump(pEnv,acset);
00217     }
00218     
00219     if(pump == NULL)
00220     {
00221         FWARNING(("GeoPumpGroup::findGeoPump: Couldn't find pump for"
00222                 "Window %p and characteristics %s!\n", win, 
00223                 describePropertyCharacteristics(acset).c_str() ));
00224     }
00225     return pump;
00226 }

GeoPumpGroup::PartialGeoPump GeoPumpGroup::findPartialGeoPump ( DrawEnv pEnv,
PropertyCharacteristics  acset 
) [static]

Definition at line 228 of file OSGGeoPumpGroup.cpp.

00231 {
00232     return NULL;
00233 }

GeoPumpGroup::ExtIndexGeoPump GeoPumpGroup::findExtIndexGeoPump ( DrawEnv pEnv,
PropertyCharacteristics  acset 
) [static]

Definition at line 235 of file OSGGeoPumpGroup.cpp.

00238 {
00239     return NULL;
00240 }

std::vector< GeoPumpGroup * > & OSG::GeoPumpGroup::getActiveGroups ( void   )  [inline, static]

Definition at line 46 of file OSGGeoPumpGroup.inl.

References _activeGroups.

00047 {
00048     return *_activeGroups;
00049 }

virtual GeoPump OSG::GeoPumpGroup::getGeoPump ( DrawEnv pEnv,
PropertyCharacteristics  acset 
) [protected, pure virtual]

virtual PartialGeoPump OSG::GeoPumpGroup::getPartialGeoPump ( DrawEnv pEnv,
PropertyCharacteristics  acset 
) [protected, pure virtual]

virtual ExtIndexGeoPump OSG::GeoPumpGroup::getExtIndexGeoPump ( DrawEnv pEnv,
PropertyCharacteristics  acset 
) [protected, pure virtual]

bool GeoPumpGroup::initActiveGroups ( void   )  [static, private]

Definition at line 95 of file OSGGeoPumpGroup.cpp.

References _activeGroups, OSG::addPostFactoryExitFunction(), and terminateActiveGroups().

00096 {
00097     _activeGroups = new std::vector<GeoPumpGroup*>;
00098     
00099     _activeGroups->push_back(new GeoVertexArrayPumpGroup);
00100     _activeGroups->push_back(new GeoImmediatePumpGroup);
00101     
00102     addPostFactoryExitFunction(&GeoPumpGroup::terminateActiveGroups);
00103 
00104     return true;
00105 }

bool GeoPumpGroup::terminateActiveGroups ( void   )  [static, private]

Definition at line 107 of file OSGGeoPumpGroup.cpp.

References _activeGroups.

Referenced by initActiveGroups().

00108 {
00109     for(UInt32 i = 0; i < _activeGroups->size(); ++i)
00110     {
00111         delete (*_activeGroups)[i];
00112     }
00113     
00114     delete _activeGroups;
00115 
00116     return true;
00117 }


Member Data Documentation

std::vector< GeoPumpGroup * > * GeoPumpGroup::_activeGroups [static, private]

Initialize the _activeGroups at startup.

Definition at line 160 of file OSGGeoPumpGroup.h.


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