nightshade-api 0.43.0

Procedural high level API for the nightshade game engine
Documentation
use nightshade_api::prelude::*;

fn build_scene(world: &mut World) {
    set_background(world, Background::Nebula);
    show_grid(world, false);
    set_bloom(world, true);
    spawn_floor(world, 14.0);

    for index in 0..7 {
        let angle = index as f32 / 7.0 * std::f32::consts::TAU;
        let column = spawn_object(
            world,
            Object {
                shape: Shape::Cylinder,
                position: vec3(angle.cos() * 7.0, 1.5, angle.sin() * 7.0),
                scale: vec3(1.0, 3.0, 1.0),
                color: STEEL,
                ..Object::default()
            },
        );
        set_metallic_roughness(world, column, 0.9, 0.3);
    }

    let centerpiece = spawn_torus(world, vec3(0.0, 2.2, 0.0));
    set_scale(world, centerpiece, vec3(1.6, 1.6, 1.6));
    set_emissive(world, centerpiece, [0.3, 0.8, 1.0], 9.0);
    point_light(world, vec3(0.0, 4.5, 0.0), [0.3, 0.8, 1.0], 8.0);

    fixed_camera(world, vec3(11.0, 6.0, 11.0), vec3(0.0, 1.8, 0.0));
}

#[cfg(not(target_arch = "wasm32"))]
fn main() {
    std::fs::create_dir_all("screenshots").expect("failed to create the screenshots directory");
    render_image(1920, 1080, "screenshots/poster.png", build_scene);
    println!("wrote screenshots/poster.png");
}

#[cfg(target_arch = "wasm32")]
fn main() {
    run_scene(build_scene).unwrap();
}