LDKRay
typedef struct LDKRay{
Vec3 origin;
Vec3 direction;
}LDKRay;
Raycasting and geometric intersection queries.
typedef struct LDKRay{
Vec3 origin;
Vec3 direction;
}LDKRay;
typedef struct LDKRaycastHit{
Vec3 position;
Vec3 normal;
float distance;
u32 triangle_index;
}LDKRaycastHit;
Construct a 3D ray from origin and direction.
LDK_API bool ldk_ray_make(
Vec3 origin,
Vec3 direction,
LDKRay *out_ray
);
Vec3 originVec3 directionLDKRay *out_rayTrue if the operation succeeds; false otherwise.
Compute the 3D position along a ray at the specified distance.
LDK_API Vec3 ldk_ray_at(
LDKRay ray,
float distance
);
LDKRay rayfloat distanceThe requested value.
Transform a ray using a matrix.
LDK_API bool ldk_ray_transform(
LDKRay ray,
Mat4 transform,
LDKRay *out_ray
);
True if the operation succeeds; false otherwise.
Test the intersection of a ray with a plane.
LDK_API bool ldk_raycast_plane(
LDKRay ray,
Vec3 plane_point,
Vec3 plane_normal,
LDKRaycastHit *out_hit
);
LDKRay rayVec3 plane_pointVec3 plane_normalLDKRaycastHit *out_hitTrue if the operation succeeds; false otherwise.
Test the intersection of a ray with a triangle.
LDK_API bool ldk_raycast_triangle(
LDKRay ray,
Vec3 a,
Vec3 b,
Vec3 c,
LDKRaycastHit *out_hit
);
LDKRay rayVec3 aVec3 bVec3 cLDKRaycastHit *out_hitTrue if the operation succeeds; false otherwise.
Intersect a ray against mesh geometry.
LDK_API bool ldk_raycast_mesh(
LDKRay ray,
const LDKMeshData *mesh,
LDKRaycastHit *out_hit
);
LDKRay rayconst LDKMeshData *meshLDKRaycastHit *out_hitTrue if the operation succeeds; false otherwise.
Intersect a ray against transformed mesh geometry.
LDK_API bool ldk_raycast_mesh_transformed(
LDKRay ray,
const LDKMeshData *mesh,
Mat4 mesh_world,
LDKRaycastHit *out_hit
);
LDKRay rayconst LDKMeshData *meshMat4 mesh_worldLDKRaycastHit *out_hitTrue if the operation succeeds; false otherwise.