Newer
Older
cg / sources / color.cpp
@glproj03 glproj03 on 2 Feb 2006 620 bytes es werde licht
#include "color.h"

Color::Color(float r, float g, float b) {
  c[0] = r;
  c[1] = g;
  c[2] = b;
  c[3] = 1.0f;
}

void Color::drawColor() {
  glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, c);
}

void Color::drawColor(GLenum pname) {
  glMaterialfv(GL_FRONT, pname, c);
}

Color* Color::clone() {
  Color* c = new Color(r(),g(),b());
  return c;
}

void Color::vardump(std::string whitespace) {
  printf("%sColor(%f, %f, %f)\n", whitespace.c_str(),
		 c[0], c[1], c[2]);
}

float* Color::v() {
  return c;
}
float Color::r() {
  return c[0];
}

float Color::g() {
  return c[1];
}

float Color::b() {
  return c[2];
}