41 lines
1.1 KiB
Rust
41 lines
1.1 KiB
Rust
use super::{
|
|
color::Color3,
|
|
framebuffer::FrameBuffer,
|
|
types::{BufferID, Position2},
|
|
vertex::Vertex,
|
|
};
|
|
|
|
pub enum DrawCommand {
|
|
/// Copy one framebuffer onto another
|
|
UpdateFrame(UpdateFrameData),
|
|
Clear(Color3),
|
|
ClearBuffer(BufferID),
|
|
AppendVertex(BufferID, Vertex),
|
|
}
|
|
|
|
/// Offset framebuffer two by offset and place it onto framebuffer one
|
|
pub struct UpdateFrameData {
|
|
pub offset: Position2,
|
|
pub framebuffer_1: FrameBuffer,
|
|
pub framebuffer_2: FrameBuffer,
|
|
}
|
|
|
|
impl UpdateFrameData {
|
|
/// Run a few checks to make sure this is a sane action
|
|
pub fn sanity_check(&self) -> bool {
|
|
let size_check;
|
|
let mut x_offscreen = false;
|
|
let mut y_offscreen = false;
|
|
|
|
size_check = self.framebuffer_1.check_size(&self.framebuffer_2);
|
|
if self.offset.inner[0] > self.framebuffer_1.width as f32 {
|
|
x_offscreen = true
|
|
}
|
|
if self.offset.inner[1] > self.framebuffer_1.height as f32 {
|
|
y_offscreen = true
|
|
}
|
|
|
|
size_check && x_offscreen && y_offscreen
|
|
}
|
|
}
|