CIvfGLPrimitive Class Reference

#include <ivf/IvfGLPrimitive.h>

Inheritance diagram for CIvfGLPrimitive:

CIvfShape CIvfObject CIvfBase CIvfRefCountBase CIvfRTTIBase CIvfLineSet CIvfLineStripSet CIvfPointSet CIvfPolySet CIvfQuadSet CIvfQuadStripSet CIvfTriSet CIvfTriStripSet List of all members.

Public Member Functions

int getCoordIndexSetSize ()
 CIvfGLPrimitive ()
virtual ~CIvfGLPrimitive ()
 IvfClassInfo ("CIvfGLPrimitive", CIvfShape)
void clear ()
void addCoord (double x, double y, double z)
void addCoord (CIvfVec3d &coord)
void setCoord (int pos, double x, double y, double z)
void getCoord (long pos, double &x, double &y, double &z)
long getCoordSetSize ()
void clearCoord ()
void addMaterial (CIvfMaterial *material)
void clearMaterial ()
int getMaterialSetSize ()
CIvfMaterialgetMaterial (int pos)
CIvfMaterialSetgetMaterialSet ()
void setMaterialSet (CIvfMaterialSet *materialSet)
void addMaterialIndex (int idx)
void clearMaterialIndex ()
int getMaterialIndex (int pos)
void addCoordIndex (CIvfIndex *index)
CIvfIndexgetCoordIndex (long pos)
void clearCoordIndex ()
void addColor (float red, float green, float blue)
void addColor (float red, float green, float blue, float alfa)
void setColor (int pos, float red, float green, float blue)
void setColor (int pos, float red, float green, float blue, float alfa)
void getColor (long pos, float &red, float &green, float &blue)
void getColor (int pos, float &red, float &green, float &blue, float &alfa)
void setAlfa (int pos, float alfa)
float getAlfa (int pos)
long getColorSetSize ()
void addColorIndex (CIvfIndex *index)
CIvfIndexgetColorIndex (long pos)
void addNormal (double n1, double n2, double n3)
void getNormal (long pos, double &n1, double &n2, double &n3)
long getNormalSetSize ()
void addNormalIndex (CIvfIndex *index)
CIvfIndexgetNormalIndex (long pos)
void addTextureCoord (double s, double t)
void setTextureCoord (int pos, double s, double t)
void getTextureCoord (long pos, double &s, double &t)
long getTextureCoordSetSize ()
void clearTextureCoord ()
void addTextureIndex (CIvfIndex *index)
CIvfIndexgetTextureIndex (long pos)
void refresh ()
void setUseVertexNormals (bool flag)
bool getUseVertexNormals ()
virtual void updateVertexNormals ()
void updateBoundingSphere ()

Protected Member Functions

virtual void calcNormal (CIvfIndex *idx)

Protected Attributes

std::vector< CIvfVec3d * > m_coordSet
std::vector< CIvfColor * > m_colorSet
std::vector< CIvfVec3d * > m_normalSet
CIvfMaterialSetPtr m_materialSet
std::vector< CIvfVec3d * > m_textureCoordSet
std::vector< CIvfIndexPtr > m_coordIndexSet
std::vector< CIvfIndexPtr > m_colorIndexSet
std::vector< CIvfIndexPtr > m_normalIndexSet
std::vector< CIvfIndexPtr > m_textureIndexSet
std::vector< CIvfVec3d * > m_vertexNormalSet
std::vector< CIvfIndexPtr > m_vertexNormalIndexSet
std::vector< int > m_materialIndexSet

Detailed Description

OpenGL primitive base class

Base class for all classes implemting OpenGL primtives. This class maintains 4 main arrays for controlling the appearance of the geometry generated: a coordinate set, a color set, a normal set and a texture coordinate set. OpenGL primitives are created indirectly from these by specifying indices with instances of CIvfIndex. A quad set is created using this principle in the following code:

        CIvfQuadSet* quadSet = new CIvfQuadSet();
        
        quadSet->addCoord(0.0,0.0,2.0);
        quadSet->addCoord(1.0,0.3,2.0);
        quadSet->addCoord(2.0,0.0,2.0);
        quadSet->addCoord(0.0,0.3,1.0);
        quadSet->addCoord(1.0,0.5,1.0);
        quadSet->addCoord(2.0,0.3,1.0);
        quadSet->addCoord(0.0,0.0,0.0);
        quadSet->addCoord(1.0,0.3,0.0);
        quadSet->addCoord(2.0,0.0,0.0);
 
        coordIdx = new CIvfIndex();
        coordIdx->add(0,1,4,3);
        coordIdx->add(1,2,5,4);
        coordIdx->add(3,4,7,6);
        coordIdx->add(4,5,8,7);

        quadSet->addCoordIndex(coordIdx);

        quadSet->setMaterial(greenMaterial);
        quadSet->setUseVertexNormals(false);

Definition at line 79 of file IvfGLPrimitive.h.


Constructor & Destructor Documentation

CIvfGLPrimitive::CIvfGLPrimitive  ) 
 

CIvfGLPrimitive constructor

virtual CIvfGLPrimitive::~CIvfGLPrimitive  )  [virtual]
 

CIvfGLPrimitive destructor


Member Function Documentation

void CIvfGLPrimitive::addColor float  red,
float  green,
float  blue,
float  alfa
 

Add a color to color set

void CIvfGLPrimitive::addColor float  red,
float  green,
float  blue
 

Add a color to color set (alfa = 1.0)

void CIvfGLPrimitive::addColorIndex CIvfIndex index  ) 
 

Add a color index

All color indices are owned by CIvfGLPrimitive.

