Ability to use a sky for reflection together with a background color.
This commit is contained in:
parent
c023a132d0
commit
5ca3af3371
4 changed files with 10 additions and 4 deletions
|
@ -4165,7 +4165,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
|
|||
|
||||
clear_color = env->bg_color.to_linear();
|
||||
storage->frame.clear_request = false;
|
||||
} else if (env->bg_mode == VS::ENV_BG_SKY) {
|
||||
} else if (env->bg_mode == VS::ENV_BG_SKY || env->bg_mode == VS::ENV_BG_COLOR_SKY) {
|
||||
|
||||
sky = storage->sky_owner.getornull(env->sky);
|
||||
|
||||
|
@ -4173,6 +4173,9 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
|
|||
env_radiance_tex = sky->radiance;
|
||||
}
|
||||
storage->frame.clear_request = false;
|
||||
if (env->bg_mode == VS::ENV_BG_COLOR_SKY) {
|
||||
clear_color = env->bg_color.to_linear();
|
||||
}
|
||||
|
||||
} else {
|
||||
storage->frame.clear_request = false;
|
||||
|
|
|
@ -269,13 +269,13 @@ 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 (bg_mode != BG_SKY) {
|
||||
if (bg_mode != BG_SKY && bg_mode != BG_COLOR_SKY) {
|
||||
property.usage = PROPERTY_USAGE_NOEDITOR;
|
||||
}
|
||||
}
|
||||
|
||||
if (property.name == "background_color") {
|
||||
if (bg_mode != BG_COLOR) {
|
||||
if (bg_mode != BG_COLOR && bg_mode != BG_COLOR_SKY) {
|
||||
property.usage = PROPERTY_USAGE_NOEDITOR;
|
||||
}
|
||||
}
|
||||
|
@ -839,7 +839,7 @@ void Environment::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_ambient_light_sky_contribution"), &Environment::get_ambient_light_sky_contribution);
|
||||
|
||||
ADD_GROUP("Background", "background_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "background_mode", PROPERTY_HINT_ENUM, "Clear Color,Custom Color,Sky,Canvas,Keep"), "set_background", "get_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::COLOR, "background_color"), "set_bg_color", "get_bg_color");
|
||||
|
@ -1118,6 +1118,7 @@ void Environment::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(BG_CLEAR_COLOR);
|
||||
BIND_ENUM_CONSTANT(BG_COLOR);
|
||||
BIND_ENUM_CONSTANT(BG_SKY);
|
||||
BIND_ENUM_CONSTANT(BG_COLOR_SKY);
|
||||
BIND_ENUM_CONSTANT(BG_CANVAS);
|
||||
BIND_ENUM_CONSTANT(BG_MAX);
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
BG_CLEAR_COLOR,
|
||||
BG_COLOR,
|
||||
BG_SKY,
|
||||
BG_COLOR_SKY,
|
||||
BG_CANVAS,
|
||||
BG_KEEP,
|
||||
BG_MAX
|
||||
|
|
|
@ -628,6 +628,7 @@ public:
|
|||
ENV_BG_CLEAR_COLOR,
|
||||
ENV_BG_COLOR,
|
||||
ENV_BG_SKY,
|
||||
ENV_BG_COLOR_SKY,
|
||||
ENV_BG_CANVAS,
|
||||
ENV_BG_KEEP,
|
||||
ENV_BG_MAX
|
||||
|
|
Loading…
Reference in a new issue