Johann Woelper il y a 4 ans
Parent
commit
c2bf5015fb
5 fichiers modifiés avec 19253 ajouts et 1 suppressions
  1. 202 0
      Cargo.lock
  2. 3 0
      Cargo.toml
  3. 45 0
      samples/box.obj
  4. 18979 0
      samples/font.obj
  5. 24 1
      src/main.rs

+ 202 - 0
Cargo.lock

@@ -0,0 +1,202 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+[[package]]
+name = "arrayvec"
+version = "0.4.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9"
+dependencies = [
+ "nodrop",
+]
+
+[[package]]
+name = "autocfg"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
+
+[[package]]
+name = "cc"
+version = "1.0.54"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311"
+
+[[package]]
+name = "cfg-if"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
+
+[[package]]
+name = "lexical"
+version = "2.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e0d09e60c187a6d0a3fa418aec8587c6a4ae9de872f6126f2134f319b5ed10d"
+dependencies = [
+ "cfg-if",
+ "lexical-core",
+ "rustc_version",
+]
+
+[[package]]
+name = "lexical-core"
+version = "0.4.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2304bccb228c4b020f3a4835d247df0a02a7c4686098d4167762cfbbe4c5cb14"
+dependencies = [
+ "arrayvec",
+ "cfg-if",
+ "rustc_version",
+ "ryu",
+ "static_assertions",
+]
+
+[[package]]
+name = "nodrop"
+version = "0.1.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
+
+[[package]]
+name = "num-traits"
+version = "0.2.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611"
+dependencies = [
+ "autocfg",
+]
+
+[[package]]
+name = "obj-rs"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc24073e9408e53811209c5a0f0e2349e2bad0314b1038ddf0af2ce6664df7de"
+dependencies = [
+ "num-traits",
+ "serde",
+ "vec_map",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa"
+dependencies = [
+ "unicode-xid",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "rustc_version"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
+dependencies = [
+ "semver",
+]
+
+[[package]]
+name = "ryu"
+version = "1.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
+
+[[package]]
+name = "semver"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
+dependencies = [
+ "semver-parser",
+]
+
+[[package]]
+name = "semver-parser"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
+
+[[package]]
+name = "serde"
+version = "1.0.114"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.114"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "shapepacker"
+version = "0.1.0"
+dependencies = [
+ "obj-rs",
+ "wavefront_obj",
+ "xatlas-rs",
+]
+
+[[package]]
+name = "static_assertions"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f3eb36b47e512f8f1c9e3d10c2c1965bc992bd9cdb024fa581e2194501c83d3"
+
+[[package]]
+name = "syn"
+version = "1.0.33"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-xid",
+]
+
+[[package]]
+name = "unicode-xid"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
+
+[[package]]
+name = "vec_map"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
+
+[[package]]
+name = "wavefront_obj"
+version = "7.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c1f83af1f50044d5ea2c0a7aef6976566f22e2b8002fc66c512a3a2f57e9d94"
+dependencies = [
+ "lexical",
+]
+
+[[package]]
+name = "xatlas-rs"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "553b5107556336828c46f3fcd752476641b8f596439c1e4ea5363d4014b7ca6c"
+dependencies = [
+ "cc",
+]

+ 3 - 0
Cargo.toml

@@ -7,3 +7,6 @@ edition = "2018"
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 
 [dependencies]
+wavefront_obj = "*"
+obj-rs = "*"
+xatlas-rs = "0.1.3"

+ 45 - 0
samples/box.obj

@@ -0,0 +1,45 @@
+# File exported by Houdini 17.5.391 (www.sidefx.com)
+# 8 points
+# 24 vertices
+# 6 primitives
+# Bounds: [-0.5, -0.5, -0.5] to [0.5, 0.5, 0.5]
+g 
+v -0.5 -0.5 -0.5
+v 0.5 -0.5 -0.5
+v 0.5 -0.5 0.5
+v -0.5 -0.5 0.5
+v -0.5 0.5 -0.5
+v 0.5 0.5 -0.5
+v 0.5 0.5 0.5
+v -0.5 0.5 0.5
+vt 0.333333343 0.666666687 0
+vt 0.648949862 0.666666687 0
+vt 0.648949862 0.982283175 0
+vt 0.333333343 0.982283175 0
+vt 0 0.666666687 0
+vt 0.315616488 0.666666687 0
+vt 0.315616488 0.982283175 0
+vt 0 0.982283175 0
+vt 0 0.333333343 0
+vt 0.315616488 0.333333343 0
+vt 0.315616488 0.648949862 0
+vt 0 0.648949862 0
+vt 0.333333343 0.333333343 0
+vt 0.648949862 0.333333343 0
+vt 0.648949862 0.648949862 0
+vt 0.333333343 0.648949862 0
+vt 0.648949862 0.315616488 0
+vt 0.333333343 0.315616488 0
+vt 0.333333343 0 0
+vt 0.648949862 0 0
+vt 0.315616488 0.315616488 0
+vt 0 0.315616488 0
+vt 0 0 0
+vt 0.315616488 0 0
+g 
+f 2/1 1/2 5/3 6/4
+f 3/5 2/6 6/7 7/8
+f 4/9 3/10 7/11 8/12
+f 1/13 4/14 8/15 5/16
+f 3/17 4/18 1/19 2/20
+f 6/21 5/22 8/23 7/24

Fichier diff supprimé car celui-ci est trop grand
+ 18979 - 0
samples/font.obj


+ 24 - 1
src/main.rs

@@ -1,3 +1,26 @@
+use std::fs::File;
+use std::io::BufReader;
+use obj::{load_obj, Obj};
+
+// use wavefront_obj::obj;
+
+
+
 fn main() {
-    println!("Hello, world!");
+
+    let obj_in = "samples/box.obj";
+
+    // let contents = std::fs::read_to_string(obj_in).unwrap();
+
+    // let objset = obj::parse(&contents).unwrap();
+
+    // for object in objset.objects {
+    //     dbg!(&object);
+    // }
+
+
+    let input = BufReader::new(File::open(obj_in).unwrap());
+    let dome: Obj = load_obj(input).unwrap();
+    // dbg!(dome.vertices);
+
 }