Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

color.cc

Go to the documentation of this file.
00001 #include "color.hh"
00002 #include "register.hh"
00003 #include <stdlib.h>
00004 #include <GL/gl.h>
00005 
00006 namespace anoid {
00007     namespace plugin {
00008 
00009         using namespace simple;
00010         using namespace config;
00011 
00012         void Color::init(Configuration &c) {
00013             color = c.getVector("color");
00014             Ability::init(c);
00015             registerName("Color");
00016         }
00017 
00018         Vector Color::getColor() {
00019             return color;
00020         }
00021 
00022         void Color::setColor(const Vector &v) {
00023             color = v;
00024         }
00025 
00026         Color::Color(): color(I) {
00027         }
00028 
00029         void Color::redraw() {
00030             glColor4f(color.getX(), color.getY(), color.getZ(), 1.0);
00031             GLfloat light[] = {color.getX(), color.getY(), color.getZ(), 1.0};
00032             glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, light);
00033             //  glMaterialfv(GL_FRONT, GL_SPECULAR, light);
00034             glMaterialf(GL_FRONT, GL_SHININESS, 1.0);
00035 
00036             Ability::redraw();
00037         }
00038 
00039         Register(Color)
00040 
00041     };
00042 };

Anoid NG © Michael Westergaard, Martin Stig Stissing, Ronni Michael Laursen, and Kristian Bisgaard Lassen