proj home

Files   Classes   Functions   Hierarchy  

writecpobj Class Reference

#include <d3tessdraw.h>

Inheritance diagram for writecpobj:
Collaboration diagram for writecpobj:

List of all members.

Public Member Functions

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


Detailed Description

Definition at line 124 of file d3tessdraw.h.


Constructor & Destructor Documentation

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

Definition at line 129 of file d3tessdraw.h.

00130     : tess(tess_) {}

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

Definition at line 79 of file d4tessdraw.h.

00080     : tess(_tess) {}


Member Function Documentation

void writecpobj::draw (  )  const

Definition at line 92 of file d4tessdraw.cpp.

References point4< T >::x, point4< T >::y, and point4< T >::z.

00093 {
00094 
00095   pt4 P0,P1,P2,P3;
00096   tess.getpoints(P0,P1,P2,P3);
00097 
00098   glPushAttrib(GL_CURRENT_BIT);
00099   glPushAttrib(GL_LIGHTING_BIT);
00100 
00101     glBegin(GL_TRIANGLES);
00102 
00103     // Inner Triangle
00104 
00105     glColor3ub(128,0,128);
00106     glVertex3f(P1.x,P1.y,P1.z);
00107     glVertex3f(P0.x,P0.y,P0.z);
00108     glColor3ub(0,255,0);
00109     glVertex3f(P2.x,P2.y,P2.z);
00110 
00111 
00112     // Outer Triangle
00113 
00114     glColor3ub(0,255,0);
00115     glVertex3f(P2.x,P2.y,P2.z);
00116     glColor3ub(255,0,0);
00117     glVertex3f(P0.x,P0.y,P0.z);
00118     glVertex3f(P1.x,P1.y,P1.z);
00119 
00120     glEnd();
00121 
00122     glColor3ub(255,215,0);
00123 
00124     double const radius=0.02;
00125 
00126     glPushMatrix();
00127     glTranslatef(P0.x,P0.y,P0.z);
00128     glutSolidSphere(radius,10,10);
00129     glPopMatrix();
00130 
00131     glPushMatrix();
00132     glTranslatef(P1.x,P1.y,P1.z);
00133     glutSolidSphere(radius,10,10);
00134     glPopMatrix();
00135 
00136     glPushMatrix();
00137     glTranslatef(P2.x,P2.y,P2.z);
00138     glutSolidSphere(radius,10,10);
00139     glPopMatrix();
00140 
00141     glPushMatrix();
00142     glTranslatef(P3.x,P3.y,P3.z);
00143     glutSolidSphere(radius,10,10);
00144     glPopMatrix();
00145 
00146 // TODO - transparent sides for better visualization of cp
00147 
00148 // I am unable to get this working. 
00149 //
00150 //  What I wanted was transpent sides of the cp other than the base. 
00151 //  The color of the inner triangle should come through.
00152 
00153 //    glDisable(GL_DEPTH_TEST);
00154 //    glEnable(GL_BLEND);
00155 //    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00156 
00157 //    float const blendratio = 0.05;
00158     
00159 
00160 
00161 
00162     
00163 //    glBegin(GL_TRIANGLES);
00164 
00165 //    glVertex4f(P0.x,P0.y,P0.z,blendratio);
00166 //    glVertex4f(P2.x,P2.y,P2.z,blendratio);
00167 //    glVertex4f(P3.x,P3.y,P3.z,blendratio);
00168 
00169 /*
00170     glVertex3f(P0.x,P0.y,P0.z);
00171     glVertex3f(P2.x,P2.y,P2.z);
00172     glVertex3f(P3.x,P3.y,P3.z);
00173 
00174     glVertex3f(P2.x,P2.y,P2.z);
00175     glVertex3f(P1.x,P1.y,P1.z);
00176     glVertex3f(P3.x,P3.y,P3.z);
00177 
00178     glVertex3f(P0.x,P0.y,P0.z);
00179     glVertex3f(P3.x,P3.y,P3.z);
00180     glVertex3f(P1.x,P1.y,P1.z);
00181 */
00182 
00183 
00184 /*
00185     glVertex4f(P0.x,P0.y,P0.z,blendratio);
00186     glVertex4f(P1.x,P1.y,P1.z,blendratio);
00187     glVertex4f(P2.x,P2.y,P2.z,blendratio);
00188 
00189     glVertex4f(P0.x,P2.y,P2.z,blendratio);
00190     glVertex4f(P3.x,P3.y,P3.z,blendratio);
00191     glVertex4f(P0.x,P0.y,P0.z,blendratio);
00192 
00193     glVertex4f(P1.x,P1.y,P1.z,blendratio);
00194     glVertex4f(P0.x,P0.y,P0.z,blendratio);
00195     glVertex4f(P3.x,P3.y,P3.z,blendratio);
00196 
00197     glVertex4f(P2.x,P2.y,P2.z,blendratio);
00198     glVertex4f(P1.x,P1.y,P1.z,blendratio);
00199     glVertex4f(P3.x,P3.y,P3.z,blendratio);
00200 */
00201 
00202 //    glEnd();
00203 
00204 
00205     glDisable(GL_BLEND);
00206     glEnable(GL_DEPTH_TEST);
00207 
00208 
00209 
00210   glPopAttrib();
00211   glPopAttrib();
00212 
00213 }

