matrix-engine-wgpu
Version:
Networking implemented - based on kurento openvidu server. fix arcball camera,instanced draws added also effect pipeline blend with instancing option.Normalmap added, Fixed shadows casting vs camera/video texture, webGPU powered pwa application. Crazy fas
38 lines (34 loc) • 872 B
JavaScript
export const hpBarEffectShaders = `
struct Camera {
viewProj : mat4x4f
};
struct Model {
model : mat4x4f,
color : vec4f,
progress : f32,
};
var<uniform> camera : Camera;
var<uniform> model : Model;
struct VertexOutput {
position : vec4f,
uv : vec2f,
};
fn vsMain(
position : vec3f,
uv : vec2f
) -> VertexOutput {
var output : VertexOutput;
output.position = camera.viewProj * model.model * vec4f(position, 1.0);
output.uv = uv;
return output;
}
fn fsMain(in : VertexOutput) -> vec4f {
// simple left-to-right fill based on progress
if (in.uv.x > model.progress) {
return vec4f(0.1, 0.1, 0.1, 0.3); // empty (transparent gray)
}
return model.color; // filled
}
`;