vrj::GlDrawRightAngleWandFunctor Class Reference

Draw a wand with a right angle. More...

#include <vrj/Draw/OGL/GlDrawWandFunctors.h>

Inheritance diagram for vrj::GlDrawRightAngleWandFunctor:

Inheritance graph
[legend]
Collaboration diagram for vrj::GlDrawRightAngleWandFunctor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~GlDrawRightAngleWandFunctor ()
virtual void contextInit ()
 Called to initialize any context specific information.
virtual void draw (vrj::User *user)
 Callback function for drawing.

Detailed Description

Draw a wand with a right angle.

Definition at line 83 of file GlDrawWandFunctors.h.


Constructor & Destructor Documentation

virtual vrj::GlDrawRightAngleWandFunctor::~GlDrawRightAngleWandFunctor (  )  [inline, virtual]

Definition at line 86 of file GlDrawWandFunctors.h.

00087    {
00088       /* Do nothing. */ ;
00089    }


Member Function Documentation

virtual void vrj::GlDrawRightAngleWandFunctor::contextInit (  )  [inline, virtual]

Called to initialize any context specific information.

Implements vrj::GlDrawObjectFunctor.

Definition at line 92 of file GlDrawWandFunctors.h.

00093    {;}

void vrj::GlDrawRightAngleWandFunctor::draw ( vrj::User user  )  [virtual]

Callback function for drawing.

Called when the object should be drawn.

Precondition:
GL context is set and ready to go.

Implements vrj::GlDrawObjectFunctor.

Definition at line 76 of file GlDrawWandFunctors.cpp.

