#include "line3d.h" using namespace Qwt3D; Qwt3D::Line3D::Line3D() { rgba.a = 1; rgba.b = 0.3; rgba.r = 0.6; rgba.g = 1; } Qwt3D::Line3D::Line3D(double thick,bool smooth) { lineThick = thick; smooth_ = smooth; rgba.a = 1; rgba.b = 0.3; rgba.r = 0.6; rgba.g = 1; } void Qwt3D::Line3D::configure(double thick, bool smooth) { lineThick = thick; smooth_ = smooth; } void Qwt3D::Line3D::drawBegin() { setDeviceLineWidth(lineThick); oldstate_ = glIsEnabled(GL_LINE_SMOOTH); if (smooth_) glEnable(GL_LINE_SMOOTH); else glDisable(GL_LINE_SMOOTH); //glPointSize(10); glBegin( GL_LINE_STRIP); } void Qwt3D::Line3D::drawEnd() { glEnd(); if (oldstate_) glEnable(GL_LINE_SMOOTH); else glDisable(GL_LINE_SMOOTH); } void Qwt3D::Line3D::draw(Qwt3D::Triple const& pos) { glColor4d(rgba.r,rgba.g,rgba.b,rgba.a); glVertex3d(pos.x,pos.y,pos.z); } void Qwt3D::Line3D::draw() { for (int i = 0; i < lineData.size(); i ++) { draw(lineData[i]); } } void Qwt3D::Line3D::rdraw() { for (int i = lineData.size()-1; i >0; i--) { draw(lineData[i]); } } void Qwt3D::Line3D::add(Qwt3D::Triple const & t) { lineData.push_back(t); } void Qwt3D::Line3D::setLineColor(RGBA color) { this->rgba = color; } //void Qwt3D::Line3D::getColor(int pointIndex) //{ //}