Improved effect example
@@ -11,13 +11,14 @@ fn main() {
// Renderer
let mut renderer = DeferredPipeline::new(&gl, width, height, vec4(0.0, 0.0, 0.0, 1.0)).unwrap();
- let mut camera = Camera::new_perspective(&gl, vec3(5.0, 5.0, 5.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0),
+ let mut camera = Camera::new_perspective(&gl, vec3(4.0, 4.0, 5.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0),
degrees(45.0), width as f32 / height as f32, 0.1, 1000.0);
let mut monkey = CPUMesh::new(include_bytes!("../assets/models/suzanne.3d")).unwrap().to_mesh(&gl).unwrap();
monkey.color = vec3(0.5, 1.0, 0.5);
- let ambient_light = AmbientLight::new(&gl, 1.0, &vec3(1.0, 1.0, 1.0)).unwrap();
+ let ambient_light = AmbientLight::new(&gl, 0.2, &vec3(1.0, 1.0, 1.0)).unwrap();
+ let directional_light = DirectionalLight::new(&gl, 0.5, &vec3(1.0, 1.0, 1.0), &vec3(-1.0, -1.0, -1.0)).unwrap();
let mut fog_effect = effects::FogEffect::new(&gl).unwrap();
fog_effect.color = vec3(0.8, 0.8, 0.8);
@@ -62,7 +63,7 @@ fn main() {
// Light pass
RenderTarget::write_to_screen(&gl, 0, 0, width, height, Some(&vec4(0.0, 0.0, 0.0, 0.0)), None, &|| {
- renderer.light_pass(&camera, Some(&ambient_light), &[], &[], &[]).unwrap();
+ renderer.light_pass(&camera, Some(&ambient_light), &[&directional_light], &[], &[]).unwrap();
}).unwrap();
// Effect