void writecpobj::draw (  )  [virtual]

Draw the object.

Implements gobj.

Definition at line 179 of file d3tessdraw.cpp.

References d3tess::cpsimplex(), simplexD2linked::pi, d3tess::pt, d3tess::vi, d3tess::vs, point3< T >::x, and point3< T >::y.

00180 {
00181   glPushAttrib(GL_CURRENT_BIT);
00182   glPushAttrib(GL_LIGHTING_BIT);
00183 
00184   simplexD2linked const & cp(tess.cpsimplex());
00185   virtualtriangle const & vs(tess.vs);
00186 
00187   pt3 P0(tess.pt[ cp.pi[vs.v[0]] ]);
00188   pt3 P1(tess.pt[ cp.pi[vs.v[1]] ]);
00189   pt3 P2(tess.pt[ cp.pi[vs.v[2]] ]);
00190 
00191   float const blendratio = 0.85;
00192 
00193   glBegin(GL_TRIANGLES);
00194 
00195 
00196 /*
00197     glColor3ub(255,0,0);
00198     glVertex2f(P0.x,P0.y);
00199     glVertex2f(P1.x,P1.y);
00200     glColor3ub(0,255,0);
00201     glVertex2f(P2.x,P2.y);
00202 */
00203 
00204     glColor4f(1.0,0.0,0.0,blendratio);
00205     glVertex2f(P0.x,P0.y);
00206     glVertex2f(P1.x,P1.y);
00207     glColor4f(0.0,1.0,0.0,blendratio);
00208     glVertex2f(P2.x,P2.y);
00209 
00210   glColor4f(1.0,156.0/255.0,0.0,blendratio);
00211 //  glColor3ub(255,165,0);
00212 
00213   for (uint i=0; i<3; ++i)
00214   {
00215     if (cp.ni[i]==0)
00216       continue;
00217 
00218     simplexD2linked const & nb(tess.vi[cp.ni[i]]);
00219 
00220     pt3 const & P0(tess.pt[ nb.pi[0] ]);
00221     pt3 const & P1(tess.pt[ nb.pi[1] ]);
00222     pt3 const & P2(tess.pt[ nb.pi[2] ]);
00223 
00224     glVertex2f(P0.x,P0.y);
00225     glVertex2f(P1.x,P1.y);
00226     glVertex2f(P2.x,P2.y);
00227   }
00228 
00229   glEnd();
00230 
00231   glPopAttrib();
00232   glPopAttrib();
00233 
00234 }


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

Generated on Fri Mar 4 00:50:25 2011 for Chelton Evans Source by  doxygen 1.5.8