From ee198b516bad5db9312dde3749bf864d6c7079b1 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 19 Feb 2025 22:21:44 +0100 Subject: animations --- world/src/mesh.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'world/src/mesh.rs') diff --git a/world/src/mesh.rs b/world/src/mesh.rs index c4a6372..ffc0f2f 100644 --- a/world/src/mesh.rs +++ b/world/src/mesh.rs @@ -20,10 +20,8 @@ use gltf::{Mesh, Node, buffer::Data}; use log::{debug, info, warn}; use std::{collections::BTreeMap, path::Path}; use weareshared::{ - Affine3A, Vec3A, - resources::{MeshPart, Prefab}, - store::ResourceStore, - vec2, vec3a, vec4, + Affine3A, Vec3A, packets::Resource, resources::MeshPart, store::ResourceStore, vec2, vec3a, + vec4, }; pub fn import_mesh( @@ -33,13 +31,13 @@ pub fn import_mesh( store: &ResourceStore, path_base: &Path, node: &Node, - prefab: &mut Prefab, args: &Args, texture_cache: &TextureCache, joint_index_map: &BTreeMap<(usize, u16), u32>, vrm: &VrmInfo, head_bones: &[u32], -) -> Result<()> { +) -> Result)>> { + let mut meshes = Vec::new(); for p in mesh.primitives() { let name = mesh.name().or(node.name()).map(|e| e.to_owned()); if let Some(name) = &name { @@ -375,7 +373,7 @@ pub fn import_mesh( let armature = node.skin().map(|_| 0); - let mesh = store.set(&MeshPart { + let mesh = MeshPart { name, index, armature, @@ -417,11 +415,10 @@ pub fn import_mesh( va_emission: None, va_metallic: None, va_roughness: None, - })?; - - prefab.mesh.push((trans, mesh)) + }; + meshes.push((node.index(), trans, store.set(&mesh)?)) } - Ok(()) + Ok(meshes) } fn bool_to_opt(b: bool, log: &str) -> Option<()> { -- cgit v1.2.3-70-g09d2