12 lines
458 B
WebGPU Shading Language
12 lines
458 B
WebGPU Shading Language
|
|
// 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;
|
||
|
|
}
|