X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmaterials%2Flighting.cpp;h=20c812fe58cfd3e6ee7434bef5f10707db67f01c;hb=5008778dbb1840bf7c6d479800d2b932f8386fb2;hp=699aabc02c7daa8679d60b2ab6fd8eaf8d99723b;hpb=3ac3a51c623271da815c8ee60c484445871753bf;p=libs%2Fgl.git diff --git a/source/materials/lighting.cpp b/source/materials/lighting.cpp index 699aabc0..20c812fe 100644 --- a/source/materials/lighting.cpp +++ b/source/materials/lighting.cpp @@ -1,21 +1,18 @@ #include #include #include +#include #include -#include "error.h" +#include #include "light.h" #include "lighting.h" -#include "matrix.h" -#include "misc.h" using namespace std; namespace Msp { namespace GL { -Lighting::Lighting(): - zenith_direction(0, 0, 1), - horizon_angle(Geometry::Angle::zero()) +Lighting::Lighting() { set_ambient(0.2f); set_fog_color(Color(0.0f, 0.0f, 0.0f, 0.0f)); @@ -28,24 +25,6 @@ void Lighting::set_ambient(const Color &a) shdata.uniform("ambient_color", ambient); } -void Lighting::set_sky_color(const Color &s) -{ - sky_color = s; - shdata.uniform("sky_color", sky_color); -} - -void Lighting::set_zenith_direction(const Vector3 &d) -{ - zenith_direction = d; - shdata.uniform("world_zenith_dir", zenith_direction); -} - -void Lighting::set_horizon_angle(const Geometry::Angle &a) -{ - horizon_angle = a; - shdata.uniform("horizon_limit", horizon_angle.radians()); -} - void Lighting::set_fog_color(const Color &c) { fog_color = c; @@ -74,38 +53,11 @@ void Lighting::attach(const Light &l) void Lighting::detach(const Light &l) { - vector::iterator i = find_member(lights, &l, &AttachedLight::light); + auto i = find_member(lights, &l, &AttachedLight::light); if(i!=lights.end()) lights.erase(i); } -void Lighting::detach(unsigned i) -{ - if(i>=lights.size()) - return; - - detach(*lights[i].light); -} - -const Light *Lighting::get_attached_light(unsigned i) const -{ - return iupdate_shader_data(sd, i); -} - const ProgramData &Lighting::get_shader_data() const { for(unsigned i=0; i::from_degrees(a)); -} -#pragma GCC diagnostic pop - void Lighting::Loader::light(const string &name) { obj.attach(get_collection().get(name)); @@ -199,23 +137,5 @@ void Lighting::Loader::light_inline() obj.attach(*lgt.release()); } -void Lighting::Loader::light_inline_index(unsigned) -{ - light_inline(); -} - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -void Lighting::Loader::sky_color(float r, float g, float b) -{ - obj.set_sky_color(Color(r, g, b)); -} - -void Lighting::Loader::zenith_direction(float x, float y, float z) -{ - obj.set_zenith_direction(Vector3(x, y, z)); -} -#pragma GCC diagnostic pop - } // namespace GL } // namespace Msp