Add support for split .gltf and .bin files #3

Merged
EIREXE merged 2 commits from gltf_fix into master 2026-09-14 13:19:29 +00:00
Showing only changes of commit 47662fe4ba - Show all commits
+8 -10
View File
@@ -3,6 +3,7 @@
use std::{ use std::{
collections::{HashMap, HashSet}, collections::{HashMap, HashSet},
io, io,
path::Path,
}; };
use bevy::{ use bevy::{
@@ -547,12 +548,8 @@ impl AssetLoader for FighterBakeSourceLoader {
let manifest: FighterManifest = ron::de::from_bytes(&manifest_bytes) let manifest: FighterManifest = ron::de::from_bytes(&manifest_bytes)
.map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))?; .map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))?;
let model_path = load_context
.path()
.resolve_embed_str(&manifest.model_path)
.map_err(|error| io::Error::other(error.to_string()))?;
let model_bytes = load_context let model_bytes = load_context
.read_asset_bytes(model_path.clone_owned()) .read_asset_bytes(&manifest.model_path)
.await .await
.map_err(|error| io::Error::other(error.to_string()))?; .map_err(|error| io::Error::other(error.to_string()))?;
@@ -562,11 +559,12 @@ impl AssetLoader for FighterBakeSourceLoader {
for buffer in gltf.buffers() { for buffer in gltf.buffers() {
let bytes = match buffer.source() { let bytes = match buffer.source() {
gltf::buffer::Source::Uri(uri) => load_context gltf::buffer::Source::Uri(uri) => load_context
.read_asset_bytes( .read_asset_bytes(AssetPath::from_path_buf(
model_path Path::new(&manifest.model_path)
.resolve_embed_str(uri) .parent()
.map_err(|error| io::Error::other(error.to_string()))?, .unwrap_or_else(|| Path::new(""))
) .join(uri),
))
.await .await
.map_err(|error| io::Error::other(error.to_string()))?, .map_err(|error| io::Error::other(error.to_string()))?,
gltf::buffer::Source::Bin => gltf.blob.clone().ok_or_else(|| { gltf::buffer::Source::Bin => gltf.blob.clone().ok_or_else(|| {