From e0ced73d8aa8633ed66c729f7d98584441c151d6 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sun, 20 Aug 2023 16:26:21 +0200 Subject: [PATCH] port: fix model lighting --- port/fast3d/gfx_pc.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/port/fast3d/gfx_pc.cpp b/port/fast3d/gfx_pc.cpp index 3c89fc84a..17915be6b 100644 --- a/port/fast3d/gfx_pc.cpp +++ b/port/fast3d/gfx_pc.cpp @@ -1014,11 +1014,6 @@ static void gfx_adjust_width_height_for_scale(uint32_t& width, uint32_t& height) static void gfx_sp_vertex(size_t n_vertices, size_t dest_index, const Vtx* vertices) { SUPPORT_CHECK(n_vertices <= MAX_VERTICES); - // seems like PD likes to use fog color/alpha without enabling G_FOG - const bool use_fog = (rsp.geometry_mode & G_FOG) || - (rdp.other_mode_l >> 30) == G_BL_CLR_FOG || - (rdp.other_mode_l >> 26) == G_BL_A_FOG; - for (size_t i = 0; i < n_vertices; i++, dest_index++) { const Vtx* v = &vertices[i]; struct LoadedVertex* d = &rsp.loaded_vertices[dest_index]; @@ -1138,7 +1133,7 @@ static void gfx_sp_vertex(size_t n_vertices, size_t dest_index, const Vtx* verti d->z = z; d->w = w; - if (use_fog) { + if (rsp.geometry_mode & G_FOG) { if (fabsf(w) < 0.001f) { // To avoid division by zero w = 0.001f; @@ -1152,7 +1147,7 @@ static void gfx_sp_vertex(size_t n_vertices, size_t dest_index, const Vtx* verti float fog_z = z * winv * rsp.fog_mul + rsp.fog_offset; d->fog = clampf(fog_z, 0.f, 255.f); } else { - d->fog = 0; + d->fog = rdp.fog_color.a; } d->color.a = vcn->a; // can be required for SHADE_ALPHA even if fog is enabled