Skip to content

Commit 8dd1add

Browse files
udpate deps to improve both performance and binary size
1 parent 074d6e4 commit 8dd1add

File tree

5 files changed

+34
-40
lines changed

5 files changed

+34
-40
lines changed

Cargo.lock

Lines changed: 4 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,32 @@ authors = ["Lucas de Linhares <[email protected]>"]
55
edition = "2024"
66

77
[dependencies]
8-
egui = "0.31"
8+
egui = { version = "0.31", default-features = false }
99
eframe = { version = "0.31", default-features = false, features = [
10-
"default_fonts", # Embed the default egui fonts.
11-
"wgpu", # Use the glow rendering backend. Alternative: "wgpu".
12-
"wayland", # To support Linux (and CI)
10+
"wgpu",
11+
"wayland", # To support Linux (and CI)
1312
"x11",
1413
] }
15-
wgpu = { version = "24", features = ["webgpu", "webgl"] }
14+
wgpu = "24"
1615
egui-wgpu = "0.31"
1716
log = "0.4"
18-
glam = "0.30"
17+
glam = { version = "0.30", features = ["fast-math"] }
1918
bytemuck = "1.22"
2019
rand = { version = "0.9", default-features = false, features = ["small_rng"] }
2120

2221
# native:
2322
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
24-
env_logger = "0.11"
23+
env_logger = { version = "0.11", optional = true }
24+
25+
26+
[features]
27+
logs = ["dep:env_logger"]
2528

2629
# web:
2730
[target.'cfg(target_arch = "wasm32")'.dependencies]
31+
wgpu = { version = "24", features = ["webgl"] }
2832
wasm-bindgen-futures = "0.4"
29-
web-sys = "0.3" # to access the DOM (to hide the loading text)
33+
web-sys = "0.3" # to access the DOM (to hide the loading text)
3034

3135
[profile.release]
3236
codegen-units = 1 # Allows LLVM to perform better optimization.

assets/Ubuntu-Light.ttf

353 KB
Binary file not shown.

src/app.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::simulation::cpu::CpuParticleSimulation;
77
use crate::simulation::transform_feedback::TransformFeedbackSimulation;
88
use crate::simulation::{ParticleSimulation, SimParams, SimulationMethod};
99

10+
use egui::epaint::text::{FontInsert, InsertFontFamily};
1011
use glam::Vec3;
1112
use std::collections::HashSet;
1213
use std::time::Instant;
@@ -45,6 +46,21 @@ pub struct ParticleApp {
4546

4647
impl ParticleApp {
4748
pub fn new(cc: &eframe::CreationContext<'_>) -> Self {
49+
cc.egui_ctx.add_font(FontInsert::new(
50+
"Ubuntu Light",
51+
egui::FontData::from_static(include_bytes!("../assets/Ubuntu-Light.ttf")),
52+
vec![
53+
InsertFontFamily {
54+
family: egui::FontFamily::Proportional,
55+
priority: egui::epaint::text::FontPriority::Highest,
56+
},
57+
InsertFontFamily {
58+
family: egui::FontFamily::Monospace,
59+
priority: egui::epaint::text::FontPriority::Lowest,
60+
},
61+
],
62+
));
63+
4864
// Get the wgpu render state
4965
let wgpu_render_state = cc
5066
.wgpu_render_state
@@ -477,6 +493,7 @@ impl eframe::App for ParticleApp {
477493
self.mouse_dragging = input.pointer.primary_down();
478494
if input.pointer.secondary_down() {
479495
// Get the actual pointer delta from egui (this is more reliable)
496+
// TODO: Check this
480497
// ctx.output_mut(|o| o.cursor_icon = egui::CursorIcon::None);
481498
let delta = input.pointer.delta();
482499

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
fn main() -> eframe::Result {
66
use std::sync::Arc;
77

8+
#[cfg(feature = "logs")]
89
env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`).
910

1011
let native_options = eframe::NativeOptions {

0 commit comments

Comments
 (0)