diff options
author | metamuffin <metamuffin@disroot.org> | 2025-01-07 17:17:58 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-01-07 17:17:58 +0100 |
commit | a82dad99984c074136062f8cd34a91517b8c801c (patch) | |
tree | a9a5a26a0310be33154fedcbfebd7720b3171aea /world/src/main.rs | |
parent | 0a0abfe7b093d91447fb7070820a0e6d56d6c22d (diff) | |
download | weareserver-a82dad99984c074136062f8cd34a91517b8c801c.tar weareserver-a82dad99984c074136062f8cd34a91517b8c801c.tar.bz2 weareserver-a82dad99984c074136062f8cd34a91517b8c801c.tar.zst |
notes
Diffstat (limited to 'world/src/main.rs')
-rw-r--r-- | world/src/main.rs | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/world/src/main.rs b/world/src/main.rs index 517f1e9..f0b10ff 100644 --- a/world/src/main.rs +++ b/world/src/main.rs @@ -2,7 +2,7 @@ use anyhow::{Result, bail}; use clap::Parser; use gltf::image::Source; -use log::{info, warn}; +use log::info; use rand::random; use std::{ fs::File, @@ -59,7 +59,7 @@ fn main() -> Result<()> { pos_y.push(p[1]); pos_z.push(p[2]); } - info!("vertex positions"); + info!("{} vertex positions", pos_x.len()); Ok::<_, anyhow::Error>([ store.set(&AttributeArray(pos_x).write_alloc())?, store.set(&AttributeArray(pos_y).write_alloc())?, @@ -79,7 +79,7 @@ fn main() -> Result<()> { normal_y.push(p[1]); normal_z.push(p[2]); } - info!("vertex normals"); + info!("{} vertex normals", normal_x.len()); Ok::<_, anyhow::Error>([ store.set(&AttributeArray(normal_x).write_alloc())?, store.set(&AttributeArray(normal_y).write_alloc())?, @@ -96,7 +96,7 @@ fn main() -> Result<()> { texcoord_u.push(p[0]); texcoord_v.push(p[1]); } - info!("vertex texture coordinates"); + info!("{} vertex texture coordinates", texcoord_u.len()); Ok::<_, anyhow::Error>([ store.set(&AttributeArray(texcoord_u).write_alloc())?, store.set(&AttributeArray(texcoord_v).write_alloc())?, @@ -111,6 +111,7 @@ fn main() -> Result<()> { .map(|e| e as u16) .array_chunks::<3>() .collect::<Vec<_>>(); + info!("{} indecies", index.len() * 3); let index = Some(store.set(&IndexArray(index).write_alloc())?); let mut tex_albedo = None; @@ -133,6 +134,23 @@ fn main() -> Result<()> { &tex.texture().source().source(), )?); } + let mut tex_roughness = None; + let mut tex_metallic = None; + if let Some(tex) = p + .material() + .pbr_metallic_roughness() + .metallic_roughness_texture() + { + let r = load_texture( + "metallic+roughness", + &store, + path_base, + &buffers, + &tex.texture().source().source(), + )?; + tex_roughness = Some(r); + tex_metallic = Some(r); + } let g_metallic = Some(p.material().pbr_metallic_roughness().metallic_factor()); let g_roughness = Some(p.material().pbr_metallic_roughness().roughness_factor()); @@ -146,6 +164,8 @@ fn main() -> Result<()> { va_texcoord, tex_albedo, tex_normal, + tex_roughness, + tex_metallic, index, ..Part::default() } |