Commit graph

222 commits

Author SHA1 Message Date
Admin
a0732c853c cleanup 2026-03-29 23:21:47 +02:00
Admin
83a9fa2017 xr room mapping 2026-03-27 13:51:54 +01:00
Admin
78296f515b optimising quest renderpath with physics 2026-03-25 22:44:16 +01:00
Admin
5e04f6fb06 optimising quest renderpath with physics 2026-03-25 22:44:16 +01:00
Kevin Boos
66075ff67f
Improve font parsing and text drawing perf with a hybrid caching approach (#986)
* fix windows build by adding missing consts to windows-rs

* Improve font parsing and text drawing perf with a hybrid caching approach

* Reset rustybuzz face cache when cloning FontFace

* fix improper row decorations, back to working properly
2026-03-25 21:28:50 +01:00
Admin
6431464aa1 better physics 2026-03-25 17:39:00 +01:00
Admin
0fc2114f61 finally runs 2026-03-25 17:31:52 +01:00
Admin
06c3e1c0d1 xr otw 2026-03-23 20:52:29 +01:00
Admin
2b677c6da0 compiles 2026-03-23 12:56:39 +01:00
Admin
f9ac0d651e tree 2026-03-22 13:39:01 +01:00
Admin
84ec5394ba fix xr lib 2026-03-21 15:24:19 +01:00
Admin
2f3260f214 demo 2026-03-21 11:39:27 +01:00
Kevin Boos
291e9365a2
cargo makepad: fix android SDK installation (unzip step) on linux (#977)
* Fix windows build: add missing constants in vendored windows-rs bindings

* fix more build errors and warnings in windows-rs vendored copy

* Fix SVG parsing and vector drawing

* Fix erroneous unzip glob pattern that doesn't work on normal linux

* try another approach: unzip everything, cp needed dirs
2026-03-21 11:21:52 +01:00
Admin
2cff94d01b fix android screencap to studio 2026-03-20 09:03:50 +01:00
Kevin Boos
be1229492d
Restore optional serde derives that were removed in Makepad 2.0 (#973) 2026-03-19 20:07:45 +01:00
Kevin Boos
7e51266f5b
Ensure that the Html <br> tag obeys current line spacing settings (#971)
Without this, Html blocks that have both `<br>` and `\n` newlines
(or even just soft line wraps) look quite janky, with poor vertical spacing.
2026-03-19 20:07:28 +01:00
Kevin Boos
7134504e82
Fixed several issue in text drawing, layout, and text flow. (#970)
These are needed to support better formatting of Html code
that mixes multiple different styles together, e.g., inline code
next to normal code, or inline code within a blockquote or a heading.

Full summary of changes:

**File:** `draw/src/shader/draw_text.rs`

Added `#[live(0.0)] pub top_drop: f32` to `TextStyle`. This is a vertical offset expressed as a fraction of font size — positive values shift text downward. It's useful for aligning baselines when mixing fonts with different vertical metrics (e.g., a code font rendered inline with regular text).

**File:** `draw/src/shader/draw_text.rs`

When `temp_y_shift != 0`, the extra shift pixels are now added to `allocate_height()` and the emitted walk rect. This prevents containers (blockquotes, etc.) from clipping the descenders (g, p, q, y) of vertically-shifted text.

**File:** `widgets/src/text_flow.rs`

After selecting the appropriate text style (normal/bold/italic/fixed), `draw_text.temp_y_shift` is now set from that style's `top_drop` value. This allows each style variant to specify its own vertical offset, since `TextFlow` uses a single shared `DrawText` instance for all text rendering.

**File:** `draw/src/turtle.rs`

New public method to mutate `layout.padding.left` after a turtle has been created.

**File:** `widgets/src/text_flow.rs`

After drawing the bullet/number marker, the actual cursor position is now measured and `set_padding_left()` is called so that wrapped continuation lines align with the text after the marker, rather than being over-indented by the estimated `font_based_padding` (which was `2.5 * font_size`).

Additionally, the hardcoded `draw_text(cx, " ")` spacer after the marker was replaced with `walk_margin(cx, self.list_item_marker_pad)` for precise pixel-based control.

**File:** `widgets/src/text_flow.rs`

Added `#[live(5.0)] list_item_marker_pad: f64` — a configurable spacing (in pixels) between the list item marker (bullet/number) and the content text that follows it.
2026-03-19 20:07:13 +01:00
Admin
5a4bef21d6 cleanup 2026-03-19 10:16:38 +01:00
Admin
4c7b806524 helmet with real envmap 2026-03-18 01:29:59 +01:00
Admin
6cd202a553 remove dep 2026-03-18 01:02:57 +01:00
Admin
1a0f01ce89 vulkan debugging 2026-03-17 23:59:07 +01:00
Admin
987f21bea4 cef 2026-03-17 19:00:28 +01:00
Admin
3803e091de vulkan video textures 2026-03-17 19:00:28 +01:00
Admin
a8f5877687 quite good 2026-03-17 19:00:28 +01:00
Kevin Boos
94711aa64b
fix SVG handling to support SVG files with fill "none" (#961)
Also fix splash example icon paths
2026-03-16 20:44:17 +01:00
Admin
6658d6515f slow voxels 2026-03-15 15:36:30 +01:00
Admin
b070eb7477 bricks 2026-03-15 13:35:58 +01:00
Admin
64b1a7c74b vulkan back 2026-03-15 13:20:49 +01:00
Admin
8ee34e0e84 otw 2026-03-15 09:52:45 +01:00
Admin
057035243b works again 2026-03-15 09:52:44 +01:00
Admin
3e3f4fd2e0 zbuf back 2026-03-15 09:52:44 +01:00
offline-ant
8189d8eab2
compositor: add projected quad and offscreen surface primitives (#947)
* draw: add draw-list transform helpers for projected composition

* draw: unroll rounded box shadow sampling in SDF shader

* platform: honor per-draw depth_write across backends

* compositor: add projected quad and offscreen surface primitives

---------

Co-authored-by: ant <ant@offline.click>
2026-03-14 12:12:05 +01:00
Admin
f040a2f2a6 hands back! 2026-03-12 16:57:25 +01:00
Admin
bca911513d xr otw 2026-03-12 15:51:30 +01:00
Sabin Regmi
2e900f48af
Clippy Fixes Only (#939)
* clippy fixes on draw

* more clippy fixes

* more clippy fixes

* more small nits
2026-03-12 14:59:41 +01:00
Sabin Regmi
bba8868caf
Optimize font loading and add SharedBytes (#938)
Introduce selective font loading and a SharedBytes abstraction with mmap support to reduce memory and IO overhead when handling fonts.

Key changes:
- Add SharedBytes (with MappedBytes using memmap2) and stats; switch FontData to SharedBytes and update loader/loader tests.
- Platform: add memmap2 dependency (non-wasm), new platform API helpers get_resource_abs_path and get_resource_font_bytes to prefer mmap'ed files and fall back to owned bytes.
- Font family/load changes: ensure_fonts_loaded_for_text and update_font_definitions now accept optional text to load only needed fallback fonts (CJK/emoji) based on text content and resource basename heuristics.
- Avoid eager loading of heavy bundled fallback fonts (LXGWWenKai*, NotoColorEmoji.ttf) when loading all script resources.
- Add env override MAKEPAD_TEXT_ATLAS_SIZE for text atlas size parsing and tests; add related parsing helpers and tests.
- Minor fixes: safer transmute for font_face data slice and several unit tests to validate behavior.

Overall this reduces unnecessary font resource reads/mmap usage and allows tuning text atlas size via environment.
2026-03-11 16:25:35 +01:00
Sabin Regmi
713628a89f
Load script resources per-handle (avoid global loads) (#923)
Replace broad cx.load_all_script_resources() calls with a targeted cx.load_script_resource(handle) to only request the specific resource needed. Refactor script resource loading (platform/src/script/res.rs) by extracting load_script_resource_impl(handle, crate_manifests) and exposing load_script_resource(handle); keep load_all_script_resources() by iterating per-handle. Improve wasm handling: resolve web_url per-resource, set explicit error states when missing, and fire async HTTP requests safely. Remove an early call to load_all_script_resources() from web startup. Additional changes: serve precompressed .br files in the local wasm dev server (with COOP/COEP headers when threaded), add wasm-specific font/theme script entries for widgets, and update various callers (draw shaders, widgets, math_view, gltf/view_splat, image) to use the per-handle loader. These changes reduce unnecessary global loads and limit network/file operations to only required resources.
2026-03-06 16:01:07 +01:00
Admin
4ad0be2a69 move draw svg with turtle 2026-03-04 10:25:19 +01:00
offline-ant
b7d573eaf5
turtle: rename BeginTurtle/EndTurtle to BeginClip/EndClip, add push/pop_clip_rect (#907)
Rename AlignEntry::BeginTurtle/EndTurtle to BeginClip/EndClip — these
entries control GPU clip rect stacking, not turtle lifecycle.

Add push_clip_rect/pop_clip_rect to Cx2d: lightweight API for manual
clip rect control without creating a full turtle. The existing
clip_and_shift_align_list pass intersects nested clip rects and writes
draw_clip into draw call instances.

Co-authored-by: ant <ant@offline.click>
2026-03-03 08:53:50 +01:00
offline-ant
1b800c4c8e
text: add letter/word spacing, RTL, features, y_offset, variations to shaper (#908)
Co-authored-by: ant <ant@offline.click>
2026-03-03 08:53:26 +01:00
Admin
524ac9186d cleanup 2026-03-01 23:15:39 +01:00
Admin
1ef52d6553 wasm 2026-03-01 20:22:11 +01:00
offline-ant
975e766c1a
Font loading: defer registration to draw-time, add fast-path completeness check (#901)
Move font family registration out of on_custom_apply (script apply time)
and into ensure_fonts_loaded (draw time). This avoids redundant work when
the same FontFamily is applied to hundreds of widgets during a frame.

ensure_fonts_loaded now has a fast path that checks is_font_family_complete()
and returns immediately when all expected members are already registered.
The slow path calls load_all_script_resources() to progress pending loads
before falling back to update_font_definitions().

Other changes:
- FontFamilyDefinition gains expected_member_count to distinguish partial
  from complete registrations.
- set_font_family_definition skips cache eviction when the definition or
  cached family is already equivalent.
- load_font_family now clones the definition instead of removing it,
  allowing re-loads after cache eviction without losing the definition.
- Loader::font_family_definitions and Layouter::loader are now pub(crate)
  to support the completeness query from Fonts.

---

Review observations (not yet addressed):

1. STALE FAMILY ON RE-APPLY (medium risk): If a FontFamily is re-applied
   with different members but the same object index (same family_id), the
   fast path in ensure_fonts_loaded will see the old definition as
   "complete" and never call update_font_definitions with the new members.
   Fix: compare current member handles against stored definition, or set a
   dirty flag in on_custom_apply that forces one refresh.

2. UNNECESSARY LAYOUT CACHE FLUSH (medium risk): Layouter::set_font_family_definition
   unconditionally clears cached_params and cached_results even when
   Loader::set_font_family_definition short-circuits as unchanged. During
   partial-load states ensure_fonts_loaded may call update repeatedly with
   identical partial definitions, flushing the text layout cache each time.
   Fix: propagate a changed bool from Loader and only clear when true.

3. COMPLETENESS IGNORES CACHE-ONLY STATE (low risk): is_font_family_complete
   only checks font_family_definitions, not font_family_cache. If a family
   was already loaded into cache and its definition consumed, completeness
   returns false. The new early-return in set_font_family_definition for
   cache-match mitigates this in practice but the invariant is fragile.
   Fix: also check font_family_cache in is_font_family_complete, or ensure
   definitions are always retained (which this diff partly does by switching
   from remove to get+clone in load_font_family).

Co-authored-by: ant <ant@offline.click>
2026-02-28 10:29:36 +01:00
Admin
8b6ccc0d85 centralised resource cache 2026-02-27 16:55:05 +01:00
offline-ant
af684756c9
Font optimization: reduce atlas 64MB→4MB, use static data for builtins (#898)
Co-authored-by: ant <ant@offline.click>
2026-02-27 16:39:38 +01:00
Admin
dd4c79b1e1 add get_color to draw_glyph 2026-02-27 09:39:21 +01:00
Admin
22ebf59337 text layout
\
2026-02-26 10:08:22 +01:00
admin
ddca609ad8 api 2026-02-25 17:14:39 +01:00
Kevin Boos
d1737883da
FIx Icon, improve to support IconRotated, expose geom in draw_svg (#883)
* Fix draw_svg to support a rotated Icon. Add `IconRotated` widget.

Fix icon resource paths in `splash` example

* Expose geometry in draw_svg to make icon/svg rotation more efficient

simplifies the code too
2026-02-25 13:05:14 +01:00
Admin
33eeb0d244 little glitches in script engine 2026-02-24 23:32:56 +01:00