webgpu triangle
This commit is contained in:
parent
64116cd980
commit
5553ded476
22 changed files with 2107 additions and 42 deletions
12
examples/VulkanTriangle/closesthit.wgsl
Normal file
12
examples/VulkanTriangle/closesthit.wgsl
Normal 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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue