Skip to content

Instantly share code, notes, and snippets.

View fuchstraumer's full-sized avatar

Fuchs fuchstraumer

View GitHub Profile
// Branch-based sphere-AABB intersection implementation
internal bool SphereInsideAABB_Branched(float4 sphere, float3 aabbMin, float3 aabbMax)
{
float3 center = sphere.xyz;
float radius = sphere.w;
// Check if sphere center is completely outside any face of the AABB
if (center.x < aabbMin.x - radius || center.x > aabbMax.x + radius) return false;
if (center.y < aabbMin.y - radius || center.y > aabbMax.y + radius) return false;