diff --git a/res/shaders/lib/AABB.slang b/res/shaders/lib/Bounding.slang similarity index 70% rename from res/shaders/lib/AABB.slang rename to res/shaders/lib/Bounding.slang index 0567ef1..4ec90b7 100644 --- a/res/shaders/lib/AABB.slang +++ b/res/shaders/lib/Bounding.slang @@ -1,5 +1,30 @@ import Common; +struct BoundingSphere +{ + float4 centerRadius; + float3 getCenter() + { + return centerRadius.xyz; + } + float getRadius() + { + return centerRadius.w; + } + bool pointInside(float3 p) + { + if(abs(getCenter() - p) > getRadius()) + { + return false; + } + return true; + } + bool insideFrustum(float4x4 transform, Frustum frustum) + { + + } +}; + struct AABB { float3 min; diff --git a/res/shaders/lib/Scene.slang b/res/shaders/lib/Scene.slang index 6a8dc5a..82cd316 100644 --- a/res/shaders/lib/Scene.slang +++ b/res/shaders/lib/Scene.slang @@ -1,8 +1,8 @@ -import AABB; +import Bounding; struct MeshletDescription { - AABB boundingBox; + BoundingSphere bounding; uint32_t vertexCount; uint32_t primitiveCount; uint32_t vertexOffset; @@ -13,7 +13,7 @@ struct MeshletDescription struct MeshData { - AABB boundingBox; + BoundingSphere bounding; uint32_t numMeshlets; uint32_t meshletOffset; uint32_t firstIndex;