proj home

Files   Classes   Functions   Hierarchy  

writegridobj Class Reference

#include <d3tessdraw.h>

Inheritance diagram for writegridobj:
Inheritance graph
Collaboration diagram for writegridobj:
Collaboration graph

List of all members.

Public Member Functions

 writegridobj (d3tess const &tess_)
void draw ()
 Draw the object.
 writegridobj (d4tess const &_tess)
void draw () const

Public Attributes

gobjglColor3ub gridcolor

Detailed Description

Definition at line 99 of file d3tessdraw.h.


Constructor & Destructor Documentation

writegridobj::writegridobj ( d3tess const &  tess_  )  [inline]

Definition at line 107 of file d3tessdraw.h.

00108     : tess(tess_), gridcolor(gobjglColor3ub(0,0,255)) {}

writegridobj::writegridobj ( d4tess const &  _tess  )  [inline]

Definition at line 110 of file d4tessdraw.h.

00111     : tess(_tess), gridcolor(gobjglColor3ub(0,0,255)) {}


Member Function Documentation

void writegridobj::draw (  )  const

Definition at line 246 of file d4tessdraw.cpp.

References gobj::global, gridcolor, d4tri::isnull(), d4tri::pi, d3tess::pt, d3tess::vi, point4< T >::x, point4< T >::y, and point4< T >::z.

00247 {
00248   gobjContainer & x = * gobjContainer::global;
00249 
00250   x.push_back( new gobjglPushAttrib(GL_CURRENT_BIT) );
00251   x.push_back( new gobjglPushAttrib(GL_LIGHTING_BIT) );
00252 
00253 
00254   x.push_back( new gobjglDisable(GL_LIGHTING) );
00255 
00256 
00257   x.push_back( new gobjglColor3ub(gridcolor) );
00258 
00259   vector<pt4> const & pt(tess.pt);
00260   vector<d4tri> const & vi(tess.vi);
00261 
00262   x.push_back( new gobjglBegin(GL_LINES) );
00263 
00264   uintc imax = tess.vi.size();
00265   for (uint i=1; i<imax; ++i)
00266   {
00267     d4tri const & t(vi[i]);
00268 
00269     if (t.isnull())
00270       continue;
00271 
00272     pt4c & P0(pt[t.pi[0]]); 
00273     pt4c & P1(pt[t.pi[1]]); 
00274     pt4c & P2(pt[t.pi[2]]); 
00275     pt4c & P3(pt[t.pi[3]]); 
00276 
00277     x.push_back( new gobjglVertex3f(P0.x,P0.y,P0.z) );
00278     x.push_back( new gobjglVertex3f(P1.x,P1.y,P1.z) );
00279     x.push_back( new gobjglVertex3f(P0.x,P0.y,P0.z) );
00280     x.push_back( new gobjglVertex3f(P2.x,P2.y,P2.z) );
00281     x.push_back( new gobjglVertex3f(P0.x,P0.y,P0.z) );
00282     x.push_back( new gobjglVertex3f(P3.x,P3.y,P3.z) );
00283     x.push_back( new gobjglVertex3f(P1.x,P1.y,P1.z) );
00284     x.push_back( new gobjglVertex3f(P2.x,P2.y,P2.z) );
00285     x.push_back( new gobjglVertex3f(P1.x,P1.y,P1.z) );
00286     x.push_back( new gobjglVertex3f(P3.x,P3.y,P3.z) );
00287     x.push_back( new gobjglVertex3f(P2.x,P2.y,P2.z) );
00288     x.push_back( new gobjglVertex3f(P3.x,P3.y,P3.z) );
00289 
00290   }
00291 
00292   x.push_back( new gobjglEnd() );
00293 
00294   x.push_back( new gobjglPopAttrib() );
00295   x.push_back( new gobjglPopAttrib() );
00296 }

void writegridobj::draw (  )  [virtual]

Draw the object.

Implements gobj.

Definition at line 99 of file d3tessdraw.cpp.

References gobjglColor3ub::draw(), gridcolor, simplexD2linked::isnull(), simplexD2linked::pi, d3tess::pt, d3tess::vi, point3< T >::x, and point3< T >::y.

00100 {
00101   glPushAttrib(GL_CURRENT_BIT);
00102   glPushAttrib(GL_LIGHTING_BIT);
00103 
00104   gridcolor.draw();
00105 
00106   vector<pt3> const & pt(tess.pt);
00107   vector<simplexD2linked> const & vi(tess.vi);
00108 
00109   glBegin(GL_LINES);
00110 
00111   uintc imax = tess.vi.size();
00112   for (uint i=1; i<imax; ++i)
00113   {
00114     simplexD2linked const & t(vi[i]);
00115 
00116     if (t.isnull())
00117       continue;
00118 
00119     pt3c & P0(pt[t.pi[0]]); 
00120     pt3c & P1(pt[t.pi[1]]); 
00121     pt3c & P2(pt[t.pi[2]]); 
00122 
00123     glVertex2f(P0.x,P0.y);
00124     glVertex2f(P1.x,P1.y);
00125     glVertex2f(P0.x,P0.y);
00126     glVertex2f(P2.x,P2.y);
00127     glVertex2f(P1.x,P1.y);
00128     glVertex2f(P2.x,P2.y);
00129 
00130   }
00131 
00132   glEnd();
00133 
00134   glPopAttrib();
00135   glPopAttrib();
00136 }


Member Data Documentation

Definition at line 105 of file d3tessdraw.h.

Referenced by draw().


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

Generated on 27 Nov 2012 for Chelton Evans Source by  doxygen 1.6.1