summaryrefslogtreecommitdiff
path: root/client/src/scene_prepare.rs
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/scene_prepare.rs')
-rw-r--r--client/src/scene_prepare.rs44
1 files changed, 29 insertions, 15 deletions
diff --git a/client/src/scene_prepare.rs b/client/src/scene_prepare.rs
index b5ac2cf..20c6e85 100644
--- a/client/src/scene_prepare.rs
+++ b/client/src/scene_prepare.rs
@@ -91,10 +91,11 @@ pub struct RPrefab(pub Vec<(Affine3A, Arc<RMeshPart>)>);
pub struct RMeshPart {
pub index_count: u32,
pub index: Arc<Buffer>,
- pub position: Arc<Buffer>,
- pub normal: Arc<Buffer>,
- pub texcoord: Arc<Buffer>,
- pub texture: Arc<BindGroup>,
+ pub va_position: Arc<Buffer>,
+ pub va_normal: Arc<Buffer>,
+ pub va_texcoord: Arc<Buffer>,
+ pub tex_albedo: Arc<BindGroup>,
+ pub tex_normal: Arc<BindGroup>,
}
impl ScenePreparer {
@@ -220,23 +221,35 @@ impl ScenePreparer {
.flatten()
};
- let mut texture = None;
+ let mut tex_albedo = None;
if let Some(albedores) = part.tex_albedo {
if let Some((_tex, bg)) = self.textures.try_get(albedores) {
- texture = Some(bg)
+ tex_albedo = Some(bg)
}
} else {
if let Some((_tex, bg)) = self.placeholder_textures.try_get(()) {
- texture = Some(bg)
+ tex_albedo = Some(bg)
+ }
+ }
+ let mut tex_normal = None;
+ if let Some(albedores) = part.tex_normal {
+ if let Some((_tex, bg)) = self.textures.try_get(albedores) {
+ tex_normal = Some(bg)
+ }
+ } else {
+ if let Some((_tex, bg)) = self.placeholder_textures.try_get(()) {
+ tex_normal = Some(bg)
}
}
if let (
- Some(normal),
+ Some(va_normal),
Some((index, index_count)),
- Some(texcoord),
- Some((position, _)),
- ) = (normal, index, texcoord, position)
+ Some(va_texcoord),
+ Some((va_position, _)),
+ Some(tex_normal),
+ Some(tex_albedo),
+ ) = (normal, index, texcoord, position, tex_normal, tex_albedo)
{
debug!("part created ({pres})");
self.mesh_parts.insert(
@@ -244,10 +257,11 @@ impl ScenePreparer {
Arc::new(RMeshPart {
index_count,
index,
- texcoord,
- normal,
- position,
- texture: texture.unwrap(),
+ va_normal,
+ va_position,
+ va_texcoord,
+ tex_albedo,
+ tex_normal,
}),
);
}