00001 #include "line.h" 00002 00007 using namespace std; 00008 00010 00011 GltLine::GltLine() 00012 : _width(1.0f) 00013 { 00014 } 00015 00016 GltLine::~GltLine() 00017 { 00018 } 00019 00020 void 00021 GltLine::draw() const 00022 { 00023 const bool noLighting = _normals.size()==0; 00024 00025 glPushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT | GL_LINE_BIT); 00026 glPushMatrix(); 00027 transformation().glMultMatrix(); 00028 00029 if (noLighting) 00030 glDisable(GL_LIGHTING); 00031 00032 glColor(); 00033 00034 if (!solid()) 00035 glPointSize(_width); 00036 else 00037 glLineWidth(_width); 00038 00039 glBegin(solid() ? GL_LINE_STRIP : GL_POINTS); 00040 for (uint32 i=0; i<_points.size(); i++) 00041 _points[i].glVertex(); 00042 glEnd(); 00043 00044 glPopMatrix(); 00045 glPopAttrib(); 00046 } 00047 00048 bool 00049 GltLine::boundingBox(Vector &min,Vector &max) const 00050 { 00051 return false; 00052 } 00053 00054 string GltLine::description() const 00055 { 00056 return "Line."; 00057 } 00058 00059 const vector<Vector> &GltLine::points() const { return _points; } 00060 const vector<Vector> &GltLine::normals() const { return _normals; } 00061 00062 vector<Vector> &GltLine::points() { return _points; } 00063 vector<Vector> &GltLine::normals() { return _normals; } 00064 00065 const GLfloat &GltLine::width() const { return _width; } 00066 GLfloat &GltLine::width() { return _width; } 00067