home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 52
/
Amiga_Dream_52.iso
/
Linux
/
Divers
/
freedraft.tar.gz
/
freedraft.tar
/
FREEdraft-050298
/
DRAWABLES
/
drawableline.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1998-04-23
|
2KB
|
55 lines
// drawableline.cpp
// Copyright (C) 1997 Cliff Johnson //
// //
// This program is free software; you can redistribute it and/or //
// modify it under the terms of the GNU General Public //
// License as published by the Free Software Foundation; either //
// version 2 of the License, or (at your option) any later version. //
// //
// This software is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
// General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this software (see COPYING); if not, write to the //
// Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //
#include <geom_enum.h>
#include <drawableline.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <point.h>
#include <line.h>
DrawableLine::DrawableLine(): DrawableGeom(LINE) {}
void DrawableLine::Draw(const Geom* geom,const float& scale) const
{
if(DrawableGeom::Type()!=LINE)return;
Line l = Line(*(reinterpret_cast<const Line* >(geom) ) );
Point p0 = l.Origin() + (10000. * l.Direction());
Point p1 = l.Origin() - (10000. * l.Direction());
glBegin(GL_LINES);
glVertex2f(p0[0],p0[1]);
glVertex2f(p1[0],p1[1]);
glEnd();
}
void DrawableLine::Select(const Geom* geom,const Handle& h,const float& scale) const
{
if(DrawableGeom::Type()!=LINE)return;
glLoadName(h.Value());
Line l = Line(*(reinterpret_cast<const Line* >(geom) ) );
Point p0 = l.Origin() + (10000. * l.Direction());
Point p1 = l.Origin() - (10000. * l.Direction());
glBegin(GL_LINES);
glVertex2f(p0[0],p0[1]);
glVertex2f(p1[0],p1[1]);
glEnd();
}