-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3d camera_mode.rs
48 lines (35 loc) · 1.06 KB
/
3d camera_mode.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#![allow(non_snake_case)]
#![cfg_attr(debug_assertions, allow(dead_code, unused_imports))]
extern crate raylib;
use raylib::consts::KeyboardKey;
use raylib::consts::KeyboardKey::*;
use raylib::consts::MouseButton::*;
use raylib::prelude::*;
use structopt::StructOpt;
mod options;
trait Drawable {
fn draw(&self, d: &mut impl RaylibDraw);
}
fn main() {
let opt = options::Opt::from_args();
let (mut rl, thread) = opt.open_window("Key shower");
let camera = Camera3D::perspective(
rvec3(0, 10, 10),
rvec3(0, 0, 0),
rvec3(0, 1, 0),
45.0,
);
let cube_position = rvec3(0, 0, 0);
rl.set_target_fps(60);
while !rl.window_should_close() {
let mut d = rl.begin_drawing(&thread);
d.clear_background(Color::RAYWHITE);
{
let mut d = d.begin_mode3D(camera);
d.draw_cube(cube_position, 2.0, 2.0, 2.0, Color::RED);
d.draw_cube_wires(cube_position, 2.0, 2.0, 2.0, Color::MAROON);
d.draw_grid(10, 1.0);
}
d.draw_fps(10, 10);
}
}