mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-23 15:52:41 +02:00
port: fix model lighting
This commit is contained in:
1 parent
f1186a35d8
commit
e0ced73d8a
1 file changed
+2
-7
@@ -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
|
||||
|
||||
Reference in new issue
Block a user