/// Shader used for drawing bitmap fills. // NOTE: The `common.wgsl` source is prepended to this before compilation. struct VertexOutput { @builtin(position) position: vec4, @location(0) uv: vec2, }; @group(1) @binding(0) var transforms: common__Transforms; @group(2) @binding(0) var textureTransforms: common__TextureTransforms; @group(2) @binding(1) var texture: texture_2d; @group(2) @binding(2) var texture_sampler: sampler; @vertex fn main_vertex(in: common__VertexInput) -> VertexOutput { let matrix_ = textureTransforms.texture_matrix; let uv = (mat3x3(matrix_[0].xyz, matrix_[1].xyz, matrix_[2].xyz) * vec3(in.position, 1.0)).xy; let pos = common__globals.view_matrix * transforms.world_matrix * vec4(in.position.x, in.position.y, 0.0, 1.0); return VertexOutput(pos, uv); } @fragment fn main_fragment(in: VertexOutput) -> @location(0) vec4 { return common__srgb_to_linear(textureSample(texture, texture_sampler, in.uv)); }