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.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/client/src/scene_prepare.rs b/client/src/scene_prepare.rs
index 0e65e72..3a93485 100644
--- a/client/src/scene_prepare.rs
+++ b/client/src/scene_prepare.rs
@@ -120,7 +120,7 @@ pub struct RMeshPart {
struct TangentBufferSpec {
index: Resource<Vec<[u32; 3]>>,
position: Resource<Vec<Vec3>>,
- texcoord: Resource<Vec<Vec2>>,
+ texcoord: Option<Resource<Vec<Vec2>>>,
}
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
@@ -280,11 +280,17 @@ impl ScenePreparer {
num_done += 1;
}
for spec in self.generated_tangent_buffers.needed() {
- if let (Some(index), Some(position), Some(texcoord)) = (
+ if let (Some(index), Some(position), texcoord) = (
dls.try_get(spec.index.clone())?,
dls.try_get(spec.position.clone())?,
- dls.try_get(spec.texcoord.clone())?,
+ spec.texcoord.clone().map(|r| dls.try_get(r)).transpose()?,
) {
+ let texcoord = match texcoord {
+ Some(Some(x)) => Some(x),
+ Some(None) => continue, // tangents provided but still loading
+ None => None,
+ };
+ let texcoord = texcoord.unwrap_or_else(|| generate_texcoords(&index, &position));
let tangents = generate_tangents(&index, &position, &texcoord);
let buffer = self.device.create_buffer_init(&BufferInitDescriptor {
label: Some("generated tangent"),
@@ -382,7 +388,7 @@ impl ScenePreparer {
self.generated_tangent_buffers.try_get(TangentBufferSpec {
index: indexres,
position: Resource(positionres.0, PhantomData),
- texcoord: part.va_texcoord.expect("TODO"),
+ texcoord: part.va_texcoord,
})
};