summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/src/scene_prepare.rs8
-rw-r--r--client/src/scene_render.rs2
-rw-r--r--shared/src/helper.rs6
-rw-r--r--shared/src/resources.rs4
-rw-r--r--world/src/mesh.rs1
-rw-r--r--world/src/physics.rs1
6 files changed, 10 insertions, 12 deletions
diff --git a/client/src/scene_prepare.rs b/client/src/scene_prepare.rs
index 20c6e85..e7946e7 100644
--- a/client/src/scene_prepare.rs
+++ b/client/src/scene_prepare.rs
@@ -80,7 +80,7 @@ pub struct ScenePreparer {
textures: DemandMap<Resource<Image>, (Arc<Texture>, Arc<BindGroup>)>,
placeholder_textures: DemandMap<(), (Arc<Texture>, Arc<BindGroup>)>,
- index_buffers: DemandMap<Resource<Vec<[u16; 3]>>, (Arc<Buffer>, u32)>,
+ index_buffers: DemandMap<Resource<Vec<[u32; 3]>>, (Arc<Buffer>, u32)>,
vertex_buffers: DemandMap<Resource<Vec<f32>>, (Arc<Buffer>, u32)>,
placeholder_vertex_buffers: DemandMap<(u32, bool), Arc<Buffer>>,
mesh_parts: DemandMap<Resource<MeshPart>, Arc<RMeshPart>>,
@@ -133,7 +133,7 @@ impl ScenePreparer {
let buf = buf
.into_iter()
.flatten()
- .flat_map(u16::to_le_bytes)
+ .flat_map(u32::to_le_bytes)
.collect::<Vec<_>>();
let buffer = self.device.create_buffer_init(&BufferInitDescriptor {
contents: &buf,
@@ -141,8 +141,8 @@ impl ScenePreparer {
usage: BufferUsages::INDEX | BufferUsages::COPY_DST,
});
self.index_buffers
- .insert(pres.clone(), (Arc::new(buffer), (buf.len() / 2) as u32));
- debug!("index buffer created (len={}) {pres}", buf.len() / 2);
+ .insert(pres.clone(), (Arc::new(buffer), (buf.len() / 4) as u32));
+ debug!("index buffer created (len={}) {pres}", buf.len() / 4);
}
}
for pres in self.vertex_buffers.needed() {
diff --git a/client/src/scene_render.rs b/client/src/scene_render.rs
index 7b2f653..b588e7d 100644
--- a/client/src/scene_render.rs
+++ b/client/src/scene_render.rs
@@ -191,7 +191,7 @@ impl ScenePipeline {
rpass.set_bind_group(1, &*part.tex_normal, &[]);
rpass.set_pipeline(&self.pipeline);
rpass.set_push_constants(ShaderStages::VERTEX, 0, projection.as_flattened());
- rpass.set_index_buffer(part.index.slice(..), IndexFormat::Uint16);
+ rpass.set_index_buffer(part.index.slice(..), IndexFormat::Uint32);
rpass.set_vertex_buffer(0, part.va_position.slice(..));
rpass.set_vertex_buffer(1, part.va_normal.slice(..));
rpass.set_vertex_buffer(2, part.va_texcoord.slice(..));
diff --git a/shared/src/helper.rs b/shared/src/helper.rs
index 61e149f..4702aef 100644
--- a/shared/src/helper.rs
+++ b/shared/src/helper.rs
@@ -104,7 +104,7 @@ impl ReadWrite for Vec<Vec2> {
.collect())
}
}
-impl ReadWrite for Vec<[u16; 3]> {
+impl ReadWrite for Vec<[u32; 3]> {
fn write(&self, w: &mut dyn Write) -> Result<()> {
for e in self {
w.write_all(&e[0].to_be_bytes())?;
@@ -118,8 +118,8 @@ impl ReadWrite for Vec<[u16; 3]> {
r.read_to_end(&mut buf)?;
Ok(buf
.into_iter()
- .array_chunks::<2>()
- .map(u16::from_be_bytes)
+ .array_chunks::<4>()
+ .map(u32::from_be_bytes)
.array_chunks::<3>()
.collect())
}
diff --git a/shared/src/resources.rs b/shared/src/resources.rs
index f422611..9e0e7b8 100644
--- a/shared/src/resources.rs
+++ b/shared/src/resources.rs
@@ -47,7 +47,7 @@ pub struct EnvironmentPart {
#[derive(Debug, Default, Clone)]
pub struct MeshPart {
pub name: Option<String>,
- pub index: Option<Resource<Vec<[u16; 3]>>>,
+ pub index: Option<Resource<Vec<[u32; 3]>>>,
pub g_metallic: Option<f32>,
pub g_roughness: Option<f32>,
pub g_albedo: Option<Vec3A>,
@@ -89,7 +89,7 @@ pub struct CollisionPart {
pub sh_cylinder: Option<(f32, f32, f32)>,
pub sh_capsule: Option<(f32, f32, f32)>,
pub sh_convex_hull: Option<Resource>,
- pub sh_mesh: Option<(Resource<Vec<[u16; 3]>>, Resource<Vec<Vec3A>>)>,
+ pub sh_mesh: Option<(Resource<Vec<[u32; 3]>>, Resource<Vec<Vec3A>>)>,
}
#[derive(Debug, Default, Clone)]
diff --git a/world/src/mesh.rs b/world/src/mesh.rs
index 67f86ad..77bb05d 100644
--- a/world/src/mesh.rs
+++ b/world/src/mesh.rs
@@ -100,7 +100,6 @@ pub fn import_mesh(
.read_indices()
.unwrap()
.into_u32()
- .map(|e| e as u16)
.array_chunks::<3>()
.collect::<Vec<_>>();
info!("{} indecies", index.len() * 3);
diff --git a/world/src/physics.rs b/world/src/physics.rs
index bc39a11..3b98378 100644
--- a/world/src/physics.rs
+++ b/world/src/physics.rs
@@ -57,7 +57,6 @@ pub fn import_physics(
.read_indices()
.ok_or(anyhow!("convexHull no index buffer"))?
.into_u32()
- .map(|e| e as u16)
.array_chunks::<3>()
.collect::<Vec<_>>();
let position = reader