Ray-caster: correct hit detection
This commit is contained in:
parent
3d7ee98dd6
commit
e80adf831d
@ -141,11 +141,11 @@ void main() {
|
||||
int frag_cnt = 0;
|
||||
for (int i = 0; i < sphere_cnt; ++i) {
|
||||
vec2 hit_depths = sphere_cast(sphere_list[i], dir);
|
||||
if (!isnan(hit_depths[0])) {
|
||||
if (hit_depths[0] > 0.) {
|
||||
frags[frag_cnt] = sphere_shading(sphere_list[i], hit_depths[0] * dir, color_list[i], i);
|
||||
++frag_cnt;
|
||||
}
|
||||
if (!isnan(hit_depths[1])) {
|
||||
if (hit_depths[1] > 0.) {
|
||||
frags[frag_cnt] = sphere_shading(sphere_list[i], hit_depths[1] * dir, color_list[i], i);
|
||||
++frag_cnt;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user