#include "glumodel.h" #include <string> GluModel::GluModel() { init(Vec(0,0,0), Material()); } GluModel::GluModel(Vec _pos, Material _mat) { init(_pos, _mat); } void GluModel::init(Vec _pos, Material _mat) { pos = _pos.clone(); rot = new Vec(0,0,0); scale = 1; mat = _mat.clone(); pt = gluNewQuadric(); enabled = true; } GluSphere::GluSphere() { init(Vec(0,0,0), Material(Color(1,0,1)), 10); } GluSphere::GluSphere(Vec _pos, Material _mat, float _rad) { init(_pos, _mat, _rad); } void GluSphere::init(Vec _pos, Material _mat, float _rad) { GluModel::init(_pos, _mat); rad = _rad; } void GluSphere::draw() { glPushMatrix(); glRotatef(rot->x(), 1.0f, 0.0f, 0.0f); glRotatef(rot->y(), 0.0f, 1.0f, 0.0f); glRotatef(rot->z(), 0.0f, 0.0f, 1.0f); glTranslatef(pos->x(), pos->y(), pos->z()); if (enabled) { mat->draw(); gluSphere(gluNewQuadric(), rad, 300, 300); } glPopMatrix(); }