mach/examples/cubemap/frag.wgsl
NewbLuck f15cea9492
examples: add cubemap example (#523)
Co-authored-by: Scott Johnson <scott.johnson@furniturerow.com>
2022-09-09 22:41:24 -07:00

11 lines
349 B
WebGPU Shading Language

@group(0) @binding(1) var mySampler: sampler;
@group(0) @binding(2) var myTexture: texture_cube<f32>;
@fragment
fn main(
@location(0) fragUV: vec2<f32>,
@location(1) fragPosition: vec4<f32>
) -> @location(0) vec4<f32> {
var cubemapVec = fragPosition.xyz - vec3<f32>(0.5, 0.5, 0.5);
return textureSample(myTexture, mySampler, cubemapVec);
}