This commit is contained in:
Evghenii
2013-11-09 21:23:34 +01:00
parent dbd0581cb3
commit 1a37135f98
3 changed files with 17 additions and 9 deletions

View File

@@ -249,8 +249,6 @@ static inline bool BVHIntersect(const LinearBVHNode nodes[],
if (TriIntersect(tris[primitivesOffset+i], ray))
hit = true;
}
if (todoOffset == 0)
break;
nodeNum = todo[--todoOffset];
}
else {
@@ -275,10 +273,10 @@ static inline bool BVHIntersect(const LinearBVHNode nodes[],
}
}
else {
if (todoOffset == 0)
break;
nodeNum = todo[--todoOffset];
}
if (todoOffset == 0)
break;
}
r.maxt = ray.maxt;
r.hitId = ray.hitId;

View File

@@ -219,6 +219,8 @@ inline inline bool BVHIntersect(const uniform LinearBVHNode nodes[],
uniform int todoOffset = 0, nodeNum = 0;
uniform int todo[64];
#define FAST
while (true) {
// Check ray against BVH node
uniform LinearBVHNode node = nodes[nodeNum];
@@ -233,8 +235,10 @@ inline inline bool BVHIntersect(const uniform LinearBVHNode nodes[],
if (TriIntersect(tris[primitivesOffset+i], ray))
hit = true;
}
#ifndef FAST
if (todoOffset == 0)
break;
#endif
nodeNum = todo[--todoOffset];
}
else
@@ -261,10 +265,16 @@ inline inline bool BVHIntersect(const uniform LinearBVHNode nodes[],
}
}
else {
#ifndef FAST
if (todoOffset == 0)
break;
#endif
nodeNum = todo[--todoOffset];
}
#ifdef FAST
if (todoOffset == 0)
break;
#endif
}
r.maxt = ray.maxt;
r.hitId = ray.hitId;