Fix clipping

This commit is contained in:
Luke Benstead 2020-03-23 13:44:24 +00:00
parent 906423db08
commit e21b7a0b9c
2 changed files with 5 additions and 8 deletions

View File

@ -255,9 +255,9 @@ void _glClipTriangleStrip(SubmissionTarget* target, uint8_t fladeShade) {
* and it's in front of the near plane (Z > -W) * and it's in front of the near plane (Z > -W)
*/ */
uint8_t visible = ( uint8_t visible = (
((v1->w > 0 && v1->xyz[2] > -v1->w) ? 4 : 0) | ((v1->w > 0 && v1->xyz[2] >= -v1->w) ? 4 : 0) |
((v2->w > 0 && v2->xyz[2] > -v2->w) ? 2 : 0) | ((v2->w > 0 && v2->xyz[2] >= -v2->w) ? 2 : 0) |
((v3->w > 0 && v3->xyz[2] > -v3->w) ? 1 : 0) ((v3->w > 0 && v3->xyz[2] >= -v3->w) ? 1 : 0)
); );
switch(visible) { switch(visible) {

View File

@ -1171,12 +1171,9 @@ GL_FORCE_INLINE void divide(SubmissionTarget* target) {
float f = MATH_fsrra(vertex->w * vertex->w); float f = MATH_fsrra(vertex->w * vertex->w);
vertex->xyz[0] *= f; vertex->xyz[0] *= f;
vertex->xyz[1] *= f; vertex->xyz[1] *= f;
vertex->xyz[2] = 1.0 - ((DEPTH_RANGE_MULTIPLIER_L * vertex->xyz[2] * f) + DEPTH_RANGE_MULTIPLIER_H);
/* Passing a value > 1.0f will cause the polygon to be dropped by the /* Scale depending on glDepthRange */
* PVR. Although we clip to the near plane, rounding errors can still vertex->xyz[2] = 1.0f - ((DEPTH_RANGE_MULTIPLIER_L * vertex->xyz[2] * f) + DEPTH_RANGE_MULTIPLIER_H);
* cause this happen. This just ensures it doesn't */
vertex->xyz[2] = MIN(1.0f, vertex->xyz[2]);
++vertex; ++vertex;
} }