#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() { } void Thing::setIterations(int i) { } Thing::~Thing() { } 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); glTranslatef(position->x(), position->y(), position->z()); 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); } ThingGroup::ThingGroup ( ) { } void ThingGroup::addThing ( Thing* t ) { things.push_back(t); } void ThingGroup::show ( ) { for ( std::vector<Thing*>::size_type i = 0; i < things.size(); i++ ) { things.at(i)->show(); } } void ThingGroup::hide ( ) { for ( std::vector<Thing*>::size_type i = 0; i < things.size(); i++ ) { things.at(i)->hide(); } } void ThingGroup::draw ( ) { for ( std::vector<Thing*>::size_type i = 0; i < things.size(); i++ ) { things.at(i)->draw(); } } void ThingGroup::rotate ( Vec rot ) { for ( std::vector<Thing*>::size_type i = 0; i < things.size(); i++ ) { things.at(i)->rotate((Vec)rot); } }