#include "light.h"
#include <GL/gl.h>
#include <GL/glu.h>
Light::Light(Vec* _pos, Vec* _dir) {
pos = _pos;
dir = _dir;
}
void Light::trace() {
glBegin (GL_LINES);
glVertex3fv(pos->getCoords());
glVertex3fv(dir->getCoords());
glEnd();
}
void Light::draw() {
//printf(GL_LIGHT0);
glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 180.0f);
float p [4] = {pos->x(), pos->y(), pos->z(), 1.0f};
float d [4] = {dir->x(), dir->y(), dir->z(), 1.0f};
glLightfv(GL_LIGHT0, GL_POSITION, p);
glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, d);
}