also initialize near/far for depth shader in TinyRenderer

This commit is contained in:
Erwin Coumans
2017-05-26 09:45:26 -07:00
parent 9d78809a55
commit 8c6d4a4c85
2 changed files with 8 additions and 5 deletions

View File

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