webgpu triangle

This commit is contained in:
Jorijn van der Graaf 2026-05-18 18:43:30 +02:00
commit 5553ded476
22 changed files with 2107 additions and 42 deletions

View file

@ -0,0 +1,12 @@
// WebGPU port of closesthit.glsl. Library concatenates this BEFORE the
// library helpers, so `Payload` declared here is visible to traceRay,
// runClosestHit, the mega-switch, and the user's raygen source.
struct Payload {
color: vec3<f32>,
};
fn closesthit_main(ray: RayDesc, hit: HitInfo, payload: ptr<function, Payload>) {
let bary = vec3<f32>(1.0 - hit.attribs.x - hit.attribs.y, hit.attribs.x, hit.attribs.y);
(*payload).color = bary;
}