codecraft 0.2.0

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
//! The smallest scene worth looking at: a lit cube turning on a grid, and a
//! camera to fly around it.
//!
//! ```text
//! cargo run --example cube
//! ```
use codecraft::ecs::Entity;
use codecraft::glam::Vec3;
use codecraft::prelude::*;
use codecraft::sceneobjects::lights::default_lights;
use codecraft::{Light, OrbitCamera, Transform, gizmos, primitives};

struct CubeScene {
    cube: Entity,
}

impl CubeScene {
    fn new(app: &mut AppState) -> Self {
        app.spawn(gizmos::grid());

        let [key, rim] = default_lights();
        app.spawn_entity((key, Light::object("Key Light")));
        app.spawn_entity((rim, Light::object("Rim Light")));

        let cube = app.spawn_entity(
            primitives::Box::cube(1.0)
                .at(0.0, 0.5, 0.0)
                .color(Color::srgb(0.9, 0.45, 0.2)),
        );
        app.spawn_entity(
            primitives::Sphere::new(0.4)
                .at(1.8, 0.4, -0.6)
                .color(Color::srgb(0.3, 0.6, 0.9)),
        );

        app.spawn_entity((
            OrbitCamera::new(Vec3::new(0.0, 0.5, 0.0), 5.0).touchpad(),
            OrbitCamera::object("Orbit Camera"),
        ));

        CubeScene { cube }
    }
}

impl Scene for CubeScene {
    fn update(&mut self, app: &mut AppState) {
        let turn = app.time().elapsed * 0.6;
        app.edit::<Transform>(self.cube, |transform| transform.set_yaw(turn));
    }
}

fn main() {
    App::new("cube").scene(CubeScene::new).run();
}