height filtering
[csRadar.git] / csrDraw.h
index b744c044e9058ed379c23004bac8d05286bf41c4..fff159094fd7b12bec3dac8e97ca4964eac95583 100644 (file)
--- a/csrDraw.h
+++ b/csrDraw.h
@@ -317,11 +317,12 @@ void simple_raster( csr_target *rt, vmf_vert tri[3] )
                                bcc = (v0[0]*vp[1] - vp[0]*v0[1]) * d;
                                bca = 1.f - bcb - bcc;
                                
-                               float hit = (tri[0].co[2] * bca + tri[1].co[2] * bcb + tri[2].co[2] * bcc) +16385.f;
+                               float hit = tri[0].co[2] * bca + tri[1].co[2] * bcb + tri[2].co[2] * bcc;
+                               float hit_depth = hit + 16385.f;
                                
-                               if( hit > depth[i] )
+                               if( hit_depth > depth[i] && hit >= rt->bounds[0][2] && hit <= rt->bounds[1][2] )
                                {
-                                       depth[i] = hit;
+                                       depth[i] = hit_depth;
                                        rt->shader->frag( frag+i*rt->shader->stride, tri, bca, bcb, bcc );
                                }
                        }