Skip to content

Commit 78f2623

Browse files
committed
UPBGE: Fix environment ligthing.
Since the merge the UI was broke, some values of the world was moved in the environment lighting panel. Also the world values was using GPU_dynamic_uniform which is replaced by GPU_select_uniform. And finally the zenith and horizon color was updated only in World and not GPUWorld previously. Then some calls to GPU_horizon_update_color and GPU_zenith_update_colorare aded in KX_WorldInfo::UpdateBackGround.
1 parent dab6cce commit 78f2623

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

release/scripts/startup/bl_ui/properties_game.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,10 @@ def draw(self, context):
635635
col.active = world.use_sky_blend
636636
row.column().prop(world, "ambient_color")
637637

638+
row = layout.row()
639+
row.prop(world, "exposure")
640+
row.prop(world, "color_range")
641+
638642

639643
class WORLD_PT_game_environment_lighting(WorldButtonsPanel, Panel):
640644
bl_label = "Environment Lighting"
@@ -660,10 +664,6 @@ def draw(self, context):
660664
split.prop(light, "environment_energy", text="Energy")
661665
split.prop(light, "environment_color", text="")
662666

663-
row = layout.row()
664-
row.prop(world, "exposure")
665-
row.prop(world, "color_range")
666-
667667

668668
class WORLD_PT_game_mist(WorldButtonsPanel, Panel):
669669
bl_label = "Mist"

source/blender/gpu/intern/gpu_material.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,8 +1882,8 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
18821882
GPU_link(mat, "math_multiply", f, GPU_uniform(&world->ao_env_energy), &f);
18831883
GPU_link(mat, "shade_mul_value", f, shi->rgb, &fcol);
18841884
GPU_link(mat, "env_apply", shr->combined,
1885-
GPU_dynamic_uniform(GPUWorld.horicol, GPU_DYNAMIC_HORIZON_COLOR, NULL),
1886-
GPU_dynamic_uniform(GPUWorld.zencol, GPU_DYNAMIC_ZENITH_COLOR, NULL), fcol,
1885+
GPU_select_uniform(GPUWorld.horicol, GPU_DYNAMIC_HORIZON_COLOR, NULL, ma),
1886+
GPU_select_uniform(GPUWorld.zencol, GPU_DYNAMIC_ZENITH_COLOR, NULL, ma), fcol,
18871887
GPU_builtin(GPU_VIEW_MATRIX), shi->vn, &shr->combined);
18881888
}
18891889
}

source/gameengine/Ketsji/KX_WorldInfo.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,17 @@ void KX_WorldInfo::setAmbientColor(const MT_Vector3& ambientcolor)
163163
void KX_WorldInfo::UpdateBackGround(RAS_IRasterizer *rasty)
164164
{
165165
if (m_hasworld) {
166+
// Update World values for world material created in GPU_material_world/GPU_material_old_world.
166167
m_scene->world->zenr = m_zenithcolor[0];
167168
m_scene->world->zeng = m_zenithcolor[1];
168169
m_scene->world->zenb = m_zenithcolor[2];
169170
m_scene->world->horr = m_horizoncolor[0];
170171
m_scene->world->horg = m_horizoncolor[1];
171172
m_scene->world->horb = m_horizoncolor[2];
173+
174+
// Update GPUWorld values for regular materials.
175+
GPU_horizon_update_color(m_horizoncolor.getValue());
176+
GPU_zenith_update_color(m_zenithcolor.getValue());
172177
}
173178
}
174179

0 commit comments

Comments
 (0)