Skip to content
Snippets Groups Projects
Commit 04cdb62a authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Correction to equality check

parent b77fcacb
No related branches found
No related tags found
1 merge request!151Implements #216 triangle renderer
Pipeline #15986 passed
This commit is part of merge request !151. Comments created here will be created in the context of that merge request.
......@@ -31,6 +31,7 @@ __device__ inline float length2(int dx, int dy) { return dx*dx + dy*dy; }
// Is this triangle valid
if (fabs(d[0] - d[1]) > 0.04f || fabs(d[0] - d[2]) > 0.04f) return;
if (d[0] < params.camera.minDepth || d[1] < params.camera.minDepth || d[2] < params.camera.minDepth) return;
short2 s[3];
s[0] = screen.tex2D(x+A,y+B);
......@@ -48,8 +49,8 @@ __device__ inline float length2(int dx, int dy) { return dx*dx + dy*dy; }
s[1].x = min(s[1].x,10);
s[2].y = min(s[2].y,10);
for (int sx=0; sx < s[1].x; ++sx) {
for (int sy=0; sy < min(s[1].x - sx, s[2].y); ++sy) {
for (int sx=0; sx <= s[1].x; ++sx) {
for (int sy=0; sy <= min(s[1].x - sx, s[2].y); ++sy) {
//if (sx > s[2].y-sy) continue;
if (dx*sx+s[0].x >= params.camera.width || dy*sy+s[0].y >= params.camera.height) continue;
......@@ -58,6 +59,7 @@ __device__ inline float length2(int dx, int dy) { return dx*dx + dy*dy; }
float dist3 = length2(s[2].x-sx, s[2].y-sy);
float new_depth = (d[0]*dist1 + d[1]*dist2 + d[2] * dist3) / (dist1+dist2+dist3);
//if (new_depth < params.camera.minDepth || new_depth > params.camera.maxDepth) continue;
atomicMin(&depth_out(dx*sx+s[0].x,dy*sy+s[0].y), int(new_depth*1000.0f));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment