Skip to content

Commit

Permalink
Update Sphereflake_Fragment.glsl
Browse files Browse the repository at this point in the history
  • Loading branch information
erichlof committed Nov 25, 2023
1 parent 0cb9554 commit 8b8300f
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions shaders/Sphereflake_Fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -99,29 +99,6 @@ float SceneIntersect( out int isRayExiting )
int shapeLookupNeeded = FALSE;


d = QuadIntersect( quads[0].v0, quads[0].v1, quads[0].v2, quads[0].v3, rayOrigin, rayDirection, FALSE );
if (d < t)
{
t = d;
hitNormal = quads[0].normal;
hitColor = quads[0].color;
hitType = quads[0].type;
hitObjectID = float(objectCount);
}
objectCount++;

d = BoxIntersect(boxes[0].minCorner, boxes[0].maxCorner, rayOrigin, rayDirection, n, isRayExiting);
if (d < t)
{
t = d;
hitNormal = n;
hitColor = vec3(1);
hitType = DIFF;
hitObjectID = float(objectCount);
}
objectCount++;



GetBoxNodeData(stackptr, currentBoxNodeData0, currentBoxNodeData1);
currentStackData = vec2(stackptr, BoundingBoxIntersect(currentBoxNodeData0.yzw, currentBoxNodeData1.yzw, rayOrigin, inverseDir));
Expand Down Expand Up @@ -214,7 +191,7 @@ float SceneIntersect( out int isRayExiting )
texelFetch(tShape_DataTexture, uv2, 0),
texelFetch(tShape_DataTexture, uv3, 0) );

sd4 = texelFetch(tShape_DataTexture, uv4, 0);
//sd4 = texelFetch(tShape_DataTexture, uv4, 0);

// transform ray into shape's object space
rObjOrigin = vec3( invTransformMatrix * vec4(rayOrigin, 1.0) );
Expand Down Expand Up @@ -260,6 +237,30 @@ float SceneIntersect( out int isRayExiting )
hitType = (uMaterialType == 1000) ? int(sd4.y) : uMaterialType;
hitObjectID = float(objectCount);
}
objectCount++;



d = QuadIntersect( quads[0].v0, quads[0].v1, quads[0].v2, quads[0].v3, rayOrigin, rayDirection, FALSE );
if (d < t)
{
t = d;
hitNormal = quads[0].normal;
hitColor = quads[0].color;
hitType = quads[0].type;
hitObjectID = float(objectCount);
}
objectCount++;

d = BoxIntersect(boxes[0].minCorner, boxes[0].maxCorner, rayOrigin, rayDirection, n, isRayExiting);
if (d < t)
{
t = d;
hitNormal = n;
hitColor = vec3(1);
hitType = DIFF;
hitObjectID = float(objectCount);
}


return t;
Expand Down

0 comments on commit 8b8300f

Please sign in to comment.