1 unstable release
0.1.0 | Oct 25, 2023 |
---|
#1046 in Graphics APIs
18KB
479 lines
SoftTri
a software triangle renderer
TODO
- Anti-Aliasing
- SIMD
lib.rs
:
Overview
a software triangle renderer
Example
let width = 1280;
let height = 720;
let v0 = Vertex::new(
[width as f32 / 2.0, 1.0].into(),
[1.0, 0.0, 0.0, 1.0].into(),
[0.0, 0.0].into(),
);
let v1 = Vertex::new(
[1.0, height as f32 - 1.0].into(),
[0.0, 1.0, 0.0, 1.0].into(),
[1.0, 0.0].into(),
);
let v2 = Vertex::new(
[width as f32 - 1.0, height as f32 - 1.0].into(),
[0.0, 0.0, 1.0, 1.0].into(),
[1.0, 1.0].into(),
);
let mut canvas = SoftTriCanvas::new(width, height, TextureFormat::RGBA);
canvas.draw_tri(v0, v1, v2, None);
// draw to a window/image using canvas.buffer
Dependencies
~2.5MB
~45K SLoC