commit c4da7892ee0e7e3eb4914e5f8a7f9c113d706718 Author: Brandon Thomas Date: Mon Jan 11 23:56:30 2021 -0500 Point cloud generator WIP project boilerplate. zeromq work not done. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a6eaf47 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*~ +.idea/ +target/ diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..c74dbbb --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,93 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "bytes" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "error-chain" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9435d864e017c3c6afeac1654189b06cdb491cf2ff73dbf0d73b0f292f42ff8" + +[[package]] +name = "libc" +version = "0.2.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89203f3fba0a3795506acaad8ebce3c80c0af93f994d5a1d7a0b1eeb23271929" + +[[package]] +name = "log" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcf3805d4480bb5b86070dcfeb9e2cb2ebc148adb753c5cca5f884d1d65a42b2" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "metadeps" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73b122901b3a675fac8cecf68dcb2f0d3036193bc861d1ac0e1c337f7d5254c2" +dependencies = [ + "error-chain", + "pkg-config", + "toml", +] + +[[package]] +name = "pkg-config" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" + +[[package]] +name = "point-generator" +version = "0.0.1" +dependencies = [ + "bytes", + "zmq", +] + +[[package]] +name = "toml" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4" + +[[package]] +name = "zmq" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aad98a7a617d608cd9e1127147f630d24af07c7cd95ba1533246d96cbdd76c66" +dependencies = [ + "bitflags", + "libc", + "log", + "zmq-sys", +] + +[[package]] +name = "zmq-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d33a2c51dde24d5b451a2ed4b488266df221a5eaee2ee519933dc46b9a9b3648" +dependencies = [ + "libc", + "metadeps", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..5be0015 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "point-generator" +edition = "2018" +version = "0.0.1" +authors = [ + "Brandon Thomas ", + "Brandon Thomas ", +] +publish = false + +[[bin]] +name = "point-generator" +path = "src/main.rs" + +[dependencies] +bytes = "1.0.1" +zmq = "0.9" +#zeromq = "0.2.0" # Doesn't compile. Complains about Rust issue #54727 diff --git a/README.md b/README.md new file mode 100644 index 0000000..e52d211 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +point-generator +=============== +Generate points to send over ZeroMQ to the Unreal Engine point cloud demo. diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..1e0fc7b --- /dev/null +++ b/src/main.rs @@ -0,0 +1,15 @@ +mod point; + +use point::Point; + +fn main() { + let ctx = zmq::Context::new(); + + let socket = ctx.socket(zmq::REQ).unwrap(); + + let point = Point::white_at(0.0f32, 0.0f32, 0.0f32); + + + socket.connect("tcp://127.0.0.1:1234").unwrap(); + socket.send("hello world!", 0).unwrap(); +} diff --git a/src/point.rs b/src/point.rs new file mode 100644 index 0000000..3f5c76f --- /dev/null +++ b/src/point.rs @@ -0,0 +1,27 @@ + +pub struct Point { + pub x: f32, + pub y: f32, + pub z: f32, + _unused: f32, + pub r: f32, + pub g: f32, + pub b: f32, + pub a: f32, +} + +impl Point { + + pub fn white_at(x: f32, y: f32, z: f32) -> Self { + Point { + x, + y, + z, + _unused: 0.0f32, + r: 1.0f32, + g: 1.0f32, + b: 1.0f32, + a: 1.0f32, + } + } +} \ No newline at end of file