grafix_toolbox/kit/opengl/
frame.rs

1pub use {fbo::*, framebuff::*, screen::FrameInfo};
2
3pub trait Frame {
4	fn aspect(&self) -> Vec2 {
5		let (w, h) = self.size();
6		let (w, h, min) = Vec3((w, h, w.min(h)));
7		(min, min).div((w, h))
8	}
9	fn to_clip(&self) -> Vec2 {
10		(1., 1.).div(self.aspect())
11	}
12	fn pixel(&self) -> f32 {
13		let (w, h) = self.size();
14		2. / f32(w.min(h))
15	}
16	fn pixel_vec2(&self) -> Vec2 {
17		let p = self.pixel();
18		(p, p)
19	}
20	fn clear(&self, args: impl ColorDepthArg) {
21		let (rgba, d) = args.getc();
22		self.ClearColor((0, rgba));
23		self.ClearDepth(d);
24	}
25	fn ClearColor(&self, _: impl ClearArgs);
26	fn ClearDepth<T>(&self, _: T)
27	where
28		f32: Cast<T>,
29	{
30	}
31	fn size(&self) -> uVec2;
32	fn bind(&self) -> Binding<Framebuff>;
33}
34
35mod args;
36mod fbo;
37mod framebuff;
38mod screen;
39
40use crate::{lib::*, math::*, GL::tex::*};
41use {super::internal::*, args::*};