00077 {
00078    boost::ignore_unused_variable_warning(user);
00079 
00080    static GLfloat VertexData[] = {
00081       0.0140000f, -0.140000f, 0.0140000f, 0.0140000f, 0.028000f, 0.0140000f, -0.0140000f, 0.028000f, 0.0140000f,
00082       -0.0140000f, -0.140000f, 0.0140000f, 0.0140000f, -0.140000f, -0.0140000f,
00083       0.0140000f, 0.00000f, -0.0140000f, 0.0140000f, 0.028000f, 0.0140000f,
00084       0.0140000f, -0.140000f, 0.0140000f, -0.0140000f, -0.140000f, -0.0140000f,
00085       -0.0140000f, 0.00000f, -0.0140000f, 0.0140000f, 0.00000f, -0.0140000f,
00086       0.0140000f, -0.140000f, -0.0140000f, -0.0140000f, -0.140000f, 0.0140000f,
00087       -0.0140000f, 0.028000f, 0.0140000f, -0.0140000f, 0.00000f, -0.0140000f,
00088       -0.0140000f, -0.140000f, -0.0140000f, -0.0140000f, -0.140000f, -0.0140000f,
00089       0.0140000f, -0.140000f, -0.0140000f, 0.0140000f, -0.140000f, 0.0140000f,
00090       -0.0140000f, -0.140000f, 0.0140000f, -0.0140000f, 0.028000f, 0.0140000f,
00091       0.0140000f, 0.028000f, 0.0140000f, 0.028000f, 0.056000f, -0.042000f,
00092       -0.028000f, 0.056000f, -0.042000f, 0.028000f, 0.042000f, -0.042000f,
00093       -0.028000f, 0.042000f, -0.042000f, -0.028000f, 0.056000f, -0.042000f,
00094       0.028000f, 0.056000f, -0.042000f, 0.0140000f, 0.028000f, 0.0140000f,
00095       0.0140000f, 0.00000f, -0.0140000f, 0.028000f, 0.042000f, -0.042000f,
00096       0.0140000f, 0.028000f, 0.0140000f, 0.028000f, 0.042000f, -0.042000f,
00097       0.028000f, 0.056000f, -0.042000f, -0.0140000f, 0.028000f, 0.0140000f,
00098       -0.028000f, 0.056000f, -0.042000f, -0.028000f, 0.042000f, -0.042000f,
00099       -0.028000f, 0.042000f, -0.042000f, -0.0140000f, 0.00000f, -0.0140000f,
00100       -0.0140000f, 0.028000f, 0.0140000f, 0.028000f, 0.042000f, -0.042000f,
00101       0.0140000f, 0.00000f, -0.0140000f, -0.0140000f, 0.00000f, -0.0140000f,
00102       -0.028000f, 0.042000f, -0.042000f
00103    };
00104    static GLuint Indices[] = {
00105       0, 1, 2,
00106       0, 2, 3,
00107       4, 5, 6,
00108       4, 6, 7,
00109       8, 9, 10,
00110       8, 10, 11,
00111       12, 13, 14,
00112       12, 14, 15,
00113       16, 17, 18,
00114       16, 18, 19,
00115       20, 21, 22,
00116       20, 22, 23,
00117       24, 25, 26,
00118       24, 26, 27,
00119       28, 29, 30,
00120       31, 32, 33,
00121       34, 35, 36,
00122       37, 38, 39,
00123       40, 41, 42,
00124       40, 42, 43
00125    };
00126 
00127    static GLfloat NormData[] = {
00128       0.0f, -0.0f, 0.004704f,
00129       0.0f, 0.0f, 0.004704f,
00130       0.00392f, 0.0f, 0.0f,
00131       0.004704f, 0.0f, 0.0f,
00132       0.0f, 0.0f, -0.00392f,
00133       0.0f, 0.0f, -0.00392f,
00134       0.004704f, 0.0f, 0.0f,
00135       0.00392f, 0.0f, 0.0f,
00136       0.0f, -0.000784f, 0.0f,
00137       0.0f, -0.000784f, 0.0f,
00138       0.0f, 0.001568f, 0.000784f,
00139       3.16352e-11f, 0.003136f, 0.001568f,
00140       0.0f, 0.0f, -0.000784f,
00141       0.0f, 0.0f, -0.000784f,
00142       0.00196f, -0.000392f, 0.000392f,
00143       0.000784f, 1.58176e-11f, 0.000196f,
00144       0.000784f, -1.58176e-11f, 0.000196f,
00145       0.00196f, -0.000392f, 0.000392f,
00146       4.84511e-11f, -0.000784f, -0.001176f,
00147       0.0f, -0.001568f, -0.002352f
00148    };
00149 
00150 #if 0
00151    unsigned num_tris(20);
00152 
00153    // USED to generate normals
00154    static bool first_time(true);
00155 
00156    if(first_time)
00157    {
00158       first_time = false;
00159 
00160       unsigned j;       // vertex offset
00161       std::vector<gmtl::Vec3f> norms;
00162 
00163       // For each triangle
00164       for(unsigned i=0;i<num_tris;i++)
00165       {
00166          j = 3*Indices[(i*3)+0];
00167          gmtl::Vec3f v1(VertexData[j], VertexData[j+1], VertexData[j+2]);
00168          j = 3*Indices[(i*3)+1];
00169          gmtl::Vec3f v2(VertexData[j], VertexData[j+1], VertexData[j+2]);
00170          j = 3*Indices[(i*3)+2];
00171          gmtl::Vec3f v3(VertexData[j], VertexData[j+1], VertexData[j+2]);
00172          gmtl::Vec3f normal;
00173          normal = gmtl::cross(normal, gmtl::Vec3f(v2-v1), gmtl::Vec3f(v3-v1));
00174          norms.push_back(normal);
00175          std::cout << i << ": " << normal << std::endl;
00176       }
00177    }
00178 
00179    glPushAttrib(GL_LIGHTING_BIT);
00180    glDisable(GL_LIGHTING);
00181    glColor3f(1.0,0.0f,0.0f);
00182    glBegin(GL_LINES);
00183       for(unsigned i=0;i<20;i++)
00184       {
00185          gmtl::Vec3f norm;    norm.set(&(NormData[(i*3)]));
00186          //norm = norms[i];
00187          gmtl::Vec3f v0;      v0.set( &(VertexData[3*Indices[(i*3)+0]]));
00188          gmtl::Vec3f v1 = v0+norm;
00189          glVertex3fv(v0.getData());
00190          glVertex3fv(v1.getData());
00191       }
00192    glEnd();
00193    glPopAttrib();
00194 #endif
00195 
00196    glColor3f(0.00000f, 1.00000f, 0.00000f);
00197 
00198    glBegin(GL_TRIANGLES);
00199    for(unsigned i=0;i<20;i++)
00200    {
00201       glNormal3fv(&(NormData[i*3]));
00202       glVertex3fv(&(VertexData[3*Indices[(i*3)+0]]));
00203       glVertex3fv(&(VertexData[3*Indices[(i*3)+1]]));
00204       glVertex3fv(&(VertexData[3*Indices[(i*3)+2]]));
00205    }
00206    glEnd();
00207 }


The documentation for this class was generated from the following files:
Generated on Thu Jan 4 10:58:16 2007 for VR Juggler by  doxygen 1.5.1