summaryrefslogtreecommitdiff
path: root/world/src/mesh.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-02-19 22:21:44 +0100
committermetamuffin <metamuffin@disroot.org>2025-02-19 22:21:44 +0100
commitee198b516bad5db9312dde3749bf864d6c7079b1 (patch)
treee1fb544e5c78a3cd7c6fff58642522be5ccef7e0 /world/src/mesh.rs
parent6edc755bc040bc67ad3cd88fa694e9d29daf4a3b (diff)
downloadweareserver-ee198b516bad5db9312dde3749bf864d6c7079b1.tar
weareserver-ee198b516bad5db9312dde3749bf864d6c7079b1.tar.bz2
weareserver-ee198b516bad5db9312dde3749bf864d6c7079b1.tar.zst
animations
Diffstat (limited to 'world/src/mesh.rs')
-rw-r--r--world/src/mesh.rs19
1 files changed, 8 insertions, 11 deletions
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<Vec<(usize, Affine3A, Resource<MeshPart>)>> {
+ 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<()> {