Newer
Older
cg / sources / thing.cpp
@glproj03 glproj03 on 1 Feb 2006 1 KB added material
#include "thing.h"

#include <GL/gl.h>
#include <GL/glu.h>

void Thing::draw() { }
void Thing::rotate(Vec rot) { }
void Thing::setColor(Color* c) { }
void Thing::setColor(Color c) { }
void Thing::setDelta(float d) { }
void Thing::showNormals() { }
void Thing::hideNormals() { }
void Thing::setPosition(Vec newpos) { }
void Thing::setCenter(Vec newcenter) { }
void Thing::translate(Vec d) { }
void Thing::scale(float f) { }
void Thing::trace(bool s) { }
void Thing::show() { }
void Thing::hide() { }

View::View() {
	rotation = new Vec(0.0f, 0.0f, 0.0f);
	position = new Vec(0.0f, 0.0f, 0.0f);
	bgcolor = new Color(0.0f, 0.0f, 0.0f);
}

View::View(Vec pos) {
	rotation = new Vec(0.0f, 0.0f, 0.0f);
	position = pos.clone();
	bgcolor = new Color(0.0f, 0.0f, 0.0f);
}

View::View(Vec pos, Vec rot) {
	rotation = rot.clone();
	position = pos.clone();
	bgcolor = new Color(0.0f, 0.0f, 0.0f);
}

void View::rotate(Vec rot) {
	rotation->add((Vec)rot);
}
void View::setPosition(Vec newpos) {
	delete position;
	position = newpos.clone();
}
void View::translate(Vec d) { 
	position->add((Vec)d);
}
void View::setColor(Color* c) {
	bgcolor = c;
}
void View::draw() {
  //glClearColor(bgcolor->r, bgcolor->g, bgcolor->b, 1.0f);

	glRotatef(rotation->x(), 1.0f, 0.0f, 0.0f);
	glRotatef(rotation->y(), 0.0f, 1.0f, 0.0f);
	glRotatef(rotation->z(), 0.0f, 0.0f, 1.0f);

	glTranslatef(position->x(), position->y(), position->z());

}