void CIvfGLPrimitive::addCoord CIvfVec3d coord  ) 
 

Add coordinate to coordinate set

void CIvfGLPrimitive::addCoord double  x,
double  y,
double  z
 

Add coordinate to coordinate set

void CIvfGLPrimitive::addCoordIndex CIvfIndex index  ) 
 

Adds a coordinate index

All indices added are owned by CIvfGLPrimitive.

void CIvfGLPrimitive::addMaterial CIvfMaterial material  ) 
 

Add a material to material set

void CIvfGLPrimitive::addMaterialIndex int  idx  ) 
 

Add material index for element

Parameters:
idx 

void CIvfGLPrimitive::addNormal double  n1,
double  n2,
double  n3
 

Add normal to normal set

void CIvfGLPrimitive::addNormalIndex CIvfIndex index  ) 
 

Add normal index

All normal indices are owned by CIvfGLPrimitive.

void CIvfGLPrimitive::addTextureCoord double  s,
double  t
 

Add Texture coordinate to texture coordinate set

void CIvfGLPrimitive::addTextureIndex CIvfIndex index  ) 
 

Add a texture coordinate index

All texture indices are owned by CIvfGLPrimitive

void CIvfGLPrimitive::clear  ) 
 

Clear all sets

void CIvfGLPrimitive::clearCoord  ) 
 

Clears coordinate set (deleting coordinates)

void CIvfGLPrimitive::clearCoordIndex  ) 
 

Clears coordinate index set (deleting indices)

void CIvfGLPrimitive::clearMaterial  ) 
 

Clear material set

void CIvfGLPrimitive::clearMaterialIndex  ) 
 

Clear material index

void CIvfGLPrimitive::clearTextureCoord  ) 
 

Clear texture coordinate set. (Deleting coordinates.)

float CIvfGLPrimitive::getAlfa int  pos  ) 
 

Return alfa value for given position

void CIvfGLPrimitive::getColor int  pos,
float &  red,
float &  green,
float &  blue,
float &  alfa
 

Return color value and alpha value at given position

void CIvfGLPrimitive::getColor long  pos,
float &  red,
float &  green,
float &  blue
 

Return color value at given position

CIvfIndex* CIvfGLPrimitive::getColorIndex long  pos  ) 
 

Returns a color index at given position

long CIvfGLPrimitive::getColorSetSize  ) 
 

Return size of color set

void CIvfGLPrimitive::getCoord long  pos,
double &  x,
double &  y,
double &  z
 

Return coordinate at specified position

CIvfIndex* CIvfGLPrimitive::getCoordIndex long  pos  ) 
 

Returns a coordinate index

long CIvfGLPrimitive::getCoordSetSize  ) 
 

Return size of coordinate set

CIvfMaterial* CIvfGLPrimitive::getMaterial int  pos  ) 
 

Return a specific material from material set

int CIvfGLPrimitive::getMaterialIndex int  pos  ) 
 

Return material index for element

Parameters:
pos 

CIvfMaterialSet* CIvfGLPrimitive::getMaterialSet  ) 
 

Return material set

int CIvfGLPrimitive::getMaterialSetSize  ) 
 

Return size of material set

void CIvfGLPrimitive::getNormal long  pos,
double &  n1,
double &  n2,
double &  n3
 

Return normal at given position

CIvfIndex* CIvfGLPrimitive::getNormalIndex long  pos  ) 
 

Return normal index at given position

long CIvfGLPrimitive::getNormalSetSize  ) 
 

Return size of normal set

void CIvfGLPrimitive::getTextureCoord long  pos,
double &  s,
double &  t
 

Return specified texture coordinate at given position

long CIvfGLPrimitive::getTextureCoordSetSize  ) 
 

Return size of texture coordinate set

CIvfIndex* CIvfGLPrimitive::getTextureIndex long  pos  ) 
 

Return texture coordinate index at given position

bool CIvfGLPrimitive::getUseVertexNormals  ) 
 

Returns state of vertex normal use

void CIvfGLPrimitive::refresh  )  [virtual]
 

Recomputes normals if geometry has been modified

Reimplemented from CIvfShape.

void CIvfGLPrimitive::setAlfa int  pos,
float  alfa
 

Set alfa value for given position

void CIvfGLPrimitive::setColor int  pos,
float  red,
float  green,
float  blue,
float  alfa
 

Set color value at given position

void CIvfGLPrimitive::setColor int  pos,
float  red,
float  green,
float  blue
 

Set a color at a specified position

Alpha value is unchanged.

void CIvfGLPrimitive::setCoord int  pos,
double  x,
double  y,
double  z
 

Set a coordinate at specified position in set

void CIvfGLPrimitive::setMaterialSet CIvfMaterialSet materialSet  ) 
 

Assign material set

void CIvfGLPrimitive::setTextureCoord int  pos,
double  s,
double  t
 

Set texture coordinate at specified position

void CIvfGLPrimitive::setUseVertexNormals bool  flag  ) 
 

Enables or disables the use of vertex normals

void CIvfGLPrimitive::updateBoundingSphere  )  [virtual]
 

Updates bounding sphere

Upates the radius of the assigned bounding sphere, if any.

Reimplemented from CIvfObject.

virtual void CIvfGLPrimitive::updateVertexNormals  )  [virtual]
 

Updates vertex normals

Should be overidden by derived classes.

Reimplemented in CIvfPolySet, CIvfQuadSet, CIvfQuadStripSet, CIvfTriSet, and CIvfTriStripSet.


The documentation for this class was generated from the following file:
Generated on Fri Sep 1 15:36:52 2006 for Interactive Visualisation Framework - Ivf++ by  doxygen 1.4.6-NO