also discard pixels in front of nearplane

This commit is contained in:
Erwin Coumans
2017-05-25 19:55:55 -07:00
parent 2b9c67b07c
commit 723b356667

View File

@@ -182,7 +182,8 @@ void triangle(mat<4,3,float> &clipc, IShader &shader, TGAImage &image, float *zb
bool discard = shader.fragment(bc_clip, color); bool discard = shader.fragment(bc_clip, color);
if (frag_depth<-shader.m_farPlane) if (frag_depth<-shader.m_farPlane)
discard=true; discard=true;
if (frag_depth>-shader.m_nearPlane)
discard=true;
if (!discard) { if (!discard) {
zbuffer[P.x+P.y*image.get_width()] = frag_depth; zbuffer[P.x+P.y*image.get_width()] = frag_depth;
if (segmentationMaskBuffer) if (segmentationMaskBuffer)