Compare commits

...
7 Commits
10 changed files with 58 additions and 29 deletions

No files matched your search

+9 -1
View File
@@ -2,6 +2,13 @@
## [Unreleased] - ReleaseDate
## [0.1.2] - 2025-10-20
### Fixed
- Fix problem that causes non-identical frames to be elided.
- Correctly align layout origins with physical pixel grid for sharper text rendering.
## [0.1.1] - 2025-10-19
### Added
@@ -26,7 +33,8 @@
- First release
<!-- next-url -->
[Unreleased]: https://github.com/meehl/rusty-path-of-building/compare/v0.1.1...HEAD
[Unreleased]: https://github.com/meehl/rusty-path-of-building/compare/v0.1.2...HEAD
[0.1.2]: https://github.com/meehl/rusty-path-of-building/compare/v0.1.1...v0.1.2
[0.1.1]: https://github.com/meehl/rusty-path-of-building/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/meehl/rusty-path-of-building/releases/tag/v0.1.0
Generated
+1 -1
View File
@@ -2509,7 +2509,7 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
[[package]]
name = "rusty-path-of-building"
version = "0.1.1"
version = "0.1.2"
dependencies = [
"ahash",
"anyhow",
+1 -1
View File
@@ -4,7 +4,7 @@ authors = ["meehl"]
description = "Cross-platform runtime for Path of Building"
repository = "https://github.com/meehl/rusty-path-of-building"
license = "MIT"
version = "0.1.1"
version = "0.1.2"
edition = "2024"
publish = false
+3 -3
View File
@@ -1,8 +1,8 @@
# Rusty Path of Building
Rusty Path of Building is a cross-platform runtime for [Path of Building](https://github.com/PathOfBuildingCommunity/PathOfBuilding) and [Path of Building 2](https://github.com/PathOfBuildingCommunity/PathOfBuilding-PoE2). It implements the API used by PoB and handles rendering, window management, and input, essentially serving as a drop-in replacement for the [official runtime](https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic).
Rusty Path of Building is a cross-platform runtime for [Path of Building](https://github.com/PathOfBuildingCommunity/PathOfBuilding) and [Path of Building 2](https://github.com/PathOfBuildingCommunity/PathOfBuilding-PoE2). Like the [official runtime](https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic), it serves as a host environment for PoB by implementing the API used by the application's Lua logic, as well as rendering, window management, and input handling.
This project was primarily created to allow Path of Building to run natively on Linux. It is written in Rust (in case you couldn't already tell from the unimaginative name) and is designed to work across all platforms, though it has only been tested on Linux so far.
This project was primarily created to allow Path of Building to run natively on Linux. It is written in Rust (in case you couldn't already tell from the unimaginative name) and is designed to work across all platforms, though only Linux has been tested so far.
## Usage
@@ -40,4 +40,4 @@ Please refer to the [Lua documentation](https://www.lua.org/manual/5.1/manual.ht
## Known Issues
- Clipboard might not work on some Wayland compositors. Check this for compositor support and temporary workaround: https://github.com/1Password/arboard?tab=readme-ov-file#backend-support
- The clipboard doesn't work with Wayland compositors that don't support the data-control extension(s). It is recommended to fall back to `Xwayland` in these cases. This can be done by unsetting `WAYLAND_DISPLAY`. More info here: https://github.com/1Password/arboard?tab=readme-ov-file#backend-support
+5 -3
View File
@@ -99,9 +99,11 @@ impl Context {
self.previous_layers_hash = layers_hash;
let primitives = self.layers.consume_layers();
let meshes = self
.tessellator
.convert_clipped_primitives(primitives, font_atlas_size);
let meshes = self.tessellator.convert_clipped_primitives(
primitives,
font_atlas_size,
self.pixels_per_point,
);
RenderJob::Render {
meshes,
+4 -8
View File
@@ -155,7 +155,7 @@ impl Fonts {
};
let mut builder =
self.layout_context
.tree_builder(&mut self.font_context, 1.0, true, &style);
.tree_builder(&mut self.font_context, 1.0, false, &style);
builder.push_text(text);
let (mut layout, _) = builder.build();
@@ -204,13 +204,9 @@ impl Fonts {
..default_style
};
let mut builder = self.layout_context.tree_builder(
&mut self.font_context,
1.0,
// TODO: quantize true or false?
true,
&style,
);
let mut builder =
self.layout_context
.tree_builder(&mut self.font_context, 1.0, false, &style);
for segment in job.segments {
let brush_style = StyleProperty::Brush(segment.color);
+3 -3
View File
@@ -13,9 +13,9 @@ pub struct Vertex {
pub pos: LogicalPoint<f32>,
pub uv: NormalizedPoint,
pub color: Srgba,
// TODO: layer_idx is the same for all vertices. use a uniform buffer
// and bind it along with the texture. move into Mesh or make part of
// TextureId (change into tuple)
/// Index into texture array
/// TODO: Remove from Vertex and put into Mesh. Use push constant to set index
/// before each draw call. Not sure if actually faster, profiling needed.
pub layer_idx: u32,
}
+1 -1
View File
@@ -188,5 +188,5 @@ impl Hash for TextPrimitive {
fn hash_pos<H: Hasher, U>(pos: &Point<f32, U>, state: &mut H) {
OrderedFloat(pos.x).hash(state);
OrderedFloat(pos.x).hash(state);
OrderedFloat(pos.y).hash(state);
}
+19 -3
View File
@@ -1,5 +1,5 @@
use crate::{
dpi::{Normalize, NormalizedQuad, NormalizedRect, Uv},
dpi::{ConvertToLogical, ConvertToPhysical, Normalize, NormalizedQuad, NormalizedRect, Uv},
fonts::FontAtlasSize,
renderer::{
mesh::{ClippedMesh, Mesh},
@@ -22,13 +22,19 @@ impl Tessellator {
&mut self,
clipped_primitives: impl Iterator<Item = ClippedPrimitive>,
font_atlas_size: FontAtlasSize,
pixels_per_point: f32,
) -> Vec<ClippedMesh> {
profiling::scope!("convert_primitives");
let mut clipped_meshes = Vec::with_capacity(self.last_clipped_meshes_size);
for clipped_primitive in clipped_primitives {
self.convert_clipped_primitive(clipped_primitive, font_atlas_size, &mut clipped_meshes);
self.convert_clipped_primitive(
clipped_primitive,
font_atlas_size,
pixels_per_point,
&mut clipped_meshes,
);
}
self.last_clipped_meshes_size = clipped_meshes.len();
@@ -39,6 +45,7 @@ impl Tessellator {
&mut self,
clipped_primitive: ClippedPrimitive,
font_atlas_size: FontAtlasSize,
pixels_per_point: f32,
out_clipped_meshes: &mut Vec<ClippedMesh>,
) {
let ClippedPrimitive {
@@ -79,6 +86,7 @@ impl Tessellator {
DrawPrimitive::Text(text_primitive) => self.convert_text_primitive(
text_primitive,
font_atlas_size,
pixels_per_point,
&mut last_clipped_mesh.mesh,
),
}
@@ -134,6 +142,7 @@ impl Tessellator {
&self,
text_primitive: TextPrimitive,
font_atlas_size: FontAtlasSize,
pixels_per_point: f32,
out: &mut Mesh,
) {
let TextPrimitive {
@@ -148,7 +157,14 @@ impl Tessellator {
out.vertices.reserve(layout.num_of_vertices);
out.indices.reserve(layout.num_of_indices);
// TODO: align to pixel grid?
// Make sure the layout origin aligns with the physical pixel grid so
// that each glyph aligns correctly. Glyphs are positioned relative
// to the layout origin and assume that it ends up on the start of
// a physical pixel.
let layout_pos = layout_pos
.to_physical::<f32, _>(pixels_per_point)
.round()
.to_logical(pixels_per_point);
for row in &layout.rows {
for glyph in &row.glyphs {
+12 -5
View File
@@ -95,12 +95,19 @@ pub struct Subscript {
receiver: Receiver<SubscriptCall>,
}
// Subscripts are lua scripts that are executed in their own instance on a separate thread.
// Subscripts are lua scripts that are executed in their own instance on a separate
// thread.
//
// When a subscript needs to call a function defined in the main instance, a `SubscriptCall` message is send over a channel. At the beginning of each frame, the main thread checks for messages and executes the requested function with the provided arguments on behalf of the subscript.
// For `BlockingCall`, the main thread sends the return values of the function back to the subscript which is waiting on them.
// For `NonBlockingCall`, the subscript doesn't wait on any return values and keeps executing the script after sending the message.
// Subscripts are required to explicitly specify the names of all (non)-blocking function calls that appear in the script.
// When a subscript needs to call a function defined in the main instance, a
// `SubscriptCall` message is send over a channel. At the beginning of each frame,
// the main thread checks for messages and executes the requested function with the
// provided arguments on behalf of the subscript.
// For `BlockingCall`, the subscript waits for the main thread to send the return
// values of the function back over another channel.
// For `NonBlockingCall`, the subscript doesn't wait on any return values and keeps
// executing the script after sending the message.
// Subscripts are required to explicitly specify the names of all (non)-blocking
// function calls that appear in the script.
impl Subscript {
pub fn new(
id: u64,