proj home

Files   Classes   Functions   Hierarchy  

Public Member Functions | Public Attributes | List of all members
vrmlshape Class Reference

#include <vrmlshape.h>

Collaboration diagram for vrmlshape:
Collaboration graph

Public Member Functions

void diffuseColorWrite () const
 Write the diffuse color if it is enabled by having non negative values.
ostreamprint (ostream &os) const
 For debug print out the classes attributes.
void writeP () const
 Write wireframe triangles.
void writePN () const
 Write Point and Normal per point triangles.
void writePNC () const
 Write Point, Normal and Color per point triangles.
void writePwind () const
 Write the triangles winding by coloring in the vertices Red, Green and Blue.

Public Attributes

vector< float > point
 Each 3 floats is a point and 3 points per triangle.
vector< float > normal
 Each 3 floats is a normal and 3 normals per triangle.
vector< float > color
 Each 3 floats is a color and 3 colors per triangle.
float diffuseColor [3]
 The global color.

Detailed Description

Definition at line 25 of file vrmlshape.h.

Member Function Documentation

void vrmlshape::diffuseColorWrite ( ) const

Write the diffuse color if it is enabled by having non negative values.

Definition at line 95 of file vrmlshape.cpp.

{
assert(diffuseColor[0]>=0.0);
glColor3f
(
);
}
ostream & vrmlshape::print ( ostream os) const

For debug print out the classes attributes.

Definition at line 53 of file vrmlshape.cpp.

{
os << "diffuseColor: ";
os << diffuseColor[0] << " ";
os << diffuseColor[1] << " ";
os << diffuseColor[2] << " ";
os << endl;
os << "point:" << endl;
for (uint i=0; i<point.size(); ++i)
{
os << point[i] << " ";
if ((i+1)%3==0)
os << endl;
}
os << endl;
os << "normal:" << endl;
for (uint i=0; i<normal.size(); ++i)
{
os << normal[i] << " ";
if ((i+1)%3==0)
os << endl;
}
os << endl;
os << "color:" << endl;
for (uint i=0; i<color.size(); ++i)
{
os << color[i] << " ";
if ((i+1)%3==0)
os << endl;
}
os << endl;
return os;
}
void vrmlshape::writeP ( ) const

Write wireframe triangles.

Definition at line 108 of file vrmlshape.cpp.

{
uintc sz = point.size();
if (sz==0)
return;
//<TODO> look at this code, does writeP() word?
glBegin(GL_LINES);
// glBegin(GL_TRIANGLES);
assert((point.size()%3)==0);
for (uint i=0; i<sz; i+=9 )
{
glVertex3f(point[i+0],point[i+1],point[i+2]);
glVertex3f(point[i+3],point[i+4],point[i+5]);
glVertex3f(point[i+3],point[i+4],point[i+5]);
glVertex3f(point[i+6],point[i+7],point[i+8]);
glVertex3f(point[i+6],point[i+7],point[i+8]);
glVertex3f(point[i+0],point[i+1],point[i+2]);
}
glEnd();
}
void vrmlshape::writePN ( ) const

Write Point and Normal per point triangles.

Definition at line 136 of file vrmlshape.cpp.

References axes().

{
uintc sz = point.size();
if (sz==0)
return;
assert(sz==normal.size());
#ifdef DEBUG_VRMLSHAPE
axes(0.25);
#endif
glBegin(GL_TRIANGLES);
for (uint i=0; i<sz; i+=3 )
{
glNormal3f(normal[i],normal[i+1],normal[i+2]);
glVertex3f(point[i],point[i+1],point[i+2]);
}
glEnd();
}
void vrmlshape::writePNC ( ) const

Write Point, Normal and Color per point triangles.

Definition at line 164 of file vrmlshape.cpp.

{
uintc sz = point.size();
if (sz==0)
return;
assert(sz==normal.size());
assert(sz==color.size());
glBegin(GL_TRIANGLES);
for (uint i=0; i<sz; i+=3 )
{
glNormal3f(normal[i],normal[i+1],normal[i+2]);
glColor3f(color[i],color[i+1],color[i+2]);
glVertex3f(point[i],point[i+1],point[i+2]);
}
glEnd();
}
void vrmlshape::writePwind ( ) const

Write the triangles winding by coloring in the vertices Red, Green and Blue.

Definition at line 186 of file vrmlshape.cpp.

{
uintc sz = point.size();
if (sz==0)
return;
glBegin(GL_TRIANGLES);
uint k;
for (uint i=0; i<sz; i+=3 )
{
k = i/3;
k %= 3;
switch (k)
{
case 0: glColor3f(1.0,0.0,0.0); break;
case 1: glColor3f(0.0,1.0,0.0); break;
default: glColor3f(0.0,0.0,1.0); break;
}
glVertex3f(point[i],point[i+1],point[i+2]);
}
glEnd();
}

Member Data Documentation

vector<float> vrmlshape::color

Each 3 floats is a color and 3 colors per triangle.

Definition at line 34 of file vrmlshape.h.

float vrmlshape::diffuseColor[3]

The global color.

Definition at line 37 of file vrmlshape.h.

vector<float> vrmlshape::normal

Each 3 floats is a normal and 3 normals per triangle.

Definition at line 32 of file vrmlshape.h.

Referenced by vrmllines::addnormals().

vector<float> vrmlshape::point

Each 3 floats is a point and 3 points per triangle.

Definition at line 30 of file vrmlshape.h.

Referenced by vrmllines::addnormals().


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