summaryrefslogtreecommitdiff
path: root/world/src/mesh.rs
diff options
context:
space:
mode:
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<()> {