init
This commit is contained in:
commit
ef1bd9e234
29 changed files with 5790 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/target
|
730
Cargo.lock
generated
Normal file
730
Cargo.lock
generated
Normal file
|
@ -0,0 +1,730 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "adler"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "autocfg"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "1.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "block-buffer"
|
||||||
|
version = "0.10.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cesu8"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cpufeatures"
|
||||||
|
version = "0.2.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crc32fast"
|
||||||
|
version = "1.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crypto-common"
|
||||||
|
version = "0.1.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
"typenum",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "digest"
|
||||||
|
version = "0.10.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||||
|
dependencies = [
|
||||||
|
"block-buffer",
|
||||||
|
"crypto-common",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dirs"
|
||||||
|
version = "5.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
|
||||||
|
dependencies = [
|
||||||
|
"dirs-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dirs-sys"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"option-ext",
|
||||||
|
"redox_users",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dunce"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fdeflate"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d329bdeac514ee06249dabc27877490f17f5d371ec693360768b838e19f3ae10"
|
||||||
|
dependencies = [
|
||||||
|
"simd-adler32",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "flate2"
|
||||||
|
version = "1.0.26"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743"
|
||||||
|
dependencies = [
|
||||||
|
"crc32fast",
|
||||||
|
"miniz_oxide",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fs_extra"
|
||||||
|
version = "1.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures"
|
||||||
|
version = "0.3.28"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40"
|
||||||
|
dependencies = [
|
||||||
|
"futures-channel",
|
||||||
|
"futures-core",
|
||||||
|
"futures-executor",
|
||||||
|
"futures-io",
|
||||||
|
"futures-sink",
|
||||||
|
"futures-task",
|
||||||
|
"futures-util",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-channel"
|
||||||
|
version = "0.3.28"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2"
|
||||||
|
dependencies = [
|
||||||
|
"futures-core",
|
||||||
|
"futures-sink",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-core"
|
||||||
|
version = "0.3.28"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-executor"
|
||||||
|
version = "0.3.28"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0"
|
||||||
|
dependencies = [
|
||||||
|
"futures-core",
|
||||||
|
"futures-task",
|
||||||
|
"futures-util",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-io"
|
||||||
|
version = "0.3.28"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-macro"
|
||||||
|
version = "0.3.28"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-sink"
|
||||||
|
version = "0.3.28"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-task"
|
||||||
|
version = "0.3.28"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-util"
|
||||||
|
version = "0.3.28"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533"
|
||||||
|
dependencies = [
|
||||||
|
"futures-channel",
|
||||||
|
"futures-core",
|
||||||
|
"futures-io",
|
||||||
|
"futures-macro",
|
||||||
|
"futures-sink",
|
||||||
|
"futures-task",
|
||||||
|
"memchr",
|
||||||
|
"pin-project-lite",
|
||||||
|
"pin-utils",
|
||||||
|
"slab",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "generic-array"
|
||||||
|
version = "0.14.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
||||||
|
dependencies = [
|
||||||
|
"typenum",
|
||||||
|
"version_check",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.1.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"wasi 0.9.0+wasi-snapshot-preview1",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.2.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gl_matrix"
|
||||||
|
version = "0.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "df64d0245c589931a0b5a385a63e7db2aeff209bdd471df0417e0f230a4c33ae"
|
||||||
|
dependencies = [
|
||||||
|
"rand",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "glob"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itoa"
|
||||||
|
version = "1.0.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "j4rs"
|
||||||
|
version = "0.17.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "81d7d940f91519a518dd367b0711e6fcb9250a4eccfba98229f40f0d506c4af6"
|
||||||
|
dependencies = [
|
||||||
|
"cesu8",
|
||||||
|
"dirs",
|
||||||
|
"dunce",
|
||||||
|
"fs_extra",
|
||||||
|
"futures",
|
||||||
|
"glob",
|
||||||
|
"java-locator",
|
||||||
|
"jni-sys",
|
||||||
|
"lazy_static",
|
||||||
|
"libc",
|
||||||
|
"libloading",
|
||||||
|
"log",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"sha2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "j_game"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"gl_matrix",
|
||||||
|
"j4rs",
|
||||||
|
"miniquad",
|
||||||
|
"png",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "java-locator"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "90003f2fd9c52f212c21d8520f1128da0080bad6fff16b68fe6e7f2f0c3780c2"
|
||||||
|
dependencies = [
|
||||||
|
"glob",
|
||||||
|
"lazy_static",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jni-sys"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lazy_static"
|
||||||
|
version = "1.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.147"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libloading"
|
||||||
|
version = "0.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d580318f95776505201b28cf98eb1fa5e4be3b689633ba6a3e6cd880ff22d8cb"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "log"
|
||||||
|
version = "0.4.19"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "malloc_buf"
|
||||||
|
version = "0.0.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memchr"
|
||||||
|
version = "2.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "miniquad"
|
||||||
|
version = "0.3.15"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"ndk-sys",
|
||||||
|
"objc",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "miniz_oxide"
|
||||||
|
version = "0.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
|
||||||
|
dependencies = [
|
||||||
|
"adler",
|
||||||
|
"simd-adler32",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ndk-sys"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "objc"
|
||||||
|
version = "0.2.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
|
||||||
|
dependencies = [
|
||||||
|
"malloc_buf",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "option-ext"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pin-project-lite"
|
||||||
|
version = "0.2.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pin-utils"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "png"
|
||||||
|
version = "0.17.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "59871cc5b6cce7eaccca5a802b4173377a1c2ba90654246789a8fa2334426d11"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"crc32fast",
|
||||||
|
"fdeflate",
|
||||||
|
"flate2",
|
||||||
|
"miniz_oxide",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ppv-lite86"
|
||||||
|
version = "0.2.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.66"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.32"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.7.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom 0.1.16",
|
||||||
|
"libc",
|
||||||
|
"rand_chacha",
|
||||||
|
"rand_core",
|
||||||
|
"rand_hc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_chacha"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
|
||||||
|
dependencies = [
|
||||||
|
"ppv-lite86",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom 0.1.16",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_hc"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
||||||
|
dependencies = [
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "redox_syscall"
|
||||||
|
version = "0.2.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "redox_users"
|
||||||
|
version = "0.4.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom 0.2.10",
|
||||||
|
"redox_syscall",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ryu"
|
||||||
|
version = "1.0.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde"
|
||||||
|
version = "1.0.177"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "63ba2516aa6bf82e0b19ca8b50019d52df58455d3cf9bdaf6315225fdd0c560a"
|
||||||
|
dependencies = [
|
||||||
|
"serde_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_derive"
|
||||||
|
version = "1.0.177"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "401797fe7833d72109fedec6bfcbe67c0eed9b99772f26eb8afd261f0abc6fd3"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_json"
|
||||||
|
version = "1.0.104"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c"
|
||||||
|
dependencies = [
|
||||||
|
"itoa",
|
||||||
|
"ryu",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sha2"
|
||||||
|
version = "0.10.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"cpufeatures",
|
||||||
|
"digest",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[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.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "2.0.27"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror"
|
||||||
|
version = "1.0.44"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90"
|
||||||
|
dependencies = [
|
||||||
|
"thiserror-impl",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror-impl"
|
||||||
|
version = "1.0.44"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typenum"
|
||||||
|
version = "1.16.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-ident"
|
||||||
|
version = "1.0.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "version_check"
|
||||||
|
version = "0.9.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.9.0+wasi-snapshot-preview1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||||
|
|
||||||
|
[[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 = "windows-sys"
|
||||||
|
version = "0.48.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-targets"
|
||||||
|
version = "0.48.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_gnullvm",
|
||||||
|
"windows_aarch64_msvc",
|
||||||
|
"windows_i686_gnu",
|
||||||
|
"windows_i686_msvc",
|
||||||
|
"windows_x86_64_gnu",
|
||||||
|
"windows_x86_64_gnullvm",
|
||||||
|
"windows_x86_64_msvc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_gnullvm"
|
||||||
|
version = "0.48.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.48.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.48.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.48.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnu"
|
||||||
|
version = "0.48.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnullvm"
|
||||||
|
version = "0.48.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.48.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
|
14
Cargo.toml
Normal file
14
Cargo.toml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
[package]
|
||||||
|
name = "j_game"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
gl_matrix = "0.0.2"
|
||||||
|
j4rs = "0.17.0"
|
||||||
|
miniquad = { path = '../jucraft/miniquad' }
|
||||||
|
png = "0.17.9"
|
||||||
|
serde = "1.0.177"
|
BIN
assets/images/avatar.png
Normal file
BIN
assets/images/avatar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 80 KiB |
3765
assets/models/Kirche.obj
Normal file
3765
assets/models/Kirche.obj
Normal file
File diff suppressed because it is too large
Load diff
358
assets/models/test.obj
Normal file
358
assets/models/test.obj
Normal file
|
@ -0,0 +1,358 @@
|
||||||
|
# Blender v3.0.1 OBJ File: 'test.blend'
|
||||||
|
# www.blender.org
|
||||||
|
mtllib test.mtl
|
||||||
|
o Cylinder
|
||||||
|
v 0.000000 -1.000000 -1.000000
|
||||||
|
v 0.000000 1.000000 -1.000000
|
||||||
|
v 0.195090 -1.000000 -0.980785
|
||||||
|
v 0.195090 1.000000 -0.980785
|
||||||
|
v 0.382683 -1.000000 -0.923880
|
||||||
|
v 0.382683 1.000000 -0.923880
|
||||||
|
v 0.555570 -1.000000 -0.831470
|
||||||
|
v 0.555570 1.000000 -0.831470
|
||||||
|
v 0.707107 -1.000000 -0.707107
|
||||||
|
v 0.707107 1.000000 -0.707107
|
||||||
|
v 0.831470 -1.000000 -0.555570
|
||||||
|
v 0.831470 1.000000 -0.555570
|
||||||
|
v 0.923880 -1.000000 -0.382683
|
||||||
|
v 0.923880 1.000000 -0.382683
|
||||||
|
v 0.980785 -1.000000 -0.195090
|
||||||
|
v 0.980785 1.000000 -0.195090
|
||||||
|
v 1.000000 -1.000000 0.000000
|
||||||
|
v 1.000000 1.000000 0.000000
|
||||||
|
v 0.980785 -1.000000 0.195090
|
||||||
|
v 0.980785 1.000000 0.195090
|
||||||
|
v 0.923880 -1.000000 0.382683
|
||||||
|
v 0.923880 1.000000 0.382683
|
||||||
|
v 0.831470 -1.000000 0.555570
|
||||||
|
v 0.831470 1.000000 0.555570
|
||||||
|
v 0.707107 -1.000000 0.707107
|
||||||
|
v 0.707107 1.000000 0.707107
|
||||||
|
v 0.555570 -1.000000 0.831470
|
||||||
|
v 0.555570 1.000000 0.831470
|
||||||
|
v 0.382683 -1.000000 0.923880
|
||||||
|
v 0.382683 1.000000 0.923880
|
||||||
|
v 0.195090 -1.000000 0.980785
|
||||||
|
v 0.195090 1.000000 0.980785
|
||||||
|
v -0.000000 -1.000000 1.000000
|
||||||
|
v -0.000000 1.000000 1.000000
|
||||||
|
v -0.195090 -1.000000 0.980785
|
||||||
|
v -0.195090 1.000000 0.980785
|
||||||
|
v -0.382683 -1.000000 0.923880
|
||||||
|
v -0.382683 1.000000 0.923880
|
||||||
|
v -0.555570 -1.000000 0.831470
|
||||||
|
v -0.555570 1.000000 0.831470
|
||||||
|
v -0.707107 -1.000000 0.707107
|
||||||
|
v -0.707107 1.000000 0.707107
|
||||||
|
v -0.831469 -1.000000 0.555570
|
||||||
|
v -0.831469 1.000000 0.555570
|
||||||
|
v -0.923880 -1.000000 0.382684
|
||||||
|
v -0.923880 1.000000 0.382684
|
||||||
|
v -0.980785 -1.000000 0.195090
|
||||||
|
v -0.980785 1.000000 0.195090
|
||||||
|
v -1.000000 -1.000000 -0.000000
|
||||||
|
v -1.000000 1.000000 -0.000000
|
||||||
|
v -0.980785 -1.000000 -0.195090
|
||||||
|
v -0.980785 1.000000 -0.195090
|
||||||
|
v -0.923879 -1.000000 -0.382684
|
||||||
|
v -0.923879 1.000000 -0.382684
|
||||||
|
v -0.831470 -1.000000 -0.555570
|
||||||
|
v -0.831470 1.000000 -0.555570
|
||||||
|
v -0.707107 -1.000000 -0.707107
|
||||||
|
v -0.707107 1.000000 -0.707107
|
||||||
|
v -0.555570 -1.000000 -0.831470
|
||||||
|
v -0.555570 1.000000 -0.831470
|
||||||
|
v -0.382683 -1.000000 -0.923880
|
||||||
|
v -0.382683 1.000000 -0.923880
|
||||||
|
v -0.195090 -1.000000 -0.980785
|
||||||
|
v -0.195090 1.000000 -0.980785
|
||||||
|
vt 1.000000 0.997706
|
||||||
|
vt 0.968750 0.002263
|
||||||
|
vt 1.000000 0.002263
|
||||||
|
vt 0.968750 0.997706
|
||||||
|
vt 0.937500 0.002263
|
||||||
|
vt 0.937500 0.997706
|
||||||
|
vt 0.906250 0.002263
|
||||||
|
vt 0.906250 0.997706
|
||||||
|
vt 0.875000 0.002263
|
||||||
|
vt 0.875000 0.997706
|
||||||
|
vt 0.843750 0.002263
|
||||||
|
vt 0.843750 0.997706
|
||||||
|
vt 0.812500 0.002263
|
||||||
|
vt 0.812500 0.997706
|
||||||
|
vt 0.781250 0.002263
|
||||||
|
vt 0.781250 0.997706
|
||||||
|
vt 0.750000 0.002263
|
||||||
|
vt 0.750000 0.997706
|
||||||
|
vt 0.718750 0.002263
|
||||||
|
vt 0.718750 0.997706
|
||||||
|
vt 0.687500 0.002263
|
||||||
|
vt 0.687500 0.997706
|
||||||
|
vt 0.656250 0.002263
|
||||||
|
vt 0.656250 0.997706
|
||||||
|
vt 0.625000 0.002263
|
||||||
|
vt 0.625000 0.997706
|
||||||
|
vt 0.593750 0.002263
|
||||||
|
vt 0.593750 0.997706
|
||||||
|
vt 0.562500 0.002263
|
||||||
|
vt 0.562500 0.997706
|
||||||
|
vt 0.531250 0.002263
|
||||||
|
vt 0.531250 0.997706
|
||||||
|
vt 0.500000 0.002263
|
||||||
|
vt 0.500000 0.997706
|
||||||
|
vt 0.468750 0.002263
|
||||||
|
vt 0.468750 0.997706
|
||||||
|
vt 0.437500 0.002263
|
||||||
|
vt 0.437500 0.997706
|
||||||
|
vt 0.406250 0.002263
|
||||||
|
vt 0.406250 0.997706
|
||||||
|
vt 0.375000 0.002263
|
||||||
|
vt 0.375000 0.997706
|
||||||
|
vt 0.343750 0.002263
|
||||||
|
vt 0.343750 0.997706
|
||||||
|
vt 0.312500 0.002263
|
||||||
|
vt 0.312500 0.997706
|
||||||
|
vt 0.281250 0.002263
|
||||||
|
vt 0.281250 0.997706
|
||||||
|
vt 0.250000 0.002263
|
||||||
|
vt 0.250000 0.997706
|
||||||
|
vt 0.218750 0.002263
|
||||||
|
vt 0.218750 0.997706
|
||||||
|
vt 0.187500 0.002263
|
||||||
|
vt 0.187500 0.997706
|
||||||
|
vt 0.156250 0.002263
|
||||||
|
vt 0.156250 0.997706
|
||||||
|
vt 0.125000 0.002263
|
||||||
|
vt 0.125000 0.997706
|
||||||
|
vt 0.093750 0.002263
|
||||||
|
vt 0.093750 0.997706
|
||||||
|
vt 0.062500 0.002263
|
||||||
|
vt 0.181687 0.201134
|
||||||
|
vt 0.247276 0.042790
|
||||||
|
vt 0.405620 0.108378
|
||||||
|
vt 0.062500 0.997706
|
||||||
|
vt 0.031250 0.002263
|
||||||
|
vt 0.031250 0.997706
|
||||||
|
vt 0.000000 0.002263
|
||||||
|
vt 0.799411 0.155388
|
||||||
|
vt 0.708963 0.020022
|
||||||
|
vt 0.573596 0.110470
|
||||||
|
vt 0.340032 0.266722
|
||||||
|
vt 0.317297 0.273619
|
||||||
|
vt 0.247276 0.266722
|
||||||
|
vt 0.293654 0.275948
|
||||||
|
vt 0.270010 0.273619
|
||||||
|
vt 0.226323 0.255523
|
||||||
|
vt 0.207958 0.240451
|
||||||
|
vt 0.192886 0.222086
|
||||||
|
vt 0.174791 0.178399
|
||||||
|
vt 0.172462 0.154756
|
||||||
|
vt 0.174791 0.131113
|
||||||
|
vt 0.181687 0.108378
|
||||||
|
vt 0.192886 0.087426
|
||||||
|
vt 0.207958 0.069061
|
||||||
|
vt 0.226323 0.053989
|
||||||
|
vt 0.270010 0.035893
|
||||||
|
vt 0.293654 0.033564
|
||||||
|
vt 0.317297 0.035893
|
||||||
|
vt 0.340032 0.042790
|
||||||
|
vt 0.360984 0.053989
|
||||||
|
vt 0.379349 0.069061
|
||||||
|
vt 0.394421 0.087426
|
||||||
|
vt 0.412516 0.131113
|
||||||
|
vt 0.414845 0.154756
|
||||||
|
vt 0.412516 0.178399
|
||||||
|
vt 0.405620 0.201134
|
||||||
|
vt 0.394421 0.222086
|
||||||
|
vt 0.379349 0.240451
|
||||||
|
vt 0.360984 0.255523
|
||||||
|
vt 0.000000 0.997706
|
||||||
|
vt 0.664045 0.245837
|
||||||
|
vt 0.686504 0.248049
|
||||||
|
vt 0.708963 0.245837
|
||||||
|
vt 0.730558 0.239286
|
||||||
|
vt 0.750461 0.228648
|
||||||
|
vt 0.767906 0.214331
|
||||||
|
vt 0.782222 0.196886
|
||||||
|
vt 0.792861 0.176984
|
||||||
|
vt 0.801624 0.132929
|
||||||
|
vt 0.799411 0.110470
|
||||||
|
vt 0.792861 0.088875
|
||||||
|
vt 0.782222 0.068972
|
||||||
|
vt 0.767906 0.051527
|
||||||
|
vt 0.750461 0.037211
|
||||||
|
vt 0.730558 0.026573
|
||||||
|
vt 0.686504 0.017810
|
||||||
|
vt 0.664045 0.020022
|
||||||
|
vt 0.642450 0.026573
|
||||||
|
vt 0.622547 0.037211
|
||||||
|
vt 0.605102 0.051527
|
||||||
|
vt 0.590786 0.068972
|
||||||
|
vt 0.580147 0.088875
|
||||||
|
vt 0.571384 0.132929
|
||||||
|
vt 0.573596 0.155388
|
||||||
|
vt 0.580147 0.176984
|
||||||
|
vt 0.590786 0.196886
|
||||||
|
vt 0.605102 0.214331
|
||||||
|
vt 0.622547 0.228648
|
||||||
|
vt 0.642450 0.239286
|
||||||
|
vn 0.0980 0.0000 -0.9952
|
||||||
|
vn 0.2903 0.0000 -0.9569
|
||||||
|
vn 0.4714 0.0000 -0.8819
|
||||||
|
vn 0.6344 0.0000 -0.7730
|
||||||
|
vn 0.7730 0.0000 -0.6344
|
||||||
|
vn 0.8819 0.0000 -0.4714
|
||||||
|
vn 0.9569 0.0000 -0.2903
|
||||||
|
vn 0.9952 0.0000 -0.0980
|
||||||
|
vn 0.9952 0.0000 0.0980
|
||||||
|
vn 0.9569 0.0000 0.2903
|
||||||
|
vn 0.8819 0.0000 0.4714
|
||||||
|
vn 0.7730 0.0000 0.6344
|
||||||
|
vn 0.6344 0.0000 0.7730
|
||||||
|
vn 0.4714 0.0000 0.8819
|
||||||
|
vn 0.2903 0.0000 0.9569
|
||||||
|
vn 0.0980 0.0000 0.9952
|
||||||
|
vn -0.0980 0.0000 0.9952
|
||||||
|
vn -0.2903 0.0000 0.9569
|
||||||
|
vn -0.4714 0.0000 0.8819
|
||||||
|
vn -0.6344 0.0000 0.7730
|
||||||
|
vn -0.7730 0.0000 0.6344
|
||||||
|
vn -0.8819 0.0000 0.4714
|
||||||
|
vn -0.9569 0.0000 0.2903
|
||||||
|
vn -0.9952 0.0000 0.0980
|
||||||
|
vn -0.9952 0.0000 -0.0980
|
||||||
|
vn -0.9569 0.0000 -0.2903
|
||||||
|
vn -0.8819 0.0000 -0.4714
|
||||||
|
vn -0.7730 0.0000 -0.6344
|
||||||
|
vn -0.6344 0.0000 -0.7730
|
||||||
|
vn -0.4714 0.0000 -0.8819
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
vn -0.2903 0.0000 -0.9569
|
||||||
|
vn -0.0980 0.0000 -0.9952
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
usemtl Material.001
|
||||||
|
s off
|
||||||
|
f 2/1/1 3/2/1 1/3/1
|
||||||
|
f 4/4/2 5/5/2 3/2/2
|
||||||
|
f 6/6/3 7/7/3 5/5/3
|
||||||
|
f 8/8/4 9/9/4 7/7/4
|
||||||
|
f 10/10/5 11/11/5 9/9/5
|
||||||
|
f 12/12/6 13/13/6 11/11/6
|
||||||
|
f 14/14/7 15/15/7 13/13/7
|
||||||
|
f 16/16/8 17/17/8 15/15/8
|
||||||
|
f 18/18/9 19/19/9 17/17/9
|
||||||
|
f 20/20/10 21/21/10 19/19/10
|
||||||
|
f 22/22/11 23/23/11 21/21/11
|
||||||
|
f 24/24/12 25/25/12 23/23/12
|
||||||
|
f 26/26/13 27/27/13 25/25/13
|
||||||
|
f 28/28/14 29/29/14 27/27/14
|
||||||
|
f 30/30/15 31/31/15 29/29/15
|
||||||
|
f 32/32/16 33/33/16 31/31/16
|
||||||
|
f 34/34/17 35/35/17 33/33/17
|
||||||
|
f 36/36/18 37/37/18 35/35/18
|
||||||
|
f 38/38/19 39/39/19 37/37/19
|
||||||
|
f 40/40/20 41/41/20 39/39/20
|
||||||
|
f 42/42/21 43/43/21 41/41/21
|
||||||
|
f 44/44/22 45/45/22 43/43/22
|
||||||
|
f 46/46/23 47/47/23 45/45/23
|
||||||
|
f 48/48/24 49/49/24 47/47/24
|
||||||
|
f 50/50/25 51/51/25 49/49/25
|
||||||
|
f 52/52/26 53/53/26 51/51/26
|
||||||
|
f 54/54/27 55/55/27 53/53/27
|
||||||
|
f 56/56/28 57/57/28 55/55/28
|
||||||
|
f 58/58/29 59/59/29 57/57/29
|
||||||
|
f 60/60/30 61/61/30 59/59/30
|
||||||
|
f 54/62/31 38/63/31 22/64/31
|
||||||
|
f 62/65/32 63/66/32 61/61/32
|
||||||
|
f 64/67/33 1/68/33 63/66/33
|
||||||
|
f 15/69/34 31/70/34 47/71/34
|
||||||
|
f 2/1/1 4/4/1 3/2/1
|
||||||
|
f 4/4/2 6/6/2 5/5/2
|
||||||
|
f 6/6/3 8/8/3 7/7/3
|
||||||
|
f 8/8/4 10/10/4 9/9/4
|
||||||
|
f 10/10/5 12/12/5 11/11/5
|
||||||
|
f 12/12/6 14/14/6 13/13/6
|
||||||
|
f 14/14/7 16/16/7 15/15/7
|
||||||
|
f 16/16/8 18/18/8 17/17/8
|
||||||
|
f 18/18/9 20/20/9 19/19/9
|
||||||
|
f 20/20/10 22/22/10 21/21/10
|
||||||
|
f 22/22/11 24/24/11 23/23/11
|
||||||
|
f 24/24/12 26/26/12 25/25/12
|
||||||
|
f 26/26/13 28/28/13 27/27/13
|
||||||
|
f 28/28/14 30/30/14 29/29/14
|
||||||
|
f 30/30/15 32/32/15 31/31/15
|
||||||
|
f 32/32/16 34/34/16 33/33/16
|
||||||
|
f 34/34/17 36/36/17 35/35/17
|
||||||
|
f 36/36/18 38/38/18 37/37/18
|
||||||
|
f 38/38/19 40/40/19 39/39/19
|
||||||
|
f 40/40/20 42/42/20 41/41/20
|
||||||
|
f 42/42/21 44/44/21 43/43/21
|
||||||
|
f 44/44/22 46/46/22 45/45/22
|
||||||
|
f 46/46/23 48/48/23 47/47/23
|
||||||
|
f 48/48/24 50/50/24 49/49/24
|
||||||
|
f 50/50/25 52/52/25 51/51/25
|
||||||
|
f 52/52/26 54/54/26 53/53/26
|
||||||
|
f 54/54/27 56/56/27 55/55/27
|
||||||
|
f 56/56/28 58/58/28 57/57/28
|
||||||
|
f 58/58/29 60/60/29 59/59/29
|
||||||
|
f 60/60/30 62/65/30 61/61/30
|
||||||
|
f 6/72/31 4/73/31 62/74/31
|
||||||
|
f 4/73/31 2/75/31 62/74/31
|
||||||
|
f 2/75/31 64/76/31 62/74/31
|
||||||
|
f 62/74/31 60/77/31 58/78/31
|
||||||
|
f 58/78/31 56/79/31 62/74/31
|
||||||
|
f 56/79/31 54/62/31 62/74/31
|
||||||
|
f 54/62/31 52/80/31 50/81/31
|
||||||
|
f 50/81/31 48/82/31 46/83/31
|
||||||
|
f 46/83/31 44/84/31 42/85/31
|
||||||
|
f 42/85/31 40/86/31 38/63/31
|
||||||
|
f 38/63/31 36/87/31 34/88/31
|
||||||
|
f 34/88/31 32/89/31 30/90/31
|
||||||
|
f 30/90/31 28/91/31 26/92/31
|
||||||
|
f 26/92/31 24/93/31 22/64/31
|
||||||
|
f 22/64/31 20/94/31 18/95/31
|
||||||
|
f 18/95/31 16/96/31 14/97/31
|
||||||
|
f 14/97/31 12/98/31 10/99/31
|
||||||
|
f 10/99/31 8/100/31 6/72/31
|
||||||
|
f 54/62/31 50/81/31 38/63/31
|
||||||
|
f 50/81/31 46/83/31 38/63/31
|
||||||
|
f 46/83/31 42/85/31 38/63/31
|
||||||
|
f 38/63/31 34/88/31 30/90/31
|
||||||
|
f 30/90/31 26/92/31 38/63/31
|
||||||
|
f 26/92/31 22/64/31 38/63/31
|
||||||
|
f 22/64/31 18/95/31 6/72/31
|
||||||
|
f 18/95/31 14/97/31 6/72/31
|
||||||
|
f 14/97/31 10/99/31 6/72/31
|
||||||
|
f 6/72/31 62/74/31 54/62/31
|
||||||
|
f 6/72/31 54/62/31 22/64/31
|
||||||
|
f 62/65/32 64/67/32 63/66/32
|
||||||
|
f 64/67/33 2/101/33 1/68/33
|
||||||
|
f 63/102/34 1/103/34 3/104/34
|
||||||
|
f 3/104/34 5/105/34 7/106/34
|
||||||
|
f 7/106/34 9/107/34 11/108/34
|
||||||
|
f 11/108/34 13/109/34 15/69/34
|
||||||
|
f 15/69/34 17/110/34 19/111/34
|
||||||
|
f 19/111/34 21/112/34 23/113/34
|
||||||
|
f 23/113/34 25/114/34 27/115/34
|
||||||
|
f 27/115/34 29/116/34 31/70/34
|
||||||
|
f 31/70/34 33/117/34 35/118/34
|
||||||
|
f 35/118/34 37/119/34 39/120/34
|
||||||
|
f 39/120/34 41/121/34 43/122/34
|
||||||
|
f 43/122/34 45/123/34 47/71/34
|
||||||
|
f 47/71/34 49/124/34 51/125/34
|
||||||
|
f 51/125/34 53/126/34 47/71/34
|
||||||
|
f 53/126/34 55/127/34 47/71/34
|
||||||
|
f 55/127/34 57/128/34 63/102/34
|
||||||
|
f 57/128/34 59/129/34 63/102/34
|
||||||
|
f 59/129/34 61/130/34 63/102/34
|
||||||
|
f 63/102/34 3/104/34 15/69/34
|
||||||
|
f 3/104/34 7/106/34 15/69/34
|
||||||
|
f 7/106/34 11/108/34 15/69/34
|
||||||
|
f 15/69/34 19/111/34 23/113/34
|
||||||
|
f 23/113/34 27/115/34 15/69/34
|
||||||
|
f 27/115/34 31/70/34 15/69/34
|
||||||
|
f 31/70/34 35/118/34 47/71/34
|
||||||
|
f 35/118/34 39/120/34 47/71/34
|
||||||
|
f 39/120/34 43/122/34 47/71/34
|
||||||
|
f 47/71/34 55/127/34 63/102/34
|
||||||
|
f 63/102/34 15/69/34 47/71/34
|
22
assets/shader/default.fsh.glsl
Normal file
22
assets/shader/default.fsh.glsl
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#version 100
|
||||||
|
precision mediump float;
|
||||||
|
|
||||||
|
varying vec2 texcoord;
|
||||||
|
varying vec3 v_normal;
|
||||||
|
varying float v_position;
|
||||||
|
uniform sampler2D u_image0;
|
||||||
|
uniform vec2 fog;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
|
||||||
|
float fogAmount = smoothstep(fog.x, fog.y, v_position);
|
||||||
|
|
||||||
|
float light = -dot(vec3(0.0, -1.0, 0.0), v_normal) / 3.0 + 1.0 + (1.0/3.0);
|
||||||
|
|
||||||
|
gl_FragColor =
|
||||||
|
texture2D(u_image0, texcoord)
|
||||||
|
* vec4(1.0 - fogAmount, 1.0 - fogAmount, 1.0 - fogAmount, 1.0 - fogAmount)
|
||||||
|
* vec4(light, light, light, 1.0);
|
||||||
|
if(gl_FragColor.a < 0.0000001)
|
||||||
|
discard;
|
||||||
|
}
|
30
assets/shader/default.vsh.glsl
Normal file
30
assets/shader/default.vsh.glsl
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#version 100
|
||||||
|
precision mediump float;
|
||||||
|
|
||||||
|
attribute vec3 pos;
|
||||||
|
attribute vec2 uv;
|
||||||
|
attribute vec3 normal;
|
||||||
|
uniform vec3 wpos;
|
||||||
|
|
||||||
|
varying vec2 texcoord;
|
||||||
|
varying vec3 v_normal;
|
||||||
|
varying float v_position;
|
||||||
|
|
||||||
|
uniform mat4 view;
|
||||||
|
uniform mat4 proj;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
mat4 drawProj = mat4(
|
||||||
|
vec4(-1.0, 0.0, 0.0, 0.0),
|
||||||
|
vec4(0.0, 1.0, 0.0, 0.0),
|
||||||
|
vec4(0.0, 0.0, -1.0, 0.0),
|
||||||
|
vec4(-wpos.x, wpos.y, -wpos.z, 1.0)
|
||||||
|
);
|
||||||
|
texcoord = uv;
|
||||||
|
|
||||||
|
v_normal = normal;
|
||||||
|
|
||||||
|
gl_Position = proj * view * drawProj * vec4(pos, 1.0);
|
||||||
|
|
||||||
|
v_position = length((view * drawProj * vec4(pos, 1.0)).xyz);
|
||||||
|
}
|
BIN
bots/MyBot.class
Normal file
BIN
bots/MyBot.class
Normal file
Binary file not shown.
39
bots/MyBot.java
Normal file
39
bots/MyBot.java
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
package bots;
|
||||||
|
|
||||||
|
import javaState.Bot;
|
||||||
|
import javaState.Controller;
|
||||||
|
import javaState.GameState;
|
||||||
|
|
||||||
|
public class MyBot extends Bot {
|
||||||
|
|
||||||
|
float dir = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getStudentName() {
|
||||||
|
return "Max Mustermann";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMatrikel() {
|
||||||
|
return 1337;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "example Bot";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(GameState state) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Controller executeTurn(GameState state, Controller controller) {
|
||||||
|
dir+=0.01;
|
||||||
|
controller.dirX = Math.cos(dir);
|
||||||
|
controller.dirY = Math.sin(dir);
|
||||||
|
|
||||||
|
return controller;
|
||||||
|
}
|
||||||
|
}
|
BIN
javaState/Bot.class
Normal file
BIN
javaState/Bot.class
Normal file
Binary file not shown.
13
javaState/Bot.java
Normal file
13
javaState/Bot.java
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
package javaState;
|
||||||
|
|
||||||
|
public abstract class Bot extends Player{
|
||||||
|
|
||||||
|
public abstract String getStudentName();
|
||||||
|
|
||||||
|
public abstract int getMatrikel();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final PlayerType getType() {
|
||||||
|
return PlayerType.AI;
|
||||||
|
}
|
||||||
|
}
|
BIN
javaState/Controller.class
Normal file
BIN
javaState/Controller.class
Normal file
Binary file not shown.
10
javaState/Controller.java
Normal file
10
javaState/Controller.java
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
package javaState;
|
||||||
|
|
||||||
|
public class Controller {
|
||||||
|
public double dirX = 0;
|
||||||
|
public double dirY = 0;
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return "[" + dirX + ", " + dirY + "]";
|
||||||
|
}
|
||||||
|
}
|
BIN
javaState/GameState.class
Normal file
BIN
javaState/GameState.class
Normal file
Binary file not shown.
7
javaState/GameState.java
Normal file
7
javaState/GameState.java
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
package javaState;
|
||||||
|
|
||||||
|
public class GameState {
|
||||||
|
public double posX = 0;
|
||||||
|
public double posY = 0;
|
||||||
|
|
||||||
|
}
|
BIN
javaState/Player$PlayerType.class
Normal file
BIN
javaState/Player$PlayerType.class
Normal file
Binary file not shown.
BIN
javaState/Player.class
Normal file
BIN
javaState/Player.class
Normal file
Binary file not shown.
20
javaState/Player.java
Normal file
20
javaState/Player.java
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
package javaState;
|
||||||
|
|
||||||
|
public abstract class Player {
|
||||||
|
|
||||||
|
enum PlayerType{
|
||||||
|
Human,
|
||||||
|
AI
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract String getName();
|
||||||
|
|
||||||
|
public abstract void init(GameState state);
|
||||||
|
|
||||||
|
public abstract Controller executeTurn(GameState state, Controller controller);
|
||||||
|
|
||||||
|
public abstract PlayerType getType();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
61
src/game.rs
Normal file
61
src/game.rs
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use std::vec;
|
||||||
|
|
||||||
|
use self::bots::*;
|
||||||
|
use self::player::Player;
|
||||||
|
|
||||||
|
mod bots;
|
||||||
|
mod player;
|
||||||
|
|
||||||
|
pub struct Game {
|
||||||
|
bots: Vec<Bot>,
|
||||||
|
bot_names: HashMap<String, usize>,
|
||||||
|
pub players: Vec<Player>
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Game {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let mut out = Self {
|
||||||
|
bots: vec![],
|
||||||
|
players: vec![],
|
||||||
|
bot_names: HashMap::new()
|
||||||
|
};
|
||||||
|
|
||||||
|
out.load_bots(".".to_string());
|
||||||
|
|
||||||
|
out
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn load_bots(&mut self, classpath: String) {
|
||||||
|
for cl in list_bot_classes() {
|
||||||
|
let bot = Bot::new(&cl, &classpath);
|
||||||
|
if bot.is_ok() {
|
||||||
|
let mut bot: Bot = bot.unwrap();
|
||||||
|
let name = bot.get_name();
|
||||||
|
if !self.bot_names.contains_key(&name) {
|
||||||
|
println!("Loaded Bot: „{}”", name);
|
||||||
|
self.bot_names.insert(name, self.bots.len());
|
||||||
|
self.bots.push(bot);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn add_player(&mut self, bot: usize) {
|
||||||
|
self.players.push(Player::new(bot));
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn tick(&mut self){
|
||||||
|
for p in self.players.iter_mut(){
|
||||||
|
let state = GameState{
|
||||||
|
posX: p.x,
|
||||||
|
posY: p.y,
|
||||||
|
};
|
||||||
|
let cont = self.bots[p.get_bot()].tick(&state);
|
||||||
|
p.dir_x = cont.dirX;
|
||||||
|
p.dir_y = cont.dirY;
|
||||||
|
p.move_player(0.05);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
75
src/game/bots.rs
Normal file
75
src/game/bots.rs
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
use j4rs::{errors::J4RsError, *};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::fs;
|
||||||
|
|
||||||
|
pub struct Bot {
|
||||||
|
jvm: Jvm,
|
||||||
|
bot: Instance,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
pub struct Controller {
|
||||||
|
pub dirX: f64,
|
||||||
|
pub dirY: f64,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
pub struct GameState {
|
||||||
|
pub posX: f64,
|
||||||
|
pub posY: f64,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Bot {
|
||||||
|
pub fn new(name: &String, classpath: &String) -> Result<Self, J4RsError> {
|
||||||
|
let jvm = JvmBuilder::new()
|
||||||
|
.classpath_entries(vec![
|
||||||
|
ClasspathEntry::new(classpath),
|
||||||
|
ClasspathEntry::new("./javaState.jar"),
|
||||||
|
])
|
||||||
|
.build()?;
|
||||||
|
let bot = jvm.create_instance(&name, &[])?;
|
||||||
|
jvm.cast(&bot, "javaState.Bot")?;
|
||||||
|
Ok(Bot { jvm, bot })
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_name(&mut self) -> String {
|
||||||
|
let result = self.jvm.invoke(&self.bot, "getName", &[]).unwrap();
|
||||||
|
self.jvm.to_rust(result).unwrap()
|
||||||
|
}
|
||||||
|
pub fn tick(&mut self, state: &GameState) -> Controller {
|
||||||
|
|
||||||
|
let controller = Controller {
|
||||||
|
dirX: 1.0,
|
||||||
|
dirY: 0.0,
|
||||||
|
};
|
||||||
|
let j_controller = InvocationArg::new(&controller, "javaState.Controller");
|
||||||
|
let j_gamestate = InvocationArg::new(state, "javaState.GameState");
|
||||||
|
|
||||||
|
let j_ret_controller = self.jvm
|
||||||
|
.invoke(&self.bot, "executeTurn", &[j_gamestate, j_controller])
|
||||||
|
.unwrap();
|
||||||
|
let controller2: Controller = self.jvm.to_rust(j_ret_controller).unwrap();
|
||||||
|
controller2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn list_bot_classes() -> Vec<String> {
|
||||||
|
let mut out: Vec<String> = vec![];
|
||||||
|
|
||||||
|
if let Ok(paths) = fs::read_dir("./bots") {
|
||||||
|
for path in paths {
|
||||||
|
if let Ok(p) = path {
|
||||||
|
if p.path().is_file() {
|
||||||
|
if p.path().extension().unwrap() == "class" {
|
||||||
|
let mut str = String::from("bots.");
|
||||||
|
str.push_str(p.path().file_stem().unwrap().to_str().unwrap());
|
||||||
|
out.push(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out
|
||||||
|
}
|
27
src/game/player.rs
Normal file
27
src/game/player.rs
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
pub struct Player {
|
||||||
|
pub x: f64,
|
||||||
|
pub y: f64,
|
||||||
|
pub dir_x: f64,
|
||||||
|
pub dir_y: f64,
|
||||||
|
bot: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Player {
|
||||||
|
pub fn new(bot: usize) -> Self {
|
||||||
|
Self {
|
||||||
|
x: 0.,
|
||||||
|
y: 0.,
|
||||||
|
dir_x: 0.,
|
||||||
|
dir_y: 0.,
|
||||||
|
bot
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub fn move_player(&mut self, delta: f64) {
|
||||||
|
self.x += self.dir_x * delta;
|
||||||
|
self.y += self.dir_y * delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_bot(&self) -> usize{
|
||||||
|
self.bot
|
||||||
|
}
|
||||||
|
}
|
48
src/main.rs
Normal file
48
src/main.rs
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
use std::env;
|
||||||
|
|
||||||
|
use game::Game;
|
||||||
|
use j4rs::{
|
||||||
|
jni_sys::{jint, JavaVM},
|
||||||
|
prelude::jobject,
|
||||||
|
};
|
||||||
|
use miniquad::*;
|
||||||
|
use no_stage::NoStage;
|
||||||
|
use stage::Stage;
|
||||||
|
use tools::parse_arg;
|
||||||
|
|
||||||
|
mod game;
|
||||||
|
mod no_stage;
|
||||||
|
mod stage;
|
||||||
|
mod tools;
|
||||||
|
mod render_tools;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let args = parse_arg(env::args().collect());
|
||||||
|
let mut game = Game::new();
|
||||||
|
|
||||||
|
game.add_player(0);
|
||||||
|
|
||||||
|
if args.contains_key("n") {
|
||||||
|
let mut no_stage = NoStage::new(game);
|
||||||
|
no_stage.run();
|
||||||
|
} else {
|
||||||
|
start(
|
||||||
|
conf::Conf {
|
||||||
|
window_title: "Jucraft".to_string(),
|
||||||
|
window_height: 900,
|
||||||
|
window_width: 900 * 16 / 9,
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
move |mut ctx| Box::new(Stage::new(&mut ctx, game)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const JNI_VERSION_1_6: jint = 0x00010006;
|
||||||
|
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn jni_onload(env: *mut JavaVM, _reserved: jobject) -> jint {
|
||||||
|
j4rs::set_java_vm(env);
|
||||||
|
JNI_VERSION_1_6
|
||||||
|
}
|
22
src/no_stage.rs
Normal file
22
src/no_stage.rs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
use crate::game::Game;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
pub struct NoStage {
|
||||||
|
game: Game
|
||||||
|
}
|
||||||
|
|
||||||
|
impl NoStage{
|
||||||
|
pub fn new(game: Game) -> Self {
|
||||||
|
Self {
|
||||||
|
game
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
impl NoStage{
|
||||||
|
pub fn run(&mut self){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
12
src/render_tools.rs
Normal file
12
src/render_tools.rs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
use gl_matrix::common::{Vec3, Vec2};
|
||||||
|
|
||||||
|
pub mod graphics;
|
||||||
|
pub mod default_solid_shader;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct Vertex {
|
||||||
|
pub pos: Vec3,
|
||||||
|
pub normal: Vec3,
|
||||||
|
pub uv: Vec2
|
||||||
|
}
|
28
src/render_tools/default_solid_shader.rs
Normal file
28
src/render_tools/default_solid_shader.rs
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
use gl_matrix::common::*;
|
||||||
|
use miniquad::*;
|
||||||
|
|
||||||
|
pub const VERTEX: &str = include_str!(concat!("../../assets/shader/default.vsh.glsl"));
|
||||||
|
|
||||||
|
pub const FRAGMENT: &str = include_str!(concat!("../../assets/shader/default.fsh.glsl"));
|
||||||
|
|
||||||
|
pub fn meta() -> ShaderMeta {
|
||||||
|
ShaderMeta {
|
||||||
|
images: vec!["u_image0".to_string()],
|
||||||
|
uniforms: UniformBlockLayout {
|
||||||
|
uniforms: vec![
|
||||||
|
UniformDesc::new("view", UniformType::Mat4),
|
||||||
|
UniformDesc::new("proj", UniformType::Mat4),
|
||||||
|
UniformDesc::new("fog", UniformType::Float2),
|
||||||
|
UniformDesc::new("wpos", UniformType::Float3),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct Uniforms {
|
||||||
|
pub view: Mat4,
|
||||||
|
pub proj: Mat4,
|
||||||
|
pub fog: Vec2,
|
||||||
|
pub wpos: Vec3,
|
||||||
|
}
|
182
src/render_tools/graphics.rs
Normal file
182
src/render_tools/graphics.rs
Normal file
|
@ -0,0 +1,182 @@
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use gl_matrix::common::{Vec2, Vec3};
|
||||||
|
use miniquad::*;
|
||||||
|
|
||||||
|
use super::Vertex;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct Graphics {
|
||||||
|
pub textures: HashMap<String, Texture>,
|
||||||
|
pub pipelines: HashMap<String, Pipeline>,
|
||||||
|
pub models: HashMap<String, (Buffer, Buffer, usize)>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Graphics {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Graphics {
|
||||||
|
textures: HashMap::new(),
|
||||||
|
pipelines: HashMap::new(),
|
||||||
|
models: HashMap::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub fn load_texture(&mut self, ctx: &mut Context, bytes: &[u8], id: String) -> Texture {
|
||||||
|
let decoder = png::Decoder::new(bytes);
|
||||||
|
let mut reader = decoder.read_info().unwrap();
|
||||||
|
let mut buf = vec![0; reader.output_buffer_size()];
|
||||||
|
let info = reader.next_frame(&mut buf).unwrap();
|
||||||
|
let bytes = &buf[..info.buffer_size()];
|
||||||
|
let text = Texture::from_data_and_format(
|
||||||
|
ctx,
|
||||||
|
bytes,
|
||||||
|
TextureParams {
|
||||||
|
format: TextureFormat::RGBA8,
|
||||||
|
wrap: TextureWrap::Repeat,
|
||||||
|
filter: FilterMode::Nearest,
|
||||||
|
width: info.width,
|
||||||
|
height: info.height,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
//text.set_filter_min_mag(ctx, FilterMode::Linear, FilterMode::Nearest);
|
||||||
|
|
||||||
|
self.textures.insert(id, text);
|
||||||
|
|
||||||
|
text
|
||||||
|
}
|
||||||
|
pub fn add_pipeline(&mut self, pipeline: Pipeline, id: String) {
|
||||||
|
self.pipelines.insert(id, pipeline);
|
||||||
|
}
|
||||||
|
pub fn add_model(
|
||||||
|
&mut self,
|
||||||
|
ctx: &mut Context,
|
||||||
|
vertices: Vec<Vertex>,
|
||||||
|
indices: Vec<i32>,
|
||||||
|
id: String,
|
||||||
|
) {
|
||||||
|
let vertex_buffer = Buffer::immutable(ctx, BufferType::VertexBuffer, &vertices);
|
||||||
|
let index_buffer = Buffer::immutable(ctx, BufferType::IndexBuffer, &indices);
|
||||||
|
self.models
|
||||||
|
.insert(id, (vertex_buffer, index_buffer, indices.len()));
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn add_model_obj(&mut self, ctx: &mut Context, txt: String, id: String) {
|
||||||
|
let mut vertices: Vec<Vertex> = vec![];
|
||||||
|
let mut indices: Vec<i32> = vec![];
|
||||||
|
let mut verts: Vec<Vec3> = vec![];
|
||||||
|
let mut texts: Vec<Vec2> = vec![];
|
||||||
|
let mut normals: Vec<Vec3> = vec![];
|
||||||
|
'lloop: for line in txt.lines() {
|
||||||
|
if line.starts_with("v ") {
|
||||||
|
verts.push(parse_vec3(String::from(line)));
|
||||||
|
} else if line.starts_with("vt ") {
|
||||||
|
texts.push(parse_vec2(String::from(line)));
|
||||||
|
} else if line.starts_with("vn ") {
|
||||||
|
normals.push(parse_vec3(String::from(line)));
|
||||||
|
} else if line.starts_with("f ") {
|
||||||
|
let words: Vec<&str> = line.split(" ").collect();
|
||||||
|
if words.len() < 4 {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let mut local_verts: Vec<Vertex> = vec![];
|
||||||
|
|
||||||
|
for i in 1..words.len() {
|
||||||
|
let vert = parse_vertex(String::from(words[i]), &verts, &texts, &normals);
|
||||||
|
if vert.is_none() {
|
||||||
|
println!("err");
|
||||||
|
continue 'lloop;
|
||||||
|
}
|
||||||
|
local_verts.push(vert.unwrap());
|
||||||
|
}
|
||||||
|
if local_verts.len() != 3 {
|
||||||
|
println!("Skipp not triangulated Face");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let index_offset = vertices.len() as i32;
|
||||||
|
let index_amount = local_verts.len() as i32;
|
||||||
|
for vert in local_verts {
|
||||||
|
vertices.push(vert);
|
||||||
|
}
|
||||||
|
for i in 0..index_amount {
|
||||||
|
indices.push(index_offset + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//println!("verts: {:?}", vertices);
|
||||||
|
//println!("indecies: {:?}", indices);
|
||||||
|
let vertex_buffer = Buffer::immutable(ctx, BufferType::VertexBuffer, &vertices);
|
||||||
|
let index_buffer = Buffer::immutable(ctx, BufferType::IndexBuffer, &indices);
|
||||||
|
self.models
|
||||||
|
.insert(id, (vertex_buffer, index_buffer, indices.len()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_vertex(
|
||||||
|
text: String,
|
||||||
|
verts: &Vec<Vec3>,
|
||||||
|
texts: &Vec<Vec2>,
|
||||||
|
normals: &Vec<Vec3>,
|
||||||
|
) -> Option<Vertex> {
|
||||||
|
let words: Vec<&str> = text.split("/").collect();
|
||||||
|
let mut out: Vertex = Vertex {
|
||||||
|
pos: [0.0; 3],
|
||||||
|
normal: [0.0; 3],
|
||||||
|
uv: [0.0; 2],
|
||||||
|
};
|
||||||
|
if words.len() == 1 || words.len() == 3 {
|
||||||
|
let v_index: isize = words[0].parse().unwrap_or(-1);
|
||||||
|
if v_index < 0 {
|
||||||
|
println!("pos err");
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
out.pos = verts.get(v_index as usize - 1).unwrap_or(&[0.0; 3]).clone();
|
||||||
|
|
||||||
|
if words.len() == 3 && words[1].len() > 0 {
|
||||||
|
let v_index: isize = words[1].parse().unwrap_or(-1);
|
||||||
|
//println!("m: {}", v_index);
|
||||||
|
if v_index < 0 {
|
||||||
|
println!("uv err");
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
out.uv = texts.get(v_index as usize - 1).unwrap_or(&[0.0; 2]).clone();
|
||||||
|
}
|
||||||
|
if words.len() == 3 {
|
||||||
|
let v_index: isize = words[2].parse().unwrap_or(-1);
|
||||||
|
if v_index < 0 {
|
||||||
|
println!("normal err");
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
out.normal = normals
|
||||||
|
.get(v_index as usize - 1)
|
||||||
|
.unwrap_or(&[0.0; 3])
|
||||||
|
.clone();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
Some(out)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_vec2(line: String) -> Vec2 {
|
||||||
|
let words: Vec<&str> = line.split(" ").collect();
|
||||||
|
let mut out: Vec2 = [0.0; 2];
|
||||||
|
for i in 0..2 {
|
||||||
|
if i >= words.len() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
out[i] = words[i + 1].parse().unwrap_or(0.0);
|
||||||
|
}
|
||||||
|
out[1] = -out[1] + 1.;
|
||||||
|
out
|
||||||
|
}
|
||||||
|
fn parse_vec3(line: String) -> Vec3 {
|
||||||
|
let words: Vec<&str> = line.split(" ").collect();
|
||||||
|
let mut out: Vec3 = [0.0; 3];
|
||||||
|
for i in 0..3 {
|
||||||
|
if i >= words.len() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
out[i] = words[i + 1].parse().unwrap_or(0.0);
|
||||||
|
}
|
||||||
|
out
|
||||||
|
}
|
283
src/stage.rs
Normal file
283
src/stage.rs
Normal file
|
@ -0,0 +1,283 @@
|
||||||
|
use gl_matrix::common::{Vec2, Vec3, PI};
|
||||||
|
use gl_matrix::mat4;
|
||||||
|
use miniquad::*;
|
||||||
|
|
||||||
|
use crate::game::Game;
|
||||||
|
|
||||||
|
use crate::render_tools::default_solid_shader;
|
||||||
|
use crate::render_tools::graphics::Graphics;
|
||||||
|
use crate::tools::Sides;
|
||||||
|
|
||||||
|
pub struct Player {
|
||||||
|
pub rot: Vec2,
|
||||||
|
pub pos: Vec3,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Stage {
|
||||||
|
game: Game,
|
||||||
|
graphics: Graphics,
|
||||||
|
pipeline: Pipeline,
|
||||||
|
player: Player,
|
||||||
|
mouse_grab: bool,
|
||||||
|
fullscreen: bool,
|
||||||
|
s_move: Sides<bool>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Stage {
|
||||||
|
pub fn new(ctx: &mut Context, game: Game) -> Self {
|
||||||
|
let mut graphics = Graphics::new();
|
||||||
|
|
||||||
|
graphics.add_model_obj(
|
||||||
|
ctx,
|
||||||
|
String::from(include_str!(concat!("../assets/models/Kirche.obj"))),
|
||||||
|
"test".to_string(),
|
||||||
|
);
|
||||||
|
|
||||||
|
graphics.load_texture(
|
||||||
|
ctx,
|
||||||
|
include_bytes!(concat!("../assets/images/avatar.png")),
|
||||||
|
"avatar".to_string(),
|
||||||
|
);
|
||||||
|
|
||||||
|
let shader = Shader::new(
|
||||||
|
ctx,
|
||||||
|
default_solid_shader::VERTEX,
|
||||||
|
default_solid_shader::FRAGMENT,
|
||||||
|
default_solid_shader::meta(),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let pipeline = Pipeline::with_params(
|
||||||
|
ctx,
|
||||||
|
&[BufferLayout::default()],
|
||||||
|
&[
|
||||||
|
VertexAttribute::with_buffer("pos", VertexFormat::Float3, 0),
|
||||||
|
VertexAttribute::with_buffer("normal", VertexFormat::Float3, 0),
|
||||||
|
VertexAttribute::with_buffer("uv", VertexFormat::Float2, 0),
|
||||||
|
],
|
||||||
|
shader,
|
||||||
|
PipelineParams {
|
||||||
|
depth_test: Comparison::LessOrEqual,
|
||||||
|
depth_write: true,
|
||||||
|
cull_face: CullFace::Back,
|
||||||
|
front_face_order: FrontFaceOrder::CounterClockwise,
|
||||||
|
color_blend: Some(BlendState::new(
|
||||||
|
Equation::Add,
|
||||||
|
BlendFactor::One,
|
||||||
|
BlendFactor::OneMinusValue(BlendValue::SourceAlpha),
|
||||||
|
)),
|
||||||
|
alpha_blend: Some(BlendState::new(
|
||||||
|
Equation::Add,
|
||||||
|
BlendFactor::One,
|
||||||
|
BlendFactor::Zero,
|
||||||
|
)),
|
||||||
|
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
Self {
|
||||||
|
game,
|
||||||
|
graphics,
|
||||||
|
pipeline,
|
||||||
|
player: Player {
|
||||||
|
rot: [0., 0.],
|
||||||
|
pos: [0., 0., -4.],
|
||||||
|
},
|
||||||
|
s_move: Sides::all(false),
|
||||||
|
mouse_grab: false,
|
||||||
|
fullscreen: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl EventHandler for Stage {
|
||||||
|
fn update(&mut self, ctx: &mut Context) {
|
||||||
|
let delta_s = 1. / 60.;
|
||||||
|
|
||||||
|
if self.s_move.top {
|
||||||
|
self.player.pos[1] += delta_s * 10.0;
|
||||||
|
}
|
||||||
|
if self.s_move.bottom {
|
||||||
|
self.player.pos[1] -= delta_s * 10.0;
|
||||||
|
}
|
||||||
|
if self.s_move.front {
|
||||||
|
self.player.pos[2] += self.player.rot[1].to_radians().cos() * delta_s * 10.0;
|
||||||
|
self.player.pos[0] -= self.player.rot[1].to_radians().sin() * delta_s * 10.0;
|
||||||
|
}
|
||||||
|
if self.s_move.back {
|
||||||
|
self.player.pos[2] -= self.player.rot[1].to_radians().cos() * delta_s * 10.0;
|
||||||
|
self.player.pos[0] += self.player.rot[1].to_radians().sin() * delta_s * 10.0;
|
||||||
|
}
|
||||||
|
if self.s_move.left {
|
||||||
|
self.player.pos[2] += self.player.rot[1].to_radians().sin() * delta_s * 10.0;
|
||||||
|
self.player.pos[0] += self.player.rot[1].to_radians().cos() * delta_s * 10.0;
|
||||||
|
}
|
||||||
|
if self.s_move.right {
|
||||||
|
self.player.pos[2] -= self.player.rot[1].to_radians().sin() * delta_s * 10.0;
|
||||||
|
self.player.pos[0] -= self.player.rot[1].to_radians().cos() * delta_s * 10.0;
|
||||||
|
}
|
||||||
|
self.game.tick();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn draw(&mut self, ctx: &mut Context) {
|
||||||
|
ctx.begin_default_pass(PassAction::clear_color(0.75, 0.85, 0.8, 1.0));
|
||||||
|
|
||||||
|
//render
|
||||||
|
ctx.apply_pipeline(&self.pipeline);
|
||||||
|
let (w, h) = ctx.screen_size();
|
||||||
|
let mut proj_matrix = mat4::create();
|
||||||
|
mat4::perspective(
|
||||||
|
&mut proj_matrix,
|
||||||
|
90.0f32.to_radians(),
|
||||||
|
w as f32 / h as f32,
|
||||||
|
0.1,
|
||||||
|
Some(10000.0),
|
||||||
|
);
|
||||||
|
|
||||||
|
let mut cammat = mat4::create();
|
||||||
|
let mut cammat1 = mat4::create();
|
||||||
|
|
||||||
|
mat4::identity(&mut cammat);
|
||||||
|
mat4::rotate_x(&mut cammat1, &cammat, -(self.player.rot[0] / 180. * PI));
|
||||||
|
mat4::rotate_y(&mut cammat, &cammat1, self.player.rot[1] / 180. * PI);
|
||||||
|
mat4::translate(
|
||||||
|
&mut cammat1,
|
||||||
|
&cammat,
|
||||||
|
&[
|
||||||
|
self.player.pos[0],
|
||||||
|
-self.player.pos[1], // - self.player.eyes,
|
||||||
|
self.player.pos[2],
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
let mut view_matrix = mat4::create();
|
||||||
|
mat4::look_at(
|
||||||
|
&mut view_matrix,
|
||||||
|
&[0., 0., 0.],
|
||||||
|
&[0., 0., 0.],
|
||||||
|
&[0., 0., 0.],
|
||||||
|
);
|
||||||
|
mat4::multiply(&mut cammat, &cammat1, &view_matrix);
|
||||||
|
|
||||||
|
ctx.apply_uniforms(&default_solid_shader::Uniforms {
|
||||||
|
proj: proj_matrix,
|
||||||
|
view: cammat,
|
||||||
|
fog: [140.0, 160.0],
|
||||||
|
wpos: [
|
||||||
|
self.game.players[0].x as f32,
|
||||||
|
0.,
|
||||||
|
self.game.players[0].y as f32,
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
ctx.apply_bindings(&Bindings {
|
||||||
|
vertex_buffers: vec![self.graphics.models["test"].0].clone(),
|
||||||
|
index_buffer: self.graphics.models["test"].1,
|
||||||
|
images: vec![self.graphics.textures["avatar"]],
|
||||||
|
});
|
||||||
|
ctx.draw(0, self.graphics.models["test"].2 as i32, 1);
|
||||||
|
|
||||||
|
ctx.end_render_pass();
|
||||||
|
ctx.commit_frame();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn key_down_event(
|
||||||
|
&mut self,
|
||||||
|
_ctx: &mut Context,
|
||||||
|
keycode: KeyCode,
|
||||||
|
_keymods: KeyMods,
|
||||||
|
_repeatt: bool,
|
||||||
|
) {
|
||||||
|
if keycode == KeyCode::Space {
|
||||||
|
self.s_move.top = true;
|
||||||
|
} else if keycode == KeyCode::LeftShift {
|
||||||
|
self.s_move.bottom = true;
|
||||||
|
} else if keycode == KeyCode::W {
|
||||||
|
self.s_move.front = true;
|
||||||
|
} else if keycode == KeyCode::A {
|
||||||
|
self.s_move.left = true;
|
||||||
|
} else if keycode == KeyCode::S {
|
||||||
|
self.s_move.back = true;
|
||||||
|
} else if keycode == KeyCode::D {
|
||||||
|
self.s_move.right = true;
|
||||||
|
} else if keycode == KeyCode::K {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn key_up_event(&mut self, ctx: &mut Context, keycode: KeyCode, _keymods: KeyMods) {
|
||||||
|
if keycode == KeyCode::F11 {
|
||||||
|
if self.fullscreen {
|
||||||
|
ctx.set_fullscreen(false);
|
||||||
|
ctx.set_window_size(1000, 800);
|
||||||
|
self.fullscreen = false;
|
||||||
|
} else {
|
||||||
|
ctx.set_fullscreen(true);
|
||||||
|
self.fullscreen = true;
|
||||||
|
}
|
||||||
|
if self.mouse_grab {
|
||||||
|
//println!("reloc");
|
||||||
|
ctx.set_cursor_grab(false);
|
||||||
|
ctx.show_mouse(true);
|
||||||
|
self.mouse_grab = false;
|
||||||
|
}
|
||||||
|
} else if keycode == KeyCode::Escape {
|
||||||
|
ctx.set_cursor_grab(false);
|
||||||
|
ctx.show_mouse(true);
|
||||||
|
self.mouse_grab = false;
|
||||||
|
} else if keycode == KeyCode::Space {
|
||||||
|
self.s_move.top = false;
|
||||||
|
} else if keycode == KeyCode::LeftShift {
|
||||||
|
self.s_move.bottom = false;
|
||||||
|
} else if keycode == KeyCode::W {
|
||||||
|
self.s_move.front = false;
|
||||||
|
} else if keycode == KeyCode::A {
|
||||||
|
self.s_move.left = false;
|
||||||
|
} else if keycode == KeyCode::S {
|
||||||
|
self.s_move.back = false;
|
||||||
|
} else if keycode == KeyCode::D {
|
||||||
|
self.s_move.right = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn window_minimized_event(&mut self, ctx: &mut Context) {
|
||||||
|
ctx.set_cursor_grab(false);
|
||||||
|
ctx.show_mouse(true);
|
||||||
|
self.mouse_grab = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn mouse_button_down_event(
|
||||||
|
&mut self,
|
||||||
|
ctx: &mut Context,
|
||||||
|
button: MouseButton,
|
||||||
|
_x: f32,
|
||||||
|
_y: f32,
|
||||||
|
) {
|
||||||
|
if button == MouseButton::Left {
|
||||||
|
if !self.mouse_grab {
|
||||||
|
ctx.set_cursor_grab(true);
|
||||||
|
ctx.show_mouse(false);
|
||||||
|
self.mouse_grab = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn raw_mouse_motion(&mut self, _ctx: &mut Context, x: f32, y: f32) {
|
||||||
|
if self.mouse_grab {
|
||||||
|
self.player.rot[0] -= y / 10.0;
|
||||||
|
self.player.rot[1] += x / 10.0;
|
||||||
|
}
|
||||||
|
if self.player.rot[0] > 90.0 {
|
||||||
|
self.player.rot[0] = 90.;
|
||||||
|
}
|
||||||
|
if self.player.rot[0] < -90.0 {
|
||||||
|
self.player.rot[0] = -90.;
|
||||||
|
}
|
||||||
|
if self.player.rot[1] > 180.0 {
|
||||||
|
self.player.rot[1] -= 360.;
|
||||||
|
}
|
||||||
|
if self.player.rot[1] < -180.0 {
|
||||||
|
self.player.rot[1] += 360.;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
43
src/tools.rs
Normal file
43
src/tools.rs
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
pub fn parse_arg(args: Vec<String>) -> HashMap<String, String> {
|
||||||
|
let mut map: HashMap<String, String> = HashMap::new();
|
||||||
|
let mut index = String::new();
|
||||||
|
|
||||||
|
for val in args {
|
||||||
|
if val.starts_with('-') {
|
||||||
|
if !index.is_empty() {
|
||||||
|
map.insert(String::from(&index), String::from(""));
|
||||||
|
index.clear();
|
||||||
|
}
|
||||||
|
index = val[1..].to_string();
|
||||||
|
} else if !index.is_empty() {
|
||||||
|
map.insert(index.clone(), val);
|
||||||
|
index.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !index.is_empty() {
|
||||||
|
map.insert(index, String::from(""));
|
||||||
|
}
|
||||||
|
|
||||||
|
map
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct Sides<T: Copy + PartialEq> {
|
||||||
|
pub top: T,
|
||||||
|
pub bottom: T,
|
||||||
|
pub left: T,
|
||||||
|
pub right: T,
|
||||||
|
pub front: T,
|
||||||
|
pub back: T,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: Copy + PartialEq> Sides<T> {
|
||||||
|
pub fn all(v: T) -> Sides<T> {
|
||||||
|
Sides { top: v, bottom: v, left: v, right: v, front: v, back: v }
|
||||||
|
}
|
||||||
|
pub fn are_all(&self, v:T) -> bool {
|
||||||
|
self.top == v && self.bottom == v && self.left == v && self.right == v && self.front == v && self.back == v
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue