🚧 wip: messing with gltf

main
_ 2021-12-19 16:34:11 +00:00
parent 174061feb1
commit 481f76fb15
3 changed files with 136 additions and 5 deletions

127
Cargo.lock generated
View File

@ -35,6 +35,12 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "base64"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff"
[[package]] [[package]]
name = "base64" name = "base64"
version = "0.13.0" version = "0.13.0"
@ -53,6 +59,12 @@ version = "3.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe"
[[package]]
name = "bytemuck"
version = "1.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439989e6b8c38d1b6570a384ef1e49c8848128f5a97f3914baef02920842712f"
[[package]] [[package]]
name = "byteorder" name = "byteorder"
version = "1.4.3" version = "1.4.3"
@ -149,6 +161,16 @@ dependencies = [
"byteorder", "byteorder",
] ]
[[package]]
name = "deflate"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174"
dependencies = [
"adler32",
"byteorder",
]
[[package]] [[package]]
name = "float-ord" name = "float-ord"
version = "0.2.0" version = "0.2.0"
@ -303,6 +325,43 @@ version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68270e16582ea40f9c5b2fcd588fbc9cb696577222e04a64d9085cc314806a8a" checksum = "68270e16582ea40f9c5b2fcd588fbc9cb696577222e04a64d9085cc314806a8a"
[[package]]
name = "gltf"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ff38b75359a0096dd0a8599b6e4f37a6ee41d5df300cc7669e62aafa697f7a2"
dependencies = [
"base64 0.12.3",
"byteorder",
"gltf-json",
"image",
"lazy_static",
]
[[package]]
name = "gltf-derive"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f2a9333e0f9c7bca94dfc20bcf44fa12a61eeec662d6e007563ff748aa59c70"
dependencies = [
"inflections",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "gltf-json"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1414d3a98cbaabdb2f134328b1f6036d14b282febc1df51952a435d2ca17fb6"
dependencies = [
"gltf-derive",
"serde",
"serde_derive",
"serde_json",
]
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.1.18" version = "0.1.18"
@ -312,6 +371,21 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "image"
version = "0.23.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d534e95ad8b9d5aa614322d02352b4f1bf962254adcf02ac6f2def8be18498e8"
dependencies = [
"bytemuck",
"byteorder",
"jpeg-decoder",
"num-iter",
"num-rational",
"num-traits",
"png 0.16.8",
]
[[package]] [[package]]
name = "inflate" name = "inflate"
version = "0.4.5" version = "0.4.5"
@ -321,6 +395,12 @@ dependencies = [
"adler32", "adler32",
] ]
[[package]]
name = "inflections"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a257582fdcde896fd96463bf2d40eefea0580021c0712a0e2b028b60b47a837a"
[[package]] [[package]]
name = "instant" name = "instant"
version = "0.1.9" version = "0.1.9"
@ -350,6 +430,12 @@ version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
[[package]]
name = "jpeg-decoder"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2"
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.50" version = "0.3.50"
@ -429,6 +515,15 @@ version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
[[package]]
name = "miniz_oxide"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435"
dependencies = [
"adler32",
]
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.7.11" version = "0.7.11"
@ -492,6 +587,17 @@ dependencies = [
"num-traits", "num-traits",
] ]
[[package]]
name = "num-rational"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2885278d5fe2adc2f75ced642d52d879bffaceb5a2e0b1d4309ffdfb239b454"
dependencies = [
"autocfg 0.1.7",
"num-integer",
"num-traits",
]
[[package]] [[package]]
name = "num-traits" name = "num-traits"
version = "0.2.14" version = "0.2.14"
@ -529,11 +635,12 @@ dependencies = [
"futures-util", "futures-util",
"gl", "gl",
"glam", "glam",
"gltf",
"inter_quake_model", "inter_quake_model",
"iota", "iota",
"maplit", "maplit",
"partial-min-max", "partial-min-max",
"png", "png 0.15.3",
"quinn", "quinn",
"rand 0.6.5", "rand 0.6.5",
"rcgen", "rcgen",
@ -588,7 +695,7 @@ version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd56cbd21fea48d0c440b41cd69c589faacade08c992d9a54e471b79d0fd13eb" checksum = "fd56cbd21fea48d0c440b41cd69c589faacade08c992d9a54e471b79d0fd13eb"
dependencies = [ dependencies = [
"base64", "base64 0.13.0",
"once_cell", "once_cell",
"regex", "regex",
] ]
@ -613,10 +720,22 @@ checksum = "ef859a23054bbfee7811284275ae522f0434a3c8e7f4b74bd4a35ae7e1c4a283"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"crc32fast", "crc32fast",
"deflate", "deflate 0.7.20",
"inflate", "inflate",
] ]
[[package]]
name = "png"
version = "0.16.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6"
dependencies = [
"bitflags",
"crc32fast",
"deflate 0.8.6",
"miniz_oxide",
]
[[package]] [[package]]
name = "ppv-lite86" name = "ppv-lite86"
version = "0.2.10" version = "0.2.10"
@ -941,7 +1060,7 @@ version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7"
dependencies = [ dependencies = [
"base64", "base64 0.13.0",
"log", "log",
"ring", "ring",
"sct", "sct",

View File

@ -17,6 +17,7 @@ futures-util = "0.3.9"
gl = "0.14.0" gl = "0.14.0"
# glam = "0.8.5" # glam = "0.8.5"
glam = "0.20.1" glam = "0.20.1"
gltf = "0.16.0"
iota = "0.2.1" iota = "0.2.1"
maplit = "1.0.2" maplit = "1.0.2"
partial-min-max = "0.4.0" partial-min-max = "0.4.0"

View File

@ -282,6 +282,17 @@ async fn main () -> Result <()> {
let mesh_sky = renderable_from_iqm_file ("sky-sphere.iqm"); let mesh_sky = renderable_from_iqm_file ("sky-sphere.iqm");
let mesh_sphere = renderable_from_iqm_file ("sphere.iqm"); let mesh_sphere = renderable_from_iqm_file ("sphere.iqm");
let level = gltf::Gltf::open ("gltf/level-00.gltf")?;
for scene in level.scenes () {
for node in scene.nodes () {
println! (
"Node #{} has {} children",
node.index(),
node.children().count(),
);
}
}
let passes = vec![ let passes = vec![
// Clear everything // Clear everything
Pass::default () Pass::default ()
@ -411,7 +422,7 @@ async fn main () -> Result <()> {
game_state.player = phys_result.body; game_state.player = phys_result.body;
// tracing::debug! ("player pos: {}", game_state.player.pos); // tracing::debug! ("player pos: {}", game_state.player.pos);
dbg! (player_jump_vec); // dbg! (player_jump_vec);
player_jump_vec = None; player_jump_vec = None;
for normal in &phys_result.normals_hit { for normal in &phys_result.normals_hit {