diff options
author | metamuffin <metamuffin@disroot.org> | 2025-01-13 00:13:54 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-01-13 00:13:54 +0100 |
commit | 3330af8a3417ce411ecb1c7c23343cc28f261b2f (patch) | |
tree | 67facac81b9233eb612e691f1fc72b71bce1d3f3 /world/src/main.rs | |
parent | 9f5d815e932c9c01265fec2f5a079470d73d6cc8 (diff) | |
download | weareserver-3330af8a3417ce411ecb1c7c23343cc28f261b2f.tar weareserver-3330af8a3417ce411ecb1c7c23343cc28f261b2f.tar.bz2 weareserver-3330af8a3417ce411ecb1c7c23343cc28f261b2f.tar.zst |
add name to light part + show network size of prefab
Diffstat (limited to 'world/src/main.rs')
-rw-r--r-- | world/src/main.rs | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/world/src/main.rs b/world/src/main.rs index efdd16b..7548d8f 100644 --- a/world/src/main.rs +++ b/world/src/main.rs @@ -21,6 +21,7 @@ pub mod physics; use anyhow::Result; use clap::Parser; use gltf::{Gltf, image::Source, import_buffers}; +use humansize::BINARY; use image::{ImageReader, codecs::webp::WebPEncoder}; use log::{debug, info}; use mesh::import_mesh; @@ -97,21 +98,26 @@ fn main() -> Result<()> { .map(|node| { let mut prefab = Prefab::default(); if let Some(mesh) = node.mesh() { - info!("--- MESH ---"); import_mesh(mesh, &buffers, &store, path_base, &node, &mut prefab, &args)?; } let (position, _, _) = node.transform().decomposed(); if let Some(light) = node.light() { - info!("--- LIGHT ---"); + let name = node.name().map(|e| e.to_owned()); + if let Some(name) = &name { + info!("adding light {name:?}"); + } else { + info!("adding light"); + } let emission = Some(Vec3A::from_array(light.color()) * light.intensity()); if let Some(e) = emission { - info!("emission is {e}"); + debug!("emission is {e}"); } prefab.light.push(( Vec3A::from_array(position), store.set(&LightPart { emission, - ..Default::default() + name, + radius: None, })?, )); } @@ -149,6 +155,13 @@ fn main() -> Result<()> { let pres = store.set(&prefab)?; + let mut size = 0; + store.iter(|d| size += d.len()).unwrap(); + info!( + "prefab has network size of {}", + humansize::format_size(size, BINARY) + ); + if args.dry_run { return Ok(()); } |