consistency

This commit is contained in:
Bigfoot71 2025-10-24 15:04:02 +02:00
parent a007baf947
commit 136e1d025c

44
src/external/rlsw.h vendored
View File

@ -2274,23 +2274,23 @@ static inline void sw_triangle_clip_and_project(void)
// Calculation of the reciprocal of W for normalization
// as well as perspective-correct attributes
const float invW = 1.0f/v->homogeneous[3];
v->homogeneous[3] = invW;
const float wRcp = 1.0f/v->homogeneous[3];
v->homogeneous[3] = wRcp;
// Division of XYZ coordinates by weight
v->homogeneous[0] *= invW;
v->homogeneous[1] *= invW;
v->homogeneous[2] *= invW;
v->homogeneous[0] *= wRcp;
v->homogeneous[1] *= wRcp;
v->homogeneous[2] *= wRcp;
// Division of texture coordinates (perspective-correct)
v->texcoord[0] *= invW;
v->texcoord[1] *= invW;
v->texcoord[0] *= wRcp;
v->texcoord[1] *= wRcp;
// Division of colors (perspective-correct)
v->color[0] *= invW;
v->color[1] *= invW;
v->color[2] *= invW;
v->color[3] *= invW;
v->color[0] *= wRcp;
v->color[1] *= wRcp;
v->color[2] *= wRcp;
v->color[3] *= wRcp;
// Transformation to screen space
sw_project_ndc_to_screen(v->screen, v->homogeneous);
@ -2616,23 +2616,23 @@ static inline void sw_quad_clip_and_project(void)
// Calculation of the reciprocal of W for normalization
// as well as perspective-correct attributes
const float invW = 1.0f/v->homogeneous[3];
v->homogeneous[3] = invW;
const float wRcp = 1.0f/v->homogeneous[3];
v->homogeneous[3] = wRcp;
// Division of XYZ coordinates by weight
v->homogeneous[0] *= invW;
v->homogeneous[1] *= invW;
v->homogeneous[2] *= invW;
v->homogeneous[0] *= wRcp;
v->homogeneous[1] *= wRcp;
v->homogeneous[2] *= wRcp;
// Division of texture coordinates (perspective-correct)
v->texcoord[0] *= invW;
v->texcoord[1] *= invW;
v->texcoord[0] *= wRcp;
v->texcoord[1] *= wRcp;
// Division of colors (perspective-correct)
v->color[0] *= invW;
v->color[1] *= invW;
v->color[2] *= invW;
v->color[3] *= invW;
v->color[0] *= wRcp;
v->color[1] *= wRcp;
v->color[2] *= wRcp;
v->color[3] *= wRcp;
// Transformation to screen space
sw_project_ndc_to_screen(v->screen, v->homogeneous);