going to switch the lights over to using position, or maybe flesh out directional light more

This commit is contained in:
2021-02-13 23:05:45 -08:00
parent 2c9ce75b8b
commit 9665a70bac
7 changed files with 220 additions and 105 deletions

View File

@@ -131,7 +131,7 @@ fn main() {
resources.insert(LoopState {
delta_time: Default::default(),
start_time: Instant::now(),
step_size: 0.005,
step_size: 0.01666, // 60hz
});
@@ -181,11 +181,8 @@ fn main() {
let mut current_time: f32 = elapsed_time;
event_loop.run(move |event, _, control_flow| {
// Artificially slows the loop rate to 10 millis
// This is called after redraw events cleared
//*control_flow = ControlFlow::WaitUntil(Instant::now() + Duration::from_millis(10));
*control_flow = ControlFlow::Poll;
*control_flow = ControlFlow::Poll;
match event {
event::Event::NewEvents(cause) => {
event_schedule.execute(&mut world, &mut resources);
@@ -256,15 +253,30 @@ pub fn entity_loading(world: &mut World, renderer: &mut Renderer) {
yaw: Rad(-PI),
pitch: Rad(PI/2.0)
},
Color {
r: 1.0,
g: 1.0,
b: 0.5,
a: 1.0,
},
CameraController::new(3.0, 1.0),
));
let light_mesh = renderer.load_mesh_to_buffer("./resources/light.obj");
let light_entity: Entity = world.push((
cgmath::Point3 {
x: 7.0 as f32,
y: -5.0 as f32,
z: 10.0 as f32,
x: 5.0 as f32,
y: 5.0 as f32,
z: 5.0 as f32,
},
Color {
r: 1.0,
g: 0.0,
b: 1.0,
a: 1.0,
},
light_mesh.clone(),
renderer.create_light(),
));
@@ -274,6 +286,7 @@ pub fn entity_loading(world: &mut World, renderer: &mut Renderer) {
y: 7.0 as f32,
z: 10.0 as f32,
},
light_mesh,
renderer.create_light(),
));
@@ -297,9 +310,9 @@ pub fn entity_loading(world: &mut World, renderer: &mut Renderer) {
},
monkey_mesh,
Color {
r: 1.0,
g: 0.5,
b: 0.5,
r: 0.0,
g: 1.0,
b: 0.0,
a: 1.0,
},
));