00001
00002 #include <blort/TomGine/tgLighting.h>
00003
00004 using namespace TomGine;
00005
00006 tgLight::tgLight(){
00007 ambient = vec4(0.0, 0.0, 0.0, 1.0);
00008 diffuse = vec4(1.0, 1.0, 1.0, 1.0);
00009 specular = vec4(1.0, 1.0, 1.0, 1.0);
00010 position = vec4(0.0, 0.0, 1.0, 0.0);
00011 }
00012
00013 void tgLighting::ApplyLight(tgLight light, int index){
00014 glLightfv(GL_LIGHT0+index, GL_AMBIENT, light.ambient);
00015 glLightfv(GL_LIGHT0+index, GL_DIFFUSE, light.diffuse);
00016 glLightfv(GL_LIGHT0+index, GL_SPECULAR, light.specular);
00017 glLightfv(GL_LIGHT0+index, GL_POSITION, light.position);
00018 glEnable(GL_LIGHT0+index);
00019 }
00020
00021 void tgLighting::Activate(){
00022 glEnable(GL_LIGHTING);
00023 }
00024
00025 void tgLighting::Deactivate(){
00026 glDisable(GL_LIGHTING);
00027 }
00028
00029