NormalTraitGeneric3f Struct Reference

Inheritance diagram for NormalTraitGeneric3f:

ParticleTraits

List of all members.

Static Public Member Functions

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

Classes

struct  dataType


Detailed Description

Definition at line 1114 of file OSGParticles.cpp.


Member Function Documentation

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

Definition at line 1125 of file OSGParticles.cpp.

References NormalTraitGeneric3f::dataType::const_n, osg::FCPtr< BasePtrTypeT, FieldContainerTypeT >::dcast(), osg::ParticlesBase::getNormals(), osg::ParticlesBase::getPositions(), NormalTraitGeneric3f::dataType::n, NormalTraitGeneric3f::dataType::norms, osg::NullFC, NormalTraitGeneric3f::dataType::perParticle, and osg::MField< FieldTypeT, fieldNameSpace >::size().

01126     {
01127         GeoNormals3fPtr norms3f = GeoNormals3fPtr::dcast(part->getNormals());
01128         
01129         data.norms = norms3f->getFieldPtr();
01130         
01131         data.perParticle = false;
01132         
01133         if(norms3f != NullFC)
01134         {
01135             if(norms3f->getSize() == 1)
01136             {
01137                 data.n = &(*(data.norms))[0];
01138             }
01139             else if(data.norms->size() == part->getPositions()->size())
01140             {
01141                 data.perParticle = true;
01142             }
01143             else
01144             {
01145                 data.const_n.setValues(0,1,0);
01146                 data.n = &data.const_n;
01147             }           
01148         }
01149         else
01150         {
01151             data.const_n.setValues(0,1,0);
01152             data.n = &data.const_n;
01153         }
01154     }

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

Definition at line 1156 of file OSGParticles.cpp.

References NormalTraitGeneric3f::dataType::n, NormalTraitGeneric3f::dataType::norms, and NormalTraitGeneric3f::dataType::perParticle.

01157     {
01158         if(data.perParticle)
01159             data.n = &(*(data.norms))[particle];
01160              
01161         return false;
01162     }

static Vec3f& NormalTraitGeneric3f::normal ( dataType data  )  [inline, static]

Definition at line 1164 of file OSGParticles.cpp.

References NormalTraitGeneric3f::dataType::n.

01165     {
01166         return *data.n;
01167     }

static void NormalTraitGeneric3f::normal ( dataType data,
UInt32   
) [inline, static]

Definition at line 1169 of file OSGParticles.cpp.

References osg::PointInterface< ValueTypeT, StorageInterfaceT >::getValues(), and NormalTraitGeneric3f::dataType::n.

01170     {
01171         glNormal3fv( (GLfloat*) data.n->getValues() );            
01172     }


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

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