Simplified lighting example viewport
@@ -223,17 +223,13 @@ fn main() {
})
.unwrap();
- let viewport_geometry_pass = Viewport::new_at_origo(
- frame_input.viewport.width - panel_width,
- frame_input.viewport.height,
- );
- let viewport_light_pass = Viewport {
+ let viewport = Viewport {
x: panel_width as i32,
y: 0,
- width: viewport_geometry_pass.width,
- height: viewport_geometry_pass.height,
+ width: frame_input.viewport.width - panel_width,
+ height: frame_input.viewport.height,
};
- change |= camera.set_aspect(viewport_geometry_pass.aspect()).unwrap();
+ change |= camera.set_aspect(viewport.aspect()).unwrap();
for event in frame_input.events.iter() {
match event {
@@ -320,16 +316,13 @@ fn main() {
// Geometry pass
if change {
pipeline
- .geometry_pass(
- viewport_geometry_pass.width,
- viewport_geometry_pass.height,
- &|| {
+ .geometry_pass(viewport.width, viewport.height, &|| {
monkey.render_geometry(
RenderStates {
cull: CullType::Back,
..Default::default()
},
- viewport_geometry_pass,
+ Viewport::new_at_origo(viewport.width, viewport.height),
&Mat4::identity(),
&camera,
)?;
@@ -338,20 +331,19 @@ fn main() {
cull: CullType::Back,
..Default::default()
},
- viewport_geometry_pass,
+ Viewport::new_at_origo(viewport.width, viewport.height),
&Mat4::identity(),
&camera,
)?;
Ok(())
- },
- )
+ })
.unwrap();
}
// Light pass
Screen::write(&context, &ClearState::default(), || {
pipeline.light_pass(
- viewport_light_pass,
+ viewport,
&camera,
if ambient_enabled {
Some(&ambient_light)
