1 #include "pointlight.h"
2 #include "programdata.h"
9 void PointLight::update_matrix()
11 matrix = Matrix::translation(position);
14 void PointLight::set_matrix(const Matrix &m)
16 Placeable::set_matrix(m);
17 position = matrix.column(3).slice<3>(0);
22 void PointLight::set_position(const Vector3 &p)
29 void PointLight::set_attenuation(float c, float l, float q)
37 void PointLight::update_shader_data(ProgramData &shdata, const string &base) const
39 shdata.uniform(base+".type", 2);
40 shdata.uniform(base+".position", position.x, position.y, position.z, 1.0f);
41 shdata.uniform(base+".color", color.r, color.g, color.b);
42 shdata.uniform3(base+".attenuation", attenuation);
46 DataFile::Loader::ActionMap PointLight::Loader::shared_actions;
48 PointLight::Loader::Loader(PointLight &l):
49 DerivedObjectLoader<PointLight, Light::Loader>(l)
51 set_actions(shared_actions);
54 void PointLight::Loader::init_actions()
56 Light::Loader::init_actions();
57 add("attenuation", &Loader::attenuation);
58 add("position", &Loader::position);
61 void PointLight::Loader::attenuation(float c, float l, float q)
63 obj.set_attenuation(c, l, q);
66 void PointLight::Loader::position(float x, float y, float z)
68 obj.set_position(Vector3(x, y, z));