From de5281c3989fd4071cf57e5b7bc0cbbc174524e8 Mon Sep 17 00:00:00 2001 From: Saracen Date: Sun, 31 Jan 2016 12:56:53 +0000 Subject: Ability to colourize baked lighting in real time. --- scene/resources/baked_light.cpp | 46 +++++++++++++++++++++++++++++++++++++++++ scene/resources/baked_light.h | 9 ++++++++ 2 files changed, 55 insertions(+) (limited to 'scene/resources') diff --git a/scene/resources/baked_light.cpp b/scene/resources/baked_light.cpp index 31282a0274..aa4aae03cb 100644 --- a/scene/resources/baked_light.cpp +++ b/scene/resources/baked_light.cpp @@ -256,6 +256,38 @@ float BakedLight::get_ao_strength() const { return ao_strength; } +void BakedLight::set_realtime_color_enabled(const bool p_realtime_color_enabled) { + + VS::get_singleton()->baked_light_set_realtime_color_enabled(baked_light, p_realtime_color_enabled); +} + +bool BakedLight::get_realtime_color_enabled() const { + + return VS::get_singleton()->baked_light_get_realtime_color_enabled(baked_light); +} + + +void BakedLight::set_realtime_color(const Color &p_realtime_color) { + + VS::get_singleton()->baked_light_set_realtime_color(baked_light, p_realtime_color); +} + +Color BakedLight::get_realtime_color() const { + + return VS::get_singleton()->baked_light_get_realtime_color(baked_light); +} + +void BakedLight::set_realtime_energy(const float p_realtime_energy) { + + VS::get_singleton()->baked_light_set_realtime_energy(baked_light, p_realtime_energy); +} + +float BakedLight::get_realtime_energy() const { + + return VS::get_singleton()->baked_light_get_realtime_energy(baked_light); +} + + void BakedLight::set_energy_multiplier(float p_multiplier){ @@ -434,6 +466,15 @@ void BakedLight::_bind_methods(){ ObjectTypeDB::bind_method(_MD("set_ao_strength","ao_strength"),&BakedLight::set_ao_strength); ObjectTypeDB::bind_method(_MD("get_ao_strength"),&BakedLight::get_ao_strength); + ObjectTypeDB::bind_method(_MD("set_realtime_color_enabled", "enabled"), &BakedLight::set_realtime_color_enabled); + ObjectTypeDB::bind_method(_MD("get_realtime_color_enabled"), &BakedLight::get_realtime_color_enabled); + + ObjectTypeDB::bind_method(_MD("set_realtime_color", "tint"), &BakedLight::set_realtime_color); + ObjectTypeDB::bind_method(_MD("get_realtime_color"), &BakedLight::get_realtime_color); + + ObjectTypeDB::bind_method(_MD("set_realtime_energy", "energy"), &BakedLight::set_realtime_energy); + ObjectTypeDB::bind_method(_MD("get_realtime_energy"), &BakedLight::get_realtime_energy); + ObjectTypeDB::bind_method(_MD("set_format","format"),&BakedLight::set_format); ObjectTypeDB::bind_method(_MD("get_format"),&BakedLight::get_format); @@ -480,6 +521,11 @@ void BakedLight::_bind_methods(){ ADD_PROPERTY( PropertyInfo(Variant::REAL,"advanced/ao_radius",PROPERTY_HINT_RANGE,"0.0,16.0,0.01"),_SCS("set_ao_radius"),_SCS("get_ao_radius")); ADD_PROPERTY( PropertyInfo(Variant::REAL,"advanced/ao_strength",PROPERTY_HINT_RANGE,"0.0,1.0,0.01"),_SCS("set_ao_strength"),_SCS("get_ao_strength")); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "realtime/enabled"), _SCS("set_realtime_color_enabled"), _SCS("get_realtime_color_enabled")); + ADD_PROPERTY(PropertyInfo(Variant::COLOR, "realtime/color", PROPERTY_HINT_COLOR_NO_ALPHA), _SCS("set_realtime_color"), _SCS("get_realtime_color")); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "realtime/energy", PROPERTY_HINT_RANGE, "0.01,4096.0,0.01"), _SCS("set_realtime_energy"), _SCS("get_realtime_energy")); + + BIND_CONSTANT( MODE_OCTREE ); BIND_CONSTANT( MODE_LIGHTMAPS ); diff --git a/scene/resources/baked_light.h b/scene/resources/baked_light.h index 41e1e5f9e0..f9a1368e8d 100644 --- a/scene/resources/baked_light.h +++ b/scene/resources/baked_light.h @@ -116,6 +116,15 @@ public: void set_ao_strength(float p_ao_strength); float get_ao_strength() const; + void set_realtime_color_enabled(const bool p_enabled); + bool get_realtime_color_enabled() const; + + void set_realtime_color(const Color& p_realtime_color); + Color get_realtime_color() const; + + void set_realtime_energy(const float p_realtime_energy); + float get_realtime_energy() const; + void set_bake_flag(BakeFlags p_flags,bool p_enable); bool get_bake_flag(BakeFlags p_flags) const; -- cgit v1.2.3