/*
 * (C) C3R14L.K1L4 / João Carlos Ferreira Gonçalves
 * further contact: jcgonc@student.dei.uc.pt
 * 03-04-2007
 * checked on 14-04-2007: OK, clean
 */
#ifndef C3R14L_COLOR4F_HEADER
#define C3R14L_COLOR4F_HEADER

#ifndef GLfloat
#include<gl/GL.h>
#endif

class Color4f {
public:
	float r, g, b, a;
	float array[4];

	Color4f() {
		r = 0;
		g = 0;
		b = 0;
		a = 1.0;
	}

	Color4f(float s) {
		r = s;
		g = s;
		b = s;
		a = 1.0;
	}

	Color4f(float nr, float ng, float nb) {
		r = nr;
		g = ng;
		b = nb;
		a = 1.0;
	}

	Color4f(float nr, float ng, float nb, float na) {
		r = nr;
		g = ng;
		b = nb;
		a = na;
	}

	void scale(float sr, float sg, float sb, float sa) {
		r *= sr;
		g *= sg;
		b *= sb;
		a *= sa;
	}

	void scale(float sr, float sg, float sb) {
		scale(sr, sg, sb, 1.0);
	}

	void scale(float ss, float sa) {
		scale(ss, ss, ss, sa);
	}

	void scale(float ss) {
		scale(ss, ss, ss, 1.0);
	}

	void bias(float sr, float sg, float sb, float sa) {
		r += sr;
		g += sg;
		b += sb;
		a += sa;
	}

	void bias(float sr, float sg, float sb) {
		bias(sr, sg, sb, 1.0);
	}

	void bias(float ss, float sa) {
		bias(ss, ss, ss, sa);
	}

	void bias(float ss) {
		bias(ss, ss, ss, 1.0);
	}

	GLfloat* to4GLfloat() {
		array[0] = (GLfloat) r;
		array[1] = (GLfloat) g;
		array[2] = (GLfloat) b;
		array[3] = (GLfloat) a;
		return array;
	}

	~Color4f() {
	}
};
#endif
