graphics???
This commit is contained in:
commit
7cf16de4f0
|
|
@ -0,0 +1 @@
|
|||
/target
|
||||
|
|
@ -0,0 +1,908 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "RaylibRustPhysics"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"glam 0.27.0",
|
||||
"macroquad",
|
||||
"nalgebra",
|
||||
"rand",
|
||||
"rapier3d",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "adler2"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
||||
|
||||
[[package]]
|
||||
name = "allocator-api2"
|
||||
version = "0.2.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
|
||||
|
||||
[[package]]
|
||||
name = "approx"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
||||
|
||||
[[package]]
|
||||
name = "bit-vec"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.24.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||
|
||||
[[package]]
|
||||
name = "color_quant"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "downcast-rs"
|
||||
version = "2.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "117240f60069e65410b3ae1bb213295bd828f707b5bec6596a1afc8793ce0cbc"
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
||||
|
||||
[[package]]
|
||||
name = "ena"
|
||||
version = "0.14.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5"
|
||||
dependencies = [
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
||||
|
||||
[[package]]
|
||||
name = "fdeflate"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"
|
||||
dependencies = [
|
||||
"simd-adler32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "foldhash"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
||||
|
||||
[[package]]
|
||||
name = "foldhash"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
|
||||
|
||||
[[package]]
|
||||
name = "fontdue"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e57e16b3fe8ff4364c0661fdaac543fb38b29ea9bc9c2f45612d90adf931d2b"
|
||||
dependencies = [
|
||||
"hashbrown 0.15.5",
|
||||
"ttf-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"r-efi",
|
||||
"wasip2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "333928d5eb103c5d4050533cec0384302db6be8ef7d3cebd30ec6a35350353da"
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.15.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3abb554f8ee44336b72d522e0a7fe86a29e09f839a36022fa869a7dfe941a54b"
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4126c0479ccf7e8664c36a2d719f5f2c140fbb4f9090008098d2c291fa5b3f16"
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.17.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e01732b97afd8508eee3333a541b9f7610f454bb818669e66e90f5f57c93a776"
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "525a3e490ba77b8e326fb67d4b44b4bd2f920f44d4cc73ccec50adc68e3bee34"
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b8509e6791516e81c1a630d0bd7fbac36d2fa8712a9da8662e716b52d5051ca"
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.20.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f43e957e744be03f5801a55472f593d43fabdebf25a4585db250f04d86b1675f"
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.21.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "518faa5064866338b013ff9b2350dc318e14cc4fcd6cb8206d7e7c9886c98815"
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12f597d56c1bd55a811a1be189459e8fad2bbc272616375602443bdfb37fa774"
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.23.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e4afd9ad95555081e109fe1d21f2a30c691b5f0919c67dfa690a2e1eb6bd51c"
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.24.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5418c17512bdf42730f9032c74e1ae39afc408745ebb2acf72fbc4691c17945"
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "151665d9be52f9bb40fc7966565d39666f2d1e69233571b71b87791c7e0528b3"
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e05e7e6723e3455f4818c7b26e855439f7546cf617ef669d1adedb8669e5cb9"
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.28.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "779ae4bf7e8421cf91c0b3b64e7e8b40b862fba4d393f59150042de7c4965a94"
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.29.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8babf46d4c1c9d92deac9f7be466f76dfc4482b6452fc5024b5e8daf6ffeb3ee"
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.30.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd47b05dddf0005d850e5644cae7f2b14ac3df487979dbfff3b56f20b1a6ae46"
|
||||
|
||||
[[package]]
|
||||
name = "hash32"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.15.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
|
||||
dependencies = [
|
||||
"allocator-api2",
|
||||
"equivalent",
|
||||
"foldhash 0.1.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.16.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
|
||||
dependencies = [
|
||||
"foldhash 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heapless"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
|
||||
dependencies = [
|
||||
"hash32",
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "image"
|
||||
version = "0.24.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"byteorder",
|
||||
"color_quant",
|
||||
"num-traits",
|
||||
"png",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.177"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976"
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
|
||||
|
||||
[[package]]
|
||||
name = "macroquad"
|
||||
version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2befbae373456143ef55aa93a73594d080adfb111dc32ec96a1123a3e4ff4ae"
|
||||
dependencies = [
|
||||
"fontdue",
|
||||
"glam 0.27.0",
|
||||
"image",
|
||||
"macroquad_macro",
|
||||
"miniquad",
|
||||
"quad-rand",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "macroquad_macro"
|
||||
version = "0.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64b1d96218903768c1ce078b657c0d5965465c95a60d2682fd97443c9d2483dd"
|
||||
|
||||
[[package]]
|
||||
name = "malloc_buf"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matrixmultiply"
|
||||
version = "0.3.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a06de3016e9fae57a36fd14dba131fccf49f74b40b7fbdb472f96e361ec71a08"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"rawpointer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miniquad"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fb3e758e46dbc45716a8a49ca9edc54b15bcca826277e80b1f690708f67f9e3"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"ndk-sys",
|
||||
"objc-rs",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.8.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
|
||||
dependencies = [
|
||||
"adler2",
|
||||
"simd-adler32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nalgebra"
|
||||
version = "0.34.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4d5b3eff5cd580f93da45e64715e8c20a3996342f1e466599cf7a267a0c2f5f"
|
||||
dependencies = [
|
||||
"approx",
|
||||
"glam 0.14.0",
|
||||
"glam 0.15.2",
|
||||
"glam 0.16.0",
|
||||
"glam 0.17.3",
|
||||
"glam 0.18.0",
|
||||
"glam 0.19.0",
|
||||
"glam 0.20.5",
|
||||
"glam 0.21.3",
|
||||
"glam 0.22.0",
|
||||
"glam 0.23.0",
|
||||
"glam 0.24.2",
|
||||
"glam 0.25.0",
|
||||
"glam 0.27.0",
|
||||
"glam 0.28.0",
|
||||
"glam 0.29.3",
|
||||
"glam 0.30.9",
|
||||
"matrixmultiply",
|
||||
"nalgebra-macros",
|
||||
"num-complex",
|
||||
"num-rational",
|
||||
"num-traits",
|
||||
"simba",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nalgebra-macros"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "973e7178a678cfd059ccec50887658d482ce16b0aa9da3888ddeab5cd5eb4889"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ndk-sys"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121"
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"
|
||||
dependencies = [
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-complex"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-derive"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.46"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-rational"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"
|
||||
dependencies = [
|
||||
"num-bigint",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc-rs"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64a1e7069a2525126bf12a9f1f7916835fafade384fb27cabf698e745e2a1eb8"
|
||||
dependencies = [
|
||||
"malloc_buf",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ordered-float"
|
||||
version = "5.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f4779c6901a562440c3786d08192c6fbda7c1c2060edd10006b05ee35d10f2d"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parry3d"
|
||||
version = "0.25.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e99471b7b6870f7fe406d5611dd4b4c9b07aa3e5436b1d27e1515f9832bb0c6b"
|
||||
dependencies = [
|
||||
"approx",
|
||||
"arrayvec",
|
||||
"bitflags 2.10.0",
|
||||
"downcast-rs",
|
||||
"either",
|
||||
"ena",
|
||||
"foldhash 0.2.0",
|
||||
"glam 0.30.9",
|
||||
"hashbrown 0.16.1",
|
||||
"log",
|
||||
"nalgebra",
|
||||
"num-derive",
|
||||
"num-traits",
|
||||
"ordered-float",
|
||||
"rstar",
|
||||
"simba",
|
||||
"slab",
|
||||
"smallvec",
|
||||
"spade",
|
||||
"static_assertions",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
||||
|
||||
[[package]]
|
||||
name = "png"
|
||||
version = "0.17.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"crc32fast",
|
||||
"fdeflate",
|
||||
"flate2",
|
||||
"miniz_oxide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
||||
dependencies = [
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.103"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "profiling"
|
||||
version = "1.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3eb8486b569e12e2c32ad3e204dbaba5e4b5b216e9367044f25f1dba42341773"
|
||||
dependencies = [
|
||||
"profiling-procmacros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "profiling-procmacros"
|
||||
version = "1.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52717f9a02b6965224f95ca2a81e2e0c5c43baacd28ca057577988930b6c3d5b"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quad-rand"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a651516ddc9168ebd67b24afd085a718be02f8858fe406591b013d101ce2f40"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "r-efi"
|
||||
version = "5.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
|
||||
dependencies = [
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rapier3d"
|
||||
version = "0.31.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68073fdc88f6b709002767ce8deffffb05ac06824bf9f98a23e270bcea64ba9f"
|
||||
dependencies = [
|
||||
"approx",
|
||||
"arrayvec",
|
||||
"bit-vec",
|
||||
"bitflags 2.10.0",
|
||||
"downcast-rs",
|
||||
"log",
|
||||
"nalgebra",
|
||||
"num-derive",
|
||||
"num-traits",
|
||||
"ordered-float",
|
||||
"parry3d",
|
||||
"profiling",
|
||||
"rustc-hash",
|
||||
"simba",
|
||||
"static_assertions",
|
||||
"thiserror",
|
||||
"vec_map",
|
||||
"wide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rawpointer"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
|
||||
|
||||
[[package]]
|
||||
name = "robust"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e27ee8bb91ca0adcf0ecb116293afa12d393f9c2b9b9cd54d33e8078fe19839"
|
||||
|
||||
[[package]]
|
||||
name = "rstar"
|
||||
version = "0.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "421400d13ccfd26dfa5858199c30a5d76f9c54e0dba7575273025b43c5175dbb"
|
||||
dependencies = [
|
||||
"heapless",
|
||||
"num-traits",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
|
||||
|
||||
[[package]]
|
||||
name = "safe_arch"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96b02de82ddbe1b636e6170c21be622223aea188ef2e139be0a5b219ec215323"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simba"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c99284beb21666094ba2b75bbceda012e610f5479dfcc2d6e2426f53197ffd95"
|
||||
dependencies = [
|
||||
"approx",
|
||||
"num-complex",
|
||||
"num-traits",
|
||||
"paste",
|
||||
"wide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simd-adler32"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
||||
|
||||
[[package]]
|
||||
name = "spade"
|
||||
version = "2.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb313e1c8afee5b5647e00ee0fe6855e3d529eb863a0fdae1d60006c4d1e9990"
|
||||
dependencies = [
|
||||
"hashbrown 0.15.5",
|
||||
"num-traits",
|
||||
"robust",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stable_deref_trait"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.110"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "2.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "2.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ttf-parser"
|
||||
version = "0.21.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2c591d83f69777866b9126b24c6dd9a18351f177e49d625920d19f989fd31cf8"
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
||||
|
||||
[[package]]
|
||||
name = "wasip2"
|
||||
version = "1.0.1+wasi-0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7"
|
||||
dependencies = [
|
||||
"wit-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wide"
|
||||
version = "0.7.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ce5da8ecb62bcd8ec8b7ea19f69a51275e91299be594ea5cc6ef7819e16cd03"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"safe_arch",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen"
|
||||
version = "0.46.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43fa6694ed34d6e57407afbccdeecfa268c470a7d2a5b0cf49ce9fcc345afb90"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.8.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c640b22cd9817fae95be82f0d2f90b11f7605f6c319d16705c459b27ac2cbc26"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
[package]
|
||||
name = "RaylibRustPhysics"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
default-run = "RaylibRustPhysics"
|
||||
|
||||
[dependencies]
|
||||
macroquad = "0.4.14"
|
||||
rapier3d = { version = "0.31", features = [ "simd-stable" ] }
|
||||
nalgebra = {version="0.34", features = ["convert-glam027"]}
|
||||
glam = "0.27"
|
||||
rand = "0.9.2"
|
||||
|
||||
[[bin]]
|
||||
name = "tools"
|
||||
path = "src/tools/main.rs"
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1763618868,
|
||||
"narHash": "sha256-v5afmLjn/uyD9EQuPBn7nZuaZVV9r+JerayK/4wvdWA=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a8d610af3f1a5fb71e23e08434d8d61a466fc942",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
description = "DevShell for rust";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, flake-utils, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let pkgs = import nixpkgs { inherit system; };
|
||||
in {
|
||||
devShells.default = with pkgs;
|
||||
mkShell rec {
|
||||
buildInputs = [
|
||||
pkg-config
|
||||
rustup
|
||||
alsa-lib
|
||||
|
||||
xorg.libX11
|
||||
xorg.libXcursor
|
||||
xorg.libXrandr
|
||||
xorg.libXinerama
|
||||
xorg.libXi
|
||||
xorg.libxcb
|
||||
libxkbcommon
|
||||
vulkan-loader
|
||||
wayland
|
||||
libGL
|
||||
mesa
|
||||
|
||||
glfw
|
||||
cmake
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${
|
||||
builtins.toString (pkgs.lib.makeLibraryPath buildInputs)
|
||||
}";
|
||||
export LIBCLANG_PATH="${pkgs.libclang.lib}/lib";
|
||||
'';
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use macroquad::prelude as mq;
|
||||
use nalgebra as na;
|
||||
use rapier3d::prelude as rp;
|
||||
|
||||
fn random_color() -> mq::Color {
|
||||
return mq::Color::new(
|
||||
rand::random_range(0.0..1.0),
|
||||
rand::random_range(0.0..1.0),
|
||||
rand::random_range(0.0..1.0),
|
||||
1.0,
|
||||
);
|
||||
}
|
||||
|
||||
pub struct World {
|
||||
physics_pipeline: rp::PhysicsPipeline,
|
||||
gravity: na::Vector3<f32>,
|
||||
integration_parameters: rp::IntegrationParameters,
|
||||
island_manager: rp::IslandManager,
|
||||
broad_phase: rp::BroadPhaseBvh,
|
||||
narrow_phase: rp::NarrowPhase,
|
||||
impulse_joint_set: rp::ImpulseJointSet,
|
||||
multibody_joint_set: rp::MultibodyJointSet,
|
||||
ccd_solver: rp::CCDSolver,
|
||||
hooks: Box<dyn rp::PhysicsHooks>,
|
||||
events: Box<dyn rp::EventHandler>,
|
||||
|
||||
pub bodies: rp::RigidBodySet,
|
||||
pub colliders: rp::ColliderSet,
|
||||
pub collider_data: HashMap<rp::ColliderHandle, ColliderExtraData>,
|
||||
}
|
||||
|
||||
pub struct ColliderExtraData {
|
||||
pub color: mq::Color,
|
||||
}
|
||||
|
||||
impl World {
|
||||
pub fn step(&mut self) {
|
||||
self.physics_pipeline.step(
|
||||
&self.gravity,
|
||||
&self.integration_parameters,
|
||||
&mut self.island_manager,
|
||||
&mut self.broad_phase,
|
||||
&mut self.narrow_phase,
|
||||
&mut self.bodies,
|
||||
&mut self.colliders,
|
||||
&mut self.impulse_joint_set,
|
||||
&mut self.multibody_joint_set,
|
||||
&mut self.ccd_solver,
|
||||
self.hooks.as_ref(),
|
||||
self.events.as_ref(),
|
||||
);
|
||||
}
|
||||
|
||||
pub fn position_of_rb(
|
||||
&self,
|
||||
rigid_body_handle: rp::RigidBodyHandle,
|
||||
) -> Option<na::Vector3<f32>> {
|
||||
let body = self.bodies.get(rigid_body_handle)?;
|
||||
return Some(*body.translation());
|
||||
}
|
||||
|
||||
pub fn position_of_collider(
|
||||
&self,
|
||||
collider_handle: rp::ColliderHandle,
|
||||
) -> Option<na::Vector3<f32>> {
|
||||
let coll = self.colliders.get(collider_handle)?;
|
||||
return Some(*coll.translation());
|
||||
}
|
||||
|
||||
pub fn register_body(&mut self, rb: rp::RigidBody) -> rp::RigidBodyHandle {
|
||||
return self.bodies.insert(rb);
|
||||
}
|
||||
|
||||
pub fn register_collider(
|
||||
&mut self,
|
||||
collider: rp::Collider,
|
||||
rigid_body_handle: rp::RigidBodyHandle,
|
||||
extra_options: Option<ColliderExtraData>,
|
||||
) -> rp::ColliderHandle {
|
||||
let handle =
|
||||
self.colliders
|
||||
.insert_with_parent(collider, rigid_body_handle, &mut self.bodies);
|
||||
self.collider_data.insert(
|
||||
handle,
|
||||
extra_options.unwrap_or(ColliderExtraData {
|
||||
color: random_color(),
|
||||
}),
|
||||
);
|
||||
return handle;
|
||||
}
|
||||
|
||||
pub fn register_free_collider(
|
||||
&mut self,
|
||||
collider: rp::Collider,
|
||||
extra_options: Option<ColliderExtraData>,
|
||||
) -> rp::ColliderHandle {
|
||||
let handle = self.colliders.insert(collider);
|
||||
self.collider_data.insert(
|
||||
handle,
|
||||
extra_options.unwrap_or(ColliderExtraData {
|
||||
color: random_color(),
|
||||
}),
|
||||
);
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for World {
|
||||
fn default() -> Self {
|
||||
let gravity: na::Vector3<f32> = rp::vector![0.0, -9.81, 0.0];
|
||||
let integration_parameters = rp::IntegrationParameters::default();
|
||||
let physics_pipeline = rp::PhysicsPipeline::new();
|
||||
let island_manager = rp::IslandManager::new();
|
||||
let broad_phase = rp::DefaultBroadPhase::new();
|
||||
let narrow_phase = rp::NarrowPhase::new();
|
||||
let impulse_joint_set = rp::ImpulseJointSet::new();
|
||||
let multibody_joint_set = rp::MultibodyJointSet::new();
|
||||
let ccd_solver = rp::CCDSolver::new();
|
||||
let physics_hooks = ();
|
||||
let event_handler = ();
|
||||
return Self {
|
||||
physics_pipeline,
|
||||
gravity: gravity,
|
||||
integration_parameters,
|
||||
island_manager,
|
||||
broad_phase,
|
||||
narrow_phase,
|
||||
impulse_joint_set,
|
||||
multibody_joint_set,
|
||||
ccd_solver,
|
||||
hooks: Box::new(physics_hooks),
|
||||
events: Box::new(event_handler),
|
||||
bodies: rp::RigidBodySet::new(),
|
||||
colliders: rp::ColliderSet::new(),
|
||||
collider_data: HashMap::new(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
use macroquad::prelude as mq;
|
||||
|
||||
pub fn draw_cuboid(center: mq::Vec3, size: mq::Vec3, color: mq::Color) {
|
||||
use mq::{Vec2, Vec3, Vertex};
|
||||
let hs = size * 0.5;
|
||||
let mut positions = [
|
||||
Vec3::new(-hs.x, -hs.y, -hs.z),
|
||||
Vec3::new(hs.x, -hs.y, -hs.z),
|
||||
Vec3::new(hs.x, hs.y, -hs.z),
|
||||
Vec3::new(-hs.x, hs.y, -hs.z),
|
||||
Vec3::new(-hs.x, -hs.y, hs.z),
|
||||
Vec3::new(hs.x, -hs.y, hs.z),
|
||||
Vec3::new(hs.x, hs.y, hs.z),
|
||||
Vec3::new(-hs.x, hs.y, hs.z),
|
||||
];
|
||||
for i in 0..positions.len() {
|
||||
positions[i] += center;
|
||||
}
|
||||
|
||||
let faces = [
|
||||
([0, 1, 2, 3], Vec3::new(0.0, 0.0, -1.0)), // Back
|
||||
([5, 4, 7, 6], Vec3::new(0.0, 0.0, 1.0)), // Front
|
||||
([4, 0, 3, 7], Vec3::new(-1.0, 0.0, 0.0)), // Left
|
||||
([1, 5, 6, 2], Vec3::new(1.0, 0.0, 0.0)), // Right
|
||||
([3, 2, 6, 7], Vec3::new(0.0, 1.0, 0.0)), // Up
|
||||
([4, 5, 1, 0], Vec3::new(0.0, -1.0, 0.0)), // Down
|
||||
];
|
||||
|
||||
let uvs = [
|
||||
Vec2::new(0.0, 0.0),
|
||||
Vec2::new(1.0, 0.0),
|
||||
Vec2::new(1.0, 1.0),
|
||||
Vec2::new(0.0, 1.0),
|
||||
];
|
||||
|
||||
let mut vertices = [Vertex {
|
||||
position: mq::Vec3::ZERO,
|
||||
uv: mq::Vec2::ZERO,
|
||||
color: color.into(),
|
||||
normal: mq::Vec4::ZERO,
|
||||
}; 24];
|
||||
|
||||
let mut vi = 0;
|
||||
for (face, normal) in faces.iter() {
|
||||
for (j, &corner) in face.iter().enumerate() {
|
||||
let pos = positions[corner];
|
||||
vertices[vi] = Vertex {
|
||||
position: mq::vec3(pos.x, pos.y, pos.z),
|
||||
uv: mq::vec2(uvs[j].x, uvs[j].y),
|
||||
color: color.into(),
|
||||
normal: mq::vec4(normal.x, normal.y, normal.z, 0.0),
|
||||
};
|
||||
vi += 1;
|
||||
}
|
||||
}
|
||||
|
||||
let mut indices = [0u16; 36];
|
||||
for i in 0..6 {
|
||||
let base = (i * 4) as u16;
|
||||
let offset = i * 6;
|
||||
indices[offset + 0] = base;
|
||||
indices[offset + 1] = base + 1;
|
||||
indices[offset + 2] = base + 2;
|
||||
indices[offset + 3] = base;
|
||||
indices[offset + 4] = base + 2;
|
||||
indices[offset + 5] = base + 3;
|
||||
}
|
||||
|
||||
unsafe {
|
||||
mq::get_internal_gl()
|
||||
.quad_gl
|
||||
.draw_mode(mq::DrawMode::Triangles);
|
||||
mq::get_internal_gl().quad_gl.geometry(&vertices, &indices);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
use macroquad::prelude as mq;
|
||||
use rapier3d::prelude::*;
|
||||
|
||||
mod engine;
|
||||
use engine::*;
|
||||
|
||||
mod graphics_util;
|
||||
use graphics_util::*;
|
||||
|
||||
#[macroquad::main("3D")]
|
||||
async fn main() {
|
||||
// Graphics Initialization
|
||||
|
||||
let vertex = include_str!("shaders/shader.vert");
|
||||
let fragment = include_str!("shaders/shader.frag");
|
||||
|
||||
let material = mq::load_material(
|
||||
mq::ShaderSource::Glsl { vertex, fragment },
|
||||
mq::MaterialParams {
|
||||
pipeline_params: mq::PipelineParams {
|
||||
depth_test: mq::Comparison::LessOrEqual,
|
||||
depth_write: true,
|
||||
..Default::default()
|
||||
},
|
||||
uniforms: vec![mq::UniformDesc::new(
|
||||
"render_normals_bool",
|
||||
mq::UniformType::Int1,
|
||||
)],
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
material.set_uniform("render_normals_bool", 0);
|
||||
|
||||
// Physics Initialization
|
||||
let mut world = World::default();
|
||||
world.register_free_collider(
|
||||
ColliderBuilder::cuboid(5.0, 0.1, 5.0)
|
||||
.restitution(0.5)
|
||||
.build(),
|
||||
None,
|
||||
);
|
||||
|
||||
let body = world.register_body(
|
||||
RigidBodyBuilder::dynamic()
|
||||
.translation(vector![0.0, 10.0, 0.0])
|
||||
.rotation(vector![std::f32::consts::PI / 4.2, 0.0, 0.0])
|
||||
.build(),
|
||||
);
|
||||
|
||||
let coll = world.register_collider(
|
||||
ColliderBuilder::cuboid(0.5, 0.5, 0.5)
|
||||
.restitution(0.5)
|
||||
.build(),
|
||||
body,
|
||||
None,
|
||||
);
|
||||
|
||||
// Main Loop
|
||||
loop {
|
||||
// Physics Simulation
|
||||
world.step();
|
||||
|
||||
// Graphics Rendering
|
||||
mq::clear_background(mq::LIGHTGRAY);
|
||||
|
||||
mq::set_camera(&mq::Camera3D {
|
||||
position: mq::vec3(-20., 15., 0.),
|
||||
up: mq::vec3(0., 1., 0.),
|
||||
target: mq::vec3(0., 0., 0.),
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
mq::draw_grid(20, 1., mq::BLACK, mq::GRAY);
|
||||
|
||||
for (handle, coll) in world.colliders.iter() {
|
||||
let position: glam::Vec3 = world.position_of_collider(handle).unwrap().into();
|
||||
let rotation = *coll.rotation();
|
||||
unsafe {
|
||||
let context = mq::get_internal_gl().quad_gl;
|
||||
|
||||
context.push_model_matrix(mq::Mat4::from_rotation_translation(
|
||||
rotation.into(),
|
||||
position,
|
||||
));
|
||||
}
|
||||
let color = world.collider_data.get(&handle).unwrap().color;
|
||||
match coll.shape().shape_type() {
|
||||
ShapeType::Ball => {
|
||||
mq::draw_sphere(
|
||||
mq::vec3(0.0, 0.0, 0.0),
|
||||
coll.shape().as_ball().unwrap().radius,
|
||||
None,
|
||||
color,
|
||||
);
|
||||
}
|
||||
ShapeType::Cuboid => {
|
||||
mq::gl_use_material(&material);
|
||||
draw_cuboid(
|
||||
mq::vec3(0.0, 0.0, 0.0),
|
||||
(coll.shape().as_cuboid().unwrap().half_extents * 2.0).into(),
|
||||
color,
|
||||
);
|
||||
mq::gl_use_default_material();
|
||||
}
|
||||
_ => println!("Not implemented.. Skipping"),
|
||||
}
|
||||
unsafe {
|
||||
let context = mq::get_internal_gl().quad_gl;
|
||||
context.pop_model_matrix();
|
||||
}
|
||||
}
|
||||
|
||||
// draw_sphere(world.position_of_rb(body).unwrap().into(), 0.5, None, BLUE);
|
||||
|
||||
mq::next_frame().await
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
#version 330 core
|
||||
|
||||
in vec4 v_normal;
|
||||
in vec4 color;
|
||||
uniform int render_normals_bool;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
const float ambient_strenght = 0.3;
|
||||
const float diffuse_strenght = 0.7;
|
||||
|
||||
void main() {
|
||||
vec3 lightDir = vec3(1.0, 0.3, 0.2);
|
||||
float diff = max(dot(normalize(vec3(v_normal.x, v_normal.y, v_normal.z)), normalize(lightDir)), 0) * diffuse_strenght;
|
||||
if (render_normals_bool == 1) {
|
||||
FragColor = vec4(v_normal);
|
||||
}
|
||||
else {
|
||||
FragColor = color * (1 / 256.0) * (ambient_strenght + diff);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
#version 330 core
|
||||
|
||||
attribute vec3 position;
|
||||
attribute vec4 color0;
|
||||
attribute vec4 normal;
|
||||
|
||||
uniform mat4 Model;
|
||||
uniform mat4 Projection;
|
||||
|
||||
out vec4 v_normal;
|
||||
out vec4 color;
|
||||
void main() {
|
||||
color = color0;
|
||||
v_normal = normal;
|
||||
gl_Position = Projection * Model * vec4(position, 1.0);
|
||||
}
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
use macroquad::prelude::{self as mq, UniformDesc};
|
||||
|
||||
#[macroquad::main("Normal Shading")]
|
||||
async fn main() {
|
||||
let vertex = include_str!("shader.vert");
|
||||
let fragment = include_str!("shader.frag");
|
||||
|
||||
let material = mq::load_material(
|
||||
mq::ShaderSource::Glsl { vertex, fragment },
|
||||
mq::MaterialParams {
|
||||
pipeline_params: mq::PipelineParams {
|
||||
depth_test: mq::Comparison::LessOrEqual,
|
||||
depth_write: true,
|
||||
..Default::default()
|
||||
},
|
||||
uniforms: vec![UniformDesc::new(
|
||||
"render_normals_bool",
|
||||
mq::UniformType::Int1,
|
||||
)],
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
material.set_uniform("render_normals_bool", 1);
|
||||
|
||||
loop {
|
||||
mq::clear_background(mq::GRAY);
|
||||
mq::set_camera(&mq::Camera3D {
|
||||
position: mq::vec3(4.0, 4.0, 4.0),
|
||||
target: mq::vec3(0.0, 0.0, 0.0),
|
||||
up: mq::vec3(0.0, 1.0, 0.0),
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
mq::gl_use_material(&material);
|
||||
|
||||
draw_cuboid(mq::vec3(3.0, 0.0, 0.0), mq::vec3(1.0, 2.0, 3.0), mq::RED);
|
||||
|
||||
mq::gl_use_default_material();
|
||||
mq::set_default_camera();
|
||||
mq::next_frame().await;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn generate_normals_smooth(vertexes: &mut Vec<mq::Vertex>, indices: &[u16]) {
|
||||
for v in vertexes.iter_mut() {
|
||||
v.normal = mq::vec4(0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
for i in 0..(indices.len() / 3) {
|
||||
let idx0 = indices[i * 3 + 0] as usize;
|
||||
let idx1 = indices[i * 3 + 1] as usize;
|
||||
let idx2 = indices[i * 3 + 2] as usize;
|
||||
|
||||
let pos0 = vertexes[idx0].position;
|
||||
let pos1 = vertexes[idx1].position;
|
||||
let pos2 = vertexes[idx2].position;
|
||||
|
||||
let side1 = pos1 - pos0;
|
||||
let side2 = pos2 - pos0;
|
||||
let normal = side1.cross(side2);
|
||||
|
||||
let normal_vec4 = mq::vec4(normal.x, normal.y, normal.z, 0.0);
|
||||
|
||||
vertexes[idx0].normal = vertexes[idx0].normal + normal_vec4;
|
||||
vertexes[idx1].normal = vertexes[idx1].normal + normal_vec4;
|
||||
vertexes[idx2].normal = vertexes[idx2].normal + normal_vec4;
|
||||
}
|
||||
|
||||
for v in vertexes.iter_mut() {
|
||||
v.normal.z = 0.0;
|
||||
let normalized = v.normal.normalize();
|
||||
v.normal = normalized;
|
||||
}
|
||||
}
|
||||
pub fn draw_cuboid(center: mq::Vec3, size: mq::Vec3, color: mq::Color) {
|
||||
use mq::{Vec2, Vec3, Vertex};
|
||||
let hs = size * 0.5;
|
||||
let mut positions = [
|
||||
Vec3::new(-hs.x, -hs.y, -hs.z),
|
||||
Vec3::new(hs.x, -hs.y, -hs.z),
|
||||
Vec3::new(hs.x, hs.y, -hs.z),
|
||||
Vec3::new(-hs.x, hs.y, -hs.z),
|
||||
Vec3::new(-hs.x, -hs.y, hs.z),
|
||||
Vec3::new(hs.x, -hs.y, hs.z),
|
||||
Vec3::new(hs.x, hs.y, hs.z),
|
||||
Vec3::new(-hs.x, hs.y, hs.z),
|
||||
];
|
||||
for i in 0..positions.len() {
|
||||
positions[i] += center;
|
||||
}
|
||||
|
||||
let faces = [
|
||||
([0, 1, 2, 3], Vec3::new(0.0, 0.0, -1.0)), // Back
|
||||
([5, 4, 7, 6], Vec3::new(0.0, 0.0, 1.0)), // Front
|
||||
([4, 0, 3, 7], Vec3::new(-1.0, 0.0, 0.0)), // Left
|
||||
([1, 5, 6, 2], Vec3::new(1.0, 0.0, 0.0)), // Right
|
||||
([3, 2, 6, 7], Vec3::new(0.0, 1.0, 0.0)), // Up
|
||||
([4, 5, 1, 0], Vec3::new(0.0, -1.0, 0.0)), // Down
|
||||
];
|
||||
|
||||
let uvs = [
|
||||
Vec2::new(0.0, 0.0),
|
||||
Vec2::new(1.0, 0.0),
|
||||
Vec2::new(1.0, 1.0),
|
||||
Vec2::new(0.0, 1.0),
|
||||
];
|
||||
|
||||
let mut vertices = [Vertex {
|
||||
position: mq::Vec3::ZERO,
|
||||
uv: mq::Vec2::ZERO,
|
||||
color: color.into(),
|
||||
normal: mq::Vec4::ZERO,
|
||||
}; 24];
|
||||
|
||||
let mut vi = 0;
|
||||
for (face, normal) in faces.iter() {
|
||||
for (j, &corner) in face.iter().enumerate() {
|
||||
let pos = positions[corner];
|
||||
vertices[vi] = Vertex {
|
||||
position: mq::vec3(pos.x, pos.y, pos.z),
|
||||
uv: mq::vec2(uvs[j].x, uvs[j].y),
|
||||
color: color.into(),
|
||||
normal: mq::vec4(normal.x, normal.y, normal.z, 0.0),
|
||||
};
|
||||
vi += 1;
|
||||
}
|
||||
}
|
||||
|
||||
let mut indices = [0u16; 36];
|
||||
for i in 0..6 {
|
||||
let base = (i * 4) as u16;
|
||||
let offset = i * 6;
|
||||
indices[offset + 0] = base;
|
||||
indices[offset + 1] = base + 1;
|
||||
indices[offset + 2] = base + 2;
|
||||
indices[offset + 3] = base;
|
||||
indices[offset + 4] = base + 2;
|
||||
indices[offset + 5] = base + 3;
|
||||
}
|
||||
generate_normals_smooth(&mut vertices.into(), &indices);
|
||||
|
||||
unsafe {
|
||||
mq::get_internal_gl()
|
||||
.quad_gl
|
||||
.draw_mode(mq::DrawMode::Triangles);
|
||||
mq::get_internal_gl().quad_gl.geometry(&vertices, &indices);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
#version 330 core
|
||||
|
||||
in vec4 v_normal;
|
||||
in vec4 color;
|
||||
uniform int render_normals_bool;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
const float ambient_strenght = 0.3;
|
||||
const float diffuse_strenght = 0.7;
|
||||
|
||||
void main() {
|
||||
vec3 lightDir = vec3(1.0, 0.3, 0.2);
|
||||
float diff = max(dot(normalize(vec3(v_normal.x, v_normal.y, v_normal.z)), normalize(lightDir)), 0) * diffuse_strenght;
|
||||
if (render_normals_bool == 1) {
|
||||
FragColor = vec4(v_normal);
|
||||
}
|
||||
else {
|
||||
FragColor = color * (1 / 256.0) * (ambient_strenght + diff);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
#version 330 core
|
||||
|
||||
attribute vec3 position;
|
||||
attribute vec4 color0;
|
||||
attribute vec4 normal;
|
||||
|
||||
uniform mat4 Model;
|
||||
uniform mat4 Projection;
|
||||
|
||||
out vec4 v_normal;
|
||||
out vec4 color;
|
||||
void main() {
|
||||
color = color0;
|
||||
v_normal = normal;
|
||||
gl_Position = Projection * Model * vec4(position, 1.0);
|
||||
}
|
||||
Loading…
Reference in New Issue