diff --git a/shaders/CSG_Museum_1_Fragment.glsl b/shaders/CSG_Museum_1_Fragment.glsl index f6e8bb05..44727fd3 100644 --- a/shaders/CSG_Museum_1_Fragment.glsl +++ b/shaders/CSG_Museum_1_Fragment.glsl @@ -746,20 +746,30 @@ float SceneIntersect( ) } objectCount++; - for (int i = 0; i < N_QUADS; i++) - { - d = QuadIntersect( quads[i].v0, quads[i].v1, quads[i].v2, quads[i].v3, rayOrigin, rayDirection, TRUE ); - if (d < t) - { - t = d; - hitNormal = (quads[i].normal); - hitEmission = quads[i].emission; - hitColor = quads[i].color; - hitType = quads[i].type; - hitObjectID = float(objectCount); - } - objectCount++; + + d = QuadIntersect( quads[0].v0, quads[0].v1, quads[0].v2, quads[0].v3, rayOrigin, rayDirection, TRUE ); + if (d < t) + { + t = d; + hitNormal = (quads[0].normal); + hitEmission = quads[0].emission; + hitColor = quads[0].color; + hitType = quads[0].type; + hitObjectID = float(objectCount); } + objectCount++; + + d = QuadIntersect( quads[1].v0, quads[1].v1, quads[1].v2, quads[1].v3, rayOrigin, rayDirection, TRUE ); + if (d < t) + { + t = d; + hitNormal = (quads[1].normal); + hitEmission = quads[1].emission; + hitColor = quads[1].color; + hitType = quads[1].type; + hitObjectID = float(objectCount); + } + objectCount++; // now intersect all CSG objects