eqemu

annotate src/material.cc @ 3:f9274bebe55e

adding 3d graphics stuff
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 17 Jul 2014 02:35:19 +0300
parents
children 3d3656360a82
rev   line source
nuclear@3 1 #include <GL/glew.h>
nuclear@3 2 #include "material.h"
nuclear@3 3
nuclear@3 4 Material::Material()
nuclear@3 5 : color(1, 1, 1), specular(0, 0, 0)
nuclear@3 6 {
nuclear@3 7 shininess = 1.0;
nuclear@3 8 alpha = 1.0;
nuclear@3 9 }
nuclear@3 10
nuclear@3 11 void Material::setup() const
nuclear@3 12 {
nuclear@3 13 float col[] = {color.x, color.y, color.z, alpha};
nuclear@3 14 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, col);
nuclear@3 15
nuclear@3 16 float spec[] = {specular.x, specular.y, specular.z, 1.0};
nuclear@3 17 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec);
nuclear@3 18
nuclear@3 19 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess > 128 ? 128 : shininess);
nuclear@3 20 }