]> git.tdb.fi Git - libs/gl.git/blobdiff - source/materials/pointlight.cpp
Some tweaks to vector component handling
[libs/gl.git] / source / materials / pointlight.cpp
index 4bbf4135dae9a7eabe6a24ba2c8a90cf62999781..1607066c093df4501556ccde918faf650dd05c00 100644 (file)
@@ -6,11 +6,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-PointLight::PointLight():
-       position(0.0f, 0.0f, 0.0f),
-       attenuation{1.0f, 0.0f, 0.1f}
-{ }
-
 void PointLight::update_matrix()
 {
        matrix = Matrix::translation(position);
@@ -42,8 +37,9 @@ void PointLight::set_attenuation(float c, float l, float q)
 void PointLight::update_shader_data(ProgramData &shdata, const string &base) const
 {
        shdata.uniform(base+".type", 2);
-       shdata.uniform(base+".position", position.x, position.y, position.z, 1.0f);
+       shdata.uniform(base+".position", compose(position, 1.0f));
        shdata.uniform(base+".color", color.r, color.g, color.b);
+       shdata.uniform3(base+".attenuation", attenuation);
 }