DataFile::Loader::ActionMap Lighting::Loader::shared_actions;
Lighting::Loader::Loader(Lighting &l):
- DataFile::ObjectLoader<Lighting>(l)
+ CollectionObjectLoader<Lighting>(l, 0)
+{
+ set_actions(shared_actions);
+}
+
+Lighting::Loader::Loader(Lighting &l, Collection &c):
+ CollectionObjectLoader<Lighting>(l, &c)
{
set_actions(shared_actions);
}
add("fog_half_distance", &Loader::fog_half_distance);
add("horizon_angle", &Loader::horizon_angle);
add("light", &Loader::light);
+ add("light", &Loader::light_inline);
add("sky_color", &Loader::sky_color);
add("zenith_direction", &Loader::zenith_direction);
// Deprecated
- add("light", &Loader::light_index);
+ add("light", &Loader::light_inline_index);
}
void Lighting::Loader::ambient(float r, float g, float b)
obj.set_horizon_angle(Geometry::Angle<float>::from_degrees(a));
}
-void Lighting::Loader::light()
+void Lighting::Loader::light(const string &name)
+{
+ obj.attach(get_collection().get<Light>(name));
+}
+
+void Lighting::Loader::light_inline()
{
RefPtr<Light> lgt = new Light;
load_sub(*lgt);
obj.owned_data.push_back(lgt.release());
}
-void Lighting::Loader::light_index(unsigned)
+void Lighting::Loader::light_inline_index(unsigned)
{
light_inline();
}
class Lighting
{
public:
- class Loader: public DataFile::ObjectLoader<Lighting>
+ class Loader: public DataFile::CollectionObjectLoader<Lighting>
{
private:
static ActionMap shared_actions;
public:
Loader(Lighting &);
+ Loader(Lighting &, Collection &);
private:
virtual void init_actions();
void fog_density(float);
void fog_half_distance(float);
void horizon_angle(float);
- void light();
- void light_index(unsigned);
+ void light(const std::string &);
+ void light_inline();
+ void light_inline_index(unsigned);
void sky_color(float, float, float);
void zenith_direction(float, float, float);
};
#include "camera.h"
#include "font.h"
#include "keyframe.h"
+#include "light.h"
#include "lighting.h"
#include "material.h"
#include "mesh.h"
add_type<Camera>().keyword("camera");
add_type<Font>().keyword("font");
add_type<KeyFrame>().suffix(".kframe").keyword("keyframe");
+ add_type<Light>().keyword("light");
add_type<Lighting>().suffix(".lightn").keyword("lighting");
add_type<Material>().suffix(".mat").creator(&Resources::create_material);
add_type<Mesh>().keyword("mesh").creator(&Resources::create_mesh);