From b9d8d358aab136fb1d1242360fe4f3c3711bde11 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 8 May 2021 22:43:43 +0300 Subject: [PATCH] Deprecate the old skylight properties in Lighting It's no longer supported by the standard shaders, and IBL is a superior solution. --- source/materials/lighting.cpp | 12 +++++++++--- source/materials/lighting.h | 6 +++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/source/materials/lighting.cpp b/source/materials/lighting.cpp index b19ebab0..3bbc01a3 100644 --- a/source/materials/lighting.cpp +++ b/source/materials/lighting.cpp @@ -153,14 +153,14 @@ void Lighting::Loader::init_actions() add("fog_color", &Loader::fog_color); add("fog_density", &Loader::fog_density); 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("horizon_angle", &Loader::horizon_angle); add("light", &Loader::light_inline_index); + add("sky_color", &Loader::sky_color); + add("zenith_direction", &Loader::zenith_direction); } void Lighting::Loader::ambient(float r, float g, float b) @@ -183,10 +183,13 @@ void Lighting::Loader::fog_half_distance(float d) obj.set_fog_half_distance(d); } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" void Lighting::Loader::horizon_angle(float a) { obj.set_horizon_angle(Geometry::Angle::from_degrees(a)); } +#pragma GCC diagnostic pop void Lighting::Loader::light(const string &name) { @@ -206,6 +209,8 @@ 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)); @@ -215,6 +220,7 @@ 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 diff --git a/source/materials/lighting.h b/source/materials/lighting.h index 833e7d2b..a2f84c32 100644 --- a/source/materials/lighting.h +++ b/source/materials/lighting.h @@ -72,15 +72,15 @@ public: const Color &get_ambient() const { return ambient; } /** Sets the color of the sky at zenith. Has no effect without shaders. */ - void set_sky_color(const Color &); + DEPRECATED void set_sky_color(const Color &); /** Sets the direction of the zenith. Defaults to positive Z axis. Has no effect without shaders. */ - void set_zenith_direction(const Vector3 &); + DEPRECATED void set_zenith_direction(const Vector3 &); /** Sets the angle where skylight cuts off, counted from the true horizon. Has no effect without shaders. */ - void set_horizon_angle(const Geometry::Angle &); + DEPRECATED void set_horizon_angle(const Geometry::Angle &); /** Sets the fog color, which is blended into distant surfaces. */ void set_fog_color(const Color &); -- 2.45.2