Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
efc69e0
Fix markdown in README
jdahlstrom Oct 14, 2025
afef09e
Implement arithmetic operators for colors
jdahlstrom Jul 31, 2024
72aae1a
Make Batch generic over primitive type
jdahlstrom Jan 22, 2025
3a65434
Add Target impl for Buf<Color4>
jdahlstrom Sep 7, 2025
c8174ab
Add minimal example that renders to a file to core/lib.rs docs
jdahlstrom May 28, 2025
4c5af3d
Fix line rendering
jdahlstrom May 28, 2025
7bad43c
Switch to as_chunks now that it's stable
jdahlstrom Aug 14, 2025
86c6dbb
Add origin method to Point
jdahlstrom Oct 18, 2025
fa8380b
Add Matrix constructor from affine basis
jdahlstrom Sep 7, 2025
6c6a3c2
Add Plane::new constructor
jdahlstrom Sep 26, 2025
77d371a
Add basis type to Polar and PolarVec
jdahlstrom Oct 18, 2025
a50aa2e
Impl Default for SphericalVec and PolarVec
jdahlstrom Oct 18, 2025
09b06a0
Add several methods to Tri and Plane
jdahlstrom Sep 6, 2025
aff69b5
Use new tri() convenience constructor
jdahlstrom Oct 19, 2025
6cc3f4b
Add a few missing doctests to geom
jdahlstrom Oct 19, 2025
126ca0c
Add demo rendering to terminal with ncurses
jdahlstrom May 28, 2025
3a8921e
Add "inverse lerp" function
jdahlstrom Sep 6, 2025
c5180f6
Fix Clippy warnings
jdahlstrom Oct 17, 2025
660fb5f
Add warp method to Mesh
jdahlstrom Sep 7, 2025
f2bf85e
Refactor HSL/RGB conversions, add doctests
jdahlstrom Sep 7, 2025
d75a8e3
Fix feature gate from std to fp
jdahlstrom Oct 27, 2025
b3bffb3
Add reshape method to Buf2
jdahlstrom Sep 7, 2025
56d1682
Reformat doc comments
jdahlstrom Sep 7, 2025
096c5a7
Remove abs polyfill, now available in core
jdahlstrom Sep 7, 2025
ce406fd
Add Mat3x3::determinant()
jdahlstrom Sep 24, 2025
a354475
Add a Mat2x2 type alias and methods
jdahlstrom Sep 24, 2025
c908831
Publish mat! macro, make it more general
jdahlstrom Sep 25, 2025
9a5e603
Improve mat doc comments
jdahlstrom Sep 25, 2025
2590ae6
Impl ApproxEq for Matrix
jdahlstrom Sep 25, 2025
6f59f3c
Add examples to vec doc comments
jdahlstrom Sep 25, 2025
acaf1b3
Add Polygon type, like Polyline but closed
jdahlstrom Sep 26, 2025
600dc3d
Fixup diagram in clip comment
jdahlstrom Sep 26, 2025
4f168d9
Factor common code in Target impls to two helper functions
jdahlstrom Sep 29, 2025
7eddb5c
Add crate texture
jdahlstrom Oct 1, 2025
32b10b1
Add Build trait to build meshes with different vertex attribs
jdahlstrom Oct 1, 2025
a0103ba
Impl Build for Box
jdahlstrom Oct 28, 2025
08eb75a
Fix frontface winding to be counter-clockwise
jdahlstrom Oct 28, 2025
83f4678
Use crate texture, change floor to checkers in crates demo
jdahlstrom Oct 28, 2025
f86ec2d
Use color ops in sprites now that they exist
jdahlstrom Oct 28, 2025
c0f0628
WIP Perlin noise support
jdahlstrom Aug 27, 2024
b18d8b5
Add terrain demo using noise
jdahlstrom Oct 29, 2025
f9ff444
Impl Lerp for arrays
jdahlstrom Oct 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ debug = 1
[profile.dev]
opt-level = 1
split-debuginfo = "unpacked"

[lints.clippy]
manual_range_contains = "allow"
collapsible_if = "allow"
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,14 @@ for custom allocators is planned in order to make `alloc` optional as well.

## Planned

- Material support
- Basic scene graph
- Hierarchical transforms

- Mipmapping and mipmap generation
- More procedural generation
- Basic animation and sequencing
- Particle simulations
- Support for more file types
* Material support
* Basic scene graph
* Hierarchical transforms
* Mipmapping and mipmap generation
* More procedural generation
* Basic animation and sequencing
* Particle simulations
* Support for more file types

# Organization

Expand Down
58 changes: 58 additions & 0 deletions core/examples/hello_tri.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
use retrofire_core::geom::tri;
use retrofire_core::{prelude::*, util::*};

fn main() {
let verts = [
vertex(pt3(-1.0, 1.0, 0.0), rgb(1.0, 0.0, 0.0)),
vertex(pt3(1.0, 1.0, 0.0), rgb(0.0, 0.8, 0.0)),
vertex(pt3(0.0, -1.0, 0.0), rgb(0.4, 0.4, 1.0)),
];

#[cfg(feature = "fp")]
let shader = shader::new(
|v: Vertex3<Color3f>, mvp: &Mat4x4<ModelToProj>| {
// Transform vertex position from model to projection space
// Interpolate vertex colors in linear color space
vertex(mvp.apply(&v.pos), v.attrib.to_linear())
},
|frag: Frag<Color3f<_>>| frag.var.to_srgb().to_color4(),
);
#[cfg(not(feature = "fp"))]
let shader = shader::new(
|v: Vertex3<Color3f>, mvp: &Mat4x4<ModelToProj>| {
// Transform vertex position from model to projection space
// Interpolate vertex colors in normal sRGB color space
vertex(mvp.apply(&v.pos), v.attrib)
},
|frag: Frag<Color3f<_>>| frag.var.to_color4(),
);

let dims @ (w, h) = (640, 480);
let modelview = translate3(0.0, 0.0, 2.0).to();
let project = perspective(1.0, w as f32 / h as f32, 0.1..1000.0);
let viewport = viewport(pt2(0, h)..pt2(w, 0));

let mut framebuf = Buf2::<Color4>::new(dims);

render(
[tri(0, 1, 2)],
verts,
&shader,
&modelview.then(&project),
viewport,
&mut framebuf,
&Context::default(),
);

let center_pixel = framebuf[[w / 2, h / 2]];

if cfg!(feature = "fp") {
assert_eq!(center_pixel, rgba(150, 128, 186, 255));
} else {
assert_eq!(center_pixel, rgba(114, 102, 127, 255));
}
#[cfg(feature = "std")]
{
pnm::save_ppm("triangle.ppm", framebuf).unwrap();
}
}
Loading
Loading