summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmniscient <omniscient.oce@gmail.com>2024-10-05 13:48:35 +1000
committerOmniscient <omniscient.oce@gmail.com>2024-10-05 13:48:35 +1000
commit034028807665e84f7c62de5901a3d82c8b5e880e (patch)
treed1d0b3f4c219d1ba3e2eabbcb5eb809f1b6ceadf
parenta49cc9f8948ce4c8d74d84ddf7f41826cd999dd9 (diff)
cleaning up rust binding
-rw-r--r--Makefile2
-rw-r--r--bindgen/rust/Cargo.lock624
-rw-r--r--bindgen/rust/Cargo.toml4
-rw-r--r--bindgen/rust/celeritas-sys/build.rs29
-rw-r--r--bindgen/rust/celeritas-sys/src/lib.rs254
-rw-r--r--bindgen/rust/src/lib.rs267
-rw-r--r--bindgen/rust/src/prelude.rs32
-rw-r--r--bindgen/rust/src/ral.rs686
-rw-r--r--bindgen/rust/src/resources.rs16
-rw-r--r--bindgen/rust/src/shader.rs40
10 files changed, 663 insertions, 1291 deletions
diff --git a/Makefile b/Makefile
index 311e873..749897a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
CC := clang
INCLUDES := -I./include -Ideps/glfw-3.3.8/include/GLFW
CFLAGS := -Wall -Wextra -O2 $(INCLUDES)
-LDFLAGS := -lglfw3
+LDFLAGS := -lglfw
# Directories
SRC_DIR := new_src
diff --git a/bindgen/rust/Cargo.lock b/bindgen/rust/Cargo.lock
index 06717c7..ea10b02 100644
--- a/bindgen/rust/Cargo.lock
+++ b/bindgen/rust/Cargo.lock
@@ -3,34 +3,6 @@
version = 3
[[package]]
-name = "ab_glyph"
-version = "0.2.28"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "79faae4620f45232f599d9bc7b290f88247a0834162c4495ab2f02d60004adfb"
-dependencies = [
- "ab_glyph_rasterizer",
- "owned_ttf_parser",
-]
-
-[[package]]
-name = "ab_glyph_rasterizer"
-version = "0.1.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046"
-
-[[package]]
-name = "ahash"
-version = "0.8.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
-dependencies = [
- "cfg-if",
- "once_cell",
- "version_check",
- "zerocopy",
-]
-
-[[package]]
name = "aho-corasick"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -60,7 +32,7 @@ version = "0.69.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags",
"cexpr",
"clang-sys",
"itertools",
@@ -73,48 +45,28 @@ dependencies = [
"regex",
"rustc-hash",
"shlex",
- "syn 2.0.72",
+ "syn",
"which",
]
[[package]]
name = "bitflags"
-version = "1.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
-
-[[package]]
-name = "bitflags"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]]
-name = "block"
-version = "0.1.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
-
-[[package]]
name = "byteorder"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
-name = "cc"
-version = "1.1.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f"
-
-[[package]]
name = "celeritas"
version = "0.1.0"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags",
"celeritas-sys",
- "egui",
- "egui_glfw",
"gl",
"glam",
"heapless",
@@ -159,117 +111,12 @@ dependencies = [
]
[[package]]
-name = "cli-clipboard"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "04087c1d4a2aa259784a563932aee09cbb0869d490775e051096174b070f3e3d"
-dependencies = [
- "clipboard-win",
- "objc",
- "objc-foundation",
- "objc_id",
- "wl-clipboard-rs",
- "x11-clipboard",
-]
-
-[[package]]
-name = "clipboard-win"
-version = "4.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362"
-dependencies = [
- "error-code",
- "str-buf",
- "winapi",
-]
-
-[[package]]
-name = "cmake"
-version = "0.1.50"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130"
-dependencies = [
- "cc",
-]
-
-[[package]]
-name = "derive-new"
-version = "0.5.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3418329ca0ad70234b9735dc4ceed10af4df60eff9c8e7b06cb5e520d92c3535"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.109",
-]
-
-[[package]]
-name = "downcast-rs"
-version = "1.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
-
-[[package]]
-name = "ecolor"
-version = "0.27.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "20930a432bbd57a6d55e07976089708d4893f3d556cf42a0d79e9e321fa73b10"
-
-[[package]]
-name = "egui"
-version = "0.27.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "584c5d1bf9a67b25778a3323af222dbe1a1feb532190e103901187f92c7fe29a"
-dependencies = [
- "ahash",
- "epaint",
- "nohash-hasher",
-]
-
-[[package]]
-name = "egui_glfw"
-version = "0.55.1"
-source = "git+https://github.com/omnisci3nce/egui_glfw.git?rev=67b432695433feb59761f3ae984b966ca3da31db#67b432695433feb59761f3ae984b966ca3da31db"
-dependencies = [
- "cli-clipboard",
- "egui",
- "gl",
- "glfw",
-]
-
-[[package]]
name = "either"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
[[package]]
-name = "emath"
-version = "0.27.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e4c3a552cfca14630702449d35f41c84a0d15963273771c6059175a803620f3f"
-
-[[package]]
-name = "epaint"
-version = "0.27.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b381f8b149657a4acf837095351839f32cd5c4aec1817fc4df84e18d76334176"
-dependencies = [
- "ab_glyph",
- "ahash",
- "ecolor",
- "emath",
- "nohash-hasher",
- "parking_lot",
-]
-
-[[package]]
-name = "equivalent"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
-
-[[package]]
name = "errno"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -280,44 +127,6 @@ dependencies = [
]
[[package]]
-name = "error-code"
-version = "2.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21"
-dependencies = [
- "libc",
- "str-buf",
-]
-
-[[package]]
-name = "fastrand"
-version = "2.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
-
-[[package]]
-name = "fixedbitset"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
-
-[[package]]
-name = "fnv"
-version = "1.0.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
-
-[[package]]
-name = "gethostname"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e"
-dependencies = [
- "libc",
- "winapi",
-]
-
-[[package]]
name = "gl"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -348,29 +157,6 @@ dependencies = [
]
[[package]]
-name = "glfw"
-version = "0.55.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a310dfc7966e5340f5d0e314fa7eed8888f1cd3bfcaa433d35cbd32d430e50c"
-dependencies = [
- "bitflags 1.3.2",
- "glfw-sys",
- "objc",
- "raw-window-handle 0.5.2",
- "raw-window-handle 0.6.2",
- "winapi",
-]
-
-[[package]]
-name = "glfw-sys"
-version = "5.0.0+3.3.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1dfc32d45fb58ff38b112696907963a7d671e9cf742b16f882062169a053cf88"
-dependencies = [
- "cmake",
-]
-
-[[package]]
name = "glob"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -386,12 +172,6 @@ dependencies = [
]
[[package]]
-name = "hashbrown"
-version = "0.14.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
-
-[[package]]
name = "heapless"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -411,16 +191,6 @@ dependencies = [
]
[[package]]
-name = "indexmap"
-version = "2.2.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
-dependencies = [
- "equivalent",
- "hashbrown",
-]
-
-[[package]]
name = "itertools"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -476,70 +246,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
[[package]]
-name = "lock_api"
-version = "0.4.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
-dependencies = [
- "autocfg",
- "scopeguard",
-]
-
-[[package]]
name = "log"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
[[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.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
-name = "memoffset"
-version = "0.6.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
-dependencies = [
- "autocfg",
-]
-
-[[package]]
name = "minimal-lexical"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
-name = "nix"
-version = "0.24.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069"
-dependencies = [
- "bitflags 1.3.2",
- "cfg-if",
- "libc",
- "memoffset",
-]
-
-[[package]]
-name = "nohash-hasher"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
-
-[[package]]
name = "nom"
version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -559,106 +283,19 @@ dependencies = [
]
[[package]]
-name = "objc"
-version = "0.2.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
-dependencies = [
- "malloc_buf",
-]
-
-[[package]]
-name = "objc-foundation"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9"
-dependencies = [
- "block",
- "objc",
- "objc_id",
-]
-
-[[package]]
-name = "objc_id"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b"
-dependencies = [
- "objc",
-]
-
-[[package]]
name = "once_cell"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
-name = "os_pipe"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "29d73ba8daf8fac13b0501d1abeddcfe21ba7401ada61a819144b6c2a4f32209"
-dependencies = [
- "libc",
- "windows-sys",
-]
-
-[[package]]
-name = "owned_ttf_parser"
-version = "0.24.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "490d3a563d3122bf7c911a59b0add9389e5ec0f5f0c3ac6b91ff235a0e6a7f90"
-dependencies = [
- "ttf-parser",
-]
-
-[[package]]
-name = "parking_lot"
-version = "0.12.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
-dependencies = [
- "lock_api",
- "parking_lot_core",
-]
-
-[[package]]
-name = "parking_lot_core"
-version = "0.9.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
-dependencies = [
- "cfg-if",
- "libc",
- "redox_syscall",
- "smallvec",
- "windows-targets",
-]
-
-[[package]]
-name = "petgraph"
-version = "0.6.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db"
-dependencies = [
- "fixedbitset",
- "indexmap",
-]
-
-[[package]]
-name = "pkg-config"
-version = "0.3.30"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
-
-[[package]]
name = "prettyplease"
version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e"
dependencies = [
"proc-macro2",
- "syn 2.0.72",
+ "syn",
]
[[package]]
@@ -680,27 +317,6 @@ dependencies = [
]
[[package]]
-name = "raw-window-handle"
-version = "0.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9"
-
-[[package]]
-name = "raw-window-handle"
-version = "0.6.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
-
-[[package]]
-name = "redox_syscall"
-version = "0.5.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4"
-dependencies = [
- "bitflags 2.6.0",
-]
-
-[[package]]
name = "regex"
version = "1.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -741,7 +357,7 @@ version = "0.38.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
dependencies = [
- "bitflags 2.6.0",
+ "bitflags",
"errno",
"libc",
"linux-raw-sys",
@@ -755,12 +371,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
[[package]]
-name = "scopeguard"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
-
-[[package]]
name = "serde"
version = "1.0.204"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -777,7 +387,7 @@ checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.72",
+ "syn",
]
[[package]]
@@ -798,35 +408,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
-name = "smallvec"
-version = "1.13.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
-
-[[package]]
name = "stable_deref_trait"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
-name = "str-buf"
-version = "1.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0"
-
-[[package]]
-name = "syn"
-version = "1.0.109"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
-dependencies = [
- "proc-macro2",
- "quote",
- "unicode-ident",
-]
-
-[[package]]
name = "syn"
version = "2.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -838,18 +425,6 @@ dependencies = [
]
[[package]]
-name = "tempfile"
-version = "3.10.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
-dependencies = [
- "cfg-if",
- "fastrand",
- "rustix",
- "windows-sys",
-]
-
-[[package]]
name = "thiserror"
version = "1.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -866,101 +441,16 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.72",
-]
-
-[[package]]
-name = "tree_magic_mini"
-version = "3.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "469a727cac55b41448315cc10427c069c618ac59bb6a4480283fcd811749bdc2"
-dependencies = [
- "fnv",
- "home",
- "memchr",
- "nom",
- "once_cell",
- "petgraph",
+ "syn",
]
[[package]]
-name = "ttf-parser"
-version = "0.24.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8686b91785aff82828ed725225925b33b4fde44c4bb15876e5f7c832724c420a"
-
-[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
-name = "version_check"
-version = "0.9.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
-
-[[package]]
-name = "wayland-client"
-version = "0.29.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715"
-dependencies = [
- "bitflags 1.3.2",
- "downcast-rs",
- "libc",
- "nix",
- "wayland-commons",
- "wayland-scanner",
- "wayland-sys",
-]
-
-[[package]]
-name = "wayland-commons"
-version = "0.29.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902"
-dependencies = [
- "nix",
- "once_cell",
- "smallvec",
- "wayland-sys",
-]
-
-[[package]]
-name = "wayland-protocols"
-version = "0.29.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6"
-dependencies = [
- "bitflags 1.3.2",
- "wayland-client",
- "wayland-commons",
- "wayland-scanner",
-]
-
-[[package]]
-name = "wayland-scanner"
-version = "0.29.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53"
-dependencies = [
- "proc-macro2",
- "quote",
- "xml-rs",
-]
-
-[[package]]
-name = "wayland-sys"
-version = "0.29.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4"
-dependencies = [
- "pkg-config",
-]
-
-[[package]]
name = "which"
version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -973,37 +463,6 @@ dependencies = [
]
[[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-wsapoll"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1eafc5f679c576995526e81635d0cf9695841736712b4e892f87abbe6fed3f28"
-dependencies = [
- "winapi",
-]
-
-[[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.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1077,76 +536,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
-name = "wl-clipboard-rs"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "981a303dfbb75d659f6612d05a14b2e363c103d24f676a2d44a00d18507a1ad9"
-dependencies = [
- "derive-new",
- "libc",
- "log",
- "nix",
- "os_pipe",
- "tempfile",
- "thiserror",
- "tree_magic_mini",
- "wayland-client",
- "wayland-protocols",
-]
-
-[[package]]
-name = "x11-clipboard"
-version = "0.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "980b9aa9226c3b7de8e2adb11bf20124327c054e0e5812d2aac0b5b5a87e7464"
-dependencies = [
- "x11rb",
-]
-
-[[package]]
-name = "x11rb"
-version = "0.10.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "592b4883219f345e712b3209c62654ebda0bb50887f330cbd018d0f654bfd507"
-dependencies = [
- "gethostname",
- "nix",
- "winapi",
- "winapi-wsapoll",
- "x11rb-protocol",
-]
-
-[[package]]
-name = "x11rb-protocol"
-version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56b245751c0ac9db0e006dc812031482784e434630205a93c73cfefcaabeac67"
-dependencies = [
- "nix",
-]
-
-[[package]]
name = "xml-rs"
version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193"
-
-[[package]]
-name = "zerocopy"
-version = "0.7.35"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
-dependencies = [
- "zerocopy-derive",
-]
-
-[[package]]
-name = "zerocopy-derive"
-version = "0.7.35"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.72",
-]
diff --git a/bindgen/rust/Cargo.toml b/bindgen/rust/Cargo.toml
index 5841fac..3493561 100644
--- a/bindgen/rust/Cargo.toml
+++ b/bindgen/rust/Cargo.toml
@@ -8,8 +8,8 @@ celeritas-sys = { path = "./celeritas-sys" }
serde = { version = "1.0.204", features = ["derive"] }
serde_json = "1.0.120"
-egui = "0.27.1"
-egui_glfw = { git = "https://github.com/omnisci3nce/egui_glfw.git", rev = "67b432695433feb59761f3ae984b966ca3da31db" }
+# egui = "0.27.1"
+# egui_glfw = { git = "https://github.com/omnisci3nce/egui_glfw.git", rev = "67b432695433feb59761f3ae984b966ca3da31db" }
gl = "0.14.0"
glam = { version = "0.28.0", features = ["approx", "serde"] }
thiserror = "1.0.63"
diff --git a/bindgen/rust/celeritas-sys/build.rs b/bindgen/rust/celeritas-sys/build.rs
index f0a1d36..24b1d85 100644
--- a/bindgen/rust/celeritas-sys/build.rs
+++ b/bindgen/rust/celeritas-sys/build.rs
@@ -43,14 +43,10 @@ impl ParseCallbacks for AdditionalDerives {
}
fn main() {
- /* */
-
- // Tell cargo to look for shared libraries in the specified directory
// TODO: we need to look based on OS
- // println!("cargo:rustc-link-search=../../build/windows/x64/debug");
- let static_lib_path =
- "/Users/josh/code/CodenameVentus/deps/celeritas-core/build/macosx/arm64/debug".to_string();
+ // Tell cargo to look for shared libraries in the specified directory
+ let static_lib_path = "/home/joshua/repos/cel-core3/build".to_string();
// let static_lib_path = std::env::var("CELERITAS_CORE_LIB")
// .unwrap_or("../../../build/macosx/arm64/debug".to_string());
@@ -58,9 +54,8 @@ fn main() {
// Tell cargo to tell rustc to link the system bzip2
// shared library.
- println!("cargo:rustc-link-lib=core_static");
- println!("cargo:rustc-link-lib=glfw3");
- // TODO: ^ use our locally compiled glfw
+ println!("cargo:rustc-link-lib=dylib=celeritas");
+ println!("cargo:rustc-link-lib=glfw");
// The bindgen::Builder is the main entry point
// to bindgen, and lets you build up options for
@@ -68,19 +63,7 @@ fn main() {
let bindings = bindgen::Builder::default()
// The input header we would like to generate
// bindings for.
- .header("../../../include/amalgamation.h")
- // -- our code
- .clang_arg("-I../../../src")
- .clang_arg("-I../../../src/core")
- .clang_arg("-I../../../src/maths")
- .clang_arg("-I../../../src/render")
- .clang_arg("-I../../../src/platform")
- .clang_arg("-I../../../src/ral")
- .clang_arg("-I../../../src/ral/backends/opengl")
- .clang_arg("-I../../../src/resources")
- .clang_arg("-I../../../src/std")
- .clang_arg("-I../../../src/std/containers")
- .clang_arg("-I../../../src/systems")
+ .header("../../../include/celeritas.h")
// -- dependencies
.clang_arg("-I../../../deps/cgltf")
.clang_arg("-I../../../deps/glfw-3.3.8/include/GLFW")
@@ -92,7 +75,7 @@ fn main() {
// Tell cargo to invalidate the built crate whenever any of the
// included header files changed.
.rustified_enum("GPU_TextureType")
- .rustified_enum("GPU_TextureFormat")
+ // .rustified_enum("GPU_TextureFormat")
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
.parse_callbacks(Box::new(AdditionalDerives))
// Finish the builder and generate the bindings.
diff --git a/bindgen/rust/celeritas-sys/src/lib.rs b/bindgen/rust/celeritas-sys/src/lib.rs
index 048e9f7..9ea3e47 100644
--- a/bindgen/rust/celeritas-sys/src/lib.rs
+++ b/bindgen/rust/celeritas-sys/src/lib.rs
@@ -6,101 +6,101 @@ use serde::{Deserialize, Serialize};
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
-// --- Conversions
-pub mod conversions {
- use crate::{Mat4, Vec3, Vec4};
+// // --- Conversions
+// pub mod conversions {
+// use crate::{Mat4, Vec3, Vec4};
- impl From<Vec3> for glam::Vec3 {
- fn from(v: Vec3) -> Self {
- Self {
- x: v.x,
- y: v.y,
- z: v.z,
- }
- }
- }
- impl From<glam::Vec3> for Vec3 {
- fn from(v: glam::Vec3) -> Self {
- Self {
- x: v.x,
- y: v.y,
- z: v.z,
- }
- }
- }
+// impl From<Vec3> for glam::Vec3 {
+// fn from(v: Vec3) -> Self {
+// Self {
+// x: v.x,
+// y: v.y,
+// z: v.z,
+// }
+// }
+// }
+// impl From<glam::Vec3> for Vec3 {
+// fn from(v: glam::Vec3) -> Self {
+// Self {
+// x: v.x,
+// y: v.y,
+// z: v.z,
+// }
+// }
+// }
- impl From<Vec4> for glam::Vec4 {
- fn from(v: Vec4) -> Self {
- Self::new(v.x, v.y, v.z, v.w)
- }
- }
- impl From<glam::Vec4> for Vec4 {
- fn from(v: glam::Vec4) -> Self {
- Vec4 {
- x: v.x,
- y: v.y,
- z: v.z,
- w: v.w,
- }
- }
- }
+// impl From<Vec4> for glam::Vec4 {
+// fn from(v: Vec4) -> Self {
+// Self::new(v.x, v.y, v.z, v.w)
+// }
+// }
+// impl From<glam::Vec4> for Vec4 {
+// fn from(v: glam::Vec4) -> Self {
+// Vec4 {
+// x: v.x,
+// y: v.y,
+// z: v.z,
+// w: v.w,
+// }
+// }
+// }
- impl From<Mat4> for glam::Mat4 {
- fn from(m: Mat4) -> Self {
- Self {
- x_axis: glam::Vec4::new(m.data[0], m.data[1], m.data[2], m.data[3]),
- y_axis: glam::Vec4::new(m.data[4], m.data[5], m.data[6], m.data[7]),
- z_axis: glam::Vec4::new(m.data[8], m.data[9], m.data[10], m.data[11]),
- w_axis: glam::Vec4::new(m.data[12], m.data[13], m.data[14], m.data[15]),
- }
- }
- }
- impl From<glam::Mat4> for Mat4 {
- fn from(m: glam::Mat4) -> Self {
- let mut slf = Self { data: [0.0; 16] };
- m.write_cols_to_slice(&mut slf.data);
- slf
- }
- }
-}
+// impl From<Mat4> for glam::Mat4 {
+// fn from(m: Mat4) -> Self {
+// Self {
+// x_axis: glam::Vec4::new(m.data[0], m.data[1], m.data[2], m.data[3]),
+// y_axis: glam::Vec4::new(m.data[4], m.data[5], m.data[6], m.data[7]),
+// z_axis: glam::Vec4::new(m.data[8], m.data[9], m.data[10], m.data[11]),
+// w_axis: glam::Vec4::new(m.data[12], m.data[13], m.data[14], m.data[15]),
+// }
+// }
+// }
+// impl From<glam::Mat4> for Mat4 {
+// fn from(m: glam::Mat4) -> Self {
+// let mut slf = Self { data: [0.0; 16] };
+// m.write_cols_to_slice(&mut slf.data);
+// slf
+// }
+// }
+// }
-impl Transform {
- #[inline]
- pub fn identity() -> Self {
- Self {
- position: Vec3 {
- x: 0.,
- y: 0.,
- z: 0.,
- },
- rotation: Vec4 {
- x: 0.,
- y: 0.,
- z: 0.,
- w: 1.0,
- },
- scale: Vec3 {
- x: 1.,
- y: 1.,
- z: 1.,
- },
- is_dirty: true,
- }
- }
-}
+// impl Transform {
+// #[inline]
+// pub fn identity() -> Self {
+// Self {
+// position: Vec3 {
+// x: 0.,
+// y: 0.,
+// z: 0.,
+// },
+// rotation: Vec4 {
+// x: 0.,
+// y: 0.,
+// z: 0.,
+// w: 1.0,
+// },
+// scale: Vec3 {
+// x: 1.,
+// y: 1.,
+// z: 1.,
+// },
+// is_dirty: true,
+// }
+// }
+// }
-impl Vec3 {
- pub const ZERO: Self = Vec3 {
- x: 0.,
- y: 0.,
- z: 0.,
- };
- pub const ONE: Self = Vec3 {
- x: 1.,
- y: 1.,
- z: 1.,
- };
-}
+// impl Vec3 {
+// pub const ZERO: Self = Vec3 {
+// x: 0.,
+// y: 0.,
+// z: 0.,
+// };
+// pub const ONE: Self = Vec3 {
+// x: 1.,
+// y: 1.,
+// z: 1.,
+// };
+// }
impl Default for ShaderBinding {
fn default() -> Self {
@@ -118,43 +118,43 @@ impl Default for ShaderBinding {
}
}
-impl Default for Camera {
- fn default() -> Self {
- let camera_pos = Vec3 {
- x: 18.9,
- y: 10.6,
- z: 11.6,
- };
- let camera_front = Vec3 {
- x: -0.6,
- y: -0.2,
- z: -0.7,
- };
+// impl Default for Camera {
+// fn default() -> Self {
+// let camera_pos = Vec3 {
+// x: 18.9,
+// y: 10.6,
+// z: 11.6,
+// };
+// let camera_front = Vec3 {
+// x: -0.6,
+// y: -0.2,
+// z: -0.7,
+// };
- unsafe {
- Camera_Create(
- camera_pos,
- camera_front,
- Vec3 {
- x: 0.0,
- y: 1.0,
- z: 0.0,
- },
- 45.0,
- )
- }
- }
-}
+// unsafe {
+// Camera_Create(
+// camera_pos,
+// camera_front,
+// Vec3 {
+// x: 0.0,
+// y: 1.0,
+// z: 0.0,
+// },
+// 45.0,
+// )
+// }
+// }
+// }
-// -- fat pointer string type
+// // -- fat pointer string type
-impl Str8 {
- pub fn from_str(s: &str) -> Self {
- let s = s.to_owned();
- let s = s.leak(); // TODO: a better way than just leaking string memory :P
- Self {
- buf: s.as_mut_ptr(),
- len: 0,
- }
- }
-}
+// impl Str8 {
+// pub fn from_str(s: &str) -> Self {
+// let s = s.to_owned();
+// let s = s.leak(); // TODO: a better way than just leaking string memory :P
+// Self {
+// buf: s.as_mut_ptr(),
+// len: 0,
+// }
+// }
+// }
diff --git a/bindgen/rust/src/lib.rs b/bindgen/rust/src/lib.rs
index 4d6cb7f..66c99a2 100644
--- a/bindgen/rust/src/lib.rs
+++ b/bindgen/rust/src/lib.rs
@@ -13,139 +13,138 @@ pub mod ral;
pub mod resources;
pub mod shader;
-use std::{
- ffi::CString,
- fs::{self, File},
- io::Write,
- path::Path,
- ptr::addr_of_mut,
-};
-
-use celeritas_sys::{
- Core_Bringup, Core_Shutdown, DirectionalLight, Material, Material_Insert, PointLight,
- TextureHandle, Transform,
-};
-use serde::{Deserialize, Serialize};
-
-pub trait IntoFFI {
- type FFIType;
- unsafe fn into_ffi(self) -> Self::FFIType;
-}
-
-/// Wrapper around a string that is the path to a gltf model **relative** to the configured
-/// `ASSETS` folder
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct ModelPath(pub String);
-
-#[deprecated]
-#[derive(Debug, Serialize, Deserialize)]
-pub struct ModelNode {
- pub model_path: ModelPath,
- pub transform: Transform,
-}
-
-/// Scene that can be saved and loaded from disk
-#[derive(Debug, Serialize, Deserialize)]
-pub struct SerializableScene {
- /// main light
- pub sun: DirectionalLight,
- pub point_lights: [Option<PointLight>; 4],
- pub camera_orientation: (Vec3, Vec3),
- pub models: Vec<ModelNode>,
-}
-
-// Runtime Scene <-> Serialized Scene
-
-impl SerializableScene {
- /// TODO: docs
- pub fn store_to_file(&self, filepath: &Path) {
- let mut file = File::create(filepath).expect("creation failed");
- let json = serde_json::to_string(&self).expect("serialize failed");
- file.write(json.as_bytes()).expect("writing failed");
- }
- /// TODO: docs
- pub fn load_from_file(filepath: &Path) -> Self {
- let contents = fs::read_to_string(filepath).expect("Filepath should be open and read-able");
-
- serde_json::from_str(&contents).expect("Should be deserializable")
- }
-}
-
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub enum Light {
- Point(ffi::PointLight),
- Directional(ffi::DirectionalLight),
- // Spot(ffi::Spotlight)
-}
-
-pub struct Core {
- _window_name: CString,
-}
-impl Core {
- pub fn init(window_name: &str, window: Option<*mut ffi::GLFWwindow>) -> Self {
- let name = CString::new(window_name).unwrap();
- let window_ptr = window.unwrap_or(std::ptr::null_mut());
- unsafe { Core_Bringup(name.as_ptr() as *const _, window_ptr) };
- Self { _window_name: name }
- }
-}
-
-impl Drop for Core {
- fn drop(&mut self) {
- unsafe { Core_Shutdown() }
- }
-}
-
-// pub struct Renderable {
-// pub mesh: MeshHandle,
-// pub material: MaterialHandle,
-// pub affine: Mat4,
-// pub bounding_box: Bbox_3D,
-// pub flags: RenderEntityFlags,
+// use std::{
+// ffi::CString,
+// fs::{self, File},
+// io::Write,
+// path::Path,
+// ptr::addr_of_mut,
+// };
+
+// use celeritas_sys::{
+// Core_Bringup, Core_Shutdown, DirectionalLight, Material, Material_Insert, PointLight,
+// TextureHandle, Transform,
+// };
+// use serde::{Deserialize, Serialize};
+
+// pub trait IntoFFI {
+// type FFIType;
+// unsafe fn into_ffi(self) -> Self::FFIType;
// }
-bitflags::bitflags! {
- #[derive(Debug, Clone, Copy, PartialEq, Eq)]
- pub struct RenderableFlags : u32 {
-
- }
-}
-
-type M = Material;
-/*
-pub name: [::std::os::raw::c_char; 64usize],
-pub kind: MaterialKind,
-pub base_colour: Vec3,
-pub metallic: f32_,
-pub roughness: f32_,
-pub ambient_occlusion: f32_,
-pub albedo_map: TextureHandle,
-pub normal_map: TextureHandle,
-pub metallic_roughness_map: TextureHandle,
-pub ambient_occlusion_map: TextureHandle, */
-
-#[derive(Debug, Clone, Default, PartialEq)]
-pub struct PBRMaterial {
- pub name: String,
- pub base_colour: glam::Vec3,
- pub metallic: f32,
- pub roughness: f32,
- pub ambient_occlusion: f32,
- pub albedo_map: Option<TextureHandle>,
- pub normal_map: Option<TextureHandle>,
- pub metallic_roughness_map: Option<TextureHandle>,
- pub ambient_occlusion_map: Option<TextureHandle>,
-}
-impl PBRMaterial {
- /// Creates the material in the C core returning a handle to it
- pub fn create(mat: Self) -> ffi::MaterialHandle {
- let mut ffi_mat = ffi::Material::from(mat);
- unsafe { Material_Insert(addr_of_mut!(ffi_mat)) }
- }
-}
-
-impl From<PBRMaterial> for ffi::Material {
- fn from(value: PBRMaterial) -> Self {
- todo!("impl conv for materials")
- }
-}
+// /// Wrapper around a string that is the path to a gltf model **relative** to the configured
+// /// `ASSETS` folder
+// #[derive(Debug, Clone, Serialize, Deserialize)]
+// pub struct ModelPath(pub String);
+
+// #[deprecated]
+// #[derive(Debug, Serialize, Deserialize)]
+// pub struct ModelNode {
+// pub model_path: ModelPath,
+// pub transform: Transform,
+// }
+
+// /// Scene that can be saved and loaded from disk
+// #[derive(Debug, Serialize, Deserialize)]
+// pub struct SerializableScene {
+// /// main light
+// pub sun: DirectionalLight,
+// pub point_lights: [Option<PointLight>; 4],
+// pub camera_orientation: (Vec3, Vec3),
+// pub models: Vec<ModelNode>,
+// }
+
+// // Runtime Scene <-> Serialized Scene
+
+// impl SerializableScene {
+// /// TODO: docs
+// pub fn store_to_file(&self, filepath: &Path) {
+// let mut file = File::create(filepath).expect("creation failed");
+// let json = serde_json::to_string(&self).expect("serialize failed");
+// file.write(json.as_bytes()).expect("writing failed");
+// }
+// /// TODO: docs
+// pub fn load_from_file(filepath: &Path) -> Self {
+// let contents = fs::read_to_string(filepath).expect("Filepath should be open and read-able");
+
+// serde_json::from_str(&contents).expect("Should be deserializable")
+// }
+// }
+
+// #[derive(Debug, Clone, Serialize, Deserialize)]
+// pub enum Light {
+// Point(ffi::PointLight),
+// Directional(ffi::DirectionalLight),
+// // Spot(ffi::Spotlight)
+// }
+
+// pub struct Core {
+// _window_name: CString,
+// }
+// impl Core {
+// pub fn init(window_name: &str, window: Option<*mut ffi::GLFWwindow>) -> Self {
+// let name = CString::new(window_name).unwrap();
+// let window_ptr = window.unwrap_or(std::ptr::null_mut());
+// unsafe { Core_Bringup(name.as_ptr() as *const _, window_ptr) };
+// Self { _window_name: name }
+// }
+// }
+
+// impl Drop for Core {
+// fn drop(&mut self) {
+// unsafe { Core_Shutdown() }
+// }
+// }
+
+// // pub struct Renderable {
+// // pub mesh: MeshHandle,
+// // pub material: MaterialHandle,
+// // pub affine: Mat4,
+// // pub bounding_box: Bbox_3D,
+// // pub flags: RenderEntityFlags,
+// // }
+
+// bitflags::bitflags! {
+// #[derive(Debug, Clone, Copy, PartialEq, Eq)]
+// pub struct RenderableFlags : u32 {
+
+// }
+// }
+
+// type M = Material;
+// /*
+// pub name: [::std::os::raw::c_char; 64usize],
+// pub kind: MaterialKind,
+// pub base_colour: Vec3,
+// pub metallic: f32_,
+// pub roughness: f32_,
+// pub ambient_occlusion: f32_,
+// pub albedo_map: TextureHandle,
+// pub normal_map: TextureHandle,
+// pub metallic_roughness_map: TextureHandle,
+// pub ambient_occlusion_map: TextureHandle, */
+// #[derive(Debug, Clone, Default, PartialEq)]
+// pub struct PBRMaterial {
+// pub name: String,
+// pub base_colour: glam::Vec3,
+// pub metallic: f32,
+// pub roughness: f32,
+// pub ambient_occlusion: f32,
+// pub albedo_map: Option<TextureHandle>,
+// pub normal_map: Option<TextureHandle>,
+// pub metallic_roughness_map: Option<TextureHandle>,
+// pub ambient_occlusion_map: Option<TextureHandle>,
+// }
+// impl PBRMaterial {
+// /// Creates the material in the C core returning a handle to it
+// pub fn create(mat: Self) -> ffi::MaterialHandle {
+// let mut ffi_mat = ffi::Material::from(mat);
+// unsafe { Material_Insert(addr_of_mut!(ffi_mat)) }
+// }
+// }
+
+// impl From<PBRMaterial> for ffi::Material {
+// fn from(value: PBRMaterial) -> Self {
+// todo!("impl conv for materials")
+// }
+// }
diff --git a/bindgen/rust/src/prelude.rs b/bindgen/rust/src/prelude.rs
index 37ad68b..74cc400 100644
--- a/bindgen/rust/src/prelude.rs
+++ b/bindgen/rust/src/prelude.rs
@@ -1,18 +1,18 @@
-/// --- maths types
-pub use celeritas_sys::Mat4;
-pub use celeritas_sys::Vec2;
-pub use celeritas_sys::Vec3;
-pub use celeritas_sys::Vec4;
+// /// --- maths types
+// pub use celeritas_sys::Mat4;
+// pub use celeritas_sys::Vec2;
+// pub use celeritas_sys::Vec3;
+// pub use celeritas_sys::Vec4;
-// --- handles
-pub use celeritas_sys::BufferHandle;
-pub use celeritas_sys::MaterialHandle;
-pub use celeritas_sys::MeshHandle;
-pub use celeritas_sys::ModelHandle;
-pub use celeritas_sys::PipelineHandle;
-pub use celeritas_sys::PipelineLayoutHandle;
-pub use celeritas_sys::RenderpassHandle;
-pub use celeritas_sys::TextureHandle;
+// // --- handles
+// pub use celeritas_sys::BufferHandle;
+// pub use celeritas_sys::MaterialHandle;
+// pub use celeritas_sys::MeshHandle;
+// pub use celeritas_sys::ModelHandle;
+// pub use celeritas_sys::PipelineHandle;
+// pub use celeritas_sys::PipelineLayoutHandle;
+// pub use celeritas_sys::RenderpassHandle;
+// pub use celeritas_sys::TextureHandle;
-// --- conversions
-pub use celeritas_sys::conversions;
+// // --- conversions
+// pub use celeritas_sys::conversions;
diff --git a/bindgen/rust/src/ral.rs b/bindgen/rust/src/ral.rs
index f55158f..9170444 100644
--- a/bindgen/rust/src/ral.rs
+++ b/bindgen/rust/src/ral.rs
@@ -1,347 +1,347 @@
-//! Wrapper around the RAL code in celeritas-core
-
-use std::ffi::c_void;
-
-use celeritas_sys::{
- BufferHandle, GPU_CmdEncoder, GPU_CmdEncoder_BeginRender, GPU_CmdEncoder_EndRender,
- GPU_EncodeBindShaderData, GPU_GetDefaultEncoder, GPU_GetDefaultRenderpass,
- GPU_GraphicsPipeline_Create, GPU_Pipeline, GraphicsPipelineDesc,
- ShaderBindingKind_BINDING_BYTES, ShaderBinding__bindgen_ty_1,
- ShaderBinding__bindgen_ty_1__bindgen_ty_1, ShaderDesc, ShaderVisibility_VISIBILITY_COMPUTE,
- ShaderVisibility_VISIBILITY_FRAGMENT, ShaderVisibility_VISIBILITY_VERTEX, Str8, TextureHandle,
- VertexDescription, MAX_SHADER_DATA_LAYOUTS,
-};
-use thiserror::Error;
-
-use crate::IntoFFI;
-
-/// Holds a pointer to the raw `GPU_CmdEncoder`
-pub struct FrameRenderEncoder(*mut GPU_CmdEncoder);
-
-/// Holds a pointer to the raw `GPU_Renderpass`
-pub struct RenderPass(pub *mut celeritas_sys::GPU_Renderpass);
-
-/// Holds a pointer to the raw `GPU_Pipeline`
-pub struct Pipeline(*mut celeritas_sys::GPU_Pipeline);
-
-impl FrameRenderEncoder {
- pub fn new(renderpass: &RenderPass) -> Self {
- let enc = unsafe {
- let enc = GPU_GetDefaultEncoder();
- GPU_CmdEncoder_BeginRender(enc, renderpass.0);
- enc
- };
- FrameRenderEncoder(enc)
- }
-}
-
-impl Drop for FrameRenderEncoder {
- fn drop(&mut self) {
- unsafe {
- GPU_CmdEncoder_EndRender(self.0);
- }
- }
-}
-
-impl FrameRenderEncoder {
- pub fn set_vertex_buffer(&self, buf: BufferHandle) {
- // TODO: Get buffer ptr from handle
- // TODO: assert that buffer type is vertex
- todo!()
- }
- pub fn set_index_buffer(&self, buf: BufferHandle) {
- // TODO: Get buffer ptr from handle
- // TODO: assert that buffer type is index
- todo!()
- }
- pub fn bind<S: ShaderData>(&mut self, data: &S) {
- // TODO: fill ShaderDataLayout with correct data
- unsafe { GPU_EncodeBindShaderData(self.0, 0, todo!()) }
- }
-}
-
-// Vertex Descriptions
-pub enum VertexAttrKind {
- Floatx1,
- Floatx2,
- Floatx3,
- Floatx4,
- U32x1,
- U32x2,
- U32x3,
- U32x4,
- I32x1,
- I32x2,
- I32x3,
- I32x4,
-}
-
-pub struct VertexAttribute {
- name: String,
- kind: VertexAttrKind,
-}
-
-#[derive(Default)]
-pub struct VertexDesc {
- debug_label: String,
- attributes: Vec<VertexAttribute>,
-}
-impl VertexDesc {
- pub fn new(name: String) -> Self {
- Self {
- debug_label: name,
- attributes: vec![],
- }
- }
- pub fn add_attr(mut self, attr_name: &str, kind: VertexAttrKind) -> Self {
- self.attributes.push(VertexAttribute {
- name: attr_name.to_owned(),
- kind,
- });
- self
- }
-}
-impl IntoFFI for VertexDesc {
- type FFIType = VertexDescription;
-
- unsafe fn into_ffi(self) -> Self::FFIType {
- VertexDescription {
- debug_label: todo!(),
- attr_names: todo!(),
- attributes: todo!(),
- attributes_count: todo!(),
- use_full_vertex_size: todo!(),
- }
- }
-}
-
-pub struct PipelineBuilder {
- name: String,
- renderpass: Option<RenderPass>,
- vertex_description: VertexDesc,
- data_layouts: Vec<ShaderDataLayout>,
- shader_paths: Option<(String, String)>,
-}
-
-#[derive(Debug, Error)]
-pub enum RALError {
- #[error("exceeded maximum of 8 layouts for a pipeline")]
- TooManyShaderDataLayouts,
-}
-
-impl PipelineBuilder {
- /// Create a new [PipelineBuilder]
- pub fn new(name: String) -> Self {
- let vertex_description = VertexDesc::new(format!("{} Vertex Description", name.clone()));
- Self {
- name,
- renderpass: None,
- vertex_description,
- data_layouts: Vec::new(),
- shader_paths: None,
- }
- }
- pub fn build(self) -> Result<Pipeline, RALError> {
- let layouts = [celeritas_sys::ShaderDataLayout::default(); 8];
- if self.data_layouts.len() > MAX_SHADER_DATA_LAYOUTS as usize {
- return Err(RALError::TooManyShaderDataLayouts);
- }
- for (i, layout) in self.data_layouts.iter().enumerate().take(8) {
- // layouts[i] = celeritas_sys::ShaderDataLayout::from(layout);
- }
- let (vert_path, frag_path) = self.shader_paths.expect("Shader paths must be provided");
- let vert_code = std::fs::read_to_string(vert_path.clone()).expect("msg");
- let frag_code = std::fs::read_to_string(frag_path.clone()).expect("msg");
-
- // TODO: convert VertexDesc -> ffi::VertexDescription
- // load shader
- let vs = ShaderDesc {
- debug_name: "".as_ptr() as *const i8,
- filepath: Str8::from_str(&vert_path),
- code: Str8::from_str(&vert_code),
- is_spirv: false,
- is_combined_vert_frag: false,
- };
- let fs = ShaderDesc {
- debug_name: "".as_ptr() as *const i8,
- filepath: Str8::from_str(&frag_path),
- code: Str8::from_str(&frag_code),
- is_spirv: false,
- is_combined_vert_frag: false,
- };
-
- let desc = GraphicsPipelineDesc {
- debug_name: "".as_ptr() as *const _,
- vertex_desc: unsafe { self.vertex_description.into_ffi() },
- vs,
- fs,
- data_layouts: layouts,
- data_layouts_count: layouts.len() as u32,
- wireframe: false,
- depth_test: true,
- };
- let p = unsafe {
- GPU_GraphicsPipeline_Create(
- desc,
- self.renderpass
- .map(|r| r.0)
- .unwrap_or(GPU_GetDefaultRenderpass()),
- )
- };
- Ok(Pipeline(p))
- }
-
- pub fn add_vertex_desc(mut self, vertex_desc: VertexDesc) -> Self {
- self.vertex_description = vertex_desc;
- self
- }
- pub fn add_shader_layout<S: ShaderData>(mut self) -> Self {
- let layout = S::layout();
- self.data_layouts.push(layout);
- self
- }
- pub fn add_shader_src(mut self, vertex_path: &str, fragment_path: &str) -> Self {
- self.shader_paths = Some((vertex_path.to_owned(), fragment_path.to_owned()));
- self
- }
-}
-
-impl Pipeline {
- pub fn raw_ptr(&self) -> *mut GPU_Pipeline {
- self.0
- }
-}
-
-///
-pub trait ShaderData {
- ///
- fn layout() -> ShaderDataLayout;
- ///
- fn bind(&self);
-
- // fn bind_texture(&self, binding_name: &str, handle: TextureHandle);
- // fn bind_buffer(&self, binding_name: &str, handle: BufferHandle);
-}
-
-#[derive(Clone)]
-pub struct ShaderBinding {
- pub label: String,
- // pub label: *const ::std::os::raw::c_char,
- pub kind: ShaderBindingKind,
- pub vis: ShaderVisibility,
- // pub data: ShaderBinding__bindgen_ty_1,
-}
-
-#[derive(Clone)]
-pub enum ShaderBindingKind {
- Bytes { size: usize, data: Option<*mut u8> },
- Buffer(Option<BufferHandle>),
- Texture(Option<TextureHandle>),
-}
-
-bitflags::bitflags! {
- #[derive(Debug, Clone, Copy, PartialEq, Eq)]
- pub struct ShaderVisibility : u32 {
- const VERTEX = 1 << ShaderVisibility_VISIBILITY_VERTEX;
- const FRAGMENT = 1 << ShaderVisibility_VISIBILITY_FRAGMENT;
- const COMPUTE = 1 << ShaderVisibility_VISIBILITY_COMPUTE;
- }
-}
-impl Default for ShaderVisibility {
- fn default() -> Self {
- ShaderVisibility::all()
- }
-}
-
-#[derive(Default)]
-pub struct ShaderDataLayout {
- pub bindings: heapless::Vec<ShaderBinding, 8>,
-}
-impl ShaderDataLayout {
- pub fn from_slice(bindings: &[ShaderBinding]) -> Self {
- todo!()
- }
-}
-impl ShaderDataLayout {
- pub fn into_ffi_type(self) -> celeritas_sys::ShaderDataLayout {
- let mut bindings = [celeritas_sys::ShaderBinding::default(); 8];
- for (i, b) in self.bindings.iter().enumerate().take(8) {
- bindings[i] = match b.kind {
- ShaderBindingKind::Bytes { size, data } => celeritas_sys::ShaderBinding {
- label: b.label.as_ptr() as *const i8,
- kind: ShaderBindingKind_BINDING_BYTES,
- vis: ShaderVisibility_VISIBILITY_VERTEX,
- data: ShaderBinding__bindgen_ty_1 {
- bytes: ShaderBinding__bindgen_ty_1__bindgen_ty_1 {
- size: size as u32,
- data: data.unwrap() as *mut c_void,
- },
- },
- },
- ShaderBindingKind::Buffer(_) => todo!(),
- ShaderBindingKind::Texture(_) => todo!(),
- };
- }
- celeritas_sys::ShaderDataLayout {
- bindings,
- binding_count: bindings.len(),
- }
- }
-}
-// impl<'a> From<&ShaderDataLayout<'a>> for celeritas_sys::ShaderDataLayout {
-// fn from(value: &ShaderDataLayout) -> Self {
+// //! Wrapper around the RAL code in celeritas-core
+
+// use std::ffi::c_void;
+
+// use celeritas_sys::{
+// BufferHandle, GPU_CmdEncoder, GPU_CmdEncoder_BeginRender, GPU_CmdEncoder_EndRender,
+// GPU_EncodeBindShaderData, GPU_GetDefaultEncoder, GPU_GetDefaultRenderpass,
+// GPU_GraphicsPipeline_Create, GPU_Pipeline, GraphicsPipelineDesc,
+// ShaderBindingKind_BINDING_BYTES, ShaderBinding__bindgen_ty_1,
+// ShaderBinding__bindgen_ty_1__bindgen_ty_1, ShaderDesc, ShaderVisibility_VISIBILITY_COMPUTE,
+// ShaderVisibility_VISIBILITY_FRAGMENT, ShaderVisibility_VISIBILITY_VERTEX, Str8, TextureHandle,
+// VertexDescription, MAX_SHADER_DATA_LAYOUTS,
+// };
+// use thiserror::Error;
+
+// use crate::IntoFFI;
+
+// /// Holds a pointer to the raw `GPU_CmdEncoder`
+// pub struct FrameRenderEncoder(*mut GPU_CmdEncoder);
+
+// /// Holds a pointer to the raw `GPU_Renderpass`
+// pub struct RenderPass(pub *mut celeritas_sys::GPU_Renderpass);
+
+// /// Holds a pointer to the raw `GPU_Pipeline`
+// pub struct Pipeline(*mut celeritas_sys::GPU_Pipeline);
+
+// impl FrameRenderEncoder {
+// pub fn new(renderpass: &RenderPass) -> Self {
+// let enc = unsafe {
+// let enc = GPU_GetDefaultEncoder();
+// GPU_CmdEncoder_BeginRender(enc, renderpass.0);
+// enc
+// };
+// FrameRenderEncoder(enc)
+// }
+// }
+
+// impl Drop for FrameRenderEncoder {
+// fn drop(&mut self) {
+// unsafe {
+// GPU_CmdEncoder_EndRender(self.0);
+// }
+// }
+// }
+
+// impl FrameRenderEncoder {
+// pub fn set_vertex_buffer(&self, buf: BufferHandle) {
+// // TODO: Get buffer ptr from handle
+// // TODO: assert that buffer type is vertex
+// todo!()
+// }
+// pub fn set_index_buffer(&self, buf: BufferHandle) {
+// // TODO: Get buffer ptr from handle
+// // TODO: assert that buffer type is index
+// todo!()
+// }
+// pub fn bind<S: ShaderData>(&mut self, data: &S) {
+// // TODO: fill ShaderDataLayout with correct data
+// unsafe { GPU_EncodeBindShaderData(self.0, 0, todo!()) }
+// }
+// }
+
+// // Vertex Descriptions
+// pub enum VertexAttrKind {
+// Floatx1,
+// Floatx2,
+// Floatx3,
+// Floatx4,
+// U32x1,
+// U32x2,
+// U32x3,
+// U32x4,
+// I32x1,
+// I32x2,
+// I32x3,
+// I32x4,
+// }
+
+// pub struct VertexAttribute {
+// name: String,
+// kind: VertexAttrKind,
+// }
+
+// #[derive(Default)]
+// pub struct VertexDesc {
+// debug_label: String,
+// attributes: Vec<VertexAttribute>,
+// }
+// impl VertexDesc {
+// pub fn new(name: String) -> Self {
+// Self {
+// debug_label: name,
+// attributes: vec![],
+// }
+// }
+// pub fn add_attr(mut self, attr_name: &str, kind: VertexAttrKind) -> Self {
+// self.attributes.push(VertexAttribute {
+// name: attr_name.to_owned(),
+// kind,
+// });
+// self
+// }
+// }
+// impl IntoFFI for VertexDesc {
+// type FFIType = VertexDescription;
+
+// unsafe fn into_ffi(self) -> Self::FFIType {
+// VertexDescription {
+// debug_label: todo!(),
+// attr_names: todo!(),
+// attributes: todo!(),
+// attributes_count: todo!(),
+// use_full_vertex_size: todo!(),
+// }
+// }
+// }
+
+// pub struct PipelineBuilder {
+// name: String,
+// renderpass: Option<RenderPass>,
+// vertex_description: VertexDesc,
+// data_layouts: Vec<ShaderDataLayout>,
+// shader_paths: Option<(String, String)>,
+// }
+
+// #[derive(Debug, Error)]
+// pub enum RALError {
+// #[error("exceeded maximum of 8 layouts for a pipeline")]
+// TooManyShaderDataLayouts,
+// }
+
+// impl PipelineBuilder {
+// /// Create a new [PipelineBuilder]
+// pub fn new(name: String) -> Self {
+// let vertex_description = VertexDesc::new(format!("{} Vertex Description", name.clone()));
+// Self {
+// name,
+// renderpass: None,
+// vertex_description,
+// data_layouts: Vec::new(),
+// shader_paths: None,
+// }
+// }
+// pub fn build(self) -> Result<Pipeline, RALError> {
+// let layouts = [celeritas_sys::ShaderDataLayout::default(); 8];
+// if self.data_layouts.len() > MAX_SHADER_DATA_LAYOUTS as usize {
+// return Err(RALError::TooManyShaderDataLayouts);
+// }
+// for (i, layout) in self.data_layouts.iter().enumerate().take(8) {
+// // layouts[i] = celeritas_sys::ShaderDataLayout::from(layout);
+// }
+// let (vert_path, frag_path) = self.shader_paths.expect("Shader paths must be provided");
+// let vert_code = std::fs::read_to_string(vert_path.clone()).expect("msg");
+// let frag_code = std::fs::read_to_string(frag_path.clone()).expect("msg");
+
+// // TODO: convert VertexDesc -> ffi::VertexDescription
+// // load shader
+// let vs = ShaderDesc {
+// debug_name: "".as_ptr() as *const i8,
+// filepath: Str8::from_str(&vert_path),
+// code: Str8::from_str(&vert_code),
+// is_spirv: false,
+// is_combined_vert_frag: false,
+// };
+// let fs = ShaderDesc {
+// debug_name: "".as_ptr() as *const i8,
+// filepath: Str8::from_str(&frag_path),
+// code: Str8::from_str(&frag_code),
+// is_spirv: false,
+// is_combined_vert_frag: false,
+// };
+
+// let desc = GraphicsPipelineDesc {
+// debug_name: "".as_ptr() as *const _,
+// vertex_desc: unsafe { self.vertex_description.into_ffi() },
+// vs,
+// fs,
+// data_layouts: layouts,
+// data_layouts_count: layouts.len() as u32,
+// wireframe: false,
+// depth_test: true,
+// };
+// let p = unsafe {
+// GPU_GraphicsPipeline_Create(
+// desc,
+// self.renderpass
+// .map(|r| r.0)
+// .unwrap_or(GPU_GetDefaultRenderpass()),
+// )
+// };
+// Ok(Pipeline(p))
+// }
+
+// pub fn add_vertex_desc(mut self, vertex_desc: VertexDesc) -> Self {
+// self.vertex_description = vertex_desc;
+// self
+// }
+// pub fn add_shader_layout<S: ShaderData>(mut self) -> Self {
+// let layout = S::layout();
+// self.data_layouts.push(layout);
+// self
+// }
+// pub fn add_shader_src(mut self, vertex_path: &str, fragment_path: &str) -> Self {
+// self.shader_paths = Some((vertex_path.to_owned(), fragment_path.to_owned()));
+// self
+// }
+// }
+
+// impl Pipeline {
+// pub fn raw_ptr(&self) -> *mut GPU_Pipeline {
+// self.0
+// }
+// }
+
+// ///
+// pub trait ShaderData {
+// ///
+// fn layout() -> ShaderDataLayout;
+// ///
+// fn bind(&self);
+
+// // fn bind_texture(&self, binding_name: &str, handle: TextureHandle);
+// // fn bind_buffer(&self, binding_name: &str, handle: BufferHandle);
+// }
+
+// #[derive(Clone)]
+// pub struct ShaderBinding {
+// pub label: String,
+// // pub label: *const ::std::os::raw::c_char,
+// pub kind: ShaderBindingKind,
+// pub vis: ShaderVisibility,
+// // pub data: ShaderBinding__bindgen_ty_1,
+// }
+
+// #[derive(Clone)]
+// pub enum ShaderBindingKind {
+// Bytes { size: usize, data: Option<*mut u8> },
+// Buffer(Option<BufferHandle>),
+// Texture(Option<TextureHandle>),
+// }
+
+// bitflags::bitflags! {
+// #[derive(Debug, Clone, Copy, PartialEq, Eq)]
+// pub struct ShaderVisibility : u32 {
+// const VERTEX = 1 << ShaderVisibility_VISIBILITY_VERTEX;
+// const FRAGMENT = 1 << ShaderVisibility_VISIBILITY_FRAGMENT;
+// const COMPUTE = 1 << ShaderVisibility_VISIBILITY_COMPUTE;
+// }
+// }
+// impl Default for ShaderVisibility {
+// fn default() -> Self {
+// ShaderVisibility::all()
+// }
+// }
+
+// #[derive(Default)]
+// pub struct ShaderDataLayout {
+// pub bindings: heapless::Vec<ShaderBinding, 8>,
+// }
+// impl ShaderDataLayout {
+// pub fn from_slice(bindings: &[ShaderBinding]) -> Self {
// todo!()
// }
// }
+// impl ShaderDataLayout {
+// pub fn into_ffi_type(self) -> celeritas_sys::ShaderDataLayout {
+// let mut bindings = [celeritas_sys::ShaderBinding::default(); 8];
+// for (i, b) in self.bindings.iter().enumerate().take(8) {
+// bindings[i] = match b.kind {
+// ShaderBindingKind::Bytes { size, data } => celeritas_sys::ShaderBinding {
+// label: b.label.as_ptr() as *const i8,
+// kind: ShaderBindingKind_BINDING_BYTES,
+// vis: ShaderVisibility_VISIBILITY_VERTEX,
+// data: ShaderBinding__bindgen_ty_1 {
+// bytes: ShaderBinding__bindgen_ty_1__bindgen_ty_1 {
+// size: size as u32,
+// data: data.unwrap() as *mut c_void,
+// },
+// },
+// },
+// ShaderBindingKind::Buffer(_) => todo!(),
+// ShaderBindingKind::Texture(_) => todo!(),
+// };
+// }
+// celeritas_sys::ShaderDataLayout {
+// bindings,
+// binding_count: bindings.len(),
+// }
+// }
+// }
+// // impl<'a> From<&ShaderDataLayout<'a>> for celeritas_sys::ShaderDataLayout {
+// // fn from(value: &ShaderDataLayout) -> Self {
+// // todo!()
+// // }
+// // }
+
+// // --- types
+
+// #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
+// pub enum PrimitiveTopology {
+// Point,
+// Line,
+// Triangle,
+// }
+// impl From<celeritas_sys::PrimitiveTopology> for PrimitiveTopology {
+// fn from(value: celeritas_sys::PrimitiveTopology) -> Self {
+// match value {
+// celeritas_sys::PrimitiveTopology_CEL_POINT => PrimitiveTopology::Point,
+// celeritas_sys::PrimitiveTopology_CEL_LINE => PrimitiveTopology::Line,
+// celeritas_sys::PrimitiveTopology_CEL_TRI => {
+// PrimitiveTopology::Triangle
+// }
+// _ => unreachable!("enum conversion should be infallible"),
+// }
+// }
+// }
+// #[cfg(test)]
+// mod test {
+// use super::*;
+
+// struct TestData {
+// _a: [f32; 2],
+// _b: [f32; 4],
+// }
+// impl ShaderData for TestData {
+// fn layout() -> ShaderDataLayout {
+// todo!()
+// }
+
+// fn bind(&self) {
+// todo!()
+// }
+// }
-// --- types
-
-#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
-pub enum PrimitiveTopology {
- Point,
- Line,
- Triangle,
-}
-impl From<celeritas_sys::PrimitiveTopology> for PrimitiveTopology {
- fn from(value: celeritas_sys::PrimitiveTopology) -> Self {
- match value {
- celeritas_sys::PrimitiveTopology_CEL_POINT => PrimitiveTopology::Point,
- celeritas_sys::PrimitiveTopology_CEL_LINE => PrimitiveTopology::Line,
- celeritas_sys::PrimitiveTopology_CEL_TRI => {
- PrimitiveTopology::Triangle
- }
- _ => unreachable!("enum conversion should be infallible"),
- }
- }
-}
-#[cfg(test)]
-mod test {
- use super::*;
-
- struct TestData {
- _a: [f32; 2],
- _b: [f32; 4],
- }
- impl ShaderData for TestData {
- fn layout() -> ShaderDataLayout {
- todo!()
- }
-
- fn bind(&self) {
- todo!()
- }
- }
-
- #[test]
- fn typecheck_pipeline_create() {
- let vertex_desc = VertexDesc::new("Empty".into())
- .add_attr("position", VertexAttrKind::Floatx2)
- .add_attr("color", VertexAttrKind::Floatx4);
-
- let builder = PipelineBuilder::new("Test Pipeline".into())
- .add_shader_layout::<TestData>()
- .add_vertex_desc(vertex_desc);
-
- let pipeline = builder.build().expect("Should be valid");
- }
-}
+// #[test]
+// fn typecheck_pipeline_create() {
+// let vertex_desc = VertexDesc::new("Empty".into())
+// .add_attr("position", VertexAttrKind::Floatx2)
+// .add_attr("color", VertexAttrKind::Floatx4);
+
+// let builder = PipelineBuilder::new("Test Pipeline".into())
+// .add_shader_layout::<TestData>()
+// .add_vertex_desc(vertex_desc);
+
+// let pipeline = builder.build().expect("Should be valid");
+// }
+// }
diff --git a/bindgen/rust/src/resources.rs b/bindgen/rust/src/resources.rs
index e7f4505..7287632 100644
--- a/bindgen/rust/src/resources.rs
+++ b/bindgen/rust/src/resources.rs
@@ -1,10 +1,10 @@
-use std::ffi::CString;
+// use std::ffi::CString;
-use celeritas_sys::{ModelHandle, ModelLoad_gltf};
+// use celeritas_sys::{ModelHandle, ModelLoad_gltf};
-/// Load a gltf from disk
-pub fn model_load_gltf(path: &str) -> Option<ModelHandle> {
- let path_str = CString::new(path).unwrap();
- let handle = unsafe { ModelLoad_gltf(path_str.as_ptr() as *const _, false) };
- Some(handle)
-}
+// /// Load a gltf from disk
+// pub fn model_load_gltf(path: &str) -> Option<ModelHandle> {
+// let path_str = CString::new(path).unwrap();
+// let handle = unsafe { ModelLoad_gltf(path_str.as_ptr() as *const _, false) };
+// Some(handle)
+// }
diff --git a/bindgen/rust/src/shader.rs b/bindgen/rust/src/shader.rs
index ef221a0..94dff46 100644
--- a/bindgen/rust/src/shader.rs
+++ b/bindgen/rust/src/shader.rs
@@ -1,24 +1,24 @@
-#![allow(unused_variables)]
-use std::{ffi::c_void, path::Path};
+// #![allow(unused_variables)]
+// use std::{ffi::c_void, path::Path};
-use crate::ral::{Pipeline, ShaderBinding};
+// use crate::ral::{Pipeline, ShaderBinding};
-pub struct Shader {
- pipeline: Pipeline,
- binding_layouts: Vec<ShaderBinding>,
-}
+// pub struct Shader {
+// pipeline: Pipeline,
+// binding_layouts: Vec<ShaderBinding>,
+// }
-#[no_mangle]
-pub unsafe extern "C" fn rust_function(data: *mut c_void) -> celeritas_sys::ShaderDataLayout {
- todo!()
-}
+// #[no_mangle]
+// pub unsafe extern "C" fn rust_function(data: *mut c_void) -> celeritas_sys::ShaderDataLayout {
+// todo!()
+// }
-impl Shader {
- pub fn new(name: String, vs_path: &Path, fs_path: &Path) -> Self {
- todo!()
- }
- pub fn add_layout(&mut self) -> &mut Self {
- // TODO
- self
- }
-}
+// impl Shader {
+// pub fn new(name: String, vs_path: &Path, fs_path: &Path) -> Self {
+// todo!()
+// }
+// pub fn add_layout(&mut self) -> &mut Self {
+// // TODO
+// self
+// }
+// }