add more checks in triangle raster code

This commit is contained in:
asrael 2025-11-10 09:39:33 -06:00
parent 79a678f162
commit 9550d34e65
No known key found for this signature in database
GPG key ID: 2786557804DFAE24
7 changed files with 357 additions and 260 deletions

View file

@ -308,11 +308,22 @@ bool pxl8_frustum_test_aabb(const pxl8_frustum* frustum, pxl8_vec3 min, pxl8_vec
(normal.z >= 0.0f) ? max.z : min.z
};
f32 dist = pxl8_vec3_dot(normal, p_vertex) + d;
pxl8_vec3 n_vertex = {
(normal.x >= 0.0f) ? min.x : max.x,
(normal.y >= 0.0f) ? min.y : max.y,
(normal.z >= 0.0f) ? min.z : max.z
};
if (dist < 0.0f) {
f32 p_dist = pxl8_vec3_dot(normal, p_vertex) + d;
f32 n_dist = pxl8_vec3_dot(normal, n_vertex) + d;
if (p_dist < -0.1f) {
return false;
}
if (n_dist > 0.1f) {
continue;
}
}
return true;