diff options
author | Juan Linietsky <juan@godotengine.org> | 2019-10-14 03:45:44 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-02-11 12:03:55 +0100 |
commit | 2c67cc654f2a5080c16d6317f71dbb00e894aabd (patch) | |
tree | a740a0fe89a1770ebb60696e5b9991e30839546e /scene/3d | |
parent | 76c6f39d99b82a07bc4f88ec4b6fb13b532be725 (diff) |
AO support for GIProbe (right on time for Godot Sprint!)
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/gi_probe.cpp | 28 | ||||
-rw-r--r-- | scene/3d/gi_probe.h | 8 |
2 files changed, 36 insertions, 0 deletions
diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 5f7f24a75d..2423c0a7a3 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -134,6 +134,24 @@ float GIProbeData::get_energy() const { return energy; } +void GIProbeData::set_ao(float p_ao) { + VS::get_singleton()->gi_probe_set_ao(probe, p_ao); + ao = p_ao; +} + +float GIProbeData::get_ao() const { + return ao; +} + +void GIProbeData::set_ao_strength(float p_ao_strength) { + VS::get_singleton()->gi_probe_set_ao_strength(probe, p_ao_strength); + ao_strength = p_ao_strength; +} + +float GIProbeData::get_ao_strength() const { + return ao_strength; +} + void GIProbeData::set_bias(float p_bias) { VS::get_singleton()->gi_probe_set_bias(probe, p_bias); bias = p_bias; @@ -213,6 +231,12 @@ void GIProbeData::_bind_methods() { ClassDB::bind_method(D_METHOD("set_anisotropy_strength", "strength"), &GIProbeData::set_anisotropy_strength); ClassDB::bind_method(D_METHOD("get_anisotropy_strength"), &GIProbeData::get_anisotropy_strength); + ClassDB::bind_method(D_METHOD("set_ao", "ao"), &GIProbeData::set_ao); + ClassDB::bind_method(D_METHOD("get_ao"), &GIProbeData::get_ao); + + ClassDB::bind_method(D_METHOD("set_ao_strength", "strength"), &GIProbeData::set_ao_strength); + ClassDB::bind_method(D_METHOD("get_ao_strength"), &GIProbeData::get_ao_strength); + ClassDB::bind_method(D_METHOD("set_interior", "interior"), &GIProbeData::set_interior); ClassDB::bind_method(D_METHOD("is_interior"), &GIProbeData::is_interior); @@ -230,12 +254,16 @@ void GIProbeData::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "normal_bias", PROPERTY_HINT_RANGE, "0,8,0.01"), "set_normal_bias", "get_normal_bias"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "propagation", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_propagation", "get_propagation"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "anisotropy_strength", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_anisotropy_strength", "get_anisotropy_strength"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "ao", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_ao", "get_ao"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "ao_strength", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_ao_strength", "get_ao_strength"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_two_bounces"), "set_use_two_bounces", "is_using_two_bounces"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interior"), "set_interior", "is_interior"); } GIProbeData::GIProbeData() { + ao = 0.0; + ao_strength = 0.5; dynamic_range = 4; energy = 1.0; bias = 1.5; diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h index 3d4ee52469..ac309e82c7 100644 --- a/scene/3d/gi_probe.h +++ b/scene/3d/gi_probe.h @@ -53,6 +53,8 @@ class GIProbeData : public Resource { float normal_bias; float propagation; float anisotropy_strength; + float ao; + float ao_strength; bool interior; bool use_two_bounces; @@ -79,6 +81,12 @@ public: void set_anisotropy_strength(float p_anisotropy_strength); float get_anisotropy_strength() const; + void set_ao(float p_ao); + float get_ao() const; + + void set_ao_strength(float p_ao_strength); + float get_ao_strength() const; + void set_energy(float p_energy); float get_energy() const; |