ld33_umonster

diff src/light.cc @ 0:4a6683050e29

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 22 Aug 2015 07:15:00 +0300
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/light.cc	Sat Aug 22 07:15:00 2015 +0300
     1.3 @@ -0,0 +1,17 @@
     1.4 +#include "light.h"
     1.5 +#include "opengl.h"
     1.6 +
     1.7 +Light::Light()
     1.8 +	: color(1, 1, 1)
     1.9 +{
    1.10 +}
    1.11 +
    1.12 +void Light::setup(int idx) const
    1.13 +{
    1.14 +	float lpos[] = {pos.x, pos.y, pos.z, 1.0};
    1.15 +	float col[] = {color.x, color.y, color.z, 1.0};
    1.16 +
    1.17 +	glLightfv(GL_LIGHT0 + idx, GL_POSITION, lpos);
    1.18 +	glLightfv(GL_LIGHT0 + idx, GL_DIFFUSE, col);
    1.19 +	glLightfv(GL_LIGHT0 + idx, GL_SPECULAR, col);
    1.20 +}