Skip to content

Instantly share code, notes, and snippets.

@sortofsleepy
Created July 25, 2017 21:27
Show Gist options
  • Save sortofsleepy/52351384d772b794d46ab6806e158e7f to your computer and use it in GitHub Desktop.
Save sortofsleepy/52351384d772b794d46ab6806e158e7f to your computer and use it in GitHub Desktop.
vec3 calcRayIntersection( vec3 pos )
{
vec3 retPos = pos;
if (rayPosition.x > pos.x - 1 &&
rayPosition.x < pos.x + 1 &&
rayPosition.y > pos.y - 1 &&
rayPosition.y < pos.y + 1 &&
rayPosition.z > pos.z - 1 &&
rayPosition.z < pos.z + 1 &&
connection[0] != -1 && connection[1] != -1 &&
connection[2] != -1 && connection[3] != -1) {
retPos = vec3(rayPosition.x, rayPosition.y, rayPosition.z);
}
return retPos;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment