Skip to main content

poster/
poster.rs

1use nightshade_api::prelude::*;
2
3fn main() {
4    std::fs::create_dir_all("screenshots").expect("failed to create the screenshots directory");
5    render_image(1920, 1080, "screenshots/poster.png", |world| {
6        set_background(world, Background::Nebula);
7        show_grid(world, false);
8        set_bloom(world, true);
9        spawn_floor(world, 14.0);
10
11        for index in 0..7 {
12            let angle = index as f32 / 7.0 * std::f32::consts::TAU;
13            let column = spawn_object(
14                world,
15                Object {
16                    shape: Shape::Cylinder,
17                    position: vec3(angle.cos() * 7.0, 1.5, angle.sin() * 7.0),
18                    scale: vec3(1.0, 3.0, 1.0),
19                    color: STEEL,
20                    ..Object::default()
21                },
22            );
23            set_metallic_roughness(world, column, 0.9, 0.3);
24        }
25
26        let centerpiece = spawn_torus(world, vec3(0.0, 2.2, 0.0));
27        set_scale(world, centerpiece, vec3(1.6, 1.6, 1.6));
28        set_emissive(world, centerpiece, [0.3, 0.8, 1.0], 9.0);
29        point_light(world, vec3(0.0, 4.5, 0.0), [0.3, 0.8, 1.0], 8.0);
30
31        fixed_camera(world, vec3(11.0, 6.0, 11.0), vec3(0.0, 1.8, 0.0));
32    });
33    println!("wrote screenshots/poster.png");
34}