diff options
author | metamuffin <metamuffin@disroot.org> | 2025-01-07 00:56:35 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-01-07 00:56:35 +0100 |
commit | 31ae23b7eb8cd0b688be07ae6cb4b5a96ee02a68 (patch) | |
tree | 4684c2716b8ec2963b4ad97eb3adc2162c9bc499 /world/src | |
parent | 32d493db1d897a61fd3e1170136fa3e812704837 (diff) | |
download | weareserver-31ae23b7eb8cd0b688be07ae6cb4b5a96ee02a68.tar weareserver-31ae23b7eb8cd0b688be07ae6cb4b5a96ee02a68.tar.bz2 weareserver-31ae23b7eb8cd0b688be07ae6cb4b5a96ee02a68.tar.zst |
a
Diffstat (limited to 'world/src')
-rw-r--r-- | world/src/main.rs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/world/src/main.rs b/world/src/main.rs index 2823540..033d176 100644 --- a/world/src/main.rs +++ b/world/src/main.rs @@ -73,7 +73,14 @@ fn main() -> Result<()> { .array_chunks::<3>() .collect::<Vec<_>>(); - if let Some(tex) = p.material().pbr_metallic_roughness().base_color_texture() {} + let mut albedo = None; + if let Some(tex) = p.material().pbr_metallic_roughness().base_color_texture() { + let s = tex.texture().source().source(); + if let gltf::image::Source::View { view, mime_type } = s { + let buf = &buffers[view.buffer().index()]; + albedo = Some(store.set(&buf.0)?); + } + } let part = store.set( &Part { @@ -91,11 +98,13 @@ fn main() -> Result<()> { Attribute::Vertex(store.set(&AttributeArray(uv_x).write_alloc())?), Attribute::Vertex(store.set(&AttributeArray(uv_y).write_alloc())?), ]), - va_pbr_albedo: Some([ - Attribute::Constant(0.9), - Attribute::Constant(0.1), - Attribute::Constant(0.1), - ]), + va_pbr_albedo: albedo.map(|a| { + [ + Attribute::Texture(a, 0), + Attribute::Texture(a, 1), + Attribute::Texture(a, 2), + ] + }), index: Some(store.set(&IndexArray(index).write_alloc())?), ..Part::default() } |