codecraft 0.1.2

A minimalist 3D game engine built on parts of Bevy (ECS, color) with wgpu and winit: OpenPBR materials, clustered lighting, a yakui-drawn UI, audio and gamepad haptics; its binary maps any folder, and the symbols of its Rust files, as a 3D wall of boxes
Documentation
// Depth from a light's point of view, and from straight above. Vertex only:
// nothing is shaded, the depth buffer that comes out is the whole product.
// The main pass reads the first to work out how much light reaches a surface,
// and the second as a height field, to work out how much sky does.

// Laid out to match `CameraUniform`, field for field: a uniform read through
// two shaders has to be described the same way in both.
struct Camera {
    view_proj: mat4x4<f32>,
    light_view_proj: mat4x4<f32>,
    ao_view_proj: mat4x4<f32>,
    light_dir: vec4<f32>,
    key_color: vec4<f32>,
    rim_dir: vec4<f32>,
    rim_color: vec4<f32>,
    ambient: vec4<f32>,
    eye: vec4<f32>,
    shadow: vec4<f32>,
    ao: vec4<f32>,
};

@group(0) @binding(0)
var<uniform> camera: Camera;

fn place(
    position: vec3<f32>,
    model_0: vec4<f32>,
    model_1: vec4<f32>,
    model_2: vec4<f32>,
    model_3: vec4<f32>,
) -> vec4<f32> {
    let model = mat4x4<f32>(model_0, model_1, model_2, model_3);
    return model * vec4<f32>(position, 1.0);
}

@vertex
fn vs_main(
    @location(0) position: vec3<f32>,
    @location(2) model_0: vec4<f32>,
    @location(3) model_1: vec4<f32>,
    @location(4) model_2: vec4<f32>,
    @location(5) model_3: vec4<f32>,
) -> @builtin(position) vec4<f32> {
    return camera.light_view_proj * place(position, model_0, model_1, model_2, model_3);
}

@vertex
fn vs_ao(
    @location(0) position: vec3<f32>,
    @location(2) model_0: vec4<f32>,
    @location(3) model_1: vec4<f32>,
    @location(4) model_2: vec4<f32>,
    @location(5) model_3: vec4<f32>,
) -> @builtin(position) vec4<f32> {
    return camera.ao_view_proj * place(position, model_0, model_1, model_2, model_3);
}