Renderer gets size as LogicalSize
This commit is contained in:
parent
c5548b1d28
commit
02182af019
|
@ -14,6 +14,7 @@ use glium::uniforms::MagnifySamplerFilter;
|
||||||
use glium::draw_parameters::{DepthTest, Blend};
|
use glium::draw_parameters::{DepthTest, Blend};
|
||||||
use glium::index::{NoIndices, PrimitiveType};
|
use glium::index::{NoIndices, PrimitiveType};
|
||||||
use glium::glutin::GlWindow;
|
use glium::glutin::GlWindow;
|
||||||
|
use glium::glutin::dpi::LogicalSize;
|
||||||
|
|
||||||
use scene::Scene;
|
use scene::Scene;
|
||||||
use camera::{RenderCamera, mat_to_f32};
|
use camera::{RenderCamera, mat_to_f32};
|
||||||
|
@ -215,29 +216,30 @@ impl Renderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a DynamicImage of the corresponding frame.
|
/// Returns a DynamicImage of the corresponding frame.
|
||||||
pub fn capture(&self, dimensions: (u32, u32)) -> image::DynamicImage {
|
pub fn capture(&self, dimensions: LogicalSize) -> image::DynamicImage {
|
||||||
rgba_image_data_to_image(self.capture_rgba_image_data(dimensions))
|
rgba_image_data_to_image(self.capture_rgba_image_data(dimensions))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a RgbaImageData of the corresponding frame.
|
/// Returns a RgbaImageData of the corresponding frame.
|
||||||
pub fn capture_rgba_image_data(&self, dimensions: (u32, u32)) -> RgbaImageData {
|
pub fn capture_rgba_image_data(&self, dimensions: LogicalSize) -> RgbaImageData {
|
||||||
|
|
||||||
let rect = Rect {
|
let rect = Rect {
|
||||||
left: 0,
|
left: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
width: dimensions.0,
|
width: dimensions.width as u32,
|
||||||
height: dimensions.1,
|
height: dimensions.height as u32,
|
||||||
};
|
};
|
||||||
|
|
||||||
let blit_target = BlitTarget {
|
let blit_target = BlitTarget {
|
||||||
left: 0,
|
left: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
width: dimensions.0 as i32,
|
width: dimensions.width as i32,
|
||||||
height: dimensions.1 as i32,
|
height: dimensions.height as i32,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create temporary texture and blit the front buffer to it
|
// Create temporary texture and blit the front buffer to it
|
||||||
let texture = SrgbTexture2d::empty(&self.display, dimensions.0, dimensions.1)
|
let texture = SrgbTexture2d::empty(
|
||||||
|
&self.display, dimensions.width as u32, dimensions.height as u32)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let framebuffer = SimpleFrameBuffer::new(&self.display, &texture)
|
let framebuffer = SimpleFrameBuffer::new(&self.display, &texture)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
Loading…
Reference in New Issue