forked from StrafesNET/strafe-project
Compare commits
95 Commits
point-phys
...
face-crawl
| Author | SHA1 | Date | |
|---|---|---|---|
| 5793f9f975 | |||
| 9de6fe85fa | |||
| ed6696be3e | |||
| 680cddc9a2 | |||
| 6a7e05bb49 | |||
| 2558eac7fa | |||
| ddb91031b0 | |||
| 6e8719136d | |||
| 7e7915293e | |||
| 78b94d7259 | |||
| 2152ae3c7b | |||
| 9d266e7be1 | |||
| 49d799eb60 | |||
| 9af374ee14 | |||
| 26e4d8cab1 | |||
| 38731c4a10 | |||
| 47560bb25f | |||
| 1d50eac5e4 | |||
| 660ea42576 | |||
| a31c3bc848 | |||
| 2a3ca06376 | |||
| 4932401553 | |||
| f53327d87b | |||
| b8a0ae6606 | |||
| 3cc006d3fb | |||
| 2cef4cba66 | |||
| 14e168942d | |||
| 1a05449315 | |||
| 3d426c0859 | |||
| 53adc651e5 | |||
| d631747030 | |||
| d7042f9cba | |||
| 66d799b3c3 | |||
| dded820fc5 | |||
| c971ab24e2 | |||
| 096284ea60 | |||
| 6766ad832d | |||
| b23b815132 | |||
| 7ba94c0837 | |||
| 6d3ff8490d | |||
| e4eaecee2c | |||
| de4a2dc652 | |||
| e6c1b87b34 | |||
| 7bae33ad06 | |||
| 05adec5499 | |||
| 5d85b39058 | |||
| b964873785 | |||
| c1ae19b098 | |||
| 0ad99958a0 | |||
| d2f209869d | |||
| f04e6ee4b7 | |||
| 9a2b033241 | |||
| e2777852d1 | |||
| 2eadb541cc | |||
| c9f2ea0308 | |||
| f4db20c206 | |||
| 72d8186ba4 | |||
| da6b800d4e | |||
| 4154a8c437 | |||
| 13dd90d5f6 | |||
| a5437c87df | |||
| a4ea566c02 | |||
| a6f9f144f4 | |||
| e33adeadc8 | |||
| 563ade11f7 | |||
| 1a250fe8d6 | |||
| 4be218defb | |||
| dc5649f2b5 | |||
| ef817389f3 | |||
| 399c9505bf | |||
| e6c955a958 | |||
| 8839b8fbb3 | |||
| d191538aa8 | |||
| 46c6271286 | |||
| bb2a5e2d35 | |||
| 4998f3803a | |||
| fa0be33bf5 | |||
| 0da6da24ac | |||
| 6a926608b7 | |||
| 71d221581f | |||
| 6fcc6b2303 | |||
| 312b0223b6 | |||
| 5a3013365e | |||
| 5c2aad268f | |||
| ea9c2efc7f | |||
| a41cbb79de | |||
| 2370fbea54 | |||
| 33972b0c2c | |||
| f50670db57 | |||
| 559a38b607 | |||
| 751ccf57ca | |||
| 5bfd340d87 | |||
| 2d3efdc2e1 | |||
| d217966f77 | |||
| 328c38ca38 |
259
Cargo.lock
generated
259
Cargo.lock
generated
@@ -4,9 +4,9 @@ version = 3
|
||||
|
||||
[[package]]
|
||||
name = "ab_glyph"
|
||||
version = "0.2.22"
|
||||
version = "0.2.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1061f3ff92c2f65800df1f12fc7b4ff44ee14783104187dd04dfee6f11b0fd2"
|
||||
checksum = "80179d7dd5d7e8c285d67c4a1e652972a92de7475beddfb92028c76463b13225"
|
||||
dependencies = [
|
||||
"ab_glyph_rasterizer",
|
||||
"owned_ttf_parser",
|
||||
@@ -245,7 +245,7 @@ checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -351,9 +351,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "configparser"
|
||||
version = "3.0.2"
|
||||
version = "3.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5458d9d1a587efaf5091602c59d299696a3877a439c8f6d461a2d3cce11df87a"
|
||||
checksum = "e0e56e414a2a52ab2a104f85cd40933c2fbc278b83637facf646ecf451b49237"
|
||||
|
||||
[[package]]
|
||||
name = "constant_time_eq"
|
||||
@@ -412,9 +412,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cursor-icon"
|
||||
version = "1.0.0"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "740bb192a8e2d1350119916954f4409ee7f62f149b536911eeb78ba5a20526bf"
|
||||
checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991"
|
||||
|
||||
[[package]]
|
||||
name = "d3d12"
|
||||
@@ -479,9 +479,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.5"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860"
|
||||
checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.48.0",
|
||||
@@ -517,7 +517,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -550,9 +550,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.10"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
|
||||
checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
@@ -563,9 +563,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.28.0"
|
||||
version = "0.28.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
|
||||
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
|
||||
|
||||
[[package]]
|
||||
name = "gl_generator"
|
||||
@@ -660,9 +660,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.2"
|
||||
version = "0.14.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
|
||||
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"allocator-api2",
|
||||
@@ -702,9 +702,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.0.2"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897"
|
||||
checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
@@ -743,9 +743,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.64"
|
||||
version = "0.3.65"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a"
|
||||
checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
@@ -769,9 +769,9 @@ checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
|
||||
|
||||
[[package]]
|
||||
name = "lazy-regex"
|
||||
version = "3.0.2"
|
||||
version = "3.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e723bd417b2df60a0f6a2b6825f297ea04b245d4ba52b5a22cb679bdf58b05fa"
|
||||
checksum = "5d12be4595afdf58bd19e4a9f4e24187da2a66700786ff660a418e9059937a4c"
|
||||
dependencies = [
|
||||
"lazy-regex-proc_macros",
|
||||
"once_cell",
|
||||
@@ -780,14 +780,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lazy-regex-proc_macros"
|
||||
version = "3.0.1"
|
||||
version = "3.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f0a1d9139f0ee2e862e08a9c5d0ba0470f2aa21cd1e1aa1b1562f83116c725f"
|
||||
checksum = "44bcd58e6c97a7fcbaffcdc95728b393b8d98933bfadad49ed4097845b57ef0b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"syn 2.0.38",
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -798,9 +798,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.149"
|
||||
version = "0.2.150"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
|
||||
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
@@ -823,10 +823,21 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.4.10"
|
||||
name = "libredox"
|
||||
version = "0.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f"
|
||||
checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607"
|
||||
dependencies = [
|
||||
"bitflags 2.4.1",
|
||||
"libc",
|
||||
"redox_syscall 0.4.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.4.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
@@ -929,9 +940,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "naga"
|
||||
version = "0.14.0"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61d829abac9f5230a85d8cc83ec0879b4c09790208ae25b5ea031ef84562e071"
|
||||
checksum = "6cd05939c491da968a42986204b7431678be21fdcd4b10cc84997ba130ada5a4"
|
||||
dependencies = [
|
||||
"bit-set",
|
||||
"bitflags 2.4.1",
|
||||
@@ -1036,7 +1047,7 @@ dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1103,18 +1114,18 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
|
||||
|
||||
[[package]]
|
||||
name = "orbclient"
|
||||
version = "0.3.46"
|
||||
version = "0.3.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8378ac0dfbd4e7895f2d2c1f1345cab3836910baf3a300b000d04250f0c8428f"
|
||||
checksum = "52f0d54bde9774d3a51dcf281a5def240c71996bc6ca05d2c847ec8b2b216166"
|
||||
dependencies = [
|
||||
"redox_syscall 0.3.5",
|
||||
"libredox",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "owned_ttf_parser"
|
||||
version = "0.19.0"
|
||||
version = "0.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "706de7e2214113d63a8238d1910463cfce781129a6f263d13fdb09ff64355ba4"
|
||||
checksum = "d4586edfe4c648c71797a74c84bacb32b52b212eff5dfe2bb9f2c599844023e7"
|
||||
dependencies = [
|
||||
"ttf-parser",
|
||||
]
|
||||
@@ -1150,9 +1161,9 @@ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "2.3.0"
|
||||
version = "2.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
|
||||
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
@@ -1168,16 +1179,16 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
|
||||
|
||||
[[package]]
|
||||
name = "polling"
|
||||
version = "3.3.0"
|
||||
version = "3.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e53b6af1f60f36f8c2ac2aad5459d75a5a9b4be1e8cdd40264f315d78193e531"
|
||||
checksum = "cf63fa624ab313c11656b4cda960bfc46c410187ad493c41f6ba2d8c1e991c9e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"concurrent-queue",
|
||||
"pin-project-lite",
|
||||
"rustix",
|
||||
"tracing",
|
||||
"windows-sys 0.48.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1209,9 +1220,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.69"
|
||||
version = "1.0.70"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
|
||||
checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@@ -1232,7 +1243,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb156a45b6b9fe8027497422179fb65afc84d36707a7ca98297bf06bccb8d43f"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1467,9 +1478,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.21"
|
||||
version = "0.38.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3"
|
||||
checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e"
|
||||
dependencies = [
|
||||
"bitflags 2.4.1",
|
||||
"errno",
|
||||
@@ -1514,22 +1525,22 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.190"
|
||||
version = "1.0.193"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7"
|
||||
checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.190"
|
||||
version = "1.0.193"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3"
|
||||
checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1552,9 +1563,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.11.1"
|
||||
version = "1.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a"
|
||||
checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
|
||||
|
||||
[[package]]
|
||||
name = "smithay-client-toolkit"
|
||||
@@ -1617,7 +1628,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "strafe-client"
|
||||
version = "0.8.0"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"configparser",
|
||||
@@ -1654,9 +1665,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.38"
|
||||
version = "2.0.39"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b"
|
||||
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1665,9 +1676,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.3.0"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64"
|
||||
checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
@@ -1689,7 +1700,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1752,9 +1763,9 @@ checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
|
||||
|
||||
[[package]]
|
||||
name = "ttf-parser"
|
||||
version = "0.19.2"
|
||||
version = "0.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49d64318d8311fc2668e48b63969f4343e0a85c4a109aa8460d6672e364b8bd1"
|
||||
checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
@@ -1804,9 +1815,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.87"
|
||||
version = "0.2.88"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
|
||||
checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
@@ -1814,24 +1825,24 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.87"
|
||||
version = "0.2.88"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
|
||||
checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
"syn 2.0.39",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.37"
|
||||
version = "0.4.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03"
|
||||
checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
@@ -1841,9 +1852,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.87"
|
||||
version = "0.2.88"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
|
||||
checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
@@ -1851,22 +1862,22 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.87"
|
||||
version = "0.2.88"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
|
||||
checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
"syn 2.0.39",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.87"
|
||||
version = "0.2.88"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
|
||||
checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b"
|
||||
|
||||
[[package]]
|
||||
name = "wayland-backend"
|
||||
@@ -2024,9 +2035,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-core"
|
||||
version = "0.18.0"
|
||||
version = "0.18.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "837e02ddcdc6d4a9b56ba4598f7fd4202a7699ab03f6ef4dcdebfad2c966aea6"
|
||||
checksum = "ef91c1d62d1e9e81c79e600131a258edf75c9531cbdbde09c44a011a47312726"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bit-vec",
|
||||
@@ -2047,9 +2058,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-hal"
|
||||
version = "0.18.0"
|
||||
version = "0.18.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e30b9a8155c83868e82a8c5d3ce899de6c3961d2ef595de8fc168a1677fc2d8"
|
||||
checksum = "b84ecc802da3eb67b4cf3dd9ea6fe45bbb47ef13e6c49c5c3240868a9cc6cdd9"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"arrayvec",
|
||||
@@ -2182,6 +2193,15 @@ dependencies = [
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.42.2"
|
||||
@@ -2212,6 +2232,21 @@ dependencies = [
|
||||
"windows_x86_64_msvc 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.52.0",
|
||||
"windows_aarch64_msvc 0.52.0",
|
||||
"windows_i686_gnu 0.52.0",
|
||||
"windows_i686_msvc 0.52.0",
|
||||
"windows_x86_64_gnu 0.52.0",
|
||||
"windows_x86_64_gnullvm 0.52.0",
|
||||
"windows_x86_64_msvc 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.42.2"
|
||||
@@ -2224,6 +2259,12 @@ version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.2"
|
||||
@@ -2236,6 +2277,12 @@ version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.2"
|
||||
@@ -2248,6 +2295,12 @@ version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.2"
|
||||
@@ -2260,6 +2313,12 @@ version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.2"
|
||||
@@ -2272,6 +2331,12 @@ version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.42.2"
|
||||
@@ -2284,6 +2349,12 @@ version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.2"
|
||||
@@ -2297,10 +2368,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
||||
[[package]]
|
||||
name = "winit"
|
||||
version = "0.29.3"
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "161598019a9da35ab6c34dc46cd13546cba9dbf9816475d4dd9a639455016563"
|
||||
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
|
||||
|
||||
[[package]]
|
||||
name = "winit"
|
||||
version = "0.29.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d25d662bb83b511acd839534bb2d88521b0bbc81440969cb077d23c4db9e62c7"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"android-activity",
|
||||
@@ -2347,9 +2424,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.5.17"
|
||||
version = "0.5.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c"
|
||||
checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
@@ -2427,20 +2504,20 @@ checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a"
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.7.18"
|
||||
version = "0.7.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ede7d7c7970ca2215b8c1ccf4d4f354c4733201dfaaba72d44ae5b37472e4901"
|
||||
checksum = "e97e415490559a91254a2979b4829267a57d2fcd741a98eee8b722fb57289aa0"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.7.18"
|
||||
version = "0.7.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b27b1bb92570f989aac0ab7e9cbfbacdd65973f7ee920d9f0e71ebac878fd0b"
|
||||
checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "strafe-client"
|
||||
version = "0.8.0"
|
||||
version = "0.9.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@@ -2,8 +2,8 @@ use crate::integer::Planar64Vec3;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Aabb{
|
||||
pub min:Planar64Vec3,
|
||||
pub max:Planar64Vec3,
|
||||
min:Planar64Vec3,
|
||||
max:Planar64Vec3,
|
||||
}
|
||||
|
||||
impl Default for Aabb {
|
||||
@@ -28,8 +28,11 @@ impl Aabb{
|
||||
pub fn intersects(&self,aabb:&Aabb)->bool{
|
||||
(self.min.cmplt(aabb.max)&aabb.min.cmplt(self.max)).all()
|
||||
}
|
||||
pub fn size(&self)->Planar64Vec3{
|
||||
self.max-self.min
|
||||
}
|
||||
pub fn center(&self)->Planar64Vec3{
|
||||
return self.min.midpoint(self.max)
|
||||
self.min.midpoint(self.max)
|
||||
}
|
||||
//probably use floats for area & volume because we don't care about precision
|
||||
// pub fn area_weight(&self)->f32{
|
||||
|
||||
@@ -1,26 +1,20 @@
|
||||
use crate::physics::Body;
|
||||
use crate::model_physics::{FEV,MeshQuery};
|
||||
use crate::integer::{Time,Planar64,Planar64Vec3};
|
||||
use crate::model_physics::{FEV,MeshQuery,DirectedEdge};
|
||||
use crate::integer::{Time,Planar64};
|
||||
use crate::zeroes::zeroes2;
|
||||
|
||||
struct State<FEV>{
|
||||
fev:FEV,
|
||||
time:Time,
|
||||
}
|
||||
|
||||
enum Transition<F,E,V>{
|
||||
enum Transition<F,E:DirectedEdge,V>{
|
||||
Miss,
|
||||
Next(FEV<F,E,V>,Time),
|
||||
Hit(F,Time),
|
||||
}
|
||||
|
||||
impl<F:Copy,E:Copy,V:Copy> State<FEV<F,E,V>>{
|
||||
fn next_transition(&self,mesh:&impl MeshQuery<F,E,V>,body:&Body,time_limit:Time)->Transition<F,E,V>{
|
||||
fn next_transition<F:Copy,E:Copy+DirectedEdge,V:Copy>(fev:&FEV<F,E,V>,time:Time,mesh:&impl MeshQuery<F,E,V>,body:&Body,time_limit:Time)->Transition<F,E,V>{
|
||||
//conflicting derivative means it crosses in the wrong direction.
|
||||
//if the transition time is equal to an already tested transition, do not replace the current best.
|
||||
let mut best_time=time_limit;
|
||||
let mut best_transtition=Transition::Miss;
|
||||
match &self.fev{
|
||||
match fev{
|
||||
&FEV::<F,E,V>::Face(face_id)=>{
|
||||
//test own face collision time, ignoring roots with zero or conflicting derivative
|
||||
//n=face.normal d=face.dot
|
||||
@@ -28,22 +22,24 @@ impl<F:Copy,E:Copy,V:Copy> State<FEV<F,E,V>>{
|
||||
let (n,d)=mesh.face_nd(face_id);
|
||||
for t in zeroes2((n.dot(body.position)-d)*2,n.dot(body.velocity)*2,n.dot(body.acceleration)){
|
||||
let t=body.time+Time::from(t);
|
||||
if self.time<t&&t<best_time&&n.dot(body.extrapolated_velocity(t))<Planar64::ZERO{
|
||||
if time<=t&&t<best_time&&n.dot(body.extrapolated_velocity(t))<Planar64::ZERO{
|
||||
best_time=t;
|
||||
best_transtition=Transition::Hit(face_id,t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//test each edge collision time, ignoring roots with zero or conflicting derivative
|
||||
for &(edge_id,test_face_id) in mesh.face_edges(face_id).iter(){
|
||||
let edge_n=mesh.edge_n(edge_id);
|
||||
for &directed_edge_id in mesh.face_edges(face_id).iter(){
|
||||
let edge_n=mesh.directed_edge_n(directed_edge_id);
|
||||
let n=n.cross(edge_n);
|
||||
//picking a vert randomly is terrible
|
||||
let d=n.dot(mesh.vert(mesh.edge_verts(edge_id)[0]));
|
||||
for t in zeroes2((n.dot(body.position)-d)*2,n.dot(body.velocity)*2,n.dot(body.acceleration)){
|
||||
let verts=mesh.edge_verts(directed_edge_id.as_undirected());
|
||||
let d=n.dot(mesh.vert(verts[0])+mesh.vert(verts[1]));
|
||||
//WARNING: d is moved out of the *2 block because of adding two vertices!
|
||||
for t in zeroes2(n.dot(body.position)*2-d,n.dot(body.velocity)*2,n.dot(body.acceleration)){
|
||||
let t=body.time+Time::from(t);
|
||||
if self.time<t&&t<best_time&&n.dot(body.extrapolated_velocity(t))<Planar64::ZERO{
|
||||
if time<=t&&t<best_time&&n.dot(body.extrapolated_velocity(t))<Planar64::ZERO{
|
||||
best_time=t;
|
||||
best_transtition=Transition::Next(FEV::<F,E,V>::Edge(edge_id),t);
|
||||
best_transtition=Transition::Next(FEV::<F,E,V>::Edge(directed_edge_id.as_undirected()),t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -53,26 +49,31 @@ impl<F:Copy,E:Copy,V:Copy> State<FEV<F,E,V>>{
|
||||
&FEV::<F,E,V>::Edge(edge_id)=>{
|
||||
//test each face collision time, ignoring roots with zero or conflicting derivative
|
||||
let edge_n=mesh.edge_n(edge_id);
|
||||
for &test_face_id in mesh.edge_faces(edge_id).iter(){
|
||||
let face_n=mesh.face_nd(test_face_id).0;
|
||||
let n=edge_n.cross(face_n);
|
||||
let d=n.dot(mesh.vert(mesh.edge_verts(edge_id)[0]));
|
||||
for t in zeroes2((n.dot(body.position)-d)*2,n.dot(body.velocity)*2,n.dot(body.acceleration)){
|
||||
let edge_verts=mesh.edge_verts(edge_id);
|
||||
let vert_sum=mesh.vert(edge_verts[0])+mesh.vert(edge_verts[1]);
|
||||
for (i,&edge_face_id) in mesh.edge_faces(edge_id).iter().enumerate(){
|
||||
let face_n=mesh.face_nd(edge_face_id).0;
|
||||
//edge_n gets parity from the order of edge_faces
|
||||
let n=face_n.cross(edge_n)*((i as i64)*2-1);
|
||||
let d=n.dot(vert_sum);
|
||||
//WARNING yada yada d *2
|
||||
for t in zeroes2((n.dot(body.position))*2-d,n.dot(body.velocity)*2,n.dot(body.acceleration)){
|
||||
let t=body.time+Time::from(t);
|
||||
if self.time<t&&t<best_time&&n.dot(body.extrapolated_velocity(t))<Planar64::ZERO{
|
||||
if time<=t&&t<best_time&&n.dot(body.extrapolated_velocity(t))<Planar64::ZERO{
|
||||
best_time=t;
|
||||
best_transtition=Transition::Next(FEV::<F,E,V>::Face(test_face_id),t);
|
||||
best_transtition=Transition::Next(FEV::<F,E,V>::Face(edge_face_id),t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//test each vertex collision time, ignoring roots with zero or conflicting derivative
|
||||
let n=mesh.edge_n(edge_id);
|
||||
for &vert_id in mesh.edge_verts(edge_id).iter(){
|
||||
for (i,&vert_id) in edge_verts.iter().enumerate(){
|
||||
//vertex normal gets parity from vert index
|
||||
let n=edge_n*(1-2*(i as i64));
|
||||
let d=n.dot(mesh.vert(vert_id));
|
||||
for t in zeroes2((n.dot(body.position)-d)*2,n.dot(body.velocity)*2,n.dot(body.acceleration)){
|
||||
let t=body.time+Time::from(t);
|
||||
if self.time<t&&t<best_time&&n.dot(body.extrapolated_velocity(t))<Planar64::ZERO{
|
||||
if time<=t&&t<best_time&&n.dot(body.extrapolated_velocity(t))<Planar64::ZERO{
|
||||
best_time=t;
|
||||
best_transtition=Transition::Next(FEV::<F,E,V>::Vert(vert_id),t);
|
||||
break;
|
||||
@@ -83,14 +84,15 @@ impl<F:Copy,E:Copy,V:Copy> State<FEV<F,E,V>>{
|
||||
},
|
||||
&FEV::<F,E,V>::Vert(vert_id)=>{
|
||||
//test each edge collision time, ignoring roots with zero or conflicting derivative
|
||||
for &edge_id in mesh.vert_edges(vert_id).iter(){
|
||||
let n=mesh.edge_n(edge_id);
|
||||
for &directed_edge_id in mesh.vert_edges(vert_id).iter(){
|
||||
//edge is directed away from vertex, but we want the dot product to turn out negative
|
||||
let n=-mesh.directed_edge_n(directed_edge_id);
|
||||
let d=n.dot(mesh.vert(vert_id));
|
||||
for t in zeroes2((n.dot(body.position)-d)*2,n.dot(body.velocity)*2,n.dot(body.acceleration)){
|
||||
let t=body.time+Time::from(t);
|
||||
if self.time<t&&t<best_time&&n.dot(body.extrapolated_velocity(t))<Planar64::ZERO{
|
||||
if time<=t&&t<best_time&&n.dot(body.extrapolated_velocity(t))<Planar64::ZERO{
|
||||
best_time=t;
|
||||
best_transtition=Transition::Next(FEV::<F,E,V>::Edge(edge_id),t);
|
||||
best_transtition=Transition::Next(FEV::<F,E,V>::Edge(directed_edge_id.as_undirected()),t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -100,27 +102,20 @@ impl<F:Copy,E:Copy,V:Copy> State<FEV<F,E,V>>{
|
||||
}
|
||||
best_transtition
|
||||
}
|
||||
pub enum CrawlResult<F,E:DirectedEdge,V>{
|
||||
Miss(FEV<F,E,V>),
|
||||
Hit(F,Time),
|
||||
}
|
||||
|
||||
pub fn predict_collision<F:Copy,E:Copy,V:Copy>(mesh:&impl MeshQuery<F,E,V>,relative_body:&Body,time_limit:Time)->Option<(F,Time)>{
|
||||
let mut state=State{
|
||||
fev:mesh.closest_fev(relative_body.position),
|
||||
time:relative_body.time,
|
||||
};
|
||||
//it would be possible to write down the point of closest approach...
|
||||
loop{
|
||||
match state.next_transition(mesh,relative_body,time_limit){
|
||||
Transition::Miss=>return None,
|
||||
Transition::Next(fev,time)=>(state.fev,state.time)=(fev,time),
|
||||
Transition::Hit(face,time)=>return Some((face,time)),
|
||||
pub fn crawl_fev<F:Copy,E:Copy+DirectedEdge,V:Copy>(mut fev:FEV<F,E,V>,mesh:&impl MeshQuery<F,E,V>,relative_body:&Body,start_time:Time,time_limit:Time)->CrawlResult<F,E,V>{
|
||||
let mut time=start_time;
|
||||
for _ in 0..20{
|
||||
match next_transition(&fev,time,mesh,relative_body,time_limit){
|
||||
Transition::Miss=>return CrawlResult::Miss(fev),
|
||||
Transition::Next(next_fev,next_time)=>(fev,time)=(next_fev,next_time),
|
||||
Transition::Hit(face,time)=>return CrawlResult::Hit(face,time),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn predict_collision_end<F:Copy,E:Copy,V:Copy>(mesh:&impl MeshQuery<F,E,V>,relative_body:&Body,time_limit:Time,ignore_face_id:F)->Option<(F,Time)>{
|
||||
//imagine the mesh without the collision face
|
||||
//no algorithm needed, there is only one state and three cases (Face,Edge,None)
|
||||
//determine when it passes an edge ("sliding off" case) or if it leaves the surface directly
|
||||
//the state can be constructed from the ContactCollision directly
|
||||
None
|
||||
//TODO: fix all bugs
|
||||
println!("Too many iterations! Using default behaviour instead of crashing...");
|
||||
CrawlResult::Miss(fev)
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#[derive(Clone,Copy,Hash,Eq,PartialEq,PartialOrd,Debug)]
|
||||
pub struct Time(i64);
|
||||
impl Time{
|
||||
pub const MIN:Self=Self(i64::MIN);
|
||||
pub const MAX:Self=Self(i64::MAX);
|
||||
pub const ZERO:Self=Self(0);
|
||||
pub const ONE_SECOND:Self=Self(1_000_000_000);
|
||||
pub const ONE_MILLISECOND:Self=Self(1_000_000);
|
||||
@@ -415,6 +417,7 @@ impl Planar64{
|
||||
pub const ZERO:Self=Self(0);
|
||||
pub const ONE:Self=Self(1<<32);
|
||||
pub const MAX:Self=Self(i64::MAX);
|
||||
pub const MIN:Self=Self(i64::MIN);
|
||||
#[inline]
|
||||
pub const fn int(num:i32)->Self{
|
||||
Self(Self::ONE.0*num as i64)
|
||||
@@ -833,16 +836,6 @@ impl Default for Planar64Mat3{
|
||||
}
|
||||
}
|
||||
}
|
||||
impl std::ops::Mul<Planar64Vec3> for Planar64Mat3{
|
||||
type Output=Planar64Vec3;
|
||||
#[inline]
|
||||
fn mul(self,rhs:Planar64Vec3) -> Self::Output {
|
||||
self.x_axis*rhs.x()
|
||||
+self.y_axis*rhs.y()
|
||||
+self.z_axis*rhs.z()
|
||||
}
|
||||
}
|
||||
|
||||
impl Planar64Mat3{
|
||||
#[inline]
|
||||
pub fn from_cols(x_axis:Planar64Vec3,y_axis:Planar64Vec3,z_axis:Planar64Vec3)->Self{
|
||||
@@ -860,6 +853,14 @@ impl Planar64Mat3{
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub const fn from_diagonal(diagonal:Planar64Vec3)->Self{
|
||||
Self{
|
||||
x_axis:Planar64Vec3::raw(diagonal.0.x,0,0),
|
||||
y_axis:Planar64Vec3::raw(0,diagonal.0.y,0),
|
||||
z_axis:Planar64Vec3::raw(0,0,diagonal.0.z),
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
pub fn from_rotation_yx(yaw:Angle32,pitch:Angle32)->Self{
|
||||
let xtheta=yaw.0 as f64*ANGLE32_TO_FLOAT64_RADIANS;
|
||||
let (xs,xc)=xtheta.sin_cos();
|
||||
@@ -955,6 +956,15 @@ impl std::fmt::Display for Planar64Mat3{
|
||||
)
|
||||
}
|
||||
}
|
||||
impl std::ops::Mul<Planar64Vec3> for Planar64Mat3{
|
||||
type Output=Planar64Vec3;
|
||||
#[inline]
|
||||
fn mul(self,rhs:Planar64Vec3) -> Self::Output {
|
||||
self.x_axis*rhs.x()
|
||||
+self.y_axis*rhs.y()
|
||||
+self.z_axis*rhs.z()
|
||||
}
|
||||
}
|
||||
impl std::ops::Div<i64> for Planar64Mat3{
|
||||
type Output=Planar64Mat3;
|
||||
#[inline]
|
||||
@@ -1023,7 +1033,7 @@ impl std::fmt::Display for Planar64Affine3{
|
||||
#[test]
|
||||
fn test_sqrt(){
|
||||
let r=Planar64::int(400);
|
||||
println!("r{}",r.get());
|
||||
assert_eq!(1717986918400,r.get());
|
||||
let s=r.sqrt();
|
||||
println!("s{}",s.get());
|
||||
assert_eq!(85899345920,s.get());
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
474
src/physics.rs
474
src/physics.rs
@@ -43,6 +43,17 @@ pub struct Body{
|
||||
pub acceleration:Planar64Vec3,//I64 where 2^32 = 1 u/s/s
|
||||
pub time:Time,//nanoseconds x xxxxD!
|
||||
}
|
||||
impl std::ops::Neg for Body{
|
||||
type Output=Self;
|
||||
fn neg(self)->Self::Output{
|
||||
Self{
|
||||
position:self.position,
|
||||
velocity:-self.velocity,
|
||||
acceleration:self.acceleration,
|
||||
time:-self.time,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//hey dumbass just use a delta
|
||||
#[derive(Clone,Debug)]
|
||||
@@ -327,6 +338,55 @@ struct StrafeSettings{
|
||||
tick_rate:Ratio64,
|
||||
}
|
||||
|
||||
struct Hitbox{
|
||||
halfsize:Planar64Vec3,
|
||||
mesh:PhysicsMesh,
|
||||
transform:crate::integer::Planar64Affine3,
|
||||
normal_transform:Planar64Mat3,
|
||||
}
|
||||
impl Hitbox{
|
||||
fn new(mesh:PhysicsMesh,transform:crate::integer::Planar64Affine3)->Self{
|
||||
//calculate extents
|
||||
let normal_transform=transform.matrix3.inverse().transpose();
|
||||
let mut aabb=crate::aabb::Aabb::default();
|
||||
for vert in mesh.verts(){
|
||||
aabb.grow(transform.transform_point3(vert));
|
||||
}
|
||||
Self{
|
||||
halfsize:aabb.size()/2,
|
||||
mesh,
|
||||
transform,
|
||||
normal_transform,
|
||||
}
|
||||
}
|
||||
fn from_mesh_scale(mesh:PhysicsMesh,scale:Planar64Vec3)->Self{
|
||||
Self{
|
||||
halfsize:scale,
|
||||
mesh,
|
||||
transform:crate::integer::Planar64Affine3::new(Planar64Mat3::from_diagonal(scale),Planar64Vec3::ZERO),
|
||||
normal_transform:Planar64Mat3::from_diagonal(scale).inverse().transpose(),
|
||||
}
|
||||
}
|
||||
fn from_mesh_scale_offset(mesh:PhysicsMesh,scale:Planar64Vec3,offset:Planar64Vec3)->Self{
|
||||
Self{
|
||||
halfsize:scale,
|
||||
mesh,
|
||||
transform:crate::integer::Planar64Affine3::new(Planar64Mat3::from_diagonal(scale),offset),
|
||||
normal_transform:Planar64Mat3::from_diagonal(scale).inverse().transpose(),
|
||||
}
|
||||
}
|
||||
fn roblox()->Self{
|
||||
Self::from_mesh_scale(PhysicsMesh::from(&crate::primitives::unit_cylinder()),Planar64Vec3::int(2,5,2)/2)
|
||||
}
|
||||
fn source()->Self{
|
||||
Self::from_mesh_scale(PhysicsMesh::from(&crate::primitives::unit_cube()),Planar64Vec3::raw(33<<28,73<<28,33<<28)/2)
|
||||
}
|
||||
#[inline]
|
||||
fn transformed_mesh(&self)->TransformedMesh{
|
||||
TransformedMesh::new(&self.mesh,&self.transform,&self.normal_transform)
|
||||
}
|
||||
}
|
||||
|
||||
struct StyleModifiers{
|
||||
controls_used:u32,//controls which are allowed to pass into gameplay
|
||||
controls_mask:u32,//controls which are masked from control state (e.g. jump in scroll style)
|
||||
@@ -346,7 +406,7 @@ struct StyleModifiers{
|
||||
surf_slope:Option<Planar64>,
|
||||
rocket_force:Option<Planar64>,
|
||||
gravity:Planar64Vec3,
|
||||
hitbox_halfsize:Planar64Vec3,
|
||||
hitbox:Hitbox,
|
||||
camera_offset:Planar64Vec3,
|
||||
}
|
||||
impl std::default::Default for StyleModifiers{
|
||||
@@ -368,14 +428,14 @@ impl StyleModifiers{
|
||||
const UP_DIR:Planar64Vec3=Planar64Vec3::Y;
|
||||
const FORWARD_DIR:Planar64Vec3=Planar64Vec3::NEG_Z;
|
||||
|
||||
fn new()->Self{
|
||||
fn neo()->Self{
|
||||
Self{
|
||||
controls_used:!0,
|
||||
controls_mask:!0,//&!(Self::CONTROL_MOVEUP|Self::CONTROL_MOVEDOWN),
|
||||
strafe:Some(StrafeSettings{
|
||||
enable:EnableStrafe::Always,
|
||||
air_accel_limit:None,
|
||||
tick_rate:Ratio64::new(128,Time::ONE_SECOND.nanos() as u64).unwrap(),
|
||||
tick_rate:Ratio64::new(64,Time::ONE_SECOND.nanos() as u64).unwrap(),
|
||||
}),
|
||||
jump_impulse:JumpImpulse::FromEnergy(Planar64::int(512)),
|
||||
jump_calculation:JumpCalculation::Energy,
|
||||
@@ -383,7 +443,7 @@ impl StyleModifiers{
|
||||
static_friction:Planar64::int(2),
|
||||
kinetic_friction:Planar64::int(3),//unrealistic: kinetic friction is typically lower than static
|
||||
mass:Planar64::int(1),
|
||||
mv:Planar64::int(2),
|
||||
mv:Planar64::int(3),
|
||||
rocket_force:None,
|
||||
walk_speed:Planar64::int(16),
|
||||
walk_accel:Planar64::int(80),
|
||||
@@ -392,7 +452,7 @@ impl StyleModifiers{
|
||||
ladder_dot:(Planar64::int(1)/2).sqrt(),
|
||||
swim_speed:Planar64::int(12),
|
||||
surf_slope:Some(Planar64::raw(7)/8),
|
||||
hitbox_halfsize:Planar64Vec3::int(2,5,2)/2,
|
||||
hitbox:Hitbox::roblox(),
|
||||
camera_offset:Planar64Vec3::int(0,2,0),//4.5-2.5=2
|
||||
}
|
||||
}
|
||||
@@ -421,7 +481,7 @@ impl StyleModifiers{
|
||||
ladder_dot:(Planar64::int(1)/2).sqrt(),
|
||||
swim_speed:Planar64::int(12),
|
||||
surf_slope:Some(Planar64::raw(3787805118)),// normal.y=0.75
|
||||
hitbox_halfsize:Planar64Vec3::int(2,5,2)/2,
|
||||
hitbox:Hitbox::roblox(),
|
||||
camera_offset:Planar64Vec3::int(0,2,0),//4.5-2.5=2
|
||||
}
|
||||
}
|
||||
@@ -449,7 +509,7 @@ impl StyleModifiers{
|
||||
ladder_dot:(Planar64::int(1)/2).sqrt(),
|
||||
swim_speed:Planar64::int(12),
|
||||
surf_slope:Some(Planar64::raw(3787805118)),// normal.y=0.75
|
||||
hitbox_halfsize:Planar64Vec3::int(2,5,2)/2,
|
||||
hitbox:Hitbox::roblox(),
|
||||
camera_offset:Planar64Vec3::int(0,2,0),//4.5-2.5=2
|
||||
}
|
||||
}
|
||||
@@ -478,7 +538,7 @@ impl StyleModifiers{
|
||||
ladder_dot:(Planar64::int(1)/2).sqrt(),//?
|
||||
swim_speed:Planar64::int(12),//?
|
||||
surf_slope:Some(Planar64::raw(3787805118)),// normal.y=0.75
|
||||
hitbox_halfsize:Planar64Vec3::raw(33<<28,73<<28,33<<28)/2,
|
||||
hitbox:Hitbox::source(),
|
||||
camera_offset:Planar64Vec3::raw(0,(64<<28)-(73<<27),0),
|
||||
}
|
||||
}
|
||||
@@ -506,7 +566,7 @@ impl StyleModifiers{
|
||||
ladder_dot:(Planar64::int(1)/2).sqrt(),//?
|
||||
swim_speed:Planar64::int(12),//?
|
||||
surf_slope:Some(Planar64::raw(3787805118)),// normal.y=0.75
|
||||
hitbox_halfsize:Planar64Vec3::raw(33<<28,73<<28,33<<28)/2,
|
||||
hitbox:Hitbox::source(),
|
||||
camera_offset:Planar64Vec3::raw(0,(64<<28)-(73<<27),0),
|
||||
}
|
||||
}
|
||||
@@ -530,7 +590,7 @@ impl StyleModifiers{
|
||||
ladder_dot:(Planar64::int(1)/2).sqrt(),
|
||||
swim_speed:Planar64::int(12),
|
||||
surf_slope:Some(Planar64::raw(3787805118)),// normal.y=0.75
|
||||
hitbox_halfsize:Planar64Vec3::int(2,5,2)/2,
|
||||
hitbox:Hitbox::roblox(),
|
||||
camera_offset:Planar64Vec3::int(0,2,0),//4.5-2.5=2
|
||||
}
|
||||
}
|
||||
@@ -644,6 +704,10 @@ impl StyleModifiers{
|
||||
let camera_mat=camera.simulate_move_rotation(camera.mouse.lerp(&next_mouse,time));
|
||||
camera_mat*self.get_control_dir(controls)
|
||||
}
|
||||
#[inline]
|
||||
fn mesh(&self)->TransformedMesh{
|
||||
self.hitbox.transformed_mesh()
|
||||
}
|
||||
}
|
||||
|
||||
enum MoveState{
|
||||
@@ -731,8 +795,7 @@ impl PhysicsModel{
|
||||
|
||||
#[derive(Debug,Clone,Eq,Hash,PartialEq)]
|
||||
struct ContactCollision{
|
||||
//face_id:crate::model_physics::MinkowskiFace,
|
||||
face_id:crate::model_physics::FaceId,
|
||||
face_id:crate::model_physics::MinkowskiFace,
|
||||
model_id:usize,//using id to avoid lifetimes
|
||||
}
|
||||
#[derive(Debug,Clone,Eq,Hash,PartialEq)]
|
||||
@@ -751,7 +814,7 @@ impl Collision{
|
||||
|&Collision::Intersect(IntersectCollision{model_id})=>model_id,
|
||||
}
|
||||
}
|
||||
fn face_id(&self)->Option<crate::model_physics::FaceId>{
|
||||
fn face_id(&self)->Option<crate::model_physics::MinkowskiFace>{
|
||||
match self{
|
||||
&Collision::Contact(ContactCollision{model_id:_,face_id})=>Some(face_id),
|
||||
&Collision::Intersect(IntersectCollision{model_id:_})=>None,
|
||||
@@ -811,20 +874,20 @@ impl TouchingState{
|
||||
//add water../?
|
||||
a
|
||||
}
|
||||
fn constrain_velocity(&self,models:&PhysicsModels,velocity:&mut Planar64Vec3){
|
||||
fn constrain_velocity(&self,models:&PhysicsModels,style_mesh:&TransformedMesh,velocity:&mut Planar64Vec3){
|
||||
//TODO: trey push solve
|
||||
for contact in &self.contacts{
|
||||
let n=models.mesh(contact.model_id).face_nd(contact.face_id).0;
|
||||
let n=contact_normal(models,style_mesh,contact);
|
||||
let d=n.dot128(*velocity);
|
||||
if d<0{
|
||||
*velocity-=n*Planar64::raw(((d<<32)/n.dot128(n)) as i64);
|
||||
}
|
||||
}
|
||||
}
|
||||
fn constrain_acceleration(&self,models:&PhysicsModels,acceleration:&mut Planar64Vec3){
|
||||
fn constrain_acceleration(&self,models:&PhysicsModels,style_mesh:&TransformedMesh,acceleration:&mut Planar64Vec3){
|
||||
//TODO: trey push solve
|
||||
for contact in &self.contacts{
|
||||
let n=models.mesh(contact.model_id).face_nd(contact.face_id).0;
|
||||
let n=contact_normal(models,style_mesh,contact);
|
||||
let d=n.dot128(*acceleration);
|
||||
if d<0{
|
||||
*acceleration-=n*Planar64::raw(((d<<32)/n.dot128(n)) as i64);
|
||||
@@ -835,30 +898,31 @@ impl TouchingState{
|
||||
//check current move conditions and use heuristics to determine
|
||||
//which ladder to climb on, which ground to walk on, etc
|
||||
//collect move state affecting objects from contacts (accelerator,water,ladder,ground)
|
||||
let style_mesh=style.mesh();
|
||||
let gravity=self.base_acceleration(models,style,camera,controls,next_mouse,time);
|
||||
let mut move_state=MoveState::Air;
|
||||
let mut a=gravity;
|
||||
for contact in &self.contacts{
|
||||
match models.attr(contact.model_id){
|
||||
PhysicsCollisionAttributes::Contact{contacting,general}=>{
|
||||
let normal=models.mesh(contact.model_id).face_nd(contact.face_id).0;
|
||||
let normal=contact_normal(models,&style_mesh,contact);
|
||||
match &contacting.contact_behaviour{
|
||||
Some(crate::model::ContactingBehaviour::Ladder(_))=>{
|
||||
//ladder walkstate
|
||||
let mut target_velocity=style.get_ladder_target_velocity(camera,controls,next_mouse,time,&normal);
|
||||
self.constrain_velocity(models,&mut target_velocity);
|
||||
self.constrain_velocity(models,&style_mesh,&mut target_velocity);
|
||||
let (walk_state,mut acceleration)=WalkState::ladder(body,style,gravity,target_velocity,contact.clone(),&normal);
|
||||
move_state=MoveState::Ladder(walk_state);
|
||||
self.constrain_acceleration(models,&mut acceleration);
|
||||
self.constrain_acceleration(models,&style_mesh,&mut acceleration);
|
||||
a=acceleration;
|
||||
},
|
||||
None=>if style.surf_slope.map_or(true,|s|normal.walkable(s,Planar64Vec3::Y)){
|
||||
//check ground
|
||||
let mut target_velocity=style.get_walk_target_velocity(camera,controls,next_mouse,time,&normal);
|
||||
self.constrain_velocity(models,&mut target_velocity);
|
||||
self.constrain_velocity(models,&style_mesh,&mut target_velocity);
|
||||
let (walk_state,mut acceleration)=WalkState::ground(body,style,gravity,target_velocity,contact.clone(),&normal);
|
||||
move_state=MoveState::Walk(walk_state);
|
||||
self.constrain_acceleration(models,&mut acceleration);
|
||||
self.constrain_acceleration(models,&style_mesh,&mut acceleration);
|
||||
a=acceleration;
|
||||
},
|
||||
_=>(),
|
||||
@@ -868,15 +932,18 @@ impl TouchingState{
|
||||
}
|
||||
}
|
||||
for intersect in &self.intersects{
|
||||
//
|
||||
//water
|
||||
}
|
||||
self.constrain_acceleration(models,&mut a);
|
||||
self.constrain_acceleration(models,&style_mesh,&mut a);
|
||||
(move_state,a)
|
||||
}
|
||||
fn predict_collision_end(&self,collector:&mut crate::instruction::InstructionCollector<PhysicsInstruction>,models:&PhysicsModels,body:&Body,time:Time){
|
||||
fn predict_collision_end(&self,collector:&mut crate::instruction::InstructionCollector<PhysicsInstruction>,models:&PhysicsModels,style_mesh:&TransformedMesh,body:&Body,time:Time){
|
||||
let relative_body=VirtualBody::relative(&Body::default(),body).body(time);
|
||||
for contact in &self.contacts{
|
||||
//detect face slide off
|
||||
collector.collect(models.mesh(contact.model_id).brute_out_face(body,collector.time(),contact.face_id).map(|(face,time)|{
|
||||
let model_mesh=models.mesh(contact.model_id);
|
||||
let minkowski=crate::model_physics::MinkowskiMesh::minkowski_sum(&model_mesh,&style_mesh);
|
||||
collector.collect(minkowski.predict_collision_face_out(&relative_body,collector.time(),contact.face_id).map(|(face,time)|{
|
||||
TimedInstruction{
|
||||
time,
|
||||
instruction:PhysicsInstruction::CollisionEnd(
|
||||
@@ -885,10 +952,11 @@ impl TouchingState{
|
||||
}
|
||||
}));
|
||||
}
|
||||
let relative_body=VirtualBody::relative(&Body::default(),body).body(time);
|
||||
for intersect in &self.intersects{
|
||||
//detect model collision in reverse
|
||||
collector.collect(models.mesh(intersect.model_id).brute_out(&relative_body,collector.time()).map(|(face,time)|{
|
||||
let model_mesh=models.mesh(intersect.model_id);
|
||||
let minkowski=crate::model_physics::MinkowskiMesh::minkowski_sum(&model_mesh,&style_mesh);
|
||||
collector.collect(minkowski.predict_collision_out(&relative_body,collector.time()).map(|(face,time)|{
|
||||
TimedInstruction{
|
||||
time,
|
||||
instruction:PhysicsInstruction::CollisionEnd(
|
||||
@@ -922,6 +990,42 @@ impl Body{
|
||||
self.velocity=self.extrapolated_velocity(time);
|
||||
self.time=time;
|
||||
}
|
||||
pub fn infinity_dir(&self)->Option<Planar64Vec3>{
|
||||
if self.velocity==Planar64Vec3::ZERO{
|
||||
if self.acceleration==Planar64Vec3::ZERO{
|
||||
None
|
||||
}else{
|
||||
Some(self.acceleration)
|
||||
}
|
||||
}else{
|
||||
Some(self.velocity)
|
||||
}
|
||||
}
|
||||
pub fn grow_aabb(&self,aabb:&mut crate::aabb::Aabb,t0:Time,t1:Time){
|
||||
aabb.grow(self.extrapolated_position(t0));
|
||||
aabb.grow(self.extrapolated_position(t1));
|
||||
//v+a*t==0
|
||||
//goober code
|
||||
if self.acceleration.x()!=Planar64::ZERO{
|
||||
let t=Time::from(-self.velocity.x()/self.acceleration.x());
|
||||
if t0<t&&t<t1{
|
||||
aabb.grow(self.extrapolated_position(t));
|
||||
}
|
||||
}
|
||||
if self.acceleration.y()!=Planar64::ZERO{
|
||||
let t=Time::from(-self.velocity.y()/self.acceleration.y());
|
||||
if t0<t&&t<t1{
|
||||
aabb.grow(self.extrapolated_position(t));
|
||||
}
|
||||
}
|
||||
if self.acceleration.z()!=Planar64::ZERO{
|
||||
let t=Time::from(-self.velocity.z()/self.acceleration.z());
|
||||
if t0<t&&t<t1{
|
||||
aabb.grow(self.extrapolated_position(t));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
impl std::fmt::Display for Body{
|
||||
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{
|
||||
@@ -1132,21 +1236,23 @@ impl PhysicsState {
|
||||
match &mut self.move_state{
|
||||
MoveState::Air|MoveState::Water=>self.touching.base_acceleration(&self.models,&self.style,&self.camera,self.controls,&self.next_mouse,self.time),
|
||||
MoveState::Walk(WalkState{state,contact,jump_direction:_})=>{
|
||||
let n=self.models.mesh(contact.model_id).face_nd(contact.face_id).0;
|
||||
let style_mesh=self.style.mesh();
|
||||
let n=contact_normal(&self.models,&style_mesh,contact);
|
||||
let gravity=self.touching.base_acceleration(&self.models,&self.style,&self.camera,self.controls,&self.next_mouse,self.time);
|
||||
let mut a;
|
||||
let mut v=self.style.get_walk_target_velocity(&self.camera,self.controls,&self.next_mouse,self.time,&n);
|
||||
self.touching.constrain_velocity(&self.models,&mut v);
|
||||
self.touching.constrain_velocity(&self.models,&style_mesh,&mut v);
|
||||
let normal_accel=-n.dot(gravity)/n.length();
|
||||
(*state,a)=WalkEnum::with_target_velocity(&self.body,&self.style,v,&n,self.style.walk_speed,normal_accel);
|
||||
a
|
||||
},
|
||||
MoveState::Ladder(WalkState{state,contact,jump_direction:_})=>{
|
||||
let n=self.models.mesh(contact.model_id).face_nd(contact.face_id).0;
|
||||
let style_mesh=self.style.mesh();
|
||||
let n=contact_normal(&self.models,&style_mesh,contact);
|
||||
let gravity=self.touching.base_acceleration(&self.models,&self.style,&self.camera,self.controls,&self.next_mouse,self.time);
|
||||
let mut a;
|
||||
let mut v=self.style.get_ladder_target_velocity(&self.camera,self.controls,&self.next_mouse,self.time,&n);
|
||||
self.touching.constrain_velocity(&self.models,&mut v);
|
||||
self.touching.constrain_velocity(&self.models,&style_mesh,&mut v);
|
||||
(*state,a)=WalkEnum::with_target_velocity(&self.body,&self.style,v,&n,self.style.ladder_speed,self.style.ladder_accel);
|
||||
a
|
||||
},
|
||||
@@ -1176,20 +1282,23 @@ impl crate::instruction::InstructionEmitter<PhysicsInstruction> for PhysicsState
|
||||
|
||||
collector.collect(self.next_move_instruction());
|
||||
|
||||
let style_mesh=self.style.mesh();
|
||||
//check for collision ends
|
||||
self.touching.predict_collision_end(&mut collector,&self.models,&self.body,self.time);
|
||||
self.touching.predict_collision_end(&mut collector,&self.models,&style_mesh,&self.body,self.time);
|
||||
//check for collision starts
|
||||
let mut aabb=crate::aabb::Aabb::default();
|
||||
aabb.grow(self.body.extrapolated_position(self.time));
|
||||
aabb.grow(self.body.extrapolated_position(collector.time()));
|
||||
aabb.inflate(self.style.hitbox_halfsize);
|
||||
self.body.grow_aabb(&mut aabb,self.time,collector.time());
|
||||
aabb.inflate(self.style.hitbox.halfsize);
|
||||
//common body
|
||||
let relative_body=VirtualBody::relative(&Body::default(),&self.body).body(self.time);
|
||||
self.bvh.the_tester(&aabb,&mut |id|{
|
||||
//no checks are needed because of the time limits.
|
||||
//let minkowski=crate::model_physics::MinkowskiMesh::minkowski_sum(self.style.mesh,&self.models.mesh(id));
|
||||
//collector.collect(crate::face_crawler::predict_collision(&minkowski,&relative_body,collector.time()).map(|(face,time)|{
|
||||
collector.collect(self.models.mesh(id).brute_in(&relative_body,collector.time()).map(|(face,time)|{
|
||||
let model_mesh=self.models.mesh(id);
|
||||
let minkowski=crate::model_physics::MinkowskiMesh::minkowski_sum(&model_mesh,&style_mesh);
|
||||
collector.collect(minkowski.predict_collision_in(&relative_body,collector.time())
|
||||
//temp (?) code to avoid collision loops
|
||||
.map_or(None,|(face,time)|if time==self.time{None}else{Some((face,time))})
|
||||
.map(|(face,time)|{
|
||||
TimedInstruction{time,instruction:PhysicsInstruction::CollisionStart(match self.models.attr(id){
|
||||
PhysicsCollisionAttributes::Contact{contacting:_,general:_}=>Collision::Contact(ContactCollision{model_id:id,face_id:face}),
|
||||
PhysicsCollisionAttributes::Intersect{intersecting:_,general:_}=>Collision::Intersect(IntersectCollision{model_id:id}),
|
||||
@@ -1209,12 +1318,18 @@ fn get_walk_state(move_state:&MoveState)->Option<&WalkState>{
|
||||
|
||||
fn jumped_velocity(models:&PhysicsModels,style:&StyleModifiers,walk_state:&WalkState,v:&mut Planar64Vec3){
|
||||
let jump_dir=match &walk_state.jump_direction{
|
||||
JumpDirection::FromContactNormal=>models.mesh(walk_state.contact.model_id).face_nd(walk_state.contact.face_id).0,
|
||||
JumpDirection::FromContactNormal=>contact_normal(models,&style.mesh(),&walk_state.contact),
|
||||
&JumpDirection::Exactly(dir)=>dir,
|
||||
};
|
||||
*v=*v+jump_dir*(style.get_jump_deltav()/jump_dir.length());
|
||||
}
|
||||
|
||||
fn contact_normal(models:&PhysicsModels,style_mesh:&TransformedMesh,contact:&ContactCollision)->Planar64Vec3{
|
||||
let model_mesh=models.mesh(contact.model_id);
|
||||
let minkowski=crate::model_physics::MinkowskiMesh::minkowski_sum(&model_mesh,style_mesh);
|
||||
minkowski.face_nd(contact.face_id).0
|
||||
}
|
||||
|
||||
fn set_position(body:&mut Body,touching:&mut TouchingState,point:Planar64Vec3)->Planar64Vec3{
|
||||
//test intersections at new position
|
||||
//hovering above the surface 0 units is not intersecting. you will fall into it just fine
|
||||
@@ -1225,11 +1340,11 @@ fn set_position(body:&mut Body,touching:&mut TouchingState,point:Planar64Vec3)->
|
||||
//touching.recalculate(body);
|
||||
point
|
||||
}
|
||||
fn set_velocity_cull(body:&mut Body,touching:&mut TouchingState,models:&PhysicsModels,v:Planar64Vec3)->bool{
|
||||
fn set_velocity_cull(body:&mut Body,touching:&mut TouchingState,models:&PhysicsModels,style_mesh:&TransformedMesh,v:Planar64Vec3)->bool{
|
||||
//This is not correct but is better than what I have
|
||||
let mut culled=false;
|
||||
touching.contacts.retain(|contact|{
|
||||
let n=models.mesh(contact.model_id).face_nd(contact.face_id).0;
|
||||
let n=contact_normal(models,style_mesh,contact);
|
||||
let r=n.dot(v)<=Planar64::ZERO;
|
||||
if !r{
|
||||
culled=true;
|
||||
@@ -1237,19 +1352,19 @@ fn set_velocity_cull(body:&mut Body,touching:&mut TouchingState,models:&PhysicsM
|
||||
}
|
||||
r
|
||||
});
|
||||
set_velocity(body,touching,models,v);
|
||||
set_velocity(body,touching,models,style_mesh,v);
|
||||
culled
|
||||
}
|
||||
fn set_velocity(body:&mut Body,touching:&TouchingState,models:&PhysicsModels,mut v:Planar64Vec3)->Planar64Vec3{
|
||||
touching.constrain_velocity(&models,&mut v);
|
||||
fn set_velocity(body:&mut Body,touching:&TouchingState,models:&PhysicsModels,style_mesh:&TransformedMesh,mut v:Planar64Vec3)->Planar64Vec3{
|
||||
touching.constrain_velocity(models,style_mesh,&mut v);
|
||||
body.velocity=v;
|
||||
v
|
||||
}
|
||||
fn set_acceleration_cull(body:&mut Body,touching:&mut TouchingState,models:&PhysicsModels,a:Planar64Vec3)->bool{
|
||||
fn set_acceleration_cull(body:&mut Body,touching:&mut TouchingState,models:&PhysicsModels,style_mesh:&TransformedMesh,a:Planar64Vec3)->bool{
|
||||
//This is not correct but is better than what I have
|
||||
let mut culled=false;
|
||||
touching.contacts.retain(|contact|{
|
||||
let n=models.mesh(contact.model_id).face_nd(contact.face_id).0;
|
||||
let n=contact_normal(models,style_mesh,contact);
|
||||
let r=n.dot(a)<=Planar64::ZERO;
|
||||
if !r{
|
||||
culled=true;
|
||||
@@ -1257,23 +1372,23 @@ fn set_acceleration_cull(body:&mut Body,touching:&mut TouchingState,models:&Phys
|
||||
}
|
||||
r
|
||||
});
|
||||
set_acceleration(body,touching,models,a);
|
||||
set_acceleration(body,touching,models,style_mesh,a);
|
||||
culled
|
||||
}
|
||||
fn set_acceleration(body:&mut Body,touching:&TouchingState,models:&PhysicsModels,mut a:Planar64Vec3)->Planar64Vec3{
|
||||
touching.constrain_acceleration(&models,&mut a);
|
||||
fn set_acceleration(body:&mut Body,touching:&TouchingState,models:&PhysicsModels,style_mesh:&TransformedMesh,mut a:Planar64Vec3)->Planar64Vec3{
|
||||
touching.constrain_acceleration(models,style_mesh,&mut a);
|
||||
body.acceleration=a;
|
||||
a
|
||||
}
|
||||
|
||||
fn teleport(body:&mut Body,touching:&mut TouchingState,models:&PhysicsModels,style:&StyleModifiers,point:Planar64Vec3)->MoveState{
|
||||
set_position(body,touching,point);
|
||||
set_acceleration(body,touching,models,style.gravity);
|
||||
set_acceleration(body,touching,models,&style.mesh(),style.gravity);
|
||||
MoveState::Air
|
||||
}
|
||||
fn teleport_to_spawn(body:&mut Body,touching:&mut TouchingState,style:&StyleModifiers,mode:&crate::model::ModeDescription,models:&PhysicsModels,stage_id:u32)->Option<MoveState>{
|
||||
let model=models.model(*mode.get_spawn_model_id(stage_id)? as usize);
|
||||
let point=model.transform.transform_point3(Planar64Vec3::Y)+Planar64Vec3::Y*(style.hitbox_halfsize.y()+Planar64::ONE/16);
|
||||
let point=model.transform.transform_point3(Planar64Vec3::Y)+Planar64Vec3::Y*(style.hitbox.halfsize.y()+Planar64::ONE/16);
|
||||
Some(teleport(body,touching,models,style,point))
|
||||
}
|
||||
|
||||
@@ -1362,41 +1477,42 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
|
||||
}
|
||||
match ins.instruction{
|
||||
PhysicsInstruction::CollisionStart(c)=>{
|
||||
let style_mesh=self.style.mesh();
|
||||
let model_id=c.model_id();
|
||||
match (self.models.attr(model_id),&c){
|
||||
(PhysicsCollisionAttributes::Contact{contacting,general},Collision::Contact(contact))=>{
|
||||
let mut v=self.body.velocity;
|
||||
let normal=self.models.mesh(model_id).face_nd(contact.face_id).0;
|
||||
let normal=contact_normal(&self.models,&style_mesh,contact);
|
||||
match &contacting.contact_behaviour{
|
||||
Some(crate::model::ContactingBehaviour::Surf)=>println!("I'm surfing!"),
|
||||
Some(crate::model::ContactingBehaviour::Cling)=>println!("Unimplemented!"),
|
||||
&Some(crate::model::ContactingBehaviour::Elastic(elasticity))=>{
|
||||
let n=self.models.mesh(contact.model_id).face_nd(contact.face_id).0;
|
||||
//velocity and normal are facing opposite directions so this is inherently negative.
|
||||
let d=n.dot(v)*(Planar64::ONE+Planar64::raw(elasticity as i64+1));
|
||||
v+=n*(d/n.dot(n));
|
||||
let d=normal.dot(v)*(Planar64::ONE+Planar64::raw(elasticity as i64+1));
|
||||
v+=normal*(d/normal.dot(normal));
|
||||
},
|
||||
Some(crate::model::ContactingBehaviour::Ladder(contacting_ladder))=>{
|
||||
if contacting_ladder.sticky{
|
||||
//kill v
|
||||
//actually you could do this with a booster attribute :thinking:
|
||||
v=Planar64Vec3::ZERO;//model.velocity
|
||||
}
|
||||
//ladder walkstate
|
||||
let gravity=self.touching.base_acceleration(&self.models,&self.style,&self.camera,self.controls,&self.next_mouse,self.time);
|
||||
let mut target_velocity=self.style.get_ladder_target_velocity(&self.camera,self.controls,&self.next_mouse,self.time,&normal);
|
||||
self.touching.constrain_velocity(&self.models,&mut target_velocity);
|
||||
self.touching.constrain_velocity(&self.models,&style_mesh,&mut target_velocity);
|
||||
let (walk_state,a)=WalkState::ladder(&self.body,&self.style,gravity,target_velocity,contact.clone(),&normal);
|
||||
self.move_state=MoveState::Ladder(walk_state);
|
||||
set_acceleration(&mut self.body,&self.touching,&self.models,a);
|
||||
set_acceleration(&mut self.body,&self.touching,&self.models,&style_mesh,a);
|
||||
}
|
||||
None=>if self.style.surf_slope.map_or(true,|s|self.models.mesh(model_id).face_nd(contact.face_id).0.walkable(s,Planar64Vec3::Y)){
|
||||
None=>if self.style.surf_slope.map_or(true,|s|contact_normal(&self.models,&style_mesh,contact).walkable(s,Planar64Vec3::Y)){
|
||||
//ground
|
||||
let gravity=self.touching.base_acceleration(&self.models,&self.style,&self.camera,self.controls,&self.next_mouse,self.time);
|
||||
let mut target_velocity=self.style.get_walk_target_velocity(&self.camera,self.controls,&self.next_mouse,self.time,&normal);
|
||||
self.touching.constrain_velocity(&self.models,&mut target_velocity);
|
||||
self.touching.constrain_velocity(&self.models,&style_mesh,&mut target_velocity);
|
||||
let (walk_state,a)=WalkState::ground(&self.body,&self.style,gravity,target_velocity,contact.clone(),&normal);
|
||||
self.move_state=MoveState::Walk(walk_state);
|
||||
set_acceleration(&mut self.body,&self.touching,&self.models,a);
|
||||
set_acceleration(&mut self.body,&self.touching,&self.models,&style_mesh,a);
|
||||
},
|
||||
}
|
||||
//check ground
|
||||
@@ -1404,7 +1520,7 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
|
||||
//I love making functions with 10 arguments to dodge the borrow checker
|
||||
run_teleport_behaviour(&general.teleport_behaviour,&mut self.game,&self.models,&self.modes,&self.style,&mut self.touching,&mut self.body,model_id);
|
||||
//flatten v
|
||||
self.touching.constrain_velocity(&self.models,&mut v);
|
||||
self.touching.constrain_velocity(&self.models,&style_mesh,&mut v);
|
||||
match &general.booster{
|
||||
Some(booster)=>{
|
||||
//DELETE THIS when boosters get converted to height machines
|
||||
@@ -1419,7 +1535,7 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
|
||||
let calc_move=if self.style.get_control(StyleModifiers::CONTROL_JUMP,self.controls){
|
||||
if let Some(walk_state)=get_walk_state(&self.move_state){
|
||||
jumped_velocity(&self.models,&self.style,walk_state,&mut v);
|
||||
set_velocity_cull(&mut self.body,&mut self.touching,&self.models,v)
|
||||
set_velocity_cull(&mut self.body,&mut self.touching,&self.models,&style_mesh,v)
|
||||
}else{false}
|
||||
}else{false};
|
||||
match &general.trajectory{
|
||||
@@ -1435,13 +1551,13 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
|
||||
},
|
||||
None=>(),
|
||||
}
|
||||
set_velocity(&mut self.body,&self.touching,&self.models,v);
|
||||
set_velocity(&mut self.body,&self.touching,&self.models,&style_mesh,v);
|
||||
//not sure if or is correct here
|
||||
if calc_move||Planar64::ZERO<normal.dot(v){
|
||||
(self.move_state,self.body.acceleration)=self.touching.get_move_state(&self.body,&self.models,&self.style,&self.camera,self.controls,&self.next_mouse,self.time);
|
||||
}
|
||||
let a=self.refresh_walk_target();
|
||||
set_acceleration(&mut self.body,&self.touching,&self.models,a);
|
||||
set_acceleration(&mut self.body,&self.touching,&self.models,&self.style.mesh(),a);
|
||||
},
|
||||
(PhysicsCollisionAttributes::Intersect{intersecting: _,general},Collision::Intersect(intersect))=>{
|
||||
//I think that setting the velocity to 0 was preventing surface contacts from entering an infinite loop
|
||||
@@ -1474,7 +1590,7 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
|
||||
let v=self.body.velocity+control_dir*(self.style.mv-d);
|
||||
//this is wrong but will work ig
|
||||
//need to note which push planes activate in push solve and keep those
|
||||
if set_velocity_cull(&mut self.body,&mut self.touching,&self.models,v){
|
||||
if set_velocity_cull(&mut self.body,&mut self.touching,&self.models,&self.style.mesh(),v){
|
||||
(self.move_state,self.body.acceleration)=self.touching.get_move_state(&self.body,&self.models,&self.style,&self.camera,self.controls,&self.next_mouse,self.time);
|
||||
}
|
||||
}
|
||||
@@ -1487,11 +1603,12 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
|
||||
match &mut walk_state.state{
|
||||
WalkEnum::Reached=>(),
|
||||
WalkEnum::Transient(walk_target)=>{
|
||||
let style_mesh=self.style.mesh();
|
||||
//precisely set velocity
|
||||
let a=Planar64Vec3::ZERO;//ignore gravity for now.
|
||||
set_acceleration(&mut self.body,&self.touching,&self.models,a);
|
||||
set_acceleration(&mut self.body,&self.touching,&self.models,&style_mesh,a);
|
||||
let v=walk_target.velocity;
|
||||
set_velocity(&mut self.body,&self.touching,&self.models,v);
|
||||
set_velocity(&mut self.body,&self.touching,&self.models,&style_mesh,v);
|
||||
walk_state.state=WalkEnum::Reached;
|
||||
},
|
||||
}
|
||||
@@ -1520,7 +1637,7 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
|
||||
if let Some(walk_state)=get_walk_state(&self.move_state){
|
||||
let mut v=self.body.velocity;
|
||||
jumped_velocity(&self.models,&self.style,walk_state,&mut v);
|
||||
if set_velocity_cull(&mut self.body,&mut self.touching,&self.models,v){
|
||||
if set_velocity_cull(&mut self.body,&mut self.touching,&self.models,&self.style.mesh(),v){
|
||||
(self.move_state,self.body.acceleration)=self.touching.get_move_state(&self.body,&self.models,&self.style,&self.camera,self.controls,&self.next_mouse,self.time);
|
||||
}
|
||||
}
|
||||
@@ -1533,7 +1650,7 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
|
||||
PhysicsInputInstruction::Reset => {
|
||||
//it matters which of these runs first, but I have not thought it through yet as it doesn't matter yet
|
||||
set_position(&mut self.body,&mut self.touching,self.spawn_point);
|
||||
set_velocity(&mut self.body,&self.touching,&self.models,Planar64Vec3::ZERO);
|
||||
set_velocity(&mut self.body,&self.touching,&self.models,&self.style.mesh(),Planar64Vec3::ZERO);
|
||||
(self.move_state,self.body.acceleration)=self.touching.get_move_state(&self.body,&self.models,&self.style,&self.camera,self.controls,&self.next_mouse,self.time);
|
||||
refresh_walk_target=false;
|
||||
},
|
||||
@@ -1541,7 +1658,7 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
|
||||
}
|
||||
if refresh_walk_target{
|
||||
let a=self.refresh_walk_target();
|
||||
if set_acceleration_cull(&mut self.body,&mut self.touching,&self.models,a){
|
||||
if set_acceleration_cull(&mut self.body,&mut self.touching,&self.models,&self.style.mesh(),a){
|
||||
(self.move_state,self.body.acceleration)=self.touching.get_move_state(&self.body,&self.models,&self.style,&self.camera,self.controls,&self.next_mouse,self.time);
|
||||
}
|
||||
}
|
||||
@@ -1549,3 +1666,218 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn test_collision_axis_aligned(relative_body:Body,expected_collision_time:Option<Time>){
|
||||
let h0=Hitbox::from_mesh_scale(PhysicsMesh::from(&crate::primitives::unit_cube()),Planar64Vec3::int(5,1,5)/2);
|
||||
let h1=Hitbox::roblox();
|
||||
let hitbox_mesh=h1.transformed_mesh();
|
||||
let platform_mesh=h0.transformed_mesh();
|
||||
let minkowski=crate::model_physics::MinkowskiMesh::minkowski_sum(&platform_mesh,&hitbox_mesh);
|
||||
let collision=minkowski.predict_collision_in(&relative_body,Time::MAX);
|
||||
assert_eq!(collision.map(|tup|tup.1),expected_collision_time,"Incorrect time of collision");
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
fn test_collision_rotated(relative_body:Body,expected_collision_time:Option<Time>){
|
||||
let h0=Hitbox::new(PhysicsMesh::from(&crate::primitives::unit_cube()),
|
||||
crate::integer::Planar64Affine3::new(
|
||||
crate::integer::Planar64Mat3::from_cols(
|
||||
Planar64Vec3::int(5,0,1)/2,
|
||||
Planar64Vec3::int(0,1,0)/2,
|
||||
Planar64Vec3::int(-1,0,5)/2,
|
||||
),
|
||||
Planar64Vec3::ZERO,
|
||||
)
|
||||
);
|
||||
let h1=Hitbox::roblox();
|
||||
let hitbox_mesh=h1.transformed_mesh();
|
||||
let platform_mesh=h0.transformed_mesh();
|
||||
let minkowski=crate::model_physics::MinkowskiMesh::minkowski_sum(&platform_mesh,&hitbox_mesh);
|
||||
let collision=minkowski.predict_collision_in(&relative_body,Time::MAX);
|
||||
assert_eq!(collision.map(|tup|tup.1),expected_collision_time,"Incorrect time of collision");
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
fn test_collision(relative_body:Body,expected_collision_time:Option<Time>){
|
||||
test_collision_axis_aligned(relative_body.clone(),expected_collision_time);
|
||||
test_collision_rotated(relative_body,expected_collision_time);
|
||||
}
|
||||
#[test]
|
||||
fn test_collision_degenerate(){
|
||||
test_collision(Body::new(
|
||||
Planar64Vec3::int(0,5,0),
|
||||
Planar64Vec3::int(0,-1,0),
|
||||
Planar64Vec3::ZERO,
|
||||
Time::ZERO
|
||||
),Some(Time::from_secs(2)));
|
||||
}
|
||||
#[test]
|
||||
fn test_collision_degenerate_east(){
|
||||
test_collision(Body::new(
|
||||
Planar64Vec3::int(3,5,0),
|
||||
Planar64Vec3::int(0,-1,0),
|
||||
Planar64Vec3::ZERO,
|
||||
Time::ZERO
|
||||
),Some(Time::from_secs(2)));
|
||||
}
|
||||
#[test]
|
||||
fn test_collision_degenerate_south(){
|
||||
test_collision(Body::new(
|
||||
Planar64Vec3::int(0,5,3),
|
||||
Planar64Vec3::int(0,-1,0),
|
||||
Planar64Vec3::ZERO,
|
||||
Time::ZERO
|
||||
),Some(Time::from_secs(2)));
|
||||
}
|
||||
#[test]
|
||||
fn test_collision_degenerate_west(){
|
||||
test_collision(Body::new(
|
||||
Planar64Vec3::int(-3,5,0),
|
||||
Planar64Vec3::int(0,-1,0),
|
||||
Planar64Vec3::ZERO,
|
||||
Time::ZERO
|
||||
),Some(Time::from_secs(2)));
|
||||
}
|
||||
#[test]
|
||||
fn test_collision_degenerate_north(){
|
||||
test_collision(Body::new(
|
||||
Planar64Vec3::int(0,5,-3),
|
||||
Planar64Vec3::int(0,-1,0),
|
||||
Planar64Vec3::ZERO,
|
||||
Time::ZERO
|
||||
),Some(Time::from_secs(2)));
|
||||
}
|
||||
#[test]
|
||||
fn test_collision_parabola_edge_east_from_west(){
|
||||
test_collision(VirtualBody::relative(&Body::default(),&Body::new(
|
||||
Planar64Vec3::int(3,3,0),
|
||||
Planar64Vec3::int(100,-1,0),
|
||||
Planar64Vec3::int(0,-1,0),
|
||||
Time::ZERO
|
||||
)).body(Time::from_secs(-1)),Some(Time::from_secs(0)));
|
||||
}
|
||||
#[test]
|
||||
fn test_collision_parabola_edge_south_from_north(){
|
||||
test_collision(VirtualBody::relative(&Body::default(),&Body::new(
|
||||
Planar64Vec3::int(0,3,3),
|
||||
Planar64Vec3::int(0,-1,100),
|
||||
Planar64Vec3::int(0,-1,0),
|
||||
Time::ZERO
|
||||
)).body(Time::from_secs(-1)),Some(Time::from_secs(0)));
|
||||
}
|
||||
#[test]
|
||||
fn test_collision_parabola_edge_west_from_east(){
|
||||
test_collision(VirtualBody::relative(&Body::default(),&Body::new(
|
||||
Planar64Vec3::int(-3,3,0),
|
||||
Planar64Vec3::int(-100,-1,0),
|
||||
Planar64Vec3::int(0,-1,0),
|
||||
Time::ZERO
|
||||
)).body(Time::from_secs(-1)),Some(Time::from_secs(0)));
|
||||
}
|
||||
#[test]
|
||||
fn test_collision_parabola_edge_north_from_south(){
|
||||
test_collision(VirtualBody::relative(&Body::default(),&Body::new(
|
||||
Planar64Vec3::int(0,3,-3),
|
||||
Planar64Vec3::int(0,-1,-100),
|
||||
Planar64Vec3::int(0,-1,0),
|
||||
Time::ZERO
|
||||
)).body(Time::from_secs(-1)),Some(Time::from_secs(0)));
|
||||
}
|
||||
#[test]
|
||||
fn test_collision_parabola_edge_north_from_ne(){
|
||||
test_collision(VirtualBody::relative(&Body::default(),&Body::new(
|
||||
Planar64Vec3::int(0,6,-7)/2,
|
||||
Planar64Vec3::int(-10,-1,1),
|
||||
Planar64Vec3::int(0,-1,0),
|
||||
Time::ZERO
|
||||
)).body(Time::from_secs(-1)),Some(Time::from_secs(0)));
|
||||
}
|
||||
#[test]
|
||||
fn test_collision_parabola_edge_north_from_nw(){
|
||||
test_collision(VirtualBody::relative(&Body::default(),&Body::new(
|
||||
Planar64Vec3::int(0,6,-7)/2,
|
||||
Planar64Vec3::int(10,-1,1),
|
||||
Planar64Vec3::int(0,-1,0),
|
||||
Time::ZERO
|
||||
)).body(Time::from_secs(-1)),Some(Time::from_secs(0)));
|
||||
}
|
||||
#[test]
|
||||
fn test_collision_parabola_edge_east_from_se(){
|
||||
test_collision(VirtualBody::relative(&Body::default(),&Body::new(
|
||||
Planar64Vec3::int(7,6,0)/2,
|
||||
Planar64Vec3::int(-1,-1,-10),
|
||||
Planar64Vec3::int(0,-1,0),
|
||||
Time::ZERO
|
||||
)).body(Time::from_secs(-1)),Some(Time::from_secs(0)));
|
||||
}
|
||||
#[test]
|
||||
fn test_collision_parabola_edge_east_from_ne(){
|
||||
test_collision(VirtualBody::relative(&Body::default(),&Body::new(
|
||||
Planar64Vec3::int(7,6,0)/2,
|
||||
Planar64Vec3::int(-1,-1,10),
|
||||
Planar64Vec3::int(0,-1,0),
|
||||
Time::ZERO
|
||||
)).body(Time::from_secs(-1)),Some(Time::from_secs(0)));
|
||||
}
|
||||
#[test]
|
||||
fn test_collision_parabola_edge_south_from_se(){
|
||||
test_collision(VirtualBody::relative(&Body::default(),&Body::new(
|
||||
Planar64Vec3::int(0,6,7)/2,
|
||||
Planar64Vec3::int(-10,-1,-1),
|
||||
Planar64Vec3::int(0,-1,0),
|
||||
Time::ZERO
|
||||
)).body(Time::from_secs(-1)),Some(Time::from_secs(0)));
|
||||
}
|
||||
#[test]
|
||||
fn test_collision_parabola_edge_south_from_sw(){
|
||||
test_collision(VirtualBody::relative(&Body::default(),&Body::new(
|
||||
Planar64Vec3::int(0,6,7)/2,
|
||||
Planar64Vec3::int(10,-1,-1),
|
||||
Planar64Vec3::int(0,-1,0),
|
||||
Time::ZERO
|
||||
)).body(Time::from_secs(-1)),Some(Time::from_secs(0)));
|
||||
}
|
||||
#[test]
|
||||
fn test_collision_parabola_edge_west_from_se(){
|
||||
test_collision(VirtualBody::relative(&Body::default(),&Body::new(
|
||||
Planar64Vec3::int(-7,6,0)/2,
|
||||
Planar64Vec3::int(1,-1,-10),
|
||||
Planar64Vec3::int(0,-1,0),
|
||||
Time::ZERO
|
||||
)).body(Time::from_secs(-1)),Some(Time::from_secs(0)));
|
||||
}
|
||||
#[test]
|
||||
fn test_collision_parabola_edge_west_from_ne(){
|
||||
test_collision(VirtualBody::relative(&Body::default(),&Body::new(
|
||||
Planar64Vec3::int(-7,6,0)/2,
|
||||
Planar64Vec3::int(1,-1,10),
|
||||
Planar64Vec3::int(0,-1,0),
|
||||
Time::ZERO
|
||||
)).body(Time::from_secs(-1)),Some(Time::from_secs(0)));
|
||||
}
|
||||
#[test]
|
||||
fn test_collision_oblique(){
|
||||
test_collision(Body::new(
|
||||
Planar64Vec3::int(0,5,0),
|
||||
Planar64Vec3::int(1,-64,2)/64,
|
||||
Planar64Vec3::ZERO,
|
||||
Time::ZERO
|
||||
),Some(Time::from_secs(2)));
|
||||
}
|
||||
#[test]
|
||||
fn zoom_hit_nothing(){
|
||||
test_collision(Body::new(
|
||||
Planar64Vec3::int(0,10,0),
|
||||
Planar64Vec3::int(1,0,0),
|
||||
Planar64Vec3::int(0,1,0),
|
||||
Time::ZERO
|
||||
),None);
|
||||
}
|
||||
#[test]
|
||||
fn already_inside_hit_nothing(){
|
||||
test_collision(Body::new(
|
||||
Planar64Vec3::ZERO,
|
||||
Planar64Vec3::int(1,0,0),
|
||||
Planar64Vec3::int(0,1,0),
|
||||
Time::ZERO
|
||||
),None);
|
||||
}
|
||||
@@ -175,8 +175,8 @@ impl<'a,Task:Send+'a> INWorker<'a,Task>{
|
||||
|
||||
#[test]//How to run this test with printing: cargo test --release -- --nocapture
|
||||
fn test_worker() {
|
||||
println!("hiiiii");
|
||||
// Create the worker thread
|
||||
let test_body=crate::physics::Body::new(crate::integer::Planar64Vec3::ONE,crate::integer::Planar64Vec3::ONE,crate::integer::Planar64Vec3::ONE,crate::integer::Time::ZERO);
|
||||
let worker=QRWorker::new(crate::physics::Body::default(),
|
||||
|_|crate::physics::Body::new(crate::integer::Planar64Vec3::ONE,crate::integer::Planar64Vec3::ONE,crate::integer::Planar64Vec3::ONE,crate::integer::Time::ZERO)
|
||||
);
|
||||
@@ -203,7 +203,7 @@ fn test_worker() {
|
||||
};
|
||||
worker.send(task).unwrap();
|
||||
|
||||
println!("value={}",worker.grab_clone());
|
||||
//assert_eq!(test_body,worker.grab_clone());
|
||||
|
||||
// wait long enough to see print from final task
|
||||
thread::sleep(std::time::Duration::from_millis(10));
|
||||
|
||||
Reference in New Issue
Block a user