Explorar el Código

return features when reading a mesh

deltanedas hace 3 años
padre
commit
cf1b8ffd05
Se han modificado 3 ficheros con 6 adiciones y 6 borrados
  1. 1 1
      Cargo.toml
  2. 1 1
      chair_exporter.py
  3. 4 4
      src/io.rs

+ 1 - 1
Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "chair"
-version = "0.1.3"
+version = "0.2.0"
 edition = "2021"
 description = "An efficient binary mesh format which is both small and extremely fast to read."
 readme = "README.md"

+ 1 - 1
chair_exporter.py

@@ -7,7 +7,7 @@ bl_info = {
 	"blender": (3, 0, 0),
 	"location": "File > Import-Export > Chair Mesh (.chr)",
 	# Same as the crate version
-	"version": (0, 1, 3),
+	"version": (0, 2.0),
 	"category": "Import-Export"
 }
 

+ 4 - 4
src/io.rs

@@ -94,9 +94,9 @@ impl<'a, A: Atlas> MeshReader<'a, A> {
 		self
 	}
 
-	/// Extract vertices and indices from file contents
+	/// Extract features, vertices and indices from file contents
 	/// If using wgpu you can use `create` to also upload it to the gpu
-	pub fn read<V: Vertex>(&self, bytes: &[u8]) -> Result<(Vec<V>, Vec<Index>)> {
+	pub fn read<V: Vertex>(&self, bytes: &[u8]) -> Result<(MeshFeatures, Vec<V>, Vec<Index>)> {
 		let mut bytes = Cursor::new(bytes);
 		let bytes = &mut bytes;
 		let mut header = [0; 5];
@@ -308,13 +308,13 @@ impl<'a, A: Atlas> MeshReader<'a, A> {
 			.map(|_| read_index(bytes))
 			.collect::<Result<_>>()?;
 
-		Ok((vertices, indices))
+		Ok((features, vertices, indices))
 	}
 
 	/// Read and create a mesh on the GPU
 	#[cfg(feature = "mesh")]
 	pub fn create<V: Vertex>(&self, device: &wgpu::Device, bytes: &[u8]) -> Result<Mesh> {
-		let (vertices, indices) = self.read::<V>(bytes)?;
+		let (_features, vertices, indices) = self.read::<V>(bytes)?;
 		Ok(Mesh::new(device, &vertices, &indices))
 	}
 }