ColTraitGeneric Struct Reference

Inheritance diagram for ColTraitGeneric:

ColTraitBase ParticleTraits

List of all members.

Public Types

enum  { numFormats = GL_DOUBLE - GL_BYTE + 1 }
typedef void(OSG_APIENTRY * pumpFunc )(GLubyte *data)

Static Public Member Functions

static void init (Particles *part, DrawActionBase *, dataType &data)
static bool particle (dataType &data, UInt32 particle)
static void vertex (dataType &, UInt32, UInt32)

Static Public Attributes

Drawing Pumps


static const int formatBase = GL_BYTE
static char * formatNames []
static pumpFunc ColorFuncs [numFormats][4]

Classes

struct  dataType


Detailed Description

Definition at line 612 of file OSGParticles.cpp.


Member Typedef Documentation

typedef void(OSG_APIENTRY * ColTraitBase::pumpFunc)(GLubyte *data) [inherited]


Member Enumeration Documentation

anonymous enum [inherited]

Enumerator:
numFormats 

Definition at line 468 of file OSGParticles.cpp.

00468 { numFormats = GL_DOUBLE - GL_BYTE + 1 };


Member Function Documentation

static void ColTraitGeneric::init ( Particles part,
DrawActionBase ,
dataType data 
) [inline, static]

Definition at line 623 of file OSGParticles.cpp.

References ColorFuncs, ColTraitGeneric::dataType::data, formatBase, formatNames, ColTraitGeneric::dataType::func, osg::ParticlesBase::getColors(), osg::ParticlesBase::getPositions(), osg::NullFC, ColTraitGeneric::dataType::perParticle, ColTraitGeneric::dataType::stride, and SWARNING.

00624     {
00625         GeoColorsPtr col = part->getColors();
00626         
00627         data.perParticle = false;
00628         
00629         if(col != NullFC)
00630         {
00631             data.data = col->getData();
00632             if((data.stride = col->getStride()) == 0)
00633                 data.stride = col->getFormatSize() * col->getDimension();
00634 
00635             data.func = ColorFuncs[ col->getFormat() - formatBase ]
00636                                   [ col->getDimension() - 1 ];
00637 
00638             if(data.func == NULL)
00639             {
00640                 SWARNING << "Particles " << part << "have illegal "
00641                          << "colors: " << col->getDimension()
00642                          << "D " << formatNames[ col->getFormat() - formatBase ]
00643                          << "!" << std::endl;
00644                 return;
00645             }
00646             
00647             if(col->getSize() == 1)
00648             {
00649                 data.func((GLubyte*) col->getData());
00650             }
00651             else if(col->getSize() == part->getPositions()->getSize())
00652             {
00653                 data.perParticle = true;
00654             }
00655         }
00656     }

static bool ColTraitGeneric::particle ( dataType data,
UInt32  particle 
) [inline, static]

Definition at line 658 of file OSGParticles.cpp.

References ColTraitGeneric::dataType::data, ColTraitGeneric::dataType::func, ColTraitGeneric::dataType::perParticle, and ColTraitGeneric::dataType::stride.

00659     {   
00660         if(data.perParticle == true)
00661             data.func((GLubyte*)(data.data + particle * data.stride));
00662         return false;
00663     }

static void ColTraitGeneric::vertex ( dataType ,
UInt32  ,
UInt32   
) [inline, static]

Definition at line 665 of file OSGParticles.cpp.

00666     {
00667     }


Member Data Documentation

const int ColTraitBase::formatBase = GL_BYTE [static, inherited]

The smallest enum for data types, used as a base for the formatNames map.

Definition at line 467 of file OSGParticles.cpp.

char * ColTraitBase::formatNames [static, inherited]

Initial value:

 
{   "GL_BYTE", "GL_UNSIGNED_BYTE", "GL_SHORT", "GL_UNSIGNED_SHORT", 
    "GL_INT", "GL_UNSIGNED_INT", "GL_FLOAT", "GL_2_BYTES", 
    "GL_3_BYTES", "GL_4_BYTES", "GL_DOUBLE"
}
A map from the OpenGL data type to the corresponding name

Definition at line 470 of file OSGParticles.cpp.

Initial value:

 {
    { NULL, NULL, 
      (pumpFunc)glColor3bv, (pumpFunc)glColor4bv },   
    { NULL, NULL, 
      (pumpFunc)glColor3ubv,(pumpFunc)glColor4ubv },  
    { NULL, NULL, 
      (pumpFunc)glColor3sv, (pumpFunc)glColor4sv },   
    { NULL, NULL,  
      (pumpFunc)glColor3usv,(pumpFunc)glColor4usv },  
    { NULL, NULL,  
      (pumpFunc)glColor3iv, (pumpFunc)glColor4iv },   
    { NULL, NULL,  
      (pumpFunc)glColor3uiv,(pumpFunc)glColor4uiv },  
    { NULL, NULL,  
      (pumpFunc)glColor3fv, (pumpFunc)glColor4fv },   
    { NULL, NULL, NULL, NULL },                       
    { NULL, NULL, NULL, NULL },                       
    { NULL, NULL, NULL, NULL },                       
    { NULL, NULL,  
      (pumpFunc)glColor3dv, (pumpFunc)glColor4dv },   
}
The pump functions for colors, indexed by data type and dimensionality

Definition at line 472 of file OSGParticles.cpp.


The documentation for this struct was generated from the following file:

Generated on Mon Mar 17 12:02:58 2008 for OpenSG by  doxygen 1.5.5