[PR #7568] Models: the obj model loader #7678

Open
opened 2026-11-03 07:21:53 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7568
Author: @UMCEKO
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: models/obj-loader


📝 Commits (2)

  • 04d85b6 Models: the composite model loader
  • a95b006 Models: the obj model loader

📊 Changes

11 files changed (+808 additions, -35 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 crates/horizon-assets/Cargo.toml (+1 -0)
📝 crates/horizon-assets/src/bake.rs (+282 -2)
📝 crates/horizon-assets/src/json.rs (+33 -0)
📝 crates/horizon-assets/src/lib.rs (+1 -0)
📝 crates/horizon-assets/src/model.rs (+89 -1)
➕ crates/horizon-assets/src/obj.rs (+183 -0)
📝 crates/horizon-assets/src/resolve.rs (+179 -22)
📝 crates/horizon-client-render/src/breaking.rs (+1 -0)
📝 crates/horizon-client-render/src/mesher.rs (+1 -1)
📝 crates/horizon-client-render/src/model_library.rs (+37 -9)

📄 Description

🤖 Opened by UMCEKO's AI agent (Claude Code, Claude Opus 5.5), not by UMCEKO personally.

Mekanism's pipes, cables and transporters are obj models: the geometry lives in a Wavefront .obj file with a .mtl for its materials, and Horizon drew nothing for them.

This reads the .obj and .mtl through a new AssetReader on ModelLibrary (the client reads them from the content root) and bakes their faces as unculled quads. A triangle repeats its last vertex, flip_v flips V, and shade_quads: false turns off directional shading through a new ModelQuad.shade flag the mesher honours (shader-pack lighting still wins). map_Kd #slot picks one of the model's texture slots, map_Kd namespace:path names a sprite, and mtl_override replaces the .mtl. A face whose o/g object the model's visibility marks false is skipped, the model nearest the leaf winning; that's how Mekanism's transmitter items show only the pieces they keep. A missing or broken file warns once and bakes nothing.

Part of #5551, on top of #7567 (its commit is the first of this branch).

Left out: other obj options (automatic culling, emissive ambient), a composite child's own render type, and the "models no blockstate names" part of the issue.

pr_ready (tools/pr_ready.py --quick, against origin/main at b09827e93; rebased onto 3527331d1 since, cargo test -p horizon-assets rerun clean)

Check Result
Scope ⚠️ 12 files, +808 −35 with #7567's commit; this commit alone is 10 files, +541 −26
Cargo.lock ✅ changes with a Cargo.toml (log for horizon-assets)
Public tree ✅
Python tests ✅ 614 passed
rustfmt ✅
clippy ✅
tests: workspace ⚠️ 5115 passed, 6 failed: horizon-world piston tests (level::tests::pistons_push_and_sticky_pistons_pull...), a crate that depends on neither changed crate
doc tests ✅ 0 passed
content root tests ✅ 24 passed
launcher rustfmt, clippy, tests ✅ 445 passed
Parity ➖ 382 affected, to run in CI (--quick)
Label feature

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/7568 **Author:** [@UMCEKO](https://github.com/UMCEKO) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `models/obj-loader` --- ### 📝 Commits (2) - [`04d85b6`](https://github.com/horizon-rust/horizon/commit/04d85b6261424550cc74d9ce9697fd8654fa4d97) Models: the composite model loader - [`a95b006`](https://github.com/horizon-rust/horizon/commit/a95b0065707bdfc213a9761e8c4e551552fdb962) Models: the obj model loader ### 📊 Changes **11 files changed** (+808 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `crates/horizon-assets/Cargo.toml` (+1 -0) 📝 `crates/horizon-assets/src/bake.rs` (+282 -2) 📝 `crates/horizon-assets/src/json.rs` (+33 -0) 📝 `crates/horizon-assets/src/lib.rs` (+1 -0) 📝 `crates/horizon-assets/src/model.rs` (+89 -1) ➕ `crates/horizon-assets/src/obj.rs` (+183 -0) 📝 `crates/horizon-assets/src/resolve.rs` (+179 -22) 📝 `crates/horizon-client-render/src/breaking.rs` (+1 -0) 📝 `crates/horizon-client-render/src/mesher.rs` (+1 -1) 📝 `crates/horizon-client-render/src/model_library.rs` (+37 -9) </details> ### 📄 Description > 🤖 Opened by UMCEKO's AI agent (Claude Code, Claude Opus 5.5), not by UMCEKO personally. Mekanism's pipes, cables and transporters are obj models: the geometry lives in a Wavefront .obj file with a .mtl for its materials, and Horizon drew nothing for them. This reads the .obj and .mtl through a new `AssetReader` on `ModelLibrary` (the client reads them from the content root) and bakes their faces as unculled quads. A triangle repeats its last vertex, `flip_v` flips V, and `shade_quads: false` turns off directional shading through a new `ModelQuad.shade` flag the mesher honours (shader-pack lighting still wins). `map_Kd #slot` picks one of the model's texture slots, `map_Kd namespace:path` names a sprite, and `mtl_override` replaces the .mtl. A face whose `o`/`g` object the model's `visibility` marks false is skipped, the model nearest the leaf winning; that's how Mekanism's transmitter items show only the pieces they keep. A missing or broken file warns once and bakes nothing. Part of #5551, on top of #7567 (its commit is the first of this branch). Left out: other obj options (automatic culling, emissive ambient), a composite child's own render type, and the "models no blockstate names" part of the issue. **pr_ready** (`tools/pr_ready.py --quick`, against origin/main at b09827e93; rebased onto 3527331d1 since, `cargo test -p horizon-assets` rerun clean) | Check | Result | | --- | --- | | Scope | ⚠️ 12 files, +808 −35 with #7567's commit; this commit alone is 10 files, +541 −26 | | Cargo.lock | ✅ changes with a Cargo.toml (`log` for horizon-assets) | | Public tree | ✅ | | Python tests | ✅ 614 passed | | rustfmt | ✅ | | clippy | ✅ | | tests: workspace | ⚠️ 5115 passed, 6 failed: `horizon-world` piston tests (`level::tests::pistons_push_and_sticky_pistons_pull`...), a crate that depends on neither changed crate | | doc tests | ✅ 0 passed | | content root tests | ✅ 24 passed | | launcher rustfmt, clippy, tests | ✅ 445 passed | | Parity | ➖ 382 affected, to run in CI (--quick) | | Label | `feature` | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#7678
No description provided.