// 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, }; fn closesthit_main(ray: RayDesc, hit: HitInfo, payload: ptr) { let bary = vec3(1.0 - hit.attribs.x - hit.attribs.y, hit.attribs.x, hit.attribs.y); (*payload).color = bary; }