core/vgui/vgui_soview3D.cxx
Go to the documentation of this file.
00001 // This is core/vgui/vgui_soview3D.cxx
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005 //:
00006 // \file
00007 // \author Philip C. Pritchett, RRG, University of Oxford
00008 // \date   24 Mar 99
00009 // \brief  See vgui_soview3D.h for a description of this file.
00010 
00011 #include "vgui_soview3D.h"
00012 #include <vcl_iostream.h>
00013 #include <vgui/vgui_gl.h>
00014 
00015 //--------------------------------------------------------------------------//
00016 
00017 vcl_ostream& vgui_point3D::print(vcl_ostream& s) const
00018 {
00019   s << "[vgui_point3D " << x << ',' << y << ',' << z << ' ';
00020   return vgui_soview3D::print(s) << ']';
00021 }
00022 
00023 void vgui_point3D::draw() const
00024 {
00025   bool lighting = false;
00026   if (glIsEnabled(GL_LIGHTING)) {
00027     lighting = true;
00028     glDisable(GL_LIGHTING);
00029   }
00030 
00031   //glPointSize(style->point_size);
00032   glBegin(GL_POINTS);
00033   glVertex3f(x,y,z);
00034   glEnd();
00035 
00036 
00037   if (lighting)
00038     glEnable(GL_LIGHTING);
00039 }
00040 
00041 //--------------------------------------------------------------------------//
00042 
00043 vcl_ostream& vgui_lineseg3D::print(vcl_ostream& s) const
00044 {
00045   s << "[vgui_lineseg3D " << x0 << ',' << y0 << ',' << z0
00046     << " - " << x1 << ',' << y1 << ',' << z1 << ' ';
00047   return vgui_soview3D::print(s) << ']';
00048 }
00049 
00050 void vgui_lineseg3D::draw() const
00051 {
00052 #ifdef DEBUG
00053   vcl_cerr << "vgui_lineseg3D::draw() line id=" << id << '\n';
00054 #endif
00055 
00056   bool lighting = false;
00057   if (glIsEnabled(GL_LIGHTING)) {
00058     lighting = true;
00059     glDisable(GL_LIGHTING);
00060   }
00061 
00062   //glLineWidth(style->line_width);
00063   glBegin(GL_LINES);
00064   glVertex3f(x0,y0,z0);
00065   glVertex3f(x1,y1,z1);
00066   glEnd();
00067 
00068   if (lighting)
00069     glEnable(GL_LIGHTING);
00070 }
00071 
00072 //--------------------------------------------------------------------------//
00073 
00074 vcl_ostream& vgui_triangle3D::print(vcl_ostream& s) const
00075 {
00076   s << "[vgui_triangle3D " << x0 << ',' << y0 << ',' << z0
00077     << " - " << x1 << ',' << y1 << ',' << z1
00078     << " - " << x2 << ',' << y2 << ',' << z2 << ' ';
00079   return vgui_soview3D::print(s) << ']';
00080 }
00081 
00082 void vgui_triangle3D::draw() const
00083 {
00084   bool lighting = false;
00085   if (glIsEnabled(GL_LIGHTING)) {
00086     lighting = true;
00087     glDisable(GL_LIGHTING);
00088   }
00089 
00090   glBegin(GL_TRIANGLES);
00091   glVertex3f(x0,y0,z0);
00092   glVertex3f(x1,y1,z1);
00093   glVertex3f(x2,y2,z2);
00094   glEnd();
00095 
00096   if (lighting)
00097     glEnable(GL_LIGHTING);
00098 }