Compare commits

..

214 Commits

Author SHA1 Message Date
5793f9f975 swap parity (again) 2023-11-29 20:00:05 -08:00
9de6fe85fa test more things 2023-11-29 19:11:43 -08:00
ed6696be3e Aabb::size() + proper private fields for aabb 2023-11-29 19:11:23 -08:00
680cddc9a2 move collision loop avoidance to outside algorithm 2023-11-29 01:03:50 -08:00
6a7e05bb49 new tests to find failure cases 2023-11-28 22:54:56 -08:00
2558eac7fa TODO: don't do this! 2023-11-28 22:33:08 -08:00
ddb91031b0 getting ahead of myself trying to save a vert_edges call 2023-11-28 21:41:46 -08:00
6e8719136d move code around 2023-11-28 21:25:31 -08:00
7e7915293e ??? 2023-11-28 20:19:39 -08:00
78b94d7259 idk anymore 2023-11-28 20:16:24 -08:00
2152ae3c7b comment about winding 2023-11-28 19:52:46 -08:00
9d266e7be1 fix unit test expected times 2023-11-28 19:25:02 -08:00
49d799eb60 rename and swap faces 2023-11-28 19:19:42 -08:00
9af374ee14 finally fix face_edges MinkowskiFace::EdgeEdge case 2023-11-28 19:19:21 -08:00
26e4d8cab1 absurdly swap everything everywhere 2023-11-28 18:43:40 -08:00
38731c4a10 absurd test: swap left and right faces + parities 2023-11-28 18:35:41 -08:00
47560bb25f rename stupid things 2023-11-28 18:35:09 -08:00
1d50eac5e4 would you look at that, my old code was right! 2023-11-28 17:35:49 -08:00
660ea42576 fix vert_edges 2023-11-27 21:00:34 -08:00
a31c3bc848 update deps 2023-11-27 17:14:54 -08:00
2a3ca06376 comment 2023-11-26 18:59:18 -08:00
4932401553 v0.9.0 minkowski 2023-11-23 19:09:31 -08:00
f53327d87b wrong 2023-11-23 19:00:52 -08:00
b8a0ae6606 opti 2023-11-23 18:59:52 -08:00
3cc006d3fb normalize your normals broh 2023-11-23 18:46:09 -08:00
2cef4cba66 opti 2023-11-23 18:02:05 -08:00
14e168942d more tests 2023-11-23 18:01:48 -08:00
1a05449315 tweak unit tests 2023-11-23 17:23:12 -08:00
3d426c0859 TEMP: fail after 10 iterations 2023-11-23 17:12:49 -08:00
53adc651e5 change parity for funsies 2023-11-23 15:52:48 -08:00
d631747030 sneaky double doubling bug 2023-11-23 15:52:48 -08:00
d7042f9cba must switch to face if equal 2023-11-23 15:52:48 -08:00
66d799b3c3 infinity_fev edge case handling algorithm 2023-11-23 15:07:24 -08:00
dded820fc5 fewer multiplications 2023-11-23 00:13:38 -08:00
c971ab24e2 TEMP: disallow 0 time collisions 2023-11-22 19:27:23 -08:00
096284ea60 wrong 2023-11-22 19:26:52 -08:00
6766ad832d wrong 2023-11-22 17:52:12 -08:00
b23b815132 already_inside_hit_nothing test 2023-11-21 20:44:50 -08:00
7ba94c0837 zoom_hit_nothing test 2023-11-21 20:44:50 -08:00
6d3ff8490d expect a particular time of collision 2023-11-21 20:44:50 -08:00
e4eaecee2c parity depends on face only 2023-11-21 20:44:50 -08:00
de4a2dc652 reuse existing variables 2023-11-21 19:53:15 -08:00
e6c1b87b34 test degenerate case 2023-11-21 19:53:15 -08:00
7bae33ad06 handle_degenerate_cases 2023-11-21 19:53:15 -08:00
05adec5499 pull constant out of loop 2023-11-21 18:17:46 -08:00
5d85b39058 not planned 2023-11-21 17:35:00 -08:00
b964873785 pull constant out of loop 2023-11-21 17:33:24 -08:00
c1ae19b098 rename DirectedEdge::neg to reverse 2023-11-21 16:02:33 -08:00
0ad99958a0 wrong 2023-11-20 19:57:27 -08:00
d2f209869d a-b != b-a 2023-11-20 19:53:59 -08:00
f04e6ee4b7 test transform 2023-11-20 19:47:28 -08:00
9a2b033241 include edges with zero dot to support crawling flush minkowksi faces 2023-11-20 19:29:16 -08:00
e2777852d1 probably wrong 2023-11-20 19:28:44 -08:00
2eadb541cc DirectedEdge.neg() 2023-11-20 19:28:00 -08:00
c9f2ea0308 UndirectedEdge trait 2023-11-20 19:28:00 -08:00
f4db20c206 swap edge faces in VertEdge case 2023-11-20 19:28:00 -08:00
72d8186ba4 MinkowskiMesh::edge_faces sorting against incorrect value 2023-11-20 19:28:00 -08:00
da6b800d4e include apexes 2023-11-20 18:55:42 -08:00
4154a8c437 are vert edges backwards? 2023-11-20 18:55:42 -08:00
13dd90d5f6 opti 2023-11-20 18:55:42 -08:00
a5437c87df wrong 2023-11-20 18:55:42 -08:00
a4ea566c02 unused impl for private type 2023-11-17 18:41:30 -08:00
a6f9f144f4 preopti 2023-11-17 18:41:30 -08:00
e33adeadc8 thinking 2023-11-17 18:41:30 -08:00
563ade11f7 rewrite infinity crawl to use a straight line
for predict_collision_out use an extrapolated body that will exist outside of the mesh in the hit case we care about
2023-11-17 18:41:30 -08:00
1a250fe8d6 style 2023-11-17 16:23:54 -08:00
4be218defb wrong 2023-11-17 16:23:54 -08:00
dc5649f2b5 wrong 2023-11-17 16:23:54 -08:00
ef817389f3 hit_the_ground unit test 2023-11-17 16:23:54 -08:00
399c9505bf reduce test spam 2023-11-17 14:12:11 -08:00
e6c955a958 combine crawl into one loop 2023-11-17 13:48:29 -08:00
8839b8fbb3 fix not moving 2023-11-16 19:57:50 -08:00
d191538aa8 fix time inversion 2023-11-16 19:18:07 -08:00
46c6271286 compiler nits 2023-11-16 18:46:10 -08:00
bb2a5e2d35 workaround stupid monolith 2023-11-16 18:46:10 -08:00
4998f3803a fix lifetimes 2023-11-16 18:46:10 -08:00
fa0be33bf5 initialize variable + guarantees 2023-11-16 18:46:10 -08:00
0da6da24ac implement final algorithm with infinity tech 2023-11-16 18:27:05 -08:00
6a926608b7 fix normal dir 2023-11-16 18:26:56 -08:00
71d221581f DirectedEdge trait (huge) 2023-11-16 17:03:15 -08:00
6fcc6b2303 water goes here 2023-11-15 22:56:16 -08:00
312b0223b6 inline them bad boys 2023-11-15 22:56:16 -08:00
5a3013365e use style mesh + remove double reference in set_velocity & set_acceleration 2023-11-15 22:52:52 -08:00
5c2aad268f style.hitbox 2023-11-15 22:52:51 -08:00
ea9c2efc7f implement Planar64Mat3::from_diagonal 2023-11-15 22:45:49 -08:00
a41cbb79de move mat mul to above mat div 2023-11-15 22:24:56 -08:00
2370fbea54 todo 2023-11-15 21:21:00 -08:00
33972b0c2c physics work 2023-11-15 21:10:50 -08:00
f50670db57 use function that doesn't exist for MinkowskiMesh::closest_fev 2023-11-15 21:10:50 -08:00
559a38b607 implement MinkowskiMesh::farthest_vert 2023-11-15 21:10:50 -08:00
751ccf57ca comment 2023-11-15 21:10:50 -08:00
5bfd340d87 implement MinkowskiMesh::predict_collision{_end} 2023-11-15 21:10:50 -08:00
2d3efdc2e1 comments about potential parallel cases 2023-11-15 21:10:50 -08:00
d217966f77 unused use 2023-11-15 21:10:50 -08:00
328c38ca38 change the MeshQuery trait and delete the code I just wrote 2023-11-15 21:10:50 -08:00
4c05c01b6e fix big wrong 2023-11-15 19:48:13 -08:00
b20f573f1d missing semicolons 2023-11-15 19:45:38 -08:00
21e29aa63e implement MinkowskiMesh::face_edges MinkowskiFace::EdgeEdge case 2023-11-15 18:00:14 -08:00
48870b8a76 implement MinkowskiMesh::edge_faces 2023-11-15 17:59:47 -08:00
020c704968 fix edge faces ordering 2023-11-15 17:59:24 -08:00
8f63699d45 consistent ordering 2023-11-15 16:05:42 -08:00
6071e23be1 style 2023-11-11 21:32:59 -08:00
46d6c31957 avoid double rocket boost 2023-11-11 21:27:20 -08:00
5b26304e95 project walk 2023-11-10 19:13:41 -08:00
d3cf75e0d5 fix ladder crashes 2023-11-10 19:13:41 -08:00
2acf740898 MinkowskiMesh::edge_faces is wrong 2023-11-10 19:13:41 -08:00
816f786763 implement MinkowskiMesh::face_nd for MinkowskiFace::EdgeEdge case 2023-11-10 19:13:41 -08:00
f7c613dfa6 correct MinkowskiMesh::face_edges FaceVert + VertFace cases 2023-11-10 19:13:41 -08:00
4fc09806f6 minkowski vert_edges 2023-11-10 19:13:41 -08:00
3cbefbab03 introduce DirectedEdge 2023-11-10 19:13:41 -08:00
717cf2290d vert_faces 2023-11-10 19:13:41 -08:00
756648c2fb probably need a better fix for this 2023-11-10 19:13:41 -08:00
44540853dd use alternate quadratic equation in poor accuracy cases 2023-11-10 19:13:41 -08:00
43e62e8f1d implement dot128 for face_nd 2023-11-10 19:13:41 -08:00
4af4dc669b update move state if acceleration culls surface 2023-11-10 19:13:41 -08:00
24f6472e9f acceleration was not being refreshed in air move (the bug) 2023-11-10 19:13:41 -08:00
cff920ddcd tweak elasticity calc 2023-11-10 19:13:41 -08:00
053514fa4a exit strafe tick early if zero control dir 2023-11-10 19:13:41 -08:00
27a46093ae introduce dot128 2023-11-10 19:13:41 -08:00
6049aba716 do not overshadow variable 2023-11-10 19:13:41 -08:00
b7998c7bd4 break walking 2023-11-10 19:13:41 -08:00
63cfbbfa9c fix ladders 2023-11-10 19:13:41 -08:00
f7072be5b4 separate culling type setters 2023-11-10 19:13:41 -08:00
4456ee29ec surf test was wrong 2023-11-10 19:13:41 -08:00
2d14e8ac8e cross product was wrong 💀x7 2023-11-10 19:13:41 -08:00
176aaa069c fix walk friction 2023-11-10 19:13:41 -08:00
a6dfa1d72b elasticity calc 2023-11-10 19:13:41 -08:00
516510faa8 add set body functions + jump query functions 2023-11-10 19:13:41 -08:00
1d2de93b9e normalize normal 2023-11-10 19:13:41 -08:00
2988175436 important 2023-11-10 19:13:41 -08:00
03b21aa27f work 2023-11-10 19:13:41 -08:00
910d520c2b wip TouchingState::get_move_state 2023-11-10 19:13:41 -08:00
c321814b9b normal_determinant is not real 2023-11-10 19:13:41 -08:00
ce1e9df334 TouchingState::base_acceleration 2023-11-10 19:13:41 -08:00
e6e7366e66 fix idiot 2023-11-10 19:13:41 -08:00
535ae1a5f0 fix constrain 2023-11-10 19:13:41 -08:00
432a38718c fix slope divide by zero 2023-11-10 19:13:41 -08:00
9aa7656278 mesh gen test 2023-11-10 19:13:41 -08:00
823a16e08d fix determinant 2023-11-10 19:13:41 -08:00
82d84ee07c fix mesh gen algorithm 2023-11-10 19:13:41 -08:00
ffc19020b9 unused var 2023-11-10 19:13:41 -08:00
e0581390bd fix transformed face_nd 2023-11-10 19:13:41 -08:00
4b4ac0de19 test stop taking so long 2023-11-10 19:13:41 -08:00
d94ad475eb debug message 2023-11-10 19:13:41 -08:00
60eadd3156 ref faster no copy 2023-11-10 19:13:41 -08:00
ebca761dbc whoops 2023-11-10 19:13:41 -08:00
ab60fb2cf7 idiot 2023-11-10 19:13:41 -08:00
ec9b720138 make build 2023-11-10 19:13:41 -08:00
7ad0270d2f TransformedMesh::new to avoid pub 2023-11-10 19:13:41 -08:00
d8e605d203 fix compiler nits 2023-11-10 19:13:41 -08:00
dc46cb3d45 delete unused aabb face code 2023-11-10 19:13:41 -08:00
a53d90f74b tape up last stragglers 2023-11-10 19:13:41 -08:00
d9be4b8105 checkpoints don't actually exist 2023-11-10 19:13:41 -08:00
58c35ce364 water 2023-11-10 19:13:41 -08:00
2a033b87e0 rethink ordered checkpoints - do not support non-teleporting (backtracking) 2023-11-10 19:13:41 -08:00
d374a3d4c6 SpawnAt comment 2023-11-10 19:13:41 -08:00
c37b990389 tweak water 2023-11-10 19:13:41 -08:00
7311b1ae88 checkpoints are stage elements 2023-11-10 19:13:41 -08:00
af7fcdd5cb add GameMechanicAttributes::is_wrcp() function 2023-11-10 19:13:41 -08:00
bf51afcf1d fix normal code 2023-11-10 19:13:41 -08:00
fd9ca6cd3f Planar64Vec3::{inverse,transpose,determinant} 2023-11-10 19:13:41 -08:00
d71f143d68 point hitbox work 2023-11-10 19:13:41 -08:00
769f88eb9f real functions 2023-11-10 19:13:41 -08:00
cf9063bffc PhysicsModels idea 2023-11-10 19:13:41 -08:00
fc3d72393f rename enum 2023-11-10 19:13:41 -08:00
a5ef0195e2 tweak minkowski code + fix edge_verts 2023-11-10 19:13:41 -08:00
6fec6b9f59 cling thing 2023-11-10 19:13:41 -08:00
895f9b82f8 tabs 2023-11-10 19:13:41 -08:00
6aa0e790d8 brute force t for plain mesh 2023-11-10 19:13:41 -08:00
b897d4a662 I need to rethink Collision vs Attributes 2023-11-10 19:13:41 -08:00
49931a40fc make aabb_list with silly iterator to avoid pub-ing Vert 2023-11-10 19:13:41 -08:00
e92eaed2d3 work on indexing meshes and attributes 2023-11-10 19:13:41 -08:00
1ec9412b49 closest_fev for TransformedMesh 2023-11-10 19:13:41 -08:00
d9966a4eb0 write mesh closest_fev 2023-11-10 19:13:41 -08:00
cee6835af6 decide 2023-11-10 19:13:41 -08:00
f1e0514ecb cross product!!!! 2023-11-10 19:13:41 -08:00
86d45252c7 use edge_n instead of ambiguous face 2023-11-10 19:13:41 -08:00
9f948744d4 add edge_n to MeshQuery 2023-11-10 19:13:41 -08:00
5e28c02640 TODOs 2023-11-10 19:13:41 -08:00
5f1b93d9c4 next_instruction face crawler implementation 2023-11-10 19:13:41 -08:00
d63a76269f ignore face 2023-11-10 19:13:41 -08:00
354b96d98f collector.time() 2023-11-10 19:13:41 -08:00
d155517587 delete aabb physics 2023-11-10 19:13:41 -08:00
3c443b6b6a mesh generation 2023-11-10 19:13:41 -08:00
f73b4a0c52 Planar64Vec3::new 2023-11-10 19:13:41 -08:00
c37194daf6 AddAssign for Planar64 2023-11-10 19:13:41 -08:00
5317a0fafe rename VirtualMesh to TransformedMesh 2023-11-10 19:13:41 -08:00
941faf199d vert and edge does not have an unambiguous face 2023-11-10 19:13:41 -08:00
053bab9e24 wip: physics work 2023-11-10 19:13:41 -08:00
89f7a2b9b9 wip: start brute force closest_fev 2023-11-10 19:13:41 -08:00
dff2648cd3 add Planar64::MAX 2023-11-10 19:13:41 -08:00
d2d5a62458 implement vert 2023-11-10 19:13:41 -08:00
89ea7f45f9 wip 2023-11-10 19:13:41 -08:00
01d74102e3 MinkowskiMesh::edge_verts 2023-11-10 19:13:41 -08:00
ee4e6dbbaf MinkowskiMesh::edge_faces 2023-11-10 19:13:41 -08:00
19d4fed2a2 MinkowskiMesh::face_edges 2023-11-10 19:13:41 -08:00
a9f6cc7c29 rename functions 2023-11-10 19:13:41 -08:00
64657e718d cow: utter brilliance 2023-11-10 19:13:41 -08:00
3d5ac0cd61 Minkowski face_nd 2023-11-10 19:13:41 -08:00
72ebe5c9c8 generic generic generic 2023-11-10 19:13:41 -08:00
e1fde9b507 there is another 2023-11-10 19:13:41 -08:00
0cb6236035 todo 2023-11-10 19:13:41 -08:00
a8b1ced5cd implement face crawler algorithm using functions that don't exist 2023-11-10 19:13:41 -08:00
bb46801610 functions 2023-11-10 19:13:41 -08:00
06eeac6043 data structures 2023-11-10 19:13:41 -08:00
558febabc3 face_normal 2023-11-10 19:13:41 -08:00
1b51e21ecd implement PhysicsMesh 2023-11-10 19:13:41 -08:00
7ce08b0bbe move stuff to model_physics 2023-11-10 19:13:41 -08:00
19c7a8924e face crawler work 2023-11-10 19:13:41 -08:00
b215578c8d virtual body 2023-11-10 19:13:41 -08:00
2bea7e210e pub body 2023-11-10 19:13:41 -08:00
f8a8cbf12a replace Body::with_pva with Body::new 2023-11-10 19:13:41 -08:00
9f76611c18 algorithm 2023-11-10 19:13:41 -08:00
4da3d78057 Face Crawler™ 2023-11-10 19:13:41 -08:00
11 changed files with 227 additions and 414 deletions

256
Cargo.lock generated

@ -63,9 +63,9 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
[[package]]
name = "android-activity"
version = "0.5.1"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39b801912a977c3fd52d80511fe1c0c8480c6f957f21ae2ce1b92ffe970cf4b9"
checksum = "052ad56e336bcc615a214bffbeca6c181ee9550acec193f0327e0b103b033a4d"
dependencies = [
"android-properties",
"bitflags 2.4.1",
@ -111,9 +111,9 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
[[package]]
name = "as-raw-xcb-connection"
version = "1.0.1"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
checksum = "2d5f312b0a56c5cdf967c0aeb67f6289603354951683bc97ddc595ab974ba9aa"
[[package]]
name = "ash"
@ -245,7 +245,7 @@ checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.42",
"syn 2.0.39",
]
[[package]]
@ -342,9 +342,9 @@ dependencies = [
[[package]]
name = "concurrent-queue"
version = "2.4.0"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363"
checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400"
dependencies = [
"crossbeam-utils",
]
@ -363,9 +363,9 @@ checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2"
[[package]]
name = "core-foundation"
version = "0.9.4"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
dependencies = [
"core-foundation-sys",
"libc",
@ -373,9 +373,9 @@ dependencies = [
[[package]]
name = "core-foundation-sys"
version = "0.8.6"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
[[package]]
name = "core-graphics"
@ -392,9 +392,9 @@ dependencies = [
[[package]]
name = "core-graphics-types"
version = "0.1.3"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf"
checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33"
dependencies = [
"bitflags 1.3.2",
"core-foundation",
@ -403,9 +403,9 @@ dependencies = [
[[package]]
name = "crossbeam-utils"
version = "0.8.18"
version = "0.8.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c"
checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
dependencies = [
"cfg-if",
]
@ -479,12 +479,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
version = "0.3.8"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8"
dependencies = [
"libc",
"windows-sys 0.52.0",
"windows-sys 0.48.0",
]
[[package]]
@ -517,7 +517,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.42",
"syn 2.0.39",
]
[[package]]
@ -528,24 +528,24 @@ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
[[package]]
name = "futures-core"
version = "0.3.30"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c"
[[package]]
name = "futures-sink"
version = "0.3.30"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5"
checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817"
[[package]]
name = "gethostname"
version = "0.4.3"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818"
checksum = "bb65d4ba3173c56a500b555b532f72c42e8d1fe64962b518897f8959fae2c177"
dependencies = [
"libc",
"windows-targets 0.48.5",
"winapi",
]
[[package]]
@ -743,9 +743,9 @@ dependencies = [
[[package]]
name = "js-sys"
version = "0.3.66"
version = "0.3.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca"
checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8"
dependencies = [
"wasm-bindgen",
]
@ -787,7 +787,7 @@ dependencies = [
"proc-macro2",
"quote",
"regex",
"syn 2.0.42",
"syn 2.0.39",
]
[[package]]
@ -798,9 +798,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.151"
version = "0.2.150"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
[[package]]
name = "libloading"
@ -835,9 +835,9 @@ dependencies = [
[[package]]
name = "linux-raw-sys"
version = "0.4.12"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456"
checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829"
[[package]]
name = "lock_api"
@ -892,9 +892,9 @@ checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
[[package]]
name = "memmap2"
version = "0.9.3"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45fd3a57831bf88bc63f8cebc0cf956116276e97fef3966103e96416209f7c92"
checksum = "deaba38d7abf1d4cca21cc89e932e542ba2b9258664d2a9ef0e61512039c9375"
dependencies = [
"libc",
]
@ -923,6 +923,12 @@ dependencies = [
"paste",
]
[[package]]
name = "minimal-lexical"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "miniz_oxide"
version = "0.7.1"
@ -934,9 +940,9 @@ dependencies = [
[[package]]
name = "naga"
version = "0.14.2"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae585df4b6514cf8842ac0f1ab4992edc975892704835b549cf818dc0191249e"
checksum = "6cd05939c491da968a42986204b7431678be21fdcd4b10cc84997ba130ada5a4"
dependencies = [
"bit-set",
"bitflags 2.4.1",
@ -1004,6 +1010,16 @@ dependencies = [
"memoffset",
]
[[package]]
name = "nom"
version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
dependencies = [
"memchr",
"minimal-lexical",
]
[[package]]
name = "num-traits"
version = "0.2.17"
@ -1031,7 +1047,7 @@ dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn 2.0.42",
"syn 2.0.39",
]
[[package]]
@ -1052,9 +1068,9 @@ dependencies = [
[[package]]
name = "objc-sys"
version = "0.3.2"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7c71324e4180d0899963fc83d9d241ac39e699609fc1025a850aadac8257459"
checksum = "99e1d07c6eab1ce8b6382b8e3c7246fe117ff3f8b34be065f5ebace6749fe845"
[[package]]
name = "objc2"
@ -1083,18 +1099,18 @@ dependencies = [
[[package]]
name = "object"
version = "0.32.2"
version = "0.32.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0"
dependencies = [
"memchr",
]
[[package]]
name = "once_cell"
version = "1.19.0"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]]
name = "orbclient"
@ -1157,9 +1173,9 @@ checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
[[package]]
name = "pkg-config"
version = "0.3.28"
version = "0.3.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a"
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
[[package]]
name = "polling"
@ -1195,40 +1211,39 @@ checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa"
[[package]]
name = "proc-macro-crate"
version = "2.0.1"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97dc5fea232fc28d2f597b37c4876b348a40e33f3b02cc975c8d006d78d94b1a"
checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8"
dependencies = [
"toml_datetime",
"toml_edit",
]
[[package]]
name = "proc-macro2"
version = "1.0.71"
version = "1.0.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8"
checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
dependencies = [
"unicode-ident",
]
[[package]]
name = "profiling"
version = "1.0.13"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d135ede8821cf6376eb7a64148901e1690b788c11ae94dc297ae917dbc91dc0e"
checksum = "f89dff0959d98c9758c88826cc002e2c3d0b9dfac4139711d1f30de442f1139b"
dependencies = [
"profiling-procmacros",
]
[[package]]
name = "profiling-procmacros"
version = "1.0.13"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b322d7d65c1ab449be3c890fcbd0db6e1092d0dd05d79dba2dd28032cebeb05"
checksum = "eb156a45b6b9fe8027497422179fb65afc84d36707a7ca98297bf06bccb8d43f"
dependencies = [
"quote",
"syn 2.0.42",
"syn 2.0.39",
]
[[package]]
@ -1463,15 +1478,15 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustix"
version = "0.38.28"
version = "0.38.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316"
checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e"
dependencies = [
"bitflags 2.4.1",
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.52.0",
"windows-sys 0.48.0",
]
[[package]]
@ -1497,9 +1512,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "sctk-adwaita"
version = "0.8.1"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82b2eaf3a5b264a521b988b2e73042e742df700c4f962cde845d1541adb46550"
checksum = "1729a30a469de249c6effc17ec8d039b0aa29b3af79b819b7f51cb6ab8046a90"
dependencies = [
"ab_glyph",
"log",
@ -1525,7 +1540,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.42",
"syn 2.0.39",
]
[[package]]
@ -1539,9 +1554,9 @@ dependencies = [
[[package]]
name = "slotmap"
version = "1.0.7"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a"
checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342"
dependencies = [
"version_check",
]
@ -1650,9 +1665,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.42"
version = "2.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b7d0a2c048d661a1a59fcd7355baa232f7ed34e0ee4df2eef3c1c1c0d3852d8"
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
dependencies = [
"proc-macro2",
"quote",
@ -1670,29 +1685,29 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.51"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7"
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.51"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df"
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.42",
"syn 2.0.39",
]
[[package]]
name = "tiny-skia"
version = "0.11.3"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6a067b809476893fce6a254cf285850ff69c847e6cfbade6a20b655b6c7e80d"
checksum = "3b72a92a05db376db09fe6d50b7948d106011761c05a6a45e23e17ee9b556222"
dependencies = [
"arrayref",
"arrayvec",
@ -1704,9 +1719,9 @@ dependencies = [
[[package]]
name = "tiny-skia-path"
version = "0.11.3"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5de35e8a90052baaaf61f171680ac2f8e925a1e43ea9d2e3a00514772250e541"
checksum = "6ac3865b9708fc7e1961a65c3a4fa55e984272f33092d3c859929f887fceb647"
dependencies = [
"arrayref",
"bytemuck",
@ -1715,15 +1730,15 @@ dependencies = [
[[package]]
name = "toml_datetime"
version = "0.6.3"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b"
checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
[[package]]
name = "toml_edit"
version = "0.20.2"
version = "0.20.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338"
checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81"
dependencies = [
"indexmap",
"toml_datetime",
@ -1800,9 +1815,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
version = "0.2.89"
version = "0.2.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e"
checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
@ -1810,24 +1825,24 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.89"
version = "0.2.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826"
checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217"
dependencies = [
"bumpalo",
"log",
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.42",
"syn 2.0.39",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.39"
version = "0.4.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12"
checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02"
dependencies = [
"cfg-if",
"js-sys",
@ -1837,9 +1852,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.89"
version = "0.2.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2"
checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@ -1847,22 +1862,22 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.89"
version = "0.2.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283"
checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.42",
"syn 2.0.39",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.89"
version = "0.2.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f"
checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b"
[[package]]
name = "wayland-backend"
@ -1985,9 +2000,9 @@ dependencies = [
[[package]]
name = "web-time"
version = "0.2.4"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa30049b1c872b72c89866d458eae9f20380ab280ffd1b1e18df2d3e2d98cfe0"
checksum = "57099a701fb3a8043f993e8228dc24229c7b942e2b009a1b962e54489ba1d3bf"
dependencies = [
"js-sys",
"wasm-bindgen",
@ -2126,6 +2141,15 @@ dependencies = [
"winapi",
]
[[package]]
name = "winapi-wsapoll"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
@ -2351,9 +2375,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
[[package]]
name = "winit"
version = "0.29.6"
version = "0.29.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a5426b43d8782441f76a9b775686da171b9eedcfcee75a698fa5180c9a09d34"
checksum = "d25d662bb83b511acd839534bb2d88521b0bbc81440969cb077d23c4db9e62c7"
dependencies = [
"ahash",
"android-activity",
@ -2400,9 +2424,9 @@ dependencies = [
[[package]]
name = "winnow"
version = "0.5.30"
version = "0.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b5c3db89721d50d0e2a673f5043fc4722f76dcc352d7b1ab8b8288bed4ed2c5"
checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b"
dependencies = [
"memchr",
]
@ -2420,30 +2444,38 @@ dependencies = [
[[package]]
name = "x11rb"
version = "0.13.0"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8f25ead8c7e4cba123243a6367da5d3990e0d3affa708ea19dce96356bd9f1a"
checksum = "b1641b26d4dec61337c35a1b1aaf9e3cba8f46f0b43636c609ab0291a648040a"
dependencies = [
"as-raw-xcb-connection",
"gethostname",
"libc",
"libloading 0.8.1",
"libloading 0.7.4",
"nix",
"once_cell",
"rustix",
"winapi",
"winapi-wsapoll",
"x11rb-protocol",
]
[[package]]
name = "x11rb-protocol"
version = "0.13.0"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e63e71c4b8bd9ffec2c963173a4dc4cbde9ee96961d4fcb4429db9929b606c34"
checksum = "82d6c3f9a0fb6701fab8f6cea9b0c0bd5d6876f1f89f7fada07e558077c344bc"
dependencies = [
"nix",
]
[[package]]
name = "xcursor"
version = "0.3.5"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a0ccd7b4a5345edfcd0c3535718a4e9ff7798ffc536bb5b5a0e26ff84732911"
checksum = "463705a63313cd4301184381c5e8042f0a7e9b4bb63653f216311d4ae74690b7"
dependencies = [
"nom",
]
[[package]]
name = "xkbcommon-dl"
@ -2472,20 +2504,20 @@ checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a"
[[package]]
name = "zerocopy"
version = "0.7.32"
version = "0.7.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be"
checksum = "e97e415490559a91254a2979b4829267a57d2fcd741a98eee8b722fb57289aa0"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.7.32"
version = "0.7.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.42",
"syn 2.0.39",
]

@ -72,9 +72,9 @@ fn generate_bvh_node(boxen:Vec<(usize,Aabb)>)->BvhNode{
sort_y.push((*i,center.y()));
sort_z.push((*i,center.z()));
}
sort_x.sort_by(|tup0,tup1|tup0.1.cmp(&tup1.1));
sort_y.sort_by(|tup0,tup1|tup0.1.cmp(&tup1.1));
sort_z.sort_by(|tup0,tup1|tup0.1.cmp(&tup1.1));
sort_x.sort_by(|tup0,tup1|tup0.1.partial_cmp(&tup1.1).unwrap());
sort_y.sort_by(|tup0,tup1|tup0.1.partial_cmp(&tup1.1).unwrap());
sort_z.sort_by(|tup0,tup1|tup0.1.partial_cmp(&tup1.1).unwrap());
let h=n/2;
let median_x=sort_x[h].1;
let median_y=sort_y[h].1;

@ -20,8 +20,6 @@ enum Transition<F,E:DirectedEdge,V>{
//n=face.normal d=face.dot
//n.a t^2+n.v t+n.p-d==0
let (n,d)=mesh.face_nd(face_id);
//TODO: use higher precision d value?
//use the mesh transform translation instead of baking it into the d value.
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 time<=t&&t<best_time&&n.dot(body.extrapolated_velocity(t))<Planar64::ZERO{
@ -35,8 +33,9 @@ enum Transition<F,E:DirectedEdge,V>{
let edge_n=mesh.directed_edge_n(directed_edge_id);
let n=n.cross(edge_n);
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-(mesh.vert(verts[0])+mesh.vert(verts[1]))),n.dot(body.velocity)*2,n.dot(body.acceleration)){
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 time<=t&&t<best_time&&n.dot(body.extrapolated_velocity(t))<Planar64::ZERO{
best_time=t;
@ -51,13 +50,14 @@ enum Transition<F,E:DirectedEdge,V>{
//test each face collision time, ignoring roots with zero or conflicting derivative
let edge_n=mesh.edge_n(edge_id);
let edge_verts=mesh.edge_verts(edge_id);
let delta_pos=body.position*2-(mesh.vert(edge_verts[0])+mesh.vert(edge_verts[1]));
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(delta_pos),n.dot(body.velocity)*2,n.dot(body.acceleration)){
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 time<=t&&t<best_time&&n.dot(body.extrapolated_velocity(t))<Planar64::ZERO{
best_time=t;
@ -70,7 +70,8 @@ enum Transition<F,E:DirectedEdge,V>{
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));
for t in zeroes2((n.dot(body.position-mesh.vert(vert_id)))*2,n.dot(body.velocity)*2,n.dot(body.acceleration)){
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 time<=t&&t<best_time&&n.dot(body.extrapolated_velocity(t))<Planar64::ZERO{
best_time=t;
@ -86,7 +87,8 @@ enum Transition<F,E:DirectedEdge,V>{
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);
for t in zeroes2((n.dot(body.position-mesh.vert(vert_id)))*2,n.dot(body.velocity)*2,n.dot(body.acceleration)){
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 time<=t&&t<best_time&&n.dot(body.extrapolated_velocity(t))<Planar64::ZERO{
best_time=t;

@ -105,23 +105,23 @@ impl Ratio64{
None
}else{
let d=gcd(num.unsigned_abs(),den);
Some(Self{num:num/(d as i64),den:den/d})
Some(Self{num:num/d as i64,den:den/d})
}
}
#[inline]
pub fn mul_int(&self,rhs:i64)->i64{
rhs*self.num/(self.den as i64)
rhs*self.num/self.den as i64
}
#[inline]
pub fn rhs_div_int(&self,rhs:i64)->i64{
rhs*(self.den as i64)/self.num
rhs*self.den as i64/self.num
}
#[inline]
pub fn mul_ref(&self,rhs:&Ratio64)->Ratio64{
let (num,den)=(self.num*rhs.num,self.den*rhs.den);
let d=gcd(num.unsigned_abs(),den);
Self{
num:num/(d as i64),
num:num/d as i64,
den:den/d,
}
}
@ -209,8 +209,8 @@ impl TryFrom<f32> for Ratio64{
std::num::FpCategory::Nan=>Err(Self::Error::Nan),
std::num::FpCategory::Infinite=>Err(Self::Error::Infinite),
std::num::FpCategory::Zero=>Ok(Self::ZERO),
std::num::FpCategory::Subnormal
|std::num::FpCategory::Normal=>ratio64_from_mes(integer_decode_f32(value)),
std::num::FpCategory::Subnormal=>Err(Self::Error::Subnormal),
std::num::FpCategory::Normal=>ratio64_from_mes(integer_decode_f32(value)),
}
}
}
@ -222,8 +222,8 @@ impl TryFrom<f64> for Ratio64{
std::num::FpCategory::Nan=>Err(Self::Error::Nan),
std::num::FpCategory::Infinite=>Err(Self::Error::Infinite),
std::num::FpCategory::Zero=>Ok(Self::ZERO),
std::num::FpCategory::Subnormal
|std::num::FpCategory::Normal=>ratio64_from_mes(integer_decode_f64(value)),
std::num::FpCategory::Subnormal=>Err(Self::Error::Subnormal),
std::num::FpCategory::Normal=>ratio64_from_mes(integer_decode_f64(value)),
}
}
}
@ -234,7 +234,7 @@ impl std::ops::Mul<Ratio64> for Ratio64{
let (num,den)=(self.num*rhs.num,self.den*rhs.den);
let d=gcd(num.unsigned_abs(),den);
Self{
num:num/(d as i64),
num:num/d as i64,
den:den/d,
}
}
@ -451,7 +451,7 @@ impl Into<f32> for Planar64{
impl From<Ratio64> for Planar64{
#[inline]
fn from(ratio:Ratio64)->Self{
Self((((ratio.num as i128)<<32)/(ratio.den as i128)) as i64)
Self((((ratio.num as i128)<<32)/ratio.den as i128) as i64)
}
}
#[derive(Debug)]
@ -459,8 +459,26 @@ pub enum Planar64TryFromFloatError{
Nan,
Infinite,
Subnormal,
HighlyNegativeExponent,
HighlyPositiveExponent,
HighlyNegativeExponent(i16),
HighlyPositiveExponent(i16),
}
#[inline]
fn planar64_from_mes((m,e,s):(u64,i16,i8))->Result<Planar64,Planar64TryFromFloatError>{
let e32=e+32;
if e32<0&&(m>>-e32)==0{//shifting m will underflow to 0
Ok(Planar64::ZERO)
// println!("m{} e{} s{}",m,e,s);
// println!("f={}",(m as f64)*(2.0f64.powf(e as f64))*(s as f64));
// Err(Planar64TryFromFloatError::HighlyNegativeExponent(e))
}else if (64-m.leading_zeros() as i16)+e32<64{//shifting m will not overflow
if e32<0{
Ok(Planar64((m as i64)*(s as i64)>>-e32))
}else{
Ok(Planar64((m as i64)*(s as i64)<<e32))
}
}else{//if shifting m will overflow (prev check failed)
Err(Planar64TryFromFloatError::HighlyPositiveExponent(e))
}
}
impl TryFrom<f32> for Planar64{
type Error=Planar64TryFromFloatError;
@ -470,15 +488,8 @@ impl TryFrom<f32> for Planar64{
std::num::FpCategory::Nan=>Err(Self::Error::Nan),
std::num::FpCategory::Infinite=>Err(Self::Error::Infinite),
std::num::FpCategory::Zero=>Ok(Self::ZERO),
std::num::FpCategory::Subnormal
|std::num::FpCategory::Normal=>{
let planar=value*PLANAR64_ONE_FLOAT32;
if planar<(i64::MIN as f32)||(i64::MAX as f32)<planar{
Err(Self::Error::HighlyPositiveExponent)
}else{
Ok(Planar64(unsafe{planar.to_int_unchecked()}))
}
}
std::num::FpCategory::Subnormal=>Err(Self::Error::Subnormal),
std::num::FpCategory::Normal=>planar64_from_mes(integer_decode_f32(value)),
}
}
}
@ -490,15 +501,8 @@ impl TryFrom<f64> for Planar64{
std::num::FpCategory::Nan=>Err(Self::Error::Nan),
std::num::FpCategory::Infinite=>Err(Self::Error::Infinite),
std::num::FpCategory::Zero=>Ok(Self::ZERO),
std::num::FpCategory::Subnormal
|std::num::FpCategory::Normal=>{
let planar=value*PLANAR64_ONE_FLOAT64;
if planar<(i64::MIN as f64)||(i64::MAX as f64)<planar{
Err(Self::Error::HighlyPositiveExponent)
}else{
Ok(Planar64(unsafe{planar.to_int_unchecked()}))
}
}
std::num::FpCategory::Subnormal=>Err(Self::Error::Subnormal),
std::num::FpCategory::Normal=>planar64_from_mes(integer_decode_f64(value)),
}
}
}
@ -568,7 +572,7 @@ impl std::ops::Div<Planar64> for Planar64{
type Output=Planar64;
#[inline]
fn div(self, rhs: Planar64) -> Self::Output {
Planar64((((self.0 as i128)<<32)/(rhs.0 as i128)) as i64)
Planar64((((self.0 as i128)<<32)/rhs.0 as i128) as i64)
}
}
// impl PartialOrd<i64> for Planar64{
@ -803,17 +807,6 @@ impl std::ops::Mul<Time> for Planar64Vec3{
))
}
}
impl std::ops::Div<Planar64> for Planar64Vec3{
type Output=Planar64Vec3;
#[inline]
fn div(self,rhs:Planar64)->Self::Output{
Planar64Vec3(glam::i64vec3(
(((self.0.x as i128)<<32)/(rhs.0 as i128)) as i64,
(((self.0.y as i128)<<32)/(rhs.0 as i128)) as i64,
(((self.0.z as i128)<<32)/(rhs.0 as i128)) as i64,
))
}
}
impl std::ops::Div<i64> for Planar64Vec3{
type Output=Planar64Vec3;
#[inline]
@ -914,14 +907,6 @@ impl Planar64Mat3{
}
}
#[inline]
pub const fn inverse_times_det(&self)->Self{
Self{
x_axis:Planar64Vec3::raw(((-(self.y_axis.0.z as i128*self.z_axis.0.y as i128)+self.y_axis.0.y as i128*self.z_axis.0.z as i128)>>32) as i64,((self.x_axis.0.z as i128*self.z_axis.0.y as i128-self.x_axis.0.y as i128*self.z_axis.0.z as i128)>>32) as i64,((-(self.x_axis.0.z as i128*self.y_axis.0.y as i128)+self.x_axis.0.y as i128*self.y_axis.0.z as i128)>>32) as i64),
y_axis:Planar64Vec3::raw(((self.y_axis.0.z as i128*self.z_axis.0.x as i128-self.y_axis.0.x as i128*self.z_axis.0.z as i128)>>32) as i64,((-(self.x_axis.0.z as i128*self.z_axis.0.x as i128)+self.x_axis.0.x as i128*self.z_axis.0.z as i128)>>32) as i64,((self.x_axis.0.z as i128*self.y_axis.0.x as i128-self.x_axis.0.x as i128*self.y_axis.0.z as i128)>>32) as i64),
z_axis:Planar64Vec3::raw(((-(self.y_axis.0.y as i128*self.z_axis.0.x as i128)+self.y_axis.0.x as i128*self.z_axis.0.y as i128)>>32) as i64,((self.x_axis.0.y as i128*self.z_axis.0.x as i128-self.x_axis.0.x as i128*self.z_axis.0.y as i128)>>32) as i64,((-(self.x_axis.0.y as i128*self.y_axis.0.x as i128)+self.x_axis.0.x as i128*self.y_axis.0.y as i128)>>32) as i64),
}
}
#[inline]
pub const fn transpose(&self)->Self{
Self{
x_axis:Planar64Vec3::raw(self.x_axis.0.x,self.y_axis.0.x,self.z_axis.0.x),

@ -14,15 +14,12 @@ fn class_is_a(class: &str, superclass: &str) -> bool {
return false
}
fn recursive_collect_superclass(objects: &mut std::vec::Vec<rbx_dom_weak::types::Ref>,dom: &rbx_dom_weak::WeakDom, instance: &rbx_dom_weak::Instance, superclass: &str){
let mut stack=vec![instance];
while let Some(item)=stack.pop(){
for &referent in item.children(){
if let Some(c)=dom.get_by_ref(referent){
if class_is_a(c.class.as_str(),superclass){
objects.push(c.referent());//copy ref
}
stack.push(c);
for &referent in instance.children() {
if let Some(c) = dom.get_by_ref(referent) {
if class_is_a(c.class.as_str(), superclass) {
objects.push(c.referent());//copy ref
}
recursive_collect_superclass(objects,dom,c,superclass);
}
}
}
@ -265,18 +262,6 @@ pub fn generate_indexed_models(dom:rbx_dom_weak::WeakDom) -> crate::model::Index
{
let model_transform=planar64_affine3_from_roblox(cf,size);
if model_transform.matrix3.determinant()==Planar64::ZERO{
let mut parent_ref=object.parent();
let mut full_path=object.name.clone();
while let Some(parent)=dom.get_by_ref(parent_ref){
full_path=format!("{}.{}",parent.name,full_path);
parent_ref=parent.parent();
}
println!("Zero determinant CFrame at location {}",full_path);
println!("matrix3:{}",model_transform.matrix3);
continue;
}
//push TempIndexedAttributes
let mut force_intersecting=false;
let mut temp_indexing_attributes=Vec::new();

@ -7,7 +7,6 @@ mod worker;
mod zeroes;
mod integer;
mod physics;
mod sniffer;
mod graphics;
mod settings;
mod primitives;

@ -259,6 +259,7 @@ impl IntersectingAttributes{
}
}
//Spawn(u32) NO! spawns are indexed in the map header instead of marked with attibutes
//TODO: deduplicate attributes
pub enum CollisionAttributes{
Decoration,//visual only
Contact{//track whether you are contacting the object

@ -238,20 +238,17 @@ pub struct TransformedMesh<'a>{
mesh:&'a PhysicsMesh,
transform:&'a crate::integer::Planar64Affine3,
normal_transform:&'a crate::integer::Planar64Mat3,
transform_det:Planar64,
}
impl TransformedMesh<'_>{
pub fn new<'a>(
mesh:&'a PhysicsMesh,
transform:&'a crate::integer::Planar64Affine3,
normal_transform:&'a crate::integer::Planar64Mat3,
transform_det:Planar64,
)->TransformedMesh<'a>{
TransformedMesh{
mesh,
transform,
normal_transform,
transform_det,
}
}
fn farthest_vert(&self,dir:Planar64Vec3)->VertId{
@ -272,8 +269,8 @@ impl MeshQuery<FaceId,DirectedEdgeId,VertId> for TransformedMesh<'_>{
fn face_nd(&self,face_id:FaceId)->(Planar64Vec3,Planar64){
let (n,d)=self.mesh.face_nd(face_id);
let transformed_n=*self.normal_transform*n;
let transformed_d=d+transformed_n.dot(self.transform.translation)/self.transform_det;
(transformed_n/self.transform_det,transformed_d)
let transformed_d=Planar64::raw(((transformed_n.dot128(self.transform.matrix3*(n*d))<<32)/n.dot128(n)) as i64)+transformed_n.dot(self.transform.translation);
(transformed_n,transformed_d)
}
fn vert(&self,vert_id:VertId)->Planar64Vec3{
self.transform.transform_point3(self.mesh.vert(vert_id))
@ -384,12 +381,12 @@ impl MinkowskiMesh<'_>{
for &directed_edge_id in self.vert_edges(vert_id).iter(){
let edge_n=self.directed_edge_n(directed_edge_id);
//is boundary uncrossable by a crawl from infinity
let edge_verts=self.edge_verts(directed_edge_id.as_undirected());
//select opposite vertex
let test_vert_id=edge_verts[directed_edge_id.parity() as usize];
//test if it's closer
let diff=point-self.vert(test_vert_id);
if crate::zeroes::zeroes1(edge_n.dot(diff),edge_n.dot(infinity_dir)).len()==0{
if infinity_dir.dot(edge_n)==Planar64::ZERO{
let edge_verts=self.edge_verts(directed_edge_id.as_undirected());
//select opposite vertex
let test_vert_id=edge_verts[directed_edge_id.parity() as usize];
//test if it's closer
let diff=point-self.vert(test_vert_id);
let distance_squared=diff.dot(diff);
if distance_squared<*best_distance_squared{
best_transition=Transition::Vert(test_vert_id);
@ -405,10 +402,9 @@ impl MinkowskiMesh<'_>{
for &directed_edge_id in self.vert_edges(vert_id).iter(){
let edge_n=self.directed_edge_n(directed_edge_id);
//is boundary uncrossable by a crawl from infinity
//check if time of collision is outside Time::MIN..Time::MAX
let d=edge_n.dot(diff);
if crate::zeroes::zeroes1(d,edge_n.dot(infinity_dir)).len()==0{
if infinity_dir.dot(edge_n)==Planar64::ZERO{
//test the edge
let d=diff.dot(edge_n);
let edge_nn=edge_n.dot(edge_n);
if Planar64::ZERO<=d&&d<=edge_nn{
let distance_squared={
@ -447,8 +443,7 @@ impl MinkowskiMesh<'_>{
EV::Edge(edge_id)=>{
//cross to face if the boundary is not crossable and we are on the wrong side
let edge_n=self.edge_n(edge_id);
// point is multiplied by two because vert_sum sums two vertices.
let delta_pos=point*2-{
let vert_sum={
let &[v0,v1]=self.edge_verts(edge_id).borrow();
self.vert(v0)+self.vert(v1)
};
@ -456,10 +451,9 @@ impl MinkowskiMesh<'_>{
let face_n=self.face_nd(face_id).0;
//edge-face boundary nd, n facing out of the face towards the edge
let boundary_n=face_n.cross(edge_n)*(i as i64*2-1);
let boundary_d=boundary_n.dot(delta_pos);
//check if time of collision is outside Time::MIN..Time::MAX
//infinity_dir can always be treated as a velocity
if (boundary_d)<=Planar64::ZERO&&crate::zeroes::zeroes1(boundary_d,boundary_n.dot(infinity_dir)*2).len()==0{
let boundary_d=boundary_n.dot(vert_sum);
// point.dot(boundary_n) is multiplied by two because vert_sum sums two vertices.
if infinity_dir.dot(boundary_n)==Planar64::ZERO&&point.dot(boundary_n)*2<=boundary_d{
//both faces cannot pass this condition, return early if one does.
return FEV::<MinkowskiFace,MinkowskiDirectedEdge,MinkowskiVert>::Face(face_id);
}
@ -604,7 +598,6 @@ impl MeshQuery<MinkowskiFace,MinkowskiDirectedEdge,MinkowskiVert> for MinkowskiM
let d=edge_face1_n.dot(edge0_n);
if d<Planar64::ZERO{
let edge0_nn=edge0_n.dot(edge0_n);
//divide by zero???
let dd=d*d/(edge_face1_nn*edge0_nn);
if best_d<dd{
best_d=dd;

@ -18,7 +18,9 @@ pub enum PhysicsInstruction {
Input(PhysicsInputInstruction),
}
#[derive(Debug)]
pub enum PhysicsInputInstruction{
pub enum PhysicsInputInstruction {
ReplaceMouse(MouseState,MouseState),
SetNextMouse(MouseState),
SetMoveRight(bool),
SetMoveUp(bool),
SetMoveBack(bool),
@ -27,51 +29,12 @@ pub enum PhysicsInputInstruction{
SetMoveForward(bool),
SetJump(bool),
SetZoom(bool),
ReplaceMouse(MouseState,MouseState),
SetNextMouse(MouseState),
Reset,
Idle,
}
#[derive(Debug)]
#[repr(u32)]
pub enum InputInstruction {
MoveRight(bool)=0,
MoveUp(bool)=1,
MoveBack(bool)=2,
MoveLeft(bool)=3,
MoveDown(bool)=4,
MoveForward(bool)=5,
Jump(bool)=6,
Zoom(bool)=7,
MoveMouse(glam::IVec2)=64,
Reset=100,
Idle=127,
//Idle: there were no input events, but the simulation is safe to advance to this timestep
//for interpolation / networking / playback reasons, most playback heads will always want
//to be 1 instruction ahead to generate the next state for interpolation.
}
impl InputInstruction{
pub fn id(&self)->u32{
let parity=match self{
crate::physics::InputInstruction::MoveRight(s)
|crate::physics::InputInstruction::MoveUp(s)
|crate::physics::InputInstruction::MoveBack(s)
|crate::physics::InputInstruction::MoveLeft(s)
|crate::physics::InputInstruction::MoveDown(s)
|crate::physics::InputInstruction::MoveForward(s)
|crate::physics::InputInstruction::Jump(s)
|crate::physics::InputInstruction::Zoom(s)=>(*s as u32)<<31,
crate::physics::InputInstruction::MoveMouse(_)
|crate::physics::InputInstruction::Reset
|crate::physics::InputInstruction::Idle=>0u32,
};
self.discriminant()|parity
}
pub fn discriminant(&self)->u32{
//from documentation for std::mem::discriminant(&self)
unsafe{*<*const _>::from(self).cast::<u32>()}
}
}
#[derive(Clone,Hash,Default)]
pub struct Body{
@ -239,7 +202,6 @@ impl PhysicsModels{
&self.meshes[self.models[model_id].mesh_id],
&self.models[model_id].transform,
&self.models[model_id].normal_transform,
self.models[model_id].transform_det,
)
}
fn model(&self,model_id:usize)->&PhysicsModel{
@ -381,11 +343,11 @@ struct Hitbox{
mesh:PhysicsMesh,
transform:crate::integer::Planar64Affine3,
normal_transform:Planar64Mat3,
transform_det:Planar64,
}
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));
@ -394,28 +356,23 @@ impl Hitbox{
halfsize:aabb.size()/2,
mesh,
transform,
normal_transform:transform.matrix3.inverse_times_det().transpose(),
transform_det:transform.matrix3.determinant(),
normal_transform,
}
}
fn from_mesh_scale(mesh:PhysicsMesh,scale:Planar64Vec3)->Self{
let matrix3=Planar64Mat3::from_diagonal(scale);
Self{
halfsize:scale,
mesh,
normal_transform:matrix3.inverse_times_det().transpose(),
transform:crate::integer::Planar64Affine3::new(matrix3,Planar64Vec3::ZERO),
transform_det:matrix3.determinant(),//scale.x*scale.y*scale.z but whatever
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{
let matrix3=Planar64Mat3::from_diagonal(scale);
Self{
halfsize:scale,
mesh,
normal_transform:matrix3.inverse_times_det().transpose(),
transform:crate::integer::Planar64Affine3::new(matrix3,offset),
transform_det:matrix3.determinant(),
transform:crate::integer::Planar64Affine3::new(Planar64Mat3::from_diagonal(scale),offset),
normal_transform:Planar64Mat3::from_diagonal(scale).inverse().transpose(),
}
}
fn roblox()->Self{
@ -426,7 +383,7 @@ impl Hitbox{
}
#[inline]
fn transformed_mesh(&self)->TransformedMesh{
TransformedMesh::new(&self.mesh,&self.transform,&self.normal_transform,self.transform_det)
TransformedMesh::new(&self.mesh,&self.transform,&self.normal_transform)
}
}
@ -563,7 +520,7 @@ impl StyleModifiers{
controls_mask:!0,//&!(Self::CONTROL_MOVEUP|Self::CONTROL_MOVEDOWN),
strafe:Some(StrafeSettings{
enable:EnableStrafe::Always,
air_accel_limit:Some(Planar64::raw(150<<28)*100),
air_accel_limit:Some(Planar64::raw(150<<28)*66),
tick_rate:Ratio64::new(100,Time::ONE_SECOND.nanos() as u64).unwrap(),
}),
jump_impulse:JumpImpulse::FromHeight(Planar64::raw(52<<28)),
@ -822,17 +779,16 @@ pub struct PhysicsModel{
attr_id:usize,
transform:crate::integer::Planar64Affine3,
normal_transform:crate::integer::Planar64Mat3,
transform_det:Planar64,
}
impl PhysicsModel{
pub fn new(mesh_id:usize,attr_id:usize,transform:crate::integer::Planar64Affine3)->Self{
let normal_transform=transform.matrix3.inverse().transpose();
Self{
mesh_id,
attr_id,
transform,
normal_transform:transform.matrix3.inverse_times_det().transpose(),
transform_det:transform.matrix3.determinant(),
normal_transform,
}
}
}
@ -1924,4 +1880,4 @@ fn already_inside_hit_nothing(){
Planar64Vec3::int(0,1,0),
Time::ZERO
),None);
}
}

@ -1,134 +0,0 @@
//file format "sniff"
/* spec
//begin global header
//global metadata (32 bytes)
b"SNFB"
u32 format_version
u64 priming_bytes
//how many bytes of the file must be read to guarantee all of the expected
//format-specific metadata is available to facilitate streaming the remaining contents
//used by the database to guarantee that it serves at least the bare minimum
u128 resource_uuid
//identifies the file from anywhere for any other file
//global block layout (variable size)
u64 num_blocks
for block_id in 0..num_blocks{
u64 first_byte
}
//end global header
//begin blocks
//each block is compressed with zstd or gz or something
*/
/* block types
BLOCK_MAP_HEADER:
DefaultStyleInfo style_info
//bvh goes here
u64 num_nodes
//node 0 parent node is implied to be None
for node_id in 1..num_nodes{
u64 parent_node
}
u64 num_spacial_blocks
for spacial_block_id in 0..num_spacial_blocks{
u64 node_id
u64 block_id //data block
Aabb block_extents
}
//ideally spacial blocks are sorted from distance to start zone
//texture blocks are inserted before the first spacial block they are used in
BLOCK_MAP_RESOURCE:
//an individual one of the following:
- model (IndexedModel)
- shader (compiled SPIR-V)
- image (JpegXL)
- sound (Opus)
- video (AV1)
- animation (Trey thing)
BLOCK_MAP_OBJECT:
//an individual one of the following:
- model instance
- located resource
//for a list of resources, parse the object.
//alternatively, BLOCK_MAP_REGION lists a group of objects to be decoded all at once
BLOCK_BOT_HEADER:
u128 map_resource_uuid //which map is this bot running
u128 time_resource_uuid //resource database time
//don't include style info in bot header because it's in the physics state
//blocks are laid out in chronological order, but indices may jump around.
u64 num_segments
for _ in 0..num_segments{
i64 time //physics_state timestamp
u64 block_id
}
BLOCK_BOT_SEGMENT:
//format version indicates what version of these structures to use
PhysicsState physics_state
//to read, greedily decode instructions until eof
loop{
//delta encode as much as possible (time,mousepos)
//strafe ticks are implied
//physics can be implied in an input-only bot file
TimedInstruction<PhysicsInstruction> instruction
}
BLOCK_DEMO_HEADER:
//timeline of loading maps, player equipment, bots
*/
struct InputInstructionCodecState{
mouse_pos:glam::IVec2,
time:crate::integer::Time,
}
//8B - 12B
impl InputInstructionCodecState{
pub fn encode(&mut self,ins:&crate::instruction::TimedInstruction<crate::physics::InputInstruction>)->([u8;12],usize){
let dt=ins.time-self.time;
self.time=ins.time;
let mut data=[0u8;12];
[data[0],data[1],data[2],data[3]]=(dt.nanos() as u32).to_le_bytes();//4B
//instruction id packed with game control parity bit. This could be 1 byte but it ruins the alignment
[data[4],data[5],data[6],data[7]]=ins.instruction.id().to_le_bytes();//4B
match &ins.instruction{
&crate::physics::InputInstruction::MoveMouse(m)=>{//4B
let dm=m-self.mouse_pos;
[data[8],data[9]]=(dm.x as i16).to_le_bytes();
[data[10],data[11]]=(dm.y as i16).to_le_bytes();
self.mouse_pos=m;
(data,12)
},
//0B
crate::physics::InputInstruction::MoveRight(_)
|crate::physics::InputInstruction::MoveUp(_)
|crate::physics::InputInstruction::MoveBack(_)
|crate::physics::InputInstruction::MoveLeft(_)
|crate::physics::InputInstruction::MoveDown(_)
|crate::physics::InputInstruction::MoveForward(_)
|crate::physics::InputInstruction::Jump(_)
|crate::physics::InputInstruction::Zoom(_)
|crate::physics::InputInstruction::Reset
|crate::physics::InputInstruction::Idle=>(data,8),
}
}
}
//everything must be 4 byte aligned, it's all going to be compressed so don't think too had about saving less than 4 bytes
//TODO: Omit (mouse only?) instructions that don't surround an actual physics instruction
fn write_input_instruction<W:std::io::Write>(state:&mut InputInstructionCodecState,w:&mut W,ins:&crate::instruction::TimedInstruction<crate::physics::InputInstruction>)->Result<usize,std::io::Error>{
//TODO: insert idle instruction if gap is over u32 nanoseconds
//TODO: don't write idle instructions
//OR: end the data block! the full state at the start of the next block will contain an absolute timestamp
let (data,size)=state.encode(ins);
w.write(&data[0..size])//8B-12B
}

@ -9,7 +9,6 @@ pub fn zeroes2(a0:Planar64,a1:Planar64,a2:Planar64) -> Vec<Planar64>{
let radicand=a1.get() as i128*a1.get() as i128-a2.get() as i128*a0.get() as i128*4;
if 0<radicand {
//start with f64 sqrt
//failure case: 2^63 < sqrt(2^127)
let planar_radicand=Planar64::raw(unsafe{(radicand as f64).sqrt().to_int_unchecked()});
//TODO: one or two newtons
//sort roots ascending and avoid taking the difference of large numbers
@ -29,12 +28,7 @@ pub fn zeroes2(a0:Planar64,a1:Planar64,a2:Planar64) -> Vec<Planar64>{
pub fn zeroes1(a0:Planar64,a1:Planar64) -> Vec<Planar64> {
if a1==Planar64::ZERO{
return vec![];
}else{
let q=((-a0.get() as i128)<<32)/(a1.get() as i128);
if i64::MIN as i128<=q&&q<=i64::MAX as i128{
return vec![Planar64::raw(q as i64)];
}else{
return vec![];
}
} else {
return vec![-a0/a1];
}
}