Skip to content
Snippets Groups Projects

Mostly fix OpenGL floor-clipping sprites

Open chromaticpipe ‎ requested to merge chromaticpipe2/SRB2:fix-ogl-spriteclipping into next
1 unresolved thread

This ports the sprite floor clipping fix that's been in Kart for over 5 years at this point. It's not perfect, and this issue will probably never truly fixed unless OpenGL gets massively overhauled in a future update, but it looks much better than before. srb20042

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
3538 wallVerts[1].x = wallVerts[2].x = wallVerts[1].x+co;
3539 }
3540
3541 3531 // Let dispoffset work first since this adjust each vertex
3532 // ...nah
3542 3533 HWR_RotateSpritePolyToAim(spr, wallVerts, false);
3534
3535 // push it toward the camera to mitigate floor-clipping sprites
3536 float sprdist = sqrtf((spr->x1 - gl_viewx)*(spr->x1 - gl_viewx) + (spr->z1 - gl_viewy)*(spr->z1 - gl_viewy) + (spr->gzt - gl_viewz)*(spr->gzt - gl_viewz));
3537 float distfact = ((2.0f*spr->dispoffset) + 20.0f) / sprdist;
3538 size_t i;
3539 for (i = 0; i < 4; i++)
3540 {
3541 wallVerts[i].x += (gl_viewx - wallVerts[i].x)*distfact;
3542 wallVerts[i].z += (gl_viewy - wallVerts[i].z)*distfact;
3543 wallVerts[i].y += (gl_viewz - wallVerts[i].y)*distfact;
  • Comment on lines +3541 to +3543
    Contributor
    Suggested change
    3541 wallVerts[i].x += (gl_viewx - wallVerts[i].x)*distfact;
    3542 wallVerts[i].z += (gl_viewy - wallVerts[i].z)*distfact;
    3543 wallVerts[i].y += (gl_viewz - wallVerts[i].y)*distfact;
    3541 wallVerts[i].x += (gl_viewx - wallVerts[i].x)*distfact;
    3542 wallVerts[i].z += (gl_viewy - wallVerts[i].z)*distfact;
    3543 wallVerts[i].y += (gl_viewz - wallVerts[i].y)*distfact;
  • Please register or sign in to reply
Please register or sign in to reply
Loading