diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-09-29 18:56:05 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-09-29 18:56:52 -0300 |
commit | d4e20555e8e1e7dc2ba2e653abfbf7b074e7e75f (patch) | |
tree | ee8183bd54e58f3597bf75321e4aa58ae3f73ac7 /scene/resources | |
parent | 2c5fa0947d724c0dcb24643f692f7a9d686a5490 (diff) |
Ability to set a custom FOV makes it possible to use sky on orthogonal view. Closes #9186
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/environment.cpp | 21 | ||||
-rw-r--r-- | scene/resources/environment.h | 6 |
2 files changed, 13 insertions, 14 deletions
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index da3bc6a95b..4c6fa7c8a1 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -55,12 +55,11 @@ void Environment::set_sky(const Ref<Sky> &p_sky) { VS::get_singleton()->environment_set_sky(environment, sb_rid); } -void Environment::set_sky_scale(float p_scale) { +void Environment::set_sky_custom_fov(float p_scale) { - bg_sky_scale = p_scale; - VS::get_singleton()->environment_set_sky_scale(environment, p_scale); + bg_sky_custom_fov = p_scale; + VS::get_singleton()->environment_set_sky_custom_fov(environment, p_scale); } - void Environment::set_bg_color(const Color &p_color) { bg_color = p_color; @@ -101,9 +100,9 @@ Ref<Sky> Environment::get_sky() const { return bg_sky; } -float Environment::get_sky_scale() const { +float Environment::get_sky_custom_fov() const { - return bg_sky_scale; + return bg_sky_custom_fov; } Color Environment::get_bg_color() const { @@ -268,7 +267,7 @@ Ref<Texture> Environment::get_adjustment_color_correction() const { void Environment::_validate_property(PropertyInfo &property) const { - if (property.name == "background_sky" || property.name == "background_sky_scale" || property.name == "ambient_light/sky_contribution") { + if (property.name == "background_sky" || property.name == "background_sky_custom_fov" || property.name == "ambient_light/sky_contribution") { if (bg_mode != BG_SKY && bg_mode != BG_COLOR_SKY) { property.usage = PROPERTY_USAGE_NOEDITOR; } @@ -820,7 +819,7 @@ void Environment::_bind_methods() { ClassDB::bind_method(D_METHOD("set_background", "mode"), &Environment::set_background); ClassDB::bind_method(D_METHOD("set_sky", "sky"), &Environment::set_sky); - ClassDB::bind_method(D_METHOD("set_sky_scale", "scale"), &Environment::set_sky_scale); + ClassDB::bind_method(D_METHOD("set_sky_custom_fov", "scale"), &Environment::set_sky_custom_fov); ClassDB::bind_method(D_METHOD("set_bg_color", "color"), &Environment::set_bg_color); ClassDB::bind_method(D_METHOD("set_bg_energy", "energy"), &Environment::set_bg_energy); ClassDB::bind_method(D_METHOD("set_canvas_max_layer", "layer"), &Environment::set_canvas_max_layer); @@ -830,7 +829,7 @@ void Environment::_bind_methods() { ClassDB::bind_method(D_METHOD("get_background"), &Environment::get_background); ClassDB::bind_method(D_METHOD("get_sky"), &Environment::get_sky); - ClassDB::bind_method(D_METHOD("get_sky_scale"), &Environment::get_sky_scale); + ClassDB::bind_method(D_METHOD("get_sky_custom_fov"), &Environment::get_sky_custom_fov); ClassDB::bind_method(D_METHOD("get_bg_color"), &Environment::get_bg_color); ClassDB::bind_method(D_METHOD("get_bg_energy"), &Environment::get_bg_energy); ClassDB::bind_method(D_METHOD("get_canvas_max_layer"), &Environment::get_canvas_max_layer); @@ -841,7 +840,7 @@ void Environment::_bind_methods() { ADD_GROUP("Background", "background_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "background_mode", PROPERTY_HINT_ENUM, "Clear Color,Custom Color,Sky,Color+Sky,Canvas,Keep"), "set_background", "get_background"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "background_sky", PROPERTY_HINT_RESOURCE_TYPE, "Sky"), "set_sky", "get_sky"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "background_sky_scale", PROPERTY_HINT_RANGE, "0,32,0.01"), "set_sky_scale", "get_sky_scale"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "background_sky_custom_fov", PROPERTY_HINT_RANGE, "0,180,0.1"), "set_sky_custom_fov", "get_sky_custom_fov"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "background_color"), "set_bg_color", "get_bg_color"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "background_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_bg_energy", "get_bg_energy"); ADD_PROPERTY(PropertyInfo(Variant::INT, "background_canvas_max_layer", PROPERTY_HINT_RANGE, "-1000,1000,1"), "set_canvas_max_layer", "get_canvas_max_layer"); @@ -1142,7 +1141,7 @@ Environment::Environment() { environment = VS::get_singleton()->environment_create(); bg_mode = BG_CLEAR_COLOR; - bg_sky_scale = 1.0; + bg_sky_custom_fov = 0; bg_energy = 1.0; bg_canvas_max_layer = 0; ambient_energy = 1.0; diff --git a/scene/resources/environment.h b/scene/resources/environment.h index 9046ec1e49..5909846074 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -76,7 +76,7 @@ private: BGMode bg_mode; Ref<Sky> bg_sky; - float bg_sky_scale; + float bg_sky_custom_fov; Color bg_color; float bg_energy; int bg_canvas_max_layer; @@ -162,7 +162,7 @@ protected: public: void set_background(BGMode p_bg); void set_sky(const Ref<Sky> &p_sky); - void set_sky_scale(float p_scale); + void set_sky_custom_fov(float p_scale); void set_bg_color(const Color &p_color); void set_bg_energy(float p_energy); void set_canvas_max_layer(int p_max_layer); @@ -172,7 +172,7 @@ public: BGMode get_background() const; Ref<Sky> get_sky() const; - float get_sky_scale() const; + float get_sky_custom_fov() const; Color get_bg_color() const; float get_bg_energy() const; int get_canvas_max_layer() const; |