Log inGet started
Package

shapes.shaderModule

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

shapes

The analytic shapes a ray is met against, shared by fx_ray_shapes and the particle solver's step kernel so both answer one definition (ray_shapes holds the same functions in its own text, which the job form of a program takes whole): plane_cand, sphere_cand, box_cand, capsule_cand, and shape_cand_of(kind, c, e, q, o, d, tmin, tmax) for one row of a table of shapes (kind 0 plane through c with unit normal e, 1 sphere of radius e.x, 2 box of half size e, 3 capsule along y of radius e.x and caps at y = -e.y and e.y; boxes and capsules turned by the quaternion q about c). A candidate is Cand { t, n }, t -1 for no hit and n outward. shape_face(n, d) turns the normal against the move and shape_hit_end(o, d, t, n, push) is where the move stops, the hit pushed out by push.

#include "@builtin::systems.procgen.kernels.shapes"

fn floor_hit(o: vec3<f32>, d: vec3<f32>) -> Cand {
    return shape_cand_of(0, vec3<f32>(0.0), vec3<f32>(0.0, 1.0, 0.0), vec4<f32>(0.0, 0.0, 0.0, 1.0), o, d, 0.0, 1.0);
}