--- /dev/null
+#include "pointlight.h"
+#include "programdata.h"
+
+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);
+}
+
+void PointLight::set_matrix(const Matrix &m)
+{
+ Placeable::set_matrix(m);
+ position = matrix.column(3).slice<3>(0);
+ update_matrix();
+ ++generation;
+}
+
+void PointLight::set_position(const Vector3 &p)
+{
+ position = p;
+ update_matrix();
+ ++generation;
+}
+
+void PointLight::set_attenuation(float c, float l, float q)
+{
+ attenuation[0] = c;
+ attenuation[1] = l;
+ attenuation[2] = q;
+ ++generation;
+}
+
+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+".color", color.r, color.g, color.b);
+}
+
+
+DataFile::Loader::ActionMap PointLight::Loader::shared_actions;
+
+PointLight::Loader::Loader(PointLight &l):
+ DerivedObjectLoader<PointLight, Light::Loader>(l)
+{
+ set_actions(shared_actions);
+}
+
+void PointLight::Loader::init_actions()
+{
+ Light::Loader::init_actions();
+ add("attenuation", &Loader::attenuation);
+ add("position", &Loader::position);
+}
+
+void PointLight::Loader::attenuation(float c, float l, float q)
+{
+ obj.set_attenuation(c, l, q);
+}
+
+void PointLight::Loader::position(float x, float y, float z)
+{
+ obj.set_position(Vector3(x, y, z));
+}
+
+} // namespace GL
+} // namespace Msp