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.rs34
1 files changed, 32 insertions, 2 deletions
diff --git a/client/src/scene_prepare.rs b/client/src/scene_prepare.rs
index 3a93485..05e9533 100644
--- a/client/src/scene_prepare.rs
+++ b/client/src/scene_prepare.rs
@@ -110,6 +110,8 @@ pub struct RMeshPart {
pub va_normal: Arc<Buffer>,
pub va_tangent: Arc<Buffer>,
pub va_texcoord: Arc<Buffer>,
+ pub va_joint_index: Option<Arc<Buffer>>,
+ pub va_joint_weight: Option<Arc<Buffer>>,
pub tex_albedo: Arc<BindGroup>,
pub tex_normal: Arc<BindGroup>,
pub material: Arc<BindGroup>,
@@ -392,6 +394,21 @@ impl ScenePreparer {
})
};
+ let joint_weight = if let Some(res) = part.va_joint_weight.clone() {
+ self.vertex_buffers
+ .try_get(Resource(res.0, PhantomData))
+ .map(Some)
+ } else {
+ Some(None)
+ };
+ let joint_index = if let Some(res) = part.va_joint_index.clone() {
+ self.vertex_buffers
+ .try_get(Resource(res.0, PhantomData))
+ .map(Some)
+ } else {
+ Some(None)
+ };
+
let mut tex_albedo = None;
if let Some(albedores) = part.tex_albedo {
if let Some((_tex, bg)) = self.textures.try_get((albedores, false)) {
@@ -447,13 +464,24 @@ impl ScenePreparer {
Some(va_tangent),
Some(va_texcoord),
Some(va_position),
+ Some(va_joint_index),
+ Some(va_joint_weight),
Some(tex_normal),
Some(tex_albedo),
Some(material),
) = (
- index, normal, tangent, texcoord, position, tex_normal, tex_albedo,
+ index,
+ normal,
+ tangent,
+ texcoord,
+ position,
+ joint_index,
+ joint_weight,
+ tex_normal,
+ tex_albedo,
material,
) {
+ let double_sided = part.g_double_sided.is_some();
debug!("part created (took {:?}) {pres}", start.elapsed());
self.mesh_parts.insert(
pres,
@@ -464,10 +492,12 @@ impl ScenePreparer {
va_tangent,
va_position,
va_texcoord,
+ va_joint_index,
+ va_joint_weight,
tex_albedo,
tex_normal,
material,
- double_sided: part.g_double_sided.is_some(),
+ double_sided,
}),
0,
);