From 211bfe1e210b0dddaeb06131961c694b2d36ef8b Mon Sep 17 00:00:00 2001 From: Jason Sobotka Date: Fri, 6 Dec 2024 16:25:44 -0600 Subject: [PATCH 01/24] Initial commit Sorting and texture generation utilities for gaussian splats --- wasm-splats/.appveyor.yml | 11 + wasm-splats/.github/dependabot.yml | 8 + wasm-splats/.gitignore | 6 + wasm-splats/.travis.yml | 69 +++++++ wasm-splats/Cargo.toml | 31 +++ wasm-splats/LICENSE_APACHE | 201 +++++++++++++++++++ wasm-splats/LICENSE_MIT | 25 +++ wasm-splats/README.md | 84 ++++++++ wasm-splats/src/lib.rs | 41 ++++ wasm-splats/src/perf_timer.rs | 75 +++++++ wasm-splats/src/radix.rs | 204 +++++++++++++++++++ wasm-splats/src/radix_simd.rs | 312 +++++++++++++++++++++++++++++ wasm-splats/src/textureGen.rs | 172 ++++++++++++++++ wasm-splats/src/utils.rs | 10 + wasm-splats/tests/web.rs | 13 ++ 15 files changed, 1262 insertions(+) create mode 100644 wasm-splats/.appveyor.yml create mode 100644 wasm-splats/.github/dependabot.yml create mode 100644 wasm-splats/.gitignore create mode 100644 wasm-splats/.travis.yml create mode 100644 wasm-splats/Cargo.toml create mode 100644 wasm-splats/LICENSE_APACHE create mode 100644 wasm-splats/LICENSE_MIT create mode 100644 wasm-splats/README.md create mode 100644 wasm-splats/src/lib.rs create mode 100644 wasm-splats/src/perf_timer.rs create mode 100644 wasm-splats/src/radix.rs create mode 100644 wasm-splats/src/radix_simd.rs create mode 100644 wasm-splats/src/textureGen.rs create mode 100644 wasm-splats/src/utils.rs create mode 100644 wasm-splats/tests/web.rs diff --git a/wasm-splats/.appveyor.yml b/wasm-splats/.appveyor.yml new file mode 100644 index 0000000..50910bd --- /dev/null +++ b/wasm-splats/.appveyor.yml @@ -0,0 +1,11 @@ +install: + - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe + - if not defined RUSTFLAGS rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain nightly + - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin + - rustc -V + - cargo -V + +build: false + +test_script: + - cargo test --locked diff --git a/wasm-splats/.github/dependabot.yml b/wasm-splats/.github/dependabot.yml new file mode 100644 index 0000000..7377d37 --- /dev/null +++ b/wasm-splats/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: +- package-ecosystem: cargo + directory: "/" + schedule: + interval: daily + time: "08:00" + open-pull-requests-limit: 10 diff --git a/wasm-splats/.gitignore b/wasm-splats/.gitignore new file mode 100644 index 0000000..4e30131 --- /dev/null +++ b/wasm-splats/.gitignore @@ -0,0 +1,6 @@ +/target +**/*.rs.bk +Cargo.lock +bin/ +pkg/ +wasm-pack.log diff --git a/wasm-splats/.travis.yml b/wasm-splats/.travis.yml new file mode 100644 index 0000000..7a91325 --- /dev/null +++ b/wasm-splats/.travis.yml @@ -0,0 +1,69 @@ +language: rust +sudo: false + +cache: cargo + +matrix: + include: + + # Builds with wasm-pack. + - rust: beta + env: RUST_BACKTRACE=1 + addons: + firefox: latest + chrome: stable + before_script: + - (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update) + - (test -x $HOME/.cargo/bin/cargo-generate || cargo install --vers "^0.2" cargo-generate) + - cargo install-update -a + - curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f + script: + - cargo generate --git . --name testing + # Having a broken Cargo.toml (in that it has curlies in fields) anywhere + # in any of our parent dirs is problematic. + - mv Cargo.toml Cargo.toml.tmpl + - cd testing + - wasm-pack build + - wasm-pack test --chrome --firefox --headless + + # Builds on nightly. + - rust: nightly + env: RUST_BACKTRACE=1 + before_script: + - (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update) + - (test -x $HOME/.cargo/bin/cargo-generate || cargo install --vers "^0.2" cargo-generate) + - cargo install-update -a + - rustup target add wasm32-unknown-unknown + script: + - cargo generate --git . --name testing + - mv Cargo.toml Cargo.toml.tmpl + - cd testing + - cargo check + - cargo check --target wasm32-unknown-unknown + - cargo check --no-default-features + - cargo check --target wasm32-unknown-unknown --no-default-features + - cargo check --no-default-features --features console_error_panic_hook + - cargo check --target wasm32-unknown-unknown --no-default-features --features console_error_panic_hook + - cargo check --no-default-features --features "console_error_panic_hook wee_alloc" + - cargo check --target wasm32-unknown-unknown --no-default-features --features "console_error_panic_hook wee_alloc" + + # Builds on beta. + - rust: beta + env: RUST_BACKTRACE=1 + before_script: + - (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update) + - (test -x $HOME/.cargo/bin/cargo-generate || cargo install --vers "^0.2" cargo-generate) + - cargo install-update -a + - rustup target add wasm32-unknown-unknown + script: + - cargo generate --git . --name testing + - mv Cargo.toml Cargo.toml.tmpl + - cd testing + - cargo check + - cargo check --target wasm32-unknown-unknown + - cargo check --no-default-features + - cargo check --target wasm32-unknown-unknown --no-default-features + - cargo check --no-default-features --features console_error_panic_hook + - cargo check --target wasm32-unknown-unknown --no-default-features --features console_error_panic_hook + # Note: no enabling the `wee_alloc` feature here because it requires + # nightly for now. diff --git a/wasm-splats/Cargo.toml b/wasm-splats/Cargo.toml new file mode 100644 index 0000000..5689934 --- /dev/null +++ b/wasm-splats/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "wasm-splats" +version = "0.1.0" +authors = ["Jason Sobotka "] +edition = "2021" + +[lib] +crate-type = ["cdylib", "rlib"] + +[features] +default = ["console_error_panic_hook"] + +[dependencies] +wasm-bindgen = "0.2.84" +js-sys = "0.3.72" +web-sys = { version="0.3.72", features=["console"]} + +# The `console_error_panic_hook` crate provides better debugging of panics by +# logging them with `console.error`. This is great for development, but requires +# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for +# code size when deploying. +console_error_panic_hook = { version = "0.1.7", optional = true } + +[dev-dependencies] +wasm-bindgen-test = "0.3.34" + +[profile.release] +# Tell `rustc` to optimize for small code size. +opt-level = 3 +lto = true +codegen-units = 1 \ No newline at end of file diff --git a/wasm-splats/LICENSE_APACHE b/wasm-splats/LICENSE_APACHE new file mode 100644 index 0000000..11069ed --- /dev/null +++ b/wasm-splats/LICENSE_APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/wasm-splats/LICENSE_MIT b/wasm-splats/LICENSE_MIT new file mode 100644 index 0000000..cb6579f --- /dev/null +++ b/wasm-splats/LICENSE_MIT @@ -0,0 +1,25 @@ +Copyright (c) 2018 Jason Sobotka + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/wasm-splats/README.md b/wasm-splats/README.md new file mode 100644 index 0000000..6b68408 --- /dev/null +++ b/wasm-splats/README.md @@ -0,0 +1,84 @@ +
+ +

wasm-pack-template

+ + A template for kick starting a Rust and WebAssembly project using wasm-pack. + +

+ Build Status +

+ +

+ Tutorial + | + Chat +

+ + Built with 🦀🕸 by The Rust and WebAssembly Working Group +
+ +## About + +[**📚 Read this template tutorial! 📚**][template-docs] + +This template is designed for compiling Rust libraries into WebAssembly and +publishing the resulting package to NPM. + +Be sure to check out [other `wasm-pack` tutorials online][tutorials] for other +templates and usages of `wasm-pack`. + +[tutorials]: https://rustwasm.github.io/docs/wasm-pack/tutorials/index.html +[template-docs]: https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html + +## 🚴 Usage + +### 🐑 Use `cargo generate` to Clone this Template + +[Learn more about `cargo generate` here.](https://github.com/ashleygwilliams/cargo-generate) + +``` +cargo generate --git https://github.com/rustwasm/wasm-pack-template.git --name my-project +cd my-project +``` + +### 🛠️ Build with `wasm-pack build` + +``` +wasm-pack build +``` + +### 🔬 Test in Headless Browsers with `wasm-pack test` + +``` +wasm-pack test --headless --firefox +``` + +### 🎁 Publish to NPM with `wasm-pack publish` + +``` +wasm-pack publish +``` + +## 🔋 Batteries Included + +* [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen) for communicating + between WebAssembly and JavaScript. +* [`console_error_panic_hook`](https://github.com/rustwasm/console_error_panic_hook) + for logging panic messages to the developer console. +* `LICENSE-APACHE` and `LICENSE-MIT`: most Rust projects are licensed this way, so these are included for you + +## License + +Licensed under either of + +* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) +* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) + +at your option. + +### Contribution + +Unless you explicitly state otherwise, any contribution intentionally +submitted for inclusion in the work by you, as defined in the Apache-2.0 +license, shall be dual licensed as above, without any additional terms or +conditions. diff --git a/wasm-splats/src/lib.rs b/wasm-splats/src/lib.rs new file mode 100644 index 0000000..39752c3 --- /dev/null +++ b/wasm-splats/src/lib.rs @@ -0,0 +1,41 @@ +mod utils; +mod perf_timer; +mod textureGen; +mod radix_simd; +mod radix; + +use wasm_bindgen::prelude::*; +use js_sys::{Float32Array, Uint8Array, Uint16Array, Uint32Array, Object}; + +#[wasm_bindgen] +extern "C" { + fn alert(s: &str); +} + +//Wrapper func. Most are called directly +#[wasm_bindgen] +pub fn generate_splat_texture_from_attrs( + positions: &Float32Array, + scales: &Float32Array, + rotations: &Float32Array, + colors: &Uint8Array, + count: usize +) -> Result { + let texture_data = textureGen::generate_texture_from_attrs( + positions, + scales, + rotations, + colors, + count + )?; + + let js_data = Uint32Array::new_with_length((texture_data.width() * texture_data.height() * 4) as u32); + js_data.copy_from(&texture_data.data()); + + let result = Object::new(); + js_sys::Reflect::set(&result, &"data".into(), &js_data)?; + js_sys::Reflect::set(&result, &"width".into(), &(texture_data.width() as f64).into())?; + js_sys::Reflect::set(&result, &"height".into(), &(texture_data.height() as f64).into())?; + + Ok(result) +} \ No newline at end of file diff --git a/wasm-splats/src/perf_timer.rs b/wasm-splats/src/perf_timer.rs new file mode 100644 index 0000000..dd79961 --- /dev/null +++ b/wasm-splats/src/perf_timer.rs @@ -0,0 +1,75 @@ +use std::time::{Duration, Instant}; +use std::collections::HashMap; +use std::fmt; + +#[derive(Debug)] +pub struct Timer { + start: Instant, + splits: HashMap, + last_split: Instant, +} + +impl Timer { + pub fn new() -> Self { + let now = Instant::now(); + Timer { + start: now, + splits: HashMap::new(), + last_split: now, + } + } + + pub fn split(&mut self, name: &str) { + let now = Instant::now(); + let duration = now.duration_since(self.last_split); + self.splits.insert(name.to_string(), duration); + self.last_split = now; + } + + pub fn elapsed(&self) -> Duration { + Instant::now().duration_since(self.start) + } + + pub fn get_split(&self, name: &str) -> Option { + self.splits.get(name).copied() + } + + pub fn reset(&mut self) { + let now = Instant::now(); + self.start = now; + self.last_split = now; + self.splits.clear(); + } +} + +impl fmt::Display for Timer { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + writeln!(f, "Total time: {:?}", self.elapsed())?; + writeln!(f, "\nSplits:")?; + for (name, duration) in &self.splits { + writeln!(f, "{}: {:?}", name, duration)?; + } + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use std::thread::sleep; + + #[test] + fn test_basic_timing() { + let mut timer = Timer::new(); + + sleep(Duration::from_millis(100)); + timer.split("first_operation"); + + sleep(Duration::from_millis(50)); + timer.split("second_operation"); + + assert!(timer.get_split("first_operation").unwrap().as_millis() >= 100); + assert!(timer.get_split("second_operation").unwrap().as_millis() >= 50); + assert!(timer.elapsed().as_millis() >= 150); + } +} \ No newline at end of file diff --git a/wasm-splats/src/radix.rs b/wasm-splats/src/radix.rs new file mode 100644 index 0000000..2d2622c --- /dev/null +++ b/wasm-splats/src/radix.rs @@ -0,0 +1,204 @@ +use wasm_bindgen::prelude::*; +use js_sys::{Float32Array, Uint8Array, Uint32Array, WebAssembly}; +use wasm_bindgen::JsCast; + +#[wasm_bindgen] +pub fn radix_sort_gaussians_attrs( + positions: &Float32Array, + scales: &Float32Array, + rotations: &Float32Array, + colors: &Uint8Array, + model_view: &Float32Array, + count: usize, +) -> Result { + if positions.length() as usize != count * 3 + || scales.length() as usize != count * 3 + || rotations.length() as usize != count * 4 + || colors.length() as usize != count * 4 + || model_view.length() != 16 { + return Err(JsValue::from_str("Invalid array lengths")); + } + + //set capacity first + let positions_vec = positions.to_vec(); + let model_view_vec = model_view.to_vec(); + + let mut depth_values = vec![0i32; count]; + let mut max_depth = f32::NEG_INFINITY; + let mut min_depth = f32::INFINITY; + + for i in 0..count { + let depth = positions_vec[i * 3] * model_view_vec[2] + + positions_vec[i * 3 + 1] * model_view_vec[6] + + positions_vec[i * 3 + 2] * model_view_vec[10]; + + let depth_int = (depth * 4096.0) as i32; + depth_values[i] = depth_int; + max_depth = max_depth.max(depth_int as f32); + min_depth = min_depth.min(depth_int as f32); + } + + let depth_offset = (-min_depth) as i32; + for depth in depth_values.iter_mut() { + *depth += depth_offset; + } + + let mut indices: Vec = (0..count as u32).collect(); + let mut temp_depths = vec![0i32; count]; + let mut temp_indices = vec![0u32; count]; + + for shift in (0..32).step_by(8) { + let mut counts = [0u32; 256]; + + for &depth in depth_values.iter() { + let byte = ((depth >> shift) & 0xFF) as usize; + counts[byte] += 1; + } + + let mut total = 0; + for count in counts.iter_mut() { + let current = *count; + *count = total; + total += current; + } + + for i in 0..count { + let byte = ((depth_values[i] >> shift) & 0xFF) as usize; + let pos = counts[byte] as usize; + counts[byte] += 1; + + temp_depths[pos] = depth_values[i]; + temp_indices[pos] = indices[i]; + } + + depth_values.copy_from_slice(&temp_depths); + indices.copy_from_slice(&temp_indices); + } + + let mut new_positions: Vec = vec![0.0; count * 3]; + let mut new_scales: Vec = vec![0.0; count * 3]; + let mut new_rotations: Vec = vec![0.0; count * 4]; + let mut new_colors: Vec = vec![0; count * 4]; + + let scales_vec = scales.to_vec(); + let rotations_vec = rotations.to_vec(); + let colors_vec = colors.to_vec(); + + for i in 0..count { + let j = indices[i] as usize; + + new_positions[i * 3] = positions_vec[j * 3]; + new_positions[i * 3 + 1] = positions_vec[j * 3 + 1]; + new_positions[i * 3 + 2] = positions_vec[j * 3 + 2]; + + new_scales[i * 3] = scales_vec[j * 3]; + new_scales[i * 3 + 1] = scales_vec[j * 3 + 1]; + new_scales[i * 3 + 2] = scales_vec[j * 3 + 2]; + + new_rotations[i * 4] = rotations_vec[j * 4]; + new_rotations[i * 4 + 1] = rotations_vec[j * 4 + 1]; + new_rotations[i * 4 + 2] = rotations_vec[j * 4 + 2]; + new_rotations[i * 4 + 3] = rotations_vec[j * 4 + 3]; + + new_colors[i * 4] = colors_vec[j * 4]; + new_colors[i * 4 + 1] = colors_vec[j * 4 + 1]; + new_colors[i * 4 + 2] = colors_vec[j * 4 + 2]; + new_colors[i * 4 + 3] = colors_vec[j * 4 + 3]; + } + + let new_positions_array = Float32Array::new_with_length(count as u32 * 3); + new_positions_array.copy_from(&new_positions[..]); + + let new_scales_array = Float32Array::new_with_length(count as u32 * 3); + new_scales_array.copy_from(&new_scales[..]); + + let new_rotations_array = Float32Array::new_with_length(count as u32 * 4); + new_rotations_array.copy_from(&new_rotations[..]); + + let new_colors_array = Uint8Array::new_with_length(count as u32 * 4); + new_colors_array.copy_from(&new_colors[..]); + + let result = js_sys::Array::new(); + result.push(&new_positions_array); + result.push(&new_scales_array); + result.push(&new_rotations_array); + result.push(&new_colors_array); + + Ok(result) +} + + +#[wasm_bindgen] +pub fn radix_sort_gaussians_indexes( + positions: &Float32Array, + model_view: &Float32Array, + texture_width: u32, + count: usize, +) -> Result { + if positions.length() as usize != count * 3 { + return Err(JsValue::from_str("Invalid positions length")); + } + if model_view.length() != 16 { + return Err(JsValue::from_str("Invalid model_view length")); + } + + let positions_vec = positions.to_vec(); + let model_view_vec = model_view.to_vec(); + let mut depth_values = vec![0i32; count]; + let mut max_depth = f32::NEG_INFINITY; + let mut min_depth = f32::INFINITY; + + for i in 0..count { + let depth = positions_vec[i * 3] * model_view_vec[2] + + positions_vec[i * 3 + 1] * model_view_vec[6] + + positions_vec[i * 3 + 2] * model_view_vec[10]; + + let depth_int = (depth * 4096.0) as i32; + depth_values[i] = depth_int; + max_depth = max_depth.max(depth_int as f32); + min_depth = min_depth.min(depth_int as f32); + } + + let depth_offset = (-min_depth) as i32; + for depth in depth_values.iter_mut() { + *depth += depth_offset; + } + + let mut indices: Vec = (0..count as u32).collect(); + let mut temp_depths = vec![0i32; count]; + let mut temp_indices = vec![0u32; count]; + + for shift in (0..32).step_by(8) { + let mut counts = [0u32; 256]; + + for &depth in depth_values.iter() { + let byte = ((depth >> shift) & 0xFF) as usize; + counts[byte] += 1; + } + + let mut total = 0; + for count in counts.iter_mut() { + let current = *count; + *count = total; + total += current; + } + + for i in 0..count { + let byte = ((depth_values[i] >> shift) & 0xFF) as usize; + let pos = counts[byte] as usize; + counts[byte] += 1; + + temp_depths[pos] = depth_values[i]; + temp_indices[pos] = indices[i]; + } + + depth_values.copy_from_slice(&temp_depths); + indices.copy_from_slice(&temp_indices); + } + + let indices_array = Uint32Array::new_with_length(count as u32); + indices_array.copy_from(&indices); + + Ok(indices_array) +} + diff --git a/wasm-splats/src/radix_simd.rs b/wasm-splats/src/radix_simd.rs new file mode 100644 index 0000000..8d8e1f6 --- /dev/null +++ b/wasm-splats/src/radix_simd.rs @@ -0,0 +1,312 @@ +use std::arch::wasm32::*; +use wasm_bindgen::prelude::*; +use js_sys::{Float32Array, Uint8Array, Uint32Array, WebAssembly}; +use wasm_bindgen::JsCast; +use web_sys::console; + +use crate::perf_timer; + +#[wasm_bindgen] +pub struct GSplatData { + positions: Vec, + scales: Vec, + rotations: Vec, + colors: Vec, + model_view: [f32; 16], + count: usize, +} + +#[wasm_bindgen] +impl GSplatData { + #[wasm_bindgen(constructor)] + pub fn new( + positions: Vec, + scales: Vec, + rotations: Vec, + colors: Vec, + model_view: Vec, + count: usize, + ) -> Self { + let mut model_view_array = [0.0; 16]; + model_view_array.copy_from_slice(&model_view); + + Self { + positions, + scales, + rotations, + colors, + model_view: model_view_array, + count, + } + } + + #[wasm_bindgen(js_name = fromFloat32Arrays)] + pub fn from_float32_arrays( + positions: Float32Array, + scales: Float32Array, + rotations: Float32Array, + colors: Uint8Array, + model_view: Float32Array, + count: usize, + ) -> Result { + if positions.length() as usize != count * 3 { + return Err(JsValue::from_str("Invalid positions length")); + } + if scales.length() as usize != count * 3 { + return Err(JsValue::from_str("Invalid scales length")); + } + if rotations.length() as usize != count * 4 { + return Err(JsValue::from_str("Invalid rotations length")); + } + if colors.length() as usize != count * 4 { + return Err(JsValue::from_str("Invalid colors length")); + } + if model_view.length() != 16 { + return Err(JsValue::from_str("Model view matrix must have 16 elements")); + } + + let positions: Vec = positions.to_vec(); + let scales: Vec = scales.to_vec(); + let rotations: Vec = rotations.to_vec(); + let colors: Vec = colors.to_vec(); + let model_view: Vec = model_view.to_vec(); + + Ok(GSplatData::new( + positions, + scales, + rotations, + colors, + model_view, + count, + )) + } + + #[wasm_bindgen(js_name = getPositions)] + pub fn get_positions(&self) -> Float32Array { + let result = Float32Array::new_with_length(self.positions.len() as u32); + result.copy_from(&self.positions[..]); + result + } + + #[wasm_bindgen(js_name = getScales)] + pub fn get_scales(&self) -> Float32Array { + let result = Float32Array::new_with_length(self.scales.len() as u32); + result.copy_from(&self.scales[..]); + result + } + + #[wasm_bindgen(js_name = getRotations)] + pub fn get_rotations(&self) -> Float32Array { + let result = Float32Array::new_with_length(self.rotations.len() as u32); + result.copy_from(&self.rotations[..]); + result + } + + #[wasm_bindgen(js_name = getColors)] + pub fn get_colors(&self) -> Uint8Array { + let result = Uint8Array::new_with_length(self.colors.len() as u32); + result.copy_from(&self.colors[..]); + result + } +} + +#[target_feature(enable = "simd128")] +unsafe fn compute_depths_simd(positions: &[f32], model_view: &[f32], count: usize) -> Vec { + let mut depths = Vec::with_capacity(count); + let simd_count = count - (count % 4); + + let scale = f32x4(4096.0, 4096.0, 4096.0, 4096.0); + let mv2 = f32x4_splat(model_view[2]); + let mv6 = f32x4_splat(model_view[6]); + let mv10 = f32x4_splat(model_view[10]); + + for chunk_idx in (0..simd_count).step_by(4) { + let base_idx = chunk_idx * 3; + if base_idx + 11 >= positions.len() { + break; + } + + let pos = v128_load(positions[base_idx..].as_ptr() as *const v128); + let mut depth = f32x4_mul(pos, mv2); + + let pos_y = v128_load(positions[base_idx + 4..].as_ptr() as *const v128); + depth = f32x4_add(depth, f32x4_mul(pos_y, mv6)); + + let pos_z = v128_load(positions[base_idx + 8..].as_ptr() as *const v128); + depth = f32x4_add(depth, f32x4_mul(pos_z, mv10)); + + let depth_scaled = f32x4_mul(depth, scale); + let depth_int = i32x4_trunc_sat_f32x4(depth_scaled); + + let mut result = [0i32; 4]; + v128_store(result.as_mut_ptr() as *mut v128, depth_int); + depths.extend_from_slice(&result); + } + + let remainder_start = (count / 4) * 4; + for i in remainder_start..count { + let idx = i * 3; + if idx + 2 < positions.len() { + let depth = positions[idx] * model_view[2] + + positions[idx + 1] * model_view[6] + + positions[idx + 2] * model_view[10]; + depths.push((depth * 4096.0) as i32); + } + } + + depths.truncate(count); + depths +} + +#[target_feature(enable = "simd128")] +unsafe fn reorder_attributes_simd(data: &mut GSplatData, indices: &[u32]) { + let mut new_positions = vec![0.0; data.positions.len()]; + let mut new_scales = vec![0.0; data.scales.len()]; + let mut new_rotations = vec![0.0; data.rotations.len()]; + let mut new_colors = vec![0; data.colors.len()]; + + for (new_idx, &old_idx) in indices.iter().enumerate() { + let old_idx = old_idx as usize; + + if old_idx * 3 + 2 >= data.positions.len() || + new_idx * 3 + 2 >= new_positions.len() { + break; + } + + let pos_idx = new_idx * 3; + let old_pos_idx = old_idx * 3; + new_positions[pos_idx..pos_idx + 3] + .copy_from_slice(&data.positions[old_pos_idx..old_pos_idx + 3]); + + if old_idx * 3 + 2 >= data.scales.len() || + new_idx * 3 + 2 >= new_scales.len() { + break; + } + + let scale_idx = new_idx * 3; + let old_scale_idx = old_idx * 3; + new_scales[scale_idx..scale_idx + 3] + .copy_from_slice(&data.scales[old_scale_idx..old_scale_idx + 3]); + + if old_idx * 4 + 3 >= data.rotations.len() || + new_idx * 4 + 3 >= new_rotations.len() { + break; + } + + let rot_idx = new_idx * 4; + let old_rot_idx = old_idx * 4; + new_rotations[rot_idx..rot_idx + 4] + .copy_from_slice(&data.rotations[old_rot_idx..old_rot_idx + 4]); + + if old_idx * 4 + 3 >= data.colors.len() || + new_idx * 4 + 3 >= new_colors.len() { + break; + } + + let color_idx = new_idx * 4; + let old_color_idx = old_idx * 4; + new_colors[color_idx..color_idx + 4] + .copy_from_slice(&data.colors[old_color_idx..old_color_idx + 4]); + } + + data.positions = new_positions; + data.scales = new_scales; + data.rotations = new_rotations; + data.colors = new_colors; +} + +#[wasm_bindgen] +pub fn radix_sort_simd(data: &mut GSplatData) -> Result<(), JsValue> { + let count = data.count; + + if count * 3 > data.positions.len() || + count * 3 > data.scales.len() || + count * 4 > data.rotations.len() || + count * 4 > data.colors.len() { + return Err(JsValue::from_str("Invalid input sizes")); + } + + let mut depths = unsafe { + compute_depths_simd(&data.positions, &data.model_view, count) + }; + let mut indices: Vec = (0..count as u32).collect(); + + let mut temp_depths = vec![0i32; count]; + let mut temp_indices = vec![0u32; count]; + + for shift in (0..32).step_by(8) { + let mut counts = [0u32; 256]; + + unsafe { count_frequencies_simd(&depths, shift, &mut counts) }; + + let mut total = 0u32; + for count in counts.iter_mut() { + let current = *count; + *count = total; + total += current; + } + + unsafe { + scatter_elements_simd( + &depths, + &indices, + shift, + &counts, + &mut temp_depths, + &mut temp_indices + ) + }; + std::mem::swap(&mut depths, &mut temp_depths); + std::mem::swap(&mut indices, &mut temp_indices); + } + + unsafe { reorder_attributes_simd(data, &indices) }; + Ok(()) +} + +#[target_feature(enable = "simd128")] +unsafe fn count_frequencies_simd(depths: &[i32], shift: u32, counts: &mut [u32; 256]) { + unsafe { + let mask = i32x4_splat(0xFF); + + for chunk in depths.chunks_exact(4) { + let values = v128_load(chunk.as_ptr() as *const v128); + let shifted = i32x4_shr(values, shift); + let bytes = v128_and(shifted as v128, mask); + + let mut result = [0i32; 4]; + v128_store(result.as_mut_ptr() as *mut v128, bytes); + + for &value in &result { + counts[value as usize] += 1; + } + } + } + + for &depth in depths.chunks_exact(4).remainder() { + let byte = ((depth >> shift) & 0xFF) as usize; + counts[byte] += 1; + } +} + +#[target_feature(enable = "simd128")] +unsafe fn scatter_elements_simd( + depths: &[i32], + indices: &[u32], + shift: u32, + counts: &[u32; 256], + temp_depths: &mut [i32], + temp_indices: &mut [u32], +) { + let mut offsets = counts.to_owned(); + + for (&depth, &index) in depths.iter().zip(indices.iter()) { + let byte = ((depth >> shift) & 0xFF) as usize; + let pos = offsets[byte] as usize; + + temp_depths[pos] = depth; + temp_indices[pos] = index; + + offsets[byte] += 1; + } +} \ No newline at end of file diff --git a/wasm-splats/src/textureGen.rs b/wasm-splats/src/textureGen.rs new file mode 100644 index 0000000..06297a4 --- /dev/null +++ b/wasm-splats/src/textureGen.rs @@ -0,0 +1,172 @@ +use wasm_bindgen::prelude::*; +use std::mem; +use js_sys::{Float32Array, Uint8Array}; +use web_sys::console::*; + +#[wasm_bindgen] +pub struct TextureData { + + data: Vec, + width: u32, + height: u32, +} + +#[wasm_bindgen] +impl TextureData { + #[wasm_bindgen(getter)] + pub fn data(&self) -> Vec { + self.data.clone() + } + + #[wasm_bindgen(getter)] + pub fn width(&self) -> u32 { + self.width + } + + #[wasm_bindgen(getter)] + pub fn height(&self) -> u32 { + self.height + } + + pub fn new(data: Vec, width: u32, height: u32) -> Self { + TextureData { + data, + width, + height + } + } +} + +//Algorithm from ILM +//https://github.com/mitsuba-renderer/openexr/blob/master/IlmBase/Half/half.cpp +fn float_to_half(f: f32) -> i16 { + let f_int = f.to_bits() as i32; + let sign = (f_int >> 16) & 0x00008000; + let mut exp = ((f_int >> 23) & 0x000000ff) - (127 - 15); + let mut frac = f_int & 0x007fffff; + + if exp <= 0 { + if exp < -10 { + return sign as i16; + } + + frac = frac | 0x00800000; + + let t = 14 - exp; + let a = (1 << (t - 1)) - 1; + let b = (frac >> t) & 1; + + frac = (frac + a + b) >> t; + return (sign | frac) as i16; + } else if exp == 0xff - (127 - 15) { + if frac == 0 { + return (sign | 0x7c00) as i16; + } else { + frac >>= 13; + return (sign | 0x7c00 | frac | ((frac == 0) as i32)) as i16; + } + } + + frac = frac + 0x00000fff + ((frac >> 13) & 1); + + if frac & 0x00800000 != 0 { + frac = 0; + exp += 1; + } + + if exp > 30 { + //the original algo sets cpu overflow here + return (sign | 0x7c00) as i16; + } + (sign | (exp << 10) | (frac >> 13)) as i16 +} + +#[wasm_bindgen] +pub fn generate_texture_from_attrs( + positions: &Float32Array, + scales: &Float32Array, + rots: &Float32Array, + colors: &Uint8Array, + count: usize +) -> Result { + let tex_width = 2048; + let tex_height = ((2 * count) as f32 / tex_width as f32).ceil() as u32; + let mut tex_data = vec![0u32; (tex_width * tex_height * 4) as usize]; + + let tex_data_c = unsafe { + std::slice::from_raw_parts_mut( + tex_data.as_mut_ptr() as *mut u8, + tex_data.len() * 4, + ) + }; + + let tex_data_f = unsafe { + std::slice::from_raw_parts_mut( + tex_data.as_mut_ptr() as *mut f32, + tex_data.len(), + ) + }; + + let rotv: Vec = rots.to_vec(); + let posv: Vec = positions.to_vec(); + let clrv: Vec = colors.to_vec(); + let sclv: Vec = scales.to_vec(); + + for i in 0..count { + tex_data_f[8 * i + 0] = posv[3 * i + 0]; + tex_data_f[8 * i + 1] = posv[3 * i + 1]; + tex_data_f[8 * i + 2] = posv[3 * i + 2]; + + //u8 offsets + tex_data_c[4 * (8 * i + 7) + 0] = clrv[4 * i + 0]; + tex_data_c[4 * (8 * i + 7) + 1] = clrv[4 * i + 1]; + tex_data_c[4 * (8 * i + 7) + 2] = clrv[4 * i + 2]; + tex_data_c[4 * (8 * i + 7) + 3] = clrv[4 * i + 3]; + + let r = rotv[4*i+3]; + let x = rotv[4*i+0]; + let y = rotv[4*i+1]; + let z = rotv[4*i+2]; + let r_matrix = [ + 1.0 - 2.0 * (y * y + z * z), + 2.0 * (x * y + r * z), + 2.0 * (x * z - r * y), + + 2.0 * (x * y - r * z), + 1.0 - 2.0 * (x * x + z * z), + 2.0 * (y * z + r * x), + + 2.0 * (x * z + r * y), + 2.0 * (y * z - r * x), + 1.0 - 2.0 * (x * x + y * y), + ]; + + // S * R multiplication + let s0 = 3 * i + 0; + let s1 = 3 * i + 1; + let s2 = 3 * i + 2; + + let m = [ + r_matrix[0] * sclv[s0], r_matrix[1] * sclv[s0], r_matrix[2] * sclv[s0], + r_matrix[3] * sclv[s1], r_matrix[4] * sclv[s1], r_matrix[5] * sclv[s1], + r_matrix[6] * sclv[s2], r_matrix[7] * sclv[s2], r_matrix[8] * sclv[s2], + ]; + let sigma = [ + m[0] * m[0] + m[3] * m[3] + m[6] * m[6], + m[0] * m[1] + m[3] * m[4] + m[6] * m[7], + m[0] * m[2] + m[3] * m[5] + m[6] * m[8], + m[1] * m[1] + m[4] * m[4] + m[7] * m[7], + m[1] * m[2] + m[4] * m[5] + m[7] * m[8], + m[2] * m[2] + m[5] * m[5] + m[8] * m[8], + ]; + tex_data[8 * i + 4] = ( float_to_half(4.0 * sigma[0]) as u32 & 0xFFFF) | ((float_to_half(4.0 * sigma[1]) as u32 & 0xFFFF) << 16); + tex_data[8 * i + 5] = (float_to_half(4.0 * sigma[2]) as u32 & 0xFFFF) | ((float_to_half(4.0 * sigma[3]) as u32 & 0xFFFF) << 16); + tex_data[8 * i + 6] = (float_to_half(4.0 * sigma[4]) as u32 & 0xFFFF) | ((float_to_half(4.0 * sigma[5]) as u32 & 0xFFFF) << 16); + } + + Ok(TextureData { + data: tex_data, + width: tex_width, + height: tex_height, + }) +} \ No newline at end of file diff --git a/wasm-splats/src/utils.rs b/wasm-splats/src/utils.rs new file mode 100644 index 0000000..b1d7929 --- /dev/null +++ b/wasm-splats/src/utils.rs @@ -0,0 +1,10 @@ +pub fn set_panic_hook() { + // When the `console_error_panic_hook` feature is enabled, we can call the + // `set_panic_hook` function at least once during initialization, and then + // we will get better error messages if our code ever panics. + // + // For more details see + // https://github.com/rustwasm/console_error_panic_hook#readme + #[cfg(feature = "console_error_panic_hook")] + console_error_panic_hook::set_once(); +} diff --git a/wasm-splats/tests/web.rs b/wasm-splats/tests/web.rs new file mode 100644 index 0000000..de5c1da --- /dev/null +++ b/wasm-splats/tests/web.rs @@ -0,0 +1,13 @@ +//! Test suite for the Web and headless browsers. + +#![cfg(target_arch = "wasm32")] + +extern crate wasm_bindgen_test; +use wasm_bindgen_test::*; + +wasm_bindgen_test_configure!(run_in_browser); + +#[wasm_bindgen_test] +fn pass() { + assert_eq!(1 + 1, 2); +} From 8996486227b6a71bacccf7a9a213a72bbd2c360d Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Fri, 10 Jan 2025 16:34:03 -0600 Subject: [PATCH 02/24] Created a workspace, updated deps, and renamed an improperly named file --- .gitignore | 10 ++++++++++ Cargo.toml | 12 ++++++++++++ wasm-splats/.cargo/config.toml | 2 ++ wasm-splats/Cargo.toml | 12 ++++++------ wasm-splats/src/lib.rs | 4 ++-- wasm-splats/src/{textureGen.rs => texture_gen.rs} | 0 6 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 wasm-splats/.cargo/config.toml rename wasm-splats/src/{textureGen.rs => texture_gen.rs} (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f6e165d --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# Rust +/target +**/*.rs.bk +Cargo.lock +bin/ +pkg/ +wasm-pack.log + +# Rust Rover +.idea/ \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..b212c9b --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,12 @@ +[workspace] +resolver = "2" +members = [ + "wasm-splats" +] + +# Profiles must be set at the root level of the `Cargo.toml` file. +[profile.release] +# Tell `rustc` to optimize for small code size. +opt-level = 3 +lto = true +codegen-units = 1 diff --git a/wasm-splats/.cargo/config.toml b/wasm-splats/.cargo/config.toml new file mode 100644 index 0000000..f4e8c00 --- /dev/null +++ b/wasm-splats/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +target = "wasm32-unknown-unknown" diff --git a/wasm-splats/Cargo.toml b/wasm-splats/Cargo.toml index 5689934..2d8755c 100644 --- a/wasm-splats/Cargo.toml +++ b/wasm-splats/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "wasm-splats" version = "0.1.0" -authors = ["Jason Sobotka "] +authors = ["Jason Sobotka ", "Adam Morris "] edition = "2021" [lib] @@ -11,9 +11,9 @@ crate-type = ["cdylib", "rlib"] default = ["console_error_panic_hook"] [dependencies] -wasm-bindgen = "0.2.84" -js-sys = "0.3.72" -web-sys = { version="0.3.72", features=["console"]} +wasm-bindgen = "0.2.99" +js-sys = "0.3.76" +web-sys = { version="0.3.76", features=["console"]} # The `console_error_panic_hook` crate provides better debugging of panics by # logging them with `console.error`. This is great for development, but requires @@ -22,10 +22,10 @@ web-sys = { version="0.3.72", features=["console"]} console_error_panic_hook = { version = "0.1.7", optional = true } [dev-dependencies] -wasm-bindgen-test = "0.3.34" +wasm-bindgen-test = "0.3.49" [profile.release] # Tell `rustc` to optimize for small code size. opt-level = 3 lto = true -codegen-units = 1 \ No newline at end of file +codegen-units = 1 diff --git a/wasm-splats/src/lib.rs b/wasm-splats/src/lib.rs index 39752c3..a5381b4 100644 --- a/wasm-splats/src/lib.rs +++ b/wasm-splats/src/lib.rs @@ -1,6 +1,6 @@ mod utils; mod perf_timer; -mod textureGen; +mod texture_gen; mod radix_simd; mod radix; @@ -21,7 +21,7 @@ pub fn generate_splat_texture_from_attrs( colors: &Uint8Array, count: usize ) -> Result { - let texture_data = textureGen::generate_texture_from_attrs( + let texture_data = texture_gen::generate_texture_from_attrs( positions, scales, rotations, diff --git a/wasm-splats/src/textureGen.rs b/wasm-splats/src/texture_gen.rs similarity index 100% rename from wasm-splats/src/textureGen.rs rename to wasm-splats/src/texture_gen.rs From a2f3f04b3002add4906095e694a57b29e0e6e1e7 Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Wed, 15 Jan 2025 14:25:22 -0600 Subject: [PATCH 03/24] Updated version, fixed license. --- LICENSE | 201 ------- LICENSE.md | 1117 ++++++++++++++++++++++++++++++++++++ wasm-splats/Cargo.toml | 5 +- wasm-splats/LICENSE_APACHE | 201 ------- wasm-splats/LICENSE_MIT | 25 - 5 files changed, 1120 insertions(+), 429 deletions(-) delete mode 100644 LICENSE create mode 100644 LICENSE.md delete mode 100644 wasm-splats/LICENSE_APACHE delete mode 100644 wasm-splats/LICENSE_MIT diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..5858130 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,1117 @@ +Copyright 2011-2025 CesiumJS Contributors + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2011-2020 CesiumJS Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Patents US9153063B2 US9865085B1 US10592242 + +Patents pending US15/829,786 US16/850,266 US16/851,958 + +# Third-Party Code + +CesiumJS includes the following third-party code. + +### Sean O'Neil + +http://sponeil.net/ + +> Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com) +> +> All rights reserved. +> +> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +> +> - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +> - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +> - Neither the name of the project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. +> +> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +### zip.js + +https://github.com/gildas-lormeau/zip.js + +> Copyright (c) 2013 Gildas Lormeau. All rights reserved. +> +> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +> +> 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +> +> 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +> +> 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. +> +> THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +### Autolinker.js + +https://github.com/gregjacobs/Autolinker.js + +The MIT License (MIT) + +> Copyright (c) 2015 Gregory Jacobs (http://greg-jacobs.com) + +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +### tween.js + +https://github.com/sole/tween.js + +> Copyright (c) 2010-2012 Tween.js authors. +> +> Easing equations Copyright (c) 2001 Robert Penner http://robertpenner.com/easing/ +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +### Knockout + +http://knockoutjs.com/ + +> (c) The Knockout.js team - http://knockoutjs.com/ +> License: MIT (http://www.opensource.org/licenses/mit-license.php) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +### Knockout ES5 plugin + +https://github.com/SteveSanderson/knockout-es5 + +> Copyright (c) Steve Sanderson +> MIT license +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +### topojson-client + +https://github.com/topojson/topojson-client + +> Copyright 2012-2019 Michael Bostock +> +> Permission to use, copy, modify, and/or distribute this software for any purpose +> with or without fee is hereby granted, provided that the above copyright notice +> and this permission notice appear in all copies. +> +> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +> FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +> OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +> TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +> THIS SOFTWARE. + +### mersenne-twister.js + +https://gist.github.com/banksean/300494 + +> Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, +> All rights reserved. +> +> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +> +> 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +> +> 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +> +> 3. The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission. +> +> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +### NVIDIA GameWorks Graphics Samples + +https://github.com/NVIDIAGameWorks/GraphicsSamples + +> Copyright 2016 NVIDIA Corporation +> +> BY DOWNLOADING THE SOFTWARE AND OTHER AVAILABLE MATERIALS, YOU ("DEVELOPER") AGREE TO BE BOUND BY THE FOLLOWING TERMS AND CONDITIONS +> +> The materials available for download to Developers may include software in both sample source ("Source Code") and object code ("Object Code") versions, documentation ("Documentation"), certain art work ("Art Assets") and other materials (collectively, these materials referred to herein as "Materials"). Except as expressly indicated herein, all terms and conditions of this Agreement apply to all of the Materials. +> +> Except as expressly set forth herein, NVIDIA owns all of the Materials and makes them available to Developer only under the terms and conditions set forth in this Agreement. +> +> License: Subject to the terms of this Agreement, NVIDIA hereby grants to Developer a royalty-free, non-exclusive license to possess and to use the Materials. The following terms apply to the specified type of Material: +> +> Source Code: Developer shall have the right to modify and create derivative works with the Source Code. Developer shall own any derivative works ("Derivatives") it creates to the Source Code, provided that Developer uses the Materials in accordance with the terms of this Agreement. Developer may distribute the Derivatives, provided that all NVIDIA copyright notices and trademarks are used properly and the Derivatives include the following statement: "This software contains source code provided by NVIDIA Corporation." +> +> Object Code: Developer agrees not to disassemble, decompile or reverse engineer the Object Code versions of any of the Materials. Developer acknowledges that certain of the Materials provided in Object Code version may contain third party components that may be subject to restrictions, and expressly agrees not to attempt to modify or distribute such Materials without first receiving consent from NVIDIA. +> +> Art Assets: Developer shall have the right to modify and create Derivatives of the Art Assets, but may not distribute any of the Art Assets or Derivatives created therefrom without NVIDIA's prior written consent. +> +> Government End Users: If you are acquiring the Software on behalf of any unit or agency of the United States Government, the following provisions apply. The Government agrees the Software and documentation were developed at private expense and are provided with "RESTRICTED RIGHTS". Use, duplication, or disclosure by the Government is subject to restrictions as set forth in DFARS 227.7202-1(a) and 227.7202-3(a) (1995), DFARS 252.227-7013(c)(1)(ii) (Oct 1988), FAR 12.212(a)(1995), FAR 52.227-19, (June 1987) or FAR 52.227-14(ALT III) (June 1987),as amended from time to time. In the event that this License, or any part thereof, is deemed inconsistent with the minimum rights identified in the Restricted Rights provisions, the minimum rights shall prevail. +> No Other License. No rights or licenses are granted by NVIDIA under this License, expressly or by implication, with respect to any proprietary information or patent, copyright, trade secret or other intellectual property right owned or controlled by NVIDIA, except as expressly provided in this License. +> Term: This License is effective until terminated. NVIDIA may terminate this Agreement (and with it, all of Developer's right to the Materials) immediately upon written notice (which may include email) to Developer, with or without cause. +> +> Support: NVIDIA has no obligation to support or to continue providing or updating any of the Materials. +> +> No Warranty: THE SOFTWARE AND ANY OTHER MATERIALS PROVIDED BY NVIDIA TO DEVELOPER HEREUNDER ARE PROVIDED "AS IS." NVIDIA DISCLAIMS ALL WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +> +> LIMITATION OF LIABILITY: NVIDIA SHALL NOT BE LIABLE TO DEVELOPER, DEVELOPER'S CUSTOMERS, OR ANY OTHER PERSON OR ENTITY CLAIMING THROUGH OR UNDER DEVELOPER FOR ANY LOSS OF PROFITS, INCOME, SAVINGS, OR ANY OTHER CONSEQUENTIAL, INCIDENTAL, SPECIAL, PUNITIVE, DIRECT OR INDIRECT DAMAGES (WHETHER IN AN ACTION IN CONTRACT, TORT OR BASED ON A WARRANTY), EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF THE ESSENTIAL PURPOSE OF ANY LIMITED REMEDY. IN NO EVENT SHALL NVIDIA'S AGGREGATE LIABILITY TO DEVELOPER OR ANY OTHER PERSON OR ENTITY CLAIMING THROUGH OR UNDER DEVELOPER EXCEED THE AMOUNT OF MONEY ACTUALLY PAID BY DEVELOPER TO NVIDIA FOR THE SOFTWARE OR ANY OTHER MATERIALS. + +### NoSleep.js + +https://github.com/richtr/NoSleep.js + +> NoSleep.js v0.5.0 - git.io/vfn01 +> Rich Tibbett +> MIT license + +### jsep + +https://github.com/EricSmekens/jsep + +> Copyright (c) 2013 Stephen Oney, https://ericsmekens.github.io/jsep/ +> +> Permission is hereby granted, free of charge, to any person obtaining +> a copy of this software and associated documentation files (the +> "Software"), to deal in the Software without restriction, including +> without limitation the rights to use, copy, modify, merge, publish, +> distribute, sublicense, and/or sell copies of the Software, and to +> permit persons to whom the Software is furnished to do so, subject to +> the following conditions: +> +> The above copyright notice and this permission notice shall be +> included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +> LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +### earcut + +https://github.com/mapbox/earcut + +> Copyright (c) 2016, Mapbox +> +> Permission to use, copy, modify, and/or distribute this software for any purpose +> with or without fee is hereby granted, provided that the above copyright notice +> and this permission notice appear in all copies. +> +> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +> FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +> OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +> TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +> THIS SOFTWARE. + +### kdbush + +https://github.com/mourner/kdbush + +> Copyright (c) 2016, Vladimir Agafonkin +> +> Permission to use, copy, modify, and/or distribute this software for any purpose +> with or without fee is hereby granted, provided that the above copyright notice +> and this permission notice appear in all copies. +> +> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +> FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +> OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +> TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +> THIS SOFTWARE. + +### rbush + +https://github.com/mourner/rbush + +> MIT License + +> Copyright (c) 2016 Vladimir Agafonkin + +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +### basis_universal + +https://github.com/BinomialLLC/basis_universal + +> Licensed under the Apache License, Version 2.0 (the "License"); you may not +> use this file except in compliance with the License. You may obtain a copy of +> the License at +> +> +> +> Unless required by applicable law or agreed to in writing, software +> distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +> WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +> License for the specific language governing permissions and limitations under +> the License. + +### KTX-Parse + +https://github.com/donmccurdy/KTX-Parse/ + +> (The MIT License) +> +> Copyright (c) 2020 Don McCurdy +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +### meshoptimizer + +https://github.com/zeux/meshoptimizer/blob/master/LICENSE.md + +> MIT License +> +> Copyright (c) 2016-2021 Arseny Kapoulkine +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all +> copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE. + +### pako + +https://github.com/nodeca/pako + +> (The MIT License) +> +> Copyright (C) 2014-2017 by Vitaly Puzrin and Andrei Tuputcyn +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +### protobuf + +https://github.com/dcodeIO/ProtoBuf.js + +> Copyright (c) 2016, Daniel Wirtz All rights reserved. +> +> Redistribution and use in source and binary forms, with or without +> modification, are permitted provided that the following conditions are +> met: +> +> - Redistributions of source code must retain the above copyright +> notice, this list of conditions and the following disclaimer. +> - Redistributions in binary form must reproduce the above copyright +> notice, this list of conditions and the following disclaimer in the +> documentation and/or other materials provided with the distribution. +> - Neither the name of its author, nor the names of its contributors +> may be used to endorse or promote products derived from this software +> without specific prior written permission. +> +> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +> "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +> LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +> A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +> OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +> SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +> LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +> DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +> THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +> (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +> OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +### gltf-WebGL-PBR + +https://github.com/KhronosGroup/glTF-WebGL-PBR + +> The MIT License +> +> Copyright (c) 2016-2017 Mohamad Moneimne and Contributors +> +> Permission is hereby granted, free of charge, to any person obtaining +> a copy of this software and associated documentation files (the "Software"), +> to deal in the Software without restriction, including without limitation the +> rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +> sell copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +> INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +> PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +> CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +> OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +### ShaderFastLibs + +https://github.com/michaldrobot/ShaderFastLibs + +> The MIT License (MIT) +> +> Copyright (c) 2014 Michal Drobot +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +### Draco + +https://github.com/google/draco + +> Licensed under the Apache License, Version 2.0 (the "License"); you may not +> use this file except in compliance with the License. You may obtain a copy of +> the License at +> +> +> +> Unless required by applicable law or agreed to in writing, software +> distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +> WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +> License for the specific language governing permissions and limitations under +> the License. + +### DOMPurify + +https://github.com/cure53/DOMPurify + +> DOMPurify +> Copyright 2015 Mario Heiderich +> +> DOMPurify is free software; you can redistribute it and/or modify it under the +> terms of either: +> +> a) the Apache License Version 2.0, or +> b) the Mozilla Public License Version 2.0 +> +> Licensed under the Apache License, Version 2.0 (the "License"); +> you may not use this file except in compliance with the License. +> You may obtain a copy of the License at +> +> http://www.apache.org/licenses/LICENSE-2.0 +> +> Unless required by applicable law or agreed to in writing, software +> distributed under the License is distributed on an "AS IS" BASIS, +> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +> See the License for the specific language governing permissions and +> limitations under the License. + +### LERC + +http://github.com/Esri/lerc/ + +> Copyright 2015 Esri +> +> Licensed under the Apache License, Version 2.0 (the "License"); +> you may not use this file except in compliance with the License. +> You may obtain a copy of the License at +> +> http://www.apache.org/licenses/LICENSE-2.0 +> +> Unless required by applicable law or agreed to in writing, software +> distributed under the License is distributed on an "AS IS" BASIS, +> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +> See the License for the specific language governing permissions and +> limitations under the License. +> +> A copy of the license and additional notices are located with the +> source distribution at: +> +> http://github.com/Esri/lerc/ + +### GraphemeSplitter + +https://github.com/orling/grapheme-splitter + +> The MIT License (MIT) +> +> Copyright (c) 2015 Orlin Georgiev +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +### bitmap-sdf + +https://github.com/dy/bitmap-sdf + +> (c) 2017 Dima Yv. MIT License +> +> Development supported by plot.ly. + +### s2geometry + +https://github.com/google/s2geometry/blob/master/LICENSE + +> Apache License +> Version 2.0, January 2004 +> http://www.apache.org/licenses/ +> +> TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION +> +> 1. Definitions. +> +> "License" shall mean the terms and conditions for use, reproduction, +> and distribution as defined by Sections 1 through 9 of this document. +> +> "Licensor" shall mean the copyright owner or entity authorized by +> the copyright owner that is granting the License. +> +> "Legal Entity" shall mean the union of the acting entity and all +> other entities that control, are controlled by, or are under common +> control with that entity. For the purposes of this definition, +> "control" means (i) the power, direct or indirect, to cause the +> direction or management of such entity, whether by contract or +> otherwise, or (ii) ownership of fifty percent (50%) or more of the +> outstanding shares, or (iii) beneficial ownership of such entity. +> +> "You" (or "Your") shall mean an individual or Legal Entity +> exercising permissions granted by this License. +> +> "Source" form shall mean the preferred form for making modifications, +> including but not limited to software source code, documentation +> source, and configuration files. +> +> "Object" form shall mean any form resulting from mechanical +> transformation or translation of a Source form, including but +> not limited to compiled object code, generated documentation, +> and conversions to other media types. +> +> "Work" shall mean the work of authorship, whether in Source or +> Object form, made available under the License, as indicated by a +> copyright notice that is included in or attached to the work +> (an example is provided in the Appendix below). +> +> "Derivative Works" shall mean any work, whether in Source or Object +> form, that is based on (or derived from) the Work and for which the +> editorial revisions, annotations, elaborations, or other modifications +> represent, as a whole, an original work of authorship. For the purposes +> of this License, Derivative Works shall not include works that remain +> separable from, or merely link (or bind by name) to the interfaces of, +> the Work and Derivative Works thereof. +> +> "Contribution" shall mean any work of authorship, including +> the original version of the Work and any modifications or additions +> to that Work or Derivative Works thereof, that is intentionally +> submitted to Licensor for inclusion in the Work by the copyright owner +> or by an individual or Legal Entity authorized to submit on behalf of +> the copyright owner. For the purposes of this definition, "submitted" +> means any form of electronic, verbal, or written communication sent +> to the Licensor or its representatives, including but not limited to +> communication on electronic mailing lists, source code control systems, +> and issue tracking systems that are managed by, or on behalf of, the +> Licensor for the purpose of discussing and improving the Work, but +> excluding communication that is conspicuously marked or otherwise +> designated in writing by the copyright owner as "Not a Contribution." +> +> "Contributor" shall mean Licensor and any individual or Legal Entity +> on behalf of whom a Contribution has been received by Licensor and +> subsequently incorporated within the Work. +> +> 2. Grant of Copyright License. Subject to the terms and conditions of +> this License, each Contributor hereby grants to You a perpetual, +> worldwide, non-exclusive, no-charge, royalty-free, irrevocable +> copyright license to reproduce, prepare Derivative Works of, +> publicly display, publicly perform, sublicense, and distribute the +> Work and such Derivative Works in Source or Object form. +> +> 3. Grant of Patent License. Subject to the terms and conditions of +> this License, each Contributor hereby grants to You a perpetual, +> worldwide, non-exclusive, no-charge, royalty-free, irrevocable +> (except as stated in this section) patent license to make, have made, +> use, offer to sell, sell, import, and otherwise transfer the Work, +> where such license applies only to those patent claims licensable +> by such Contributor that are necessarily infringed by their +> Contribution(s) alone or by combination of their Contribution(s) +> with the Work to which such Contribution(s) was submitted. If You +> institute patent litigation against any entity (including a +> cross-claim or counterclaim in a lawsuit) alleging that the Work +> or a Contribution incorporated within the Work constitutes direct +> or contributory patent infringement, then any patent licenses +> granted to You under this License for that Work shall terminate +> as of the date such litigation is filed. +> +> 4. Redistribution. You may reproduce and distribute copies of the +> Work or Derivative Works thereof in any medium, with or without +> modifications, and in Source or Object form, provided that You +> meet the following conditions: +> +> (a) You must give any other recipients of the Work or +> Derivative Works a copy of this License; and +> +> (b) You must cause any modified files to carry prominent notices +> stating that You changed the files; and +> +> (c) You must retain, in the Source form of any Derivative Works +> that You distribute, all copyright, patent, trademark, and +> attribution notices from the Source form of the Work, +> excluding those notices that do not pertain to any part of +> the Derivative Works; and +> +> (d) If the Work includes a "NOTICE" text file as part of its +> distribution, then any Derivative Works that You distribute must +> include a readable copy of the attribution notices contained +> within such NOTICE file, excluding those notices that do not +> pertain to any part of the Derivative Works, in at least one +> of the following places: within a NOTICE text file distributed +> as part of the Derivative Works; within the Source form or +> documentation, if provided along with the Derivative Works; or, +> within a display generated by the Derivative Works, if and +> wherever such third-party notices normally appear. The contents +> of the NOTICE file are for informational purposes only and +> do not modify the License. You may add Your own attribution +> notices within Derivative Works that You distribute, alongside +> or as an addendum to the NOTICE text from the Work, provided +> that such additional attribution notices cannot be construed +> as modifying the License. +> +> You may add Your own copyright statement to Your modifications and +> may provide additional or different license terms and conditions +> for use, reproduction, or distribution of Your modifications, or +> for any such Derivative Works as a whole, provided Your use, +> reproduction, and distribution of the Work otherwise complies with +> the conditions stated in this License. +> +> 5. Submission of Contributions. Unless You explicitly state otherwise, +> any Contribution intentionally submitted for inclusion in the Work +> by You to the Licensor shall be under the terms and conditions of +> this License, without any additional terms or conditions. +> Notwithstanding the above, nothing herein shall supersede or modify +> the terms of any separate license agreement you may have executed +> with Licensor regarding such Contributions. +> +> 6. Trademarks. This License does not grant permission to use the trade +> names, trademarks, service marks, or product names of the Licensor, +> except as required for reasonable and customary use in describing the +> origin of the Work and reproducing the content of the NOTICE file. +> +> 7. Disclaimer of Warranty. Unless required by applicable law or +> agreed to in writing, Licensor provides the Work (and each +> Contributor provides its Contributions) on an "AS IS" BASIS, +> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +> implied, including, without limitation, any warranties or conditions +> of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +> PARTICULAR PURPOSE. You are solely responsible for determining the +> appropriateness of using or redistributing the Work and assume any +> risks associated with Your exercise of permissions under this License. +> +> 8. Limitation of Liability. In no event and under no legal theory, +> whether in tort (including negligence), contract, or otherwise, +> unless required by applicable law (such as deliberate and grossly +> negligent acts) or agreed to in writing, shall any Contributor be +> liable to You for damages, including any direct, indirect, special, +> incidental, or consequential damages of any character arising as a +> result of this License or out of the use or inability to use the +> Work (including but not limited to damages for loss of goodwill, +> work stoppage, computer failure or malfunction, or any and all +> other commercial damages or losses), even if such Contributor +> has been advised of the possibility of such damages. +> +> 9. Accepting Warranty or Additional Liability. While redistributing +> the Work or Derivative Works thereof, You may choose to offer, +> and charge a fee for, acceptance of support, warranty, indemnity, +> or other liability obligations and/or rights consistent with this +> License. However, in accepting such obligations, You may act only +> on Your own behalf and on Your sole responsibility, not on behalf +> of any other Contributor, and only if You agree to indemnify, +> defend, and hold each Contributor harmless for any liability +> incurred by, or claims asserted against, such Contributor by reason +> of your accepting any such warranty or additional liability. +> +> END OF TERMS AND CONDITIONS +> +> APPENDIX: How to apply the Apache License to your work. +> +> To apply the Apache License to your work, attach the following +> boilerplate notice, with the fields enclosed by brackets "[]" +> replaced with your own identifying information. (Don't include +> the brackets!) The text should be enclosed in the appropriate +> comment syntax for the file format. We also recommend that a +> file or class name and description of purpose be included on the +> same "printed page" as the copyright notice for easier +> identification within third-party archives. +> +> Copyright [yyyy] [name of copyright owner] +> +> Licensed under the Apache License, Version 2.0 (the "License"); +> you may not use this file except in compliance with the License. +> You may obtain a copy of the License at +> +> http://www.apache.org/licenses/LICENSE-2.0 +> +> Unless required by applicable law or agreed to in writing, software +> distributed under the License is distributed on an "AS IS" BASIS, +> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +> See the License for the specific language governing permissions and +> limitations under the License. + +### URI.js + +http://medialize.github.io/URI.js/ + +> The MIT License (MIT) +> +> Copyright (c) 2011 Rodney Rehm +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +# Tests + +The CesiumJS tests use the following third-party libraries and data. + +### Jasmine + +http://jasmine.github.io/ + +Copyright (c) 2008-2014 Pivotal Labs + +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# CesiumJS Documentation + +The CesiumJS documentation files include the following third-party content. + +### Source Sans Pro (Font) + +Source® Sans Pro, Adobe's first open source typeface family, was designed by Paul D. Hunt. It is a sans serif typeface intended to work well in user interfaces. + +[SIL Open Font License, 1.1](http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL) ([text](http://scripts.sil.org/cms/scripts/render_download.php?format=file&media_id=OFL_plaintext&filename=OFL.txt)) + +# Example Applications + +The CesiumJS example applications include the following third-party libraries and data. + +### Dojo Toolkit + +http://dojotoolkit.org/ + +> Copyright (c) 2005-2015, The Dojo Foundation +> +> All rights reserved. +> +> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +> +> - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +> - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +> - Neither the name of the Dojo Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. +> +> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +### CodeMirror + +http://codemirror.net/ + +> Copyright (C) 2017 by Marijn Haverbeke and others +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +> +> Please note that some subdirectories of the CodeMirror distribution include their own LICENSE files, and are released under different licences. + +### clipboard.js + +https://clipboardjs.com/ + +> The MIT License (MIT) +> Copyright © 2018 Zeno Rocha +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +### JSHint + +http://www.jshint.com/ + +> JSHint, by JSHint Community. +> +> Licensed under the same slightly modified MIT license that JSLint is. It stops evil-doers everywhere. +> +> JSHint is a derivative work of JSLint: +> +> Copyright (c) 2002 Douglas Crockford (www.JSLint.com) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> The Software shall be used for Good, not Evil. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. JSHint was forked from the 2010-12-16 edition of JSLint. + +### Public domain data from Natural Earth + +Free vector and raster map data @ naturalearthdata.com + +Terms of use: http://www.naturalearthdata.com/about/terms-of-use/ + +### Data from JHT's Planetary Pixel Emporium + +Copyright (c) by James Hastings-Trew + +http://planetpixelemporium.com/ + +Copyright Information: http://planetpixelemporium.com/planets.html + +### Sky box images from NASA + +http://maps.jpl.nasa.gov/stars.html + +http://svs.gsfc.nasa.gov/vis/a000000/a003500/a003572/ + +Terms of use: http://www.nasa.gov/audience/formedia/features/MP_Photo_Guidelines.html + +### Some vector icons from (or inspired by) Raphaël JS + +http://raphaeljs.com/icons/ + +http://raphaeljs.com/license.html + +### Mouse and gesture vector icons made by Freepik from Flaticon.com + +Creative Commons Attribution 3.0 +https://web.archive.org/web/20140419110558/http://www.flaticon.com/terms-of-use + +### Maki icon set from Mapbox + +https://www.mapbox.com/maki/ + +https://github.com/mapbox/maki + +### Big Buck Bunny trailer + +Creative Commons Attribution 3.0 +(c) copyright 2008, Blender Foundation +www.bigbuckbunny.org + +### population909500.json + +https://github.com/dataarts/webgl-globe + +> Copyright 2011 Google Data Arts Team +> +> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at +> +> http://www.apache.org/licenses/LICENSE-2.0 +> +> Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +### Wooden Watch Tower + +Creative Commons Attribution 3.0 +(c) copyright 2012, Dennis Haupt +http://www.blendswap.com/blends/view/61653 + +### Perc Lead Mine + +Creative Commons Attribution 4.0 International +(c) copyright 2019, Dr Edward Alan Lockhart +https://sketchfab.com/3d-models/parc-lead-mine-4759a23abbff454c8c682ff9b02ba111 + +### GitHub logo + +https://github.com/logos + +### GPX files + +Public domain +https://www.gpsvisualizer.com/examples/google_gpx.html + +Creative Commons Attribution-ShareAlike 2.0 +https://wiki.openstreetmap.org/wiki/GPX + +### Font Awesome Icon + +Font Awesome by Dave Gandy - http://fontawesome.io diff --git a/wasm-splats/Cargo.toml b/wasm-splats/Cargo.toml index 2d8755c..e751c2b 100644 --- a/wasm-splats/Cargo.toml +++ b/wasm-splats/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-splats" -version = "0.1.0" +version = "1.0.0" authors = ["Jason Sobotka ", "Adam Morris "] edition = "2021" @@ -13,7 +13,7 @@ default = ["console_error_panic_hook"] [dependencies] wasm-bindgen = "0.2.99" js-sys = "0.3.76" -web-sys = { version="0.3.76", features=["console"]} +web-sys = { version = "0.3.76", features = ["console"] } # The `console_error_panic_hook` crate provides better debugging of panics by # logging them with `console.error`. This is great for development, but requires @@ -24,6 +24,7 @@ console_error_panic_hook = { version = "0.1.7", optional = true } [dev-dependencies] wasm-bindgen-test = "0.3.49" +# Typically we wouldn't include profiles in a workspace project like this, but `wasm-pack` doesn't support workspaces yet. [profile.release] # Tell `rustc` to optimize for small code size. opt-level = 3 diff --git a/wasm-splats/LICENSE_APACHE b/wasm-splats/LICENSE_APACHE deleted file mode 100644 index 11069ed..0000000 --- a/wasm-splats/LICENSE_APACHE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/wasm-splats/LICENSE_MIT b/wasm-splats/LICENSE_MIT deleted file mode 100644 index cb6579f..0000000 --- a/wasm-splats/LICENSE_MIT +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2018 Jason Sobotka - -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. From 250609653830366811d6d18535ac135d31fd1fae Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Wed, 15 Jan 2025 14:30:41 -0600 Subject: [PATCH 04/24] Updated authors in Cargo.toml --- wasm-splats/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wasm-splats/Cargo.toml b/wasm-splats/Cargo.toml index e751c2b..47bcc6f 100644 --- a/wasm-splats/Cargo.toml +++ b/wasm-splats/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "wasm-splats" version = "1.0.0" -authors = ["Jason Sobotka ", "Adam Morris "] +authors = ["Cesium GS, Inc. "] edition = "2021" [lib] From ded94b7cf08783573e58d8e1e6519ad00952dcfa Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Wed, 15 Jan 2025 15:21:51 -0600 Subject: [PATCH 05/24] Added CONTRIBUTING.md and CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 5 +++ CONTRIBUTING.md | 84 +++++++++++++++++++++++++++++++++++++ Documentation/BuildGuide.md | 1 + 3 files changed, 90 insertions(+) create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 Documentation/BuildGuide.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..b4657de --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,5 @@ +# Code of Conduct + +One of Cesium's strengths is our community. Our contributors and users are pushing the 3D geospatial field to amazing new levels. We rely on an open, friendly, inclusive environment to facilitate this. As such, we follow the [Contributor Covenant](https://www.contributor-covenant.org/)'s [Code of Conduct](https://www.contributor-covenant.org/version/2/0/code_of_conduct/) to ensure a harassment-free experience in the Cesium community. Any unacceptable behavior can be confidentially sent to the core team at hello@cesium.com. + +This applies to the main Cesium repo, forum, twitter, and all channels, including all repos in the [CesiumGS](https://github.com/CesiumGS) GitHub organization. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..1b034b3 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,84 @@ +# Contribution Guide + +Thanks for contributing to Cesium WASM Utilities. You rock! Are you + +- [submitting an issue](#submitting-an-issue), +- [getting started contributing](#getting-started-contributing), or +- [opening a pull request](#opening-a-pull-request)? + +To ensure an inclusive community, contributors and users in the Cesium community should follow the [code of conduct](./CODE_OF_CONDUCT.md). + +## Submitting an Issue + +If you have a question, do not submit an issue; instead, search the [Cesium community forum](https://community.cesium.com/). The forum is very active and there are years of informative archives, often with answers from the core Cesium team. If you do not find an answer to your question, start a new thread, and you'll likely get a quick response. + +If you think you've found a bug in Cesium WASM Utilities, first search the [issues](https://github.com/CesiumGS/cesium/issues). If an issue already exists, please add a comment expressing your interest and any additional information. This helps us prioritize issues. + +If a related issue does not exist, submit a new one. Please be concise and include as much of the following information as is relevant: + +- Minimum amount of sample code (and data) shared through [Sandcastle](https://sandcastle.cesium.com). +- Screenshot or animated .gif if appropriate (try [LICEcap](http://www.cockos.com/licecap/)). For example, see [#3153](https://github.com/CesiumGS/cesium/issues/3153) in CesiumJS. Screenshots are particularly useful for exceptions and rendering artifacts. If it is a rendering artifact, also include the output of [webglreport.com](http://webglreport.com/). +- Link to the thread if this was discussed on the Cesium forum or elsewhere. For example, see [#3045](https://github.com/CesiumGS/cesium/issues/3045) in CesiumJS. +- Your operating system and version, browser and version, and video card. Are they all up-to-date? Is the issue specific to one of them? +- The version of Cesium. Did this work in a previous version? +- Ideas for how to fix or workaround the issue. Also mention if you are willing to help fix it. If so, the Cesium team can often provide guidance and the issue may get fixed more quickly with your help. + +## Getting Started Contributing + +Everyone is welcome to contribute to Cesium WASM Utilities! + +In addition to contributing core Cesium WASM Utilities code, we appreciate many types of contributions: + +- Being active on the [Cesium community forum](https://community.cesium.com/) by answering questions and providing input on Cesium's direction. +- Showcasing your Cesium apps on [Cesium blog](https://cesium.com/blog/categories/userstories/). Contact us at hello@cesium.com. +- Writing tutorials, creating examples, and improving the reference documentation. See the issues labeled [category - doc](https://github.com/CesiumGS/cesium/labels/category%20-%20doc). +- Submitting issues as [described above](#submitting-an-issue). +- Triaging issues. Browse the [issues](https://github.com/CesiumGS/cesium/issues) and comment on issues that are no longer reproducible or on issues which you have additional information. +- Creating ecosystem projects for [glTF](https://github.com/KhronosGroup/glTF/issues/456), [CZML](https://github.com/CesiumGS/cesium/wiki/CZML-Guide), and [3D Tiles](https://github.com/CesiumGS/3d-tiles). + +For ideas for Cesium WASM Utilities code contributions, see: + +- issues labeled [`good first issue`](https://github.com/CesiumGS/cesium/labels/good%20first%20issue) and +- issues labeled [`type - roadmap`](https://github.com/CesiumGS/cesium/labels/type%20-%20roadmap). + +See the [Build Guide](Documentation/BuildGuide.md) for how to build and run Cesium on your system. + +Always feel free to introduce yourself on the [Cesium community forum](https://community.cesium.com/) to brainstorm ideas and ask for guidance. + +## Opening a Pull Request + +We love pull requests. We strive to promptly review them, provide feedback, and merge. Interest in Cesium is at an all-time high so the core team is busy. Following the tips in this guide will help your pull request get merged quickly. + +> If you plan to make a major change, please start a new thread on the [Cesium community forum](https://community.cesium.com/) first. Pull requests for small features and bug fixes can generally just be opened without discussion on the forum. + +### Contributor License Agreement (CLA) + +Before we can review a pull request, we require a signed Contributor License Agreement. There is a CLA for: + +- [individuals](https://docs.google.com/forms/d/e/1FAIpQLScU-yvQdcdjCFHkNXwdNeEXx5Qhu45QXuWX_uF5qiLGFSEwlA/viewform) and +- [corporations](https://docs.google.com/forms/d/e/1FAIpQLSeYEaWlBl1tQEiegfHMuqnH9VxyfgXGyIw13C2sN7Fj3J3GVA/viewform). + +This only needs to be completed once, and enables contributions to all of the projects under the [CesiumGS](https://github.com/CesiumGS) organization, including Cesium WASM Utilities. The CLA ensures you retain copyright to your contributions, and provides us the right to use, modify, and redistribute your contributions using the [Apache 2.0 License](LICENSE.md). + +If you have any questions, feel free to reach out to [hello@cesium.com](mailto:hello@cesium)! + +### Pull Request Guidelines + +Our code is our lifeblood so maintaining Cesium WASM Utilities' high code quality is important to us. + +- Review the [Contributor Guide](./CONTRIBUTING.md). In addition to Cesium WASM Utilities specific topics, they contain a lot of general software development best practices. +- For an overview of our workflow see [GitHub pull request workflows](https://cesium.com/blog/2013/10/08/github-pull-request-workflows/). +- Pull request tips + - If your pull request fixes an existing issue, include a link to the issue in the description (like this: "Fixes [#1](https://github.com/CesiumGS/cesium/issues/1)"). Likewise, if your pull request fixes an issue reported on the Cesium forum, include a link to the thread. + - If your pull request needs additional work, include a [task list](https://github.com/blog/1375%0A-task-lists-in-gfm-issues-pulls-comments). + - Once you are done making new commits to address feedback, add a comment to the pull request such as `"this is ready"` since GitHub doesn't notify us about commits. +- Code and tests + - Follow the [Rust Style Guide](https://doc.rust-lang.org/nightly/style-guide/) and verify that your code passes [rustfmt](https://github.com/rust-lang/rustfmt). + - Verify that your code passes [clippy](https://doc.rust-lang.org/clippy/index.html). + - Verify that all tests pass, and write new tests with excellent code coverage for new code. + - Update the [CHANGES.md](CHANGES.md) file with a summary of your changes. + - If you added third-party libraries, including new version of existing libraries, update [LICENSE.md](LICENSE.md). Mention it in [CHANGES.md](CHANGES.md). If you plan to add a third-party library, start a [GitHub issue](https://github.com/CesiumGS/cesium-wasm-utils/issues/new) discussing it first. + +### Code of Conduct + +To ensure an inclusive community, contributors and users in the Cesium community should follow the [code of conduct](./CODE_OF_CONDUCT.md). diff --git a/Documentation/BuildGuide.md b/Documentation/BuildGuide.md new file mode 100644 index 0000000..30404ce --- /dev/null +++ b/Documentation/BuildGuide.md @@ -0,0 +1 @@ +TODO \ No newline at end of file From 88f3cc9c5ff95775ef2268b8401868bde9860e2d Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Wed, 15 Jan 2025 15:54:57 -0600 Subject: [PATCH 06/24] Ran clippy and cleaned up linting errors --- wasm-splats/src/lib.rs | 38 +++++----- wasm-splats/src/perf_timer.rs | 75 -------------------- wasm-splats/src/radix.rs | 36 +++++----- wasm-splats/src/radix_simd.rs | 126 +++++++++++++++------------------ wasm-splats/src/texture_gen.rs | 68 +++++++++--------- wasm-splats/src/utils.rs | 10 --- 6 files changed, 126 insertions(+), 227 deletions(-) delete mode 100644 wasm-splats/src/perf_timer.rs delete mode 100644 wasm-splats/src/utils.rs diff --git a/wasm-splats/src/lib.rs b/wasm-splats/src/lib.rs index a5381b4..66c1526 100644 --- a/wasm-splats/src/lib.rs +++ b/wasm-splats/src/lib.rs @@ -1,11 +1,9 @@ -mod utils; -mod perf_timer; -mod texture_gen; -mod radix_simd; mod radix; +mod radix_simd; +mod texture_gen; +use js_sys::{Float32Array, Object, Uint32Array, Uint8Array}; use wasm_bindgen::prelude::*; -use js_sys::{Float32Array, Uint8Array, Uint16Array, Uint32Array, Object}; #[wasm_bindgen] extern "C" { @@ -19,23 +17,27 @@ pub fn generate_splat_texture_from_attrs( scales: &Float32Array, rotations: &Float32Array, colors: &Uint8Array, - count: usize + count: usize, ) -> Result { - let texture_data = texture_gen::generate_texture_from_attrs( - positions, - scales, - rotations, - colors, - count - )?; + let texture_data = + texture_gen::generate_texture_from_attrs(positions, scales, rotations, colors, count)?; - let js_data = Uint32Array::new_with_length((texture_data.width() * texture_data.height() * 4) as u32); + let js_data = + Uint32Array::new_with_length(texture_data.width() * texture_data.height() * 4); js_data.copy_from(&texture_data.data()); let result = Object::new(); js_sys::Reflect::set(&result, &"data".into(), &js_data)?; - js_sys::Reflect::set(&result, &"width".into(), &(texture_data.width() as f64).into())?; - js_sys::Reflect::set(&result, &"height".into(), &(texture_data.height() as f64).into())?; - + js_sys::Reflect::set( + &result, + &"width".into(), + &(texture_data.width() as f64).into(), + )?; + js_sys::Reflect::set( + &result, + &"height".into(), + &(texture_data.height() as f64).into(), + )?; + Ok(result) -} \ No newline at end of file +} diff --git a/wasm-splats/src/perf_timer.rs b/wasm-splats/src/perf_timer.rs deleted file mode 100644 index dd79961..0000000 --- a/wasm-splats/src/perf_timer.rs +++ /dev/null @@ -1,75 +0,0 @@ -use std::time::{Duration, Instant}; -use std::collections::HashMap; -use std::fmt; - -#[derive(Debug)] -pub struct Timer { - start: Instant, - splits: HashMap, - last_split: Instant, -} - -impl Timer { - pub fn new() -> Self { - let now = Instant::now(); - Timer { - start: now, - splits: HashMap::new(), - last_split: now, - } - } - - pub fn split(&mut self, name: &str) { - let now = Instant::now(); - let duration = now.duration_since(self.last_split); - self.splits.insert(name.to_string(), duration); - self.last_split = now; - } - - pub fn elapsed(&self) -> Duration { - Instant::now().duration_since(self.start) - } - - pub fn get_split(&self, name: &str) -> Option { - self.splits.get(name).copied() - } - - pub fn reset(&mut self) { - let now = Instant::now(); - self.start = now; - self.last_split = now; - self.splits.clear(); - } -} - -impl fmt::Display for Timer { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - writeln!(f, "Total time: {:?}", self.elapsed())?; - writeln!(f, "\nSplits:")?; - for (name, duration) in &self.splits { - writeln!(f, "{}: {:?}", name, duration)?; - } - Ok(()) - } -} - -#[cfg(test)] -mod tests { - use super::*; - use std::thread::sleep; - - #[test] - fn test_basic_timing() { - let mut timer = Timer::new(); - - sleep(Duration::from_millis(100)); - timer.split("first_operation"); - - sleep(Duration::from_millis(50)); - timer.split("second_operation"); - - assert!(timer.get_split("first_operation").unwrap().as_millis() >= 100); - assert!(timer.get_split("second_operation").unwrap().as_millis() >= 50); - assert!(timer.elapsed().as_millis() >= 150); - } -} \ No newline at end of file diff --git a/wasm-splats/src/radix.rs b/wasm-splats/src/radix.rs index 2d2622c..5d4dd4f 100644 --- a/wasm-splats/src/radix.rs +++ b/wasm-splats/src/radix.rs @@ -1,6 +1,5 @@ +use js_sys::{Float32Array, Uint32Array, Uint8Array}; use wasm_bindgen::prelude::*; -use js_sys::{Float32Array, Uint8Array, Uint32Array, WebAssembly}; -use wasm_bindgen::JsCast; #[wasm_bindgen] pub fn radix_sort_gaussians_attrs( @@ -11,11 +10,12 @@ pub fn radix_sort_gaussians_attrs( model_view: &Float32Array, count: usize, ) -> Result { - if positions.length() as usize != count * 3 - || scales.length() as usize != count * 3 - || rotations.length() as usize != count * 4 - || colors.length() as usize != count * 4 - || model_view.length() != 16 { + if positions.length() as usize != count * 3 + || scales.length() as usize != count * 3 + || rotations.length() as usize != count * 4 + || colors.length() as usize != count * 4 + || model_view.length() != 16 + { return Err(JsValue::from_str("Invalid array lengths")); } @@ -28,10 +28,10 @@ pub fn radix_sort_gaussians_attrs( let mut min_depth = f32::INFINITY; for i in 0..count { - let depth = positions_vec[i * 3] * model_view_vec[2] + - positions_vec[i * 3 + 1] * model_view_vec[6] + - positions_vec[i * 3 + 2] * model_view_vec[10]; - + let depth = positions_vec[i * 3] * model_view_vec[2] + + positions_vec[i * 3 + 1] * model_view_vec[6] + + positions_vec[i * 3 + 2] * model_view_vec[10]; + let depth_int = (depth * 4096.0) as i32; depth_values[i] = depth_int; max_depth = max_depth.max(depth_int as f32); @@ -127,12 +127,11 @@ pub fn radix_sort_gaussians_attrs( Ok(result) } - #[wasm_bindgen] pub fn radix_sort_gaussians_indexes( positions: &Float32Array, model_view: &Float32Array, - texture_width: u32, + _texture_width: u32, // TODO: FIGURE OUT IF THIS IS NEEDED. count: usize, ) -> Result { if positions.length() as usize != count * 3 { @@ -149,9 +148,9 @@ pub fn radix_sort_gaussians_indexes( let mut min_depth = f32::INFINITY; for i in 0..count { - let depth = positions_vec[i * 3] * model_view_vec[2] + - positions_vec[i * 3 + 1] * model_view_vec[6] + - positions_vec[i * 3 + 2] * model_view_vec[10]; + let depth = positions_vec[i * 3] * model_view_vec[2] + + positions_vec[i * 3 + 1] * model_view_vec[6] + + positions_vec[i * 3 + 2] * model_view_vec[10]; let depth_int = (depth * 4096.0) as i32; depth_values[i] = depth_int; @@ -170,7 +169,7 @@ pub fn radix_sort_gaussians_indexes( for shift in (0..32).step_by(8) { let mut counts = [0u32; 256]; - + for &depth in depth_values.iter() { let byte = ((depth >> shift) & 0xFF) as usize; counts[byte] += 1; @@ -198,7 +197,6 @@ pub fn radix_sort_gaussians_indexes( let indices_array = Uint32Array::new_with_length(count as u32); indices_array.copy_from(&indices); - + Ok(indices_array) } - diff --git a/wasm-splats/src/radix_simd.rs b/wasm-splats/src/radix_simd.rs index 8d8e1f6..b899264 100644 --- a/wasm-splats/src/radix_simd.rs +++ b/wasm-splats/src/radix_simd.rs @@ -1,10 +1,6 @@ +use js_sys::{Float32Array, Uint8Array}; use std::arch::wasm32::*; use wasm_bindgen::prelude::*; -use js_sys::{Float32Array, Uint8Array, Uint32Array, WebAssembly}; -use wasm_bindgen::JsCast; -use web_sys::console; - -use crate::perf_timer; #[wasm_bindgen] pub struct GSplatData { @@ -29,7 +25,7 @@ impl GSplatData { ) -> Self { let mut model_view_array = [0.0; 16]; model_view_array.copy_from_slice(&model_view); - + Self { positions, scales, @@ -72,12 +68,7 @@ impl GSplatData { let model_view: Vec = model_view.to_vec(); Ok(GSplatData::new( - positions, - scales, - rotations, - colors, - model_view, - count, + positions, scales, rotations, colors, model_view, count, )) } @@ -114,46 +105,46 @@ impl GSplatData { unsafe fn compute_depths_simd(positions: &[f32], model_view: &[f32], count: usize) -> Vec { let mut depths = Vec::with_capacity(count); let simd_count = count - (count % 4); - + let scale = f32x4(4096.0, 4096.0, 4096.0, 4096.0); let mv2 = f32x4_splat(model_view[2]); let mv6 = f32x4_splat(model_view[6]); let mv10 = f32x4_splat(model_view[10]); - + for chunk_idx in (0..simd_count).step_by(4) { let base_idx = chunk_idx * 3; if base_idx + 11 >= positions.len() { - break; + break; } - + let pos = v128_load(positions[base_idx..].as_ptr() as *const v128); let mut depth = f32x4_mul(pos, mv2); - + let pos_y = v128_load(positions[base_idx + 4..].as_ptr() as *const v128); depth = f32x4_add(depth, f32x4_mul(pos_y, mv6)); - + let pos_z = v128_load(positions[base_idx + 8..].as_ptr() as *const v128); depth = f32x4_add(depth, f32x4_mul(pos_z, mv10)); - + let depth_scaled = f32x4_mul(depth, scale); let depth_int = i32x4_trunc_sat_f32x4(depth_scaled); - + let mut result = [0i32; 4]; v128_store(result.as_mut_ptr() as *mut v128, depth_int); depths.extend_from_slice(&result); } - + let remainder_start = (count / 4) * 4; for i in remainder_start..count { let idx = i * 3; if idx + 2 < positions.len() { - let depth = positions[idx] * model_view[2] + - positions[idx + 1] * model_view[6] + - positions[idx + 2] * model_view[10]; + let depth = positions[idx] * model_view[2] + + positions[idx + 1] * model_view[6] + + positions[idx + 2] * model_view[10]; depths.push((depth * 4096.0) as i32); } } - + depths.truncate(count); depths } @@ -164,12 +155,11 @@ unsafe fn reorder_attributes_simd(data: &mut GSplatData, indices: &[u32]) { let mut new_scales = vec![0.0; data.scales.len()]; let mut new_rotations = vec![0.0; data.rotations.len()]; let mut new_colors = vec![0; data.colors.len()]; - + for (new_idx, &old_idx) in indices.iter().enumerate() { let old_idx = old_idx as usize; - if old_idx * 3 + 2 >= data.positions.len() || - new_idx * 3 + 2 >= new_positions.len() { + if old_idx * 3 + 2 >= data.positions.len() || new_idx * 3 + 2 >= new_positions.len() { break; } @@ -177,29 +167,26 @@ unsafe fn reorder_attributes_simd(data: &mut GSplatData, indices: &[u32]) { let old_pos_idx = old_idx * 3; new_positions[pos_idx..pos_idx + 3] .copy_from_slice(&data.positions[old_pos_idx..old_pos_idx + 3]); - - if old_idx * 3 + 2 >= data.scales.len() || - new_idx * 3 + 2 >= new_scales.len() { + + if old_idx * 3 + 2 >= data.scales.len() || new_idx * 3 + 2 >= new_scales.len() { break; } - + let scale_idx = new_idx * 3; let old_scale_idx = old_idx * 3; new_scales[scale_idx..scale_idx + 3] .copy_from_slice(&data.scales[old_scale_idx..old_scale_idx + 3]); - - if old_idx * 4 + 3 >= data.rotations.len() || - new_idx * 4 + 3 >= new_rotations.len() { + + if old_idx * 4 + 3 >= data.rotations.len() || new_idx * 4 + 3 >= new_rotations.len() { break; } - + let rot_idx = new_idx * 4; let old_rot_idx = old_idx * 4; new_rotations[rot_idx..rot_idx + 4] .copy_from_slice(&data.rotations[old_rot_idx..old_rot_idx + 4]); - - if old_idx * 4 + 3 >= data.colors.len() || - new_idx * 4 + 3 >= new_colors.len() { + + if old_idx * 4 + 3 >= data.colors.len() || new_idx * 4 + 3 >= new_colors.len() { break; } @@ -208,7 +195,7 @@ unsafe fn reorder_attributes_simd(data: &mut GSplatData, indices: &[u32]) { new_colors[color_idx..color_idx + 4] .copy_from_slice(&data.colors[old_color_idx..old_color_idx + 4]); } - + data.positions = new_positions; data.scales = new_scales; data.rotations = new_rotations; @@ -218,25 +205,24 @@ unsafe fn reorder_attributes_simd(data: &mut GSplatData, indices: &[u32]) { #[wasm_bindgen] pub fn radix_sort_simd(data: &mut GSplatData) -> Result<(), JsValue> { let count = data.count; - - if count * 3 > data.positions.len() || - count * 3 > data.scales.len() || - count * 4 > data.rotations.len() || - count * 4 > data.colors.len() { + + if count * 3 > data.positions.len() + || count * 3 > data.scales.len() + || count * 4 > data.rotations.len() + || count * 4 > data.colors.len() + { return Err(JsValue::from_str("Invalid input sizes")); } - - let mut depths = unsafe { - compute_depths_simd(&data.positions, &data.model_view, count) - }; + + let mut depths = unsafe { compute_depths_simd(&data.positions, &data.model_view, count) }; let mut indices: Vec = (0..count as u32).collect(); - + let mut temp_depths = vec![0i32; count]; let mut temp_indices = vec![0u32; count]; - + for shift in (0..32).step_by(8) { let mut counts = [0u32; 256]; - + unsafe { count_frequencies_simd(&depths, shift, &mut counts) }; let mut total = 0u32; @@ -246,20 +232,20 @@ pub fn radix_sort_simd(data: &mut GSplatData) -> Result<(), JsValue> { total += current; } - unsafe { + unsafe { scatter_elements_simd( - &depths, - &indices, - shift, - &counts, - &mut temp_depths, - &mut temp_indices - ) + &depths, + &indices, + shift, + &counts, + &mut temp_depths, + &mut temp_indices, + ) }; std::mem::swap(&mut depths, &mut temp_depths); std::mem::swap(&mut indices, &mut temp_indices); } - + unsafe { reorder_attributes_simd(data, &indices) }; Ok(()) } @@ -268,21 +254,21 @@ pub fn radix_sort_simd(data: &mut GSplatData) -> Result<(), JsValue> { unsafe fn count_frequencies_simd(depths: &[i32], shift: u32, counts: &mut [u32; 256]) { unsafe { let mask = i32x4_splat(0xFF); - + for chunk in depths.chunks_exact(4) { let values = v128_load(chunk.as_ptr() as *const v128); let shifted = i32x4_shr(values, shift); - let bytes = v128_and(shifted as v128, mask); - + let bytes = v128_and(shifted, mask); + let mut result = [0i32; 4]; v128_store(result.as_mut_ptr() as *mut v128, bytes); - + for &value in &result { counts[value as usize] += 1; } } } - + for &depth in depths.chunks_exact(4).remainder() { let byte = ((depth >> shift) & 0xFF) as usize; counts[byte] += 1; @@ -299,14 +285,14 @@ unsafe fn scatter_elements_simd( temp_indices: &mut [u32], ) { let mut offsets = counts.to_owned(); - + for (&depth, &index) in depths.iter().zip(indices.iter()) { let byte = ((depth >> shift) & 0xFF) as usize; let pos = offsets[byte] as usize; - + temp_depths[pos] = depth; temp_indices[pos] = index; - + offsets[byte] += 1; } -} \ No newline at end of file +} diff --git a/wasm-splats/src/texture_gen.rs b/wasm-splats/src/texture_gen.rs index 06297a4..dbf9a22 100644 --- a/wasm-splats/src/texture_gen.rs +++ b/wasm-splats/src/texture_gen.rs @@ -1,11 +1,8 @@ -use wasm_bindgen::prelude::*; -use std::mem; use js_sys::{Float32Array, Uint8Array}; -use web_sys::console::*; +use wasm_bindgen::prelude::*; #[wasm_bindgen] pub struct TextureData { - data: Vec, width: u32, height: u32, @@ -32,12 +29,12 @@ impl TextureData { TextureData { data, width, - height + height, } } } -//Algorithm from ILM +//Algorithm from ILM //https://github.com/mitsuba-renderer/openexr/blob/master/IlmBase/Half/half.cpp fn float_to_half(f: f32) -> i16 { let f_int = f.to_bits() as i32; @@ -50,7 +47,7 @@ fn float_to_half(f: f32) -> i16 { return sign as i16; } - frac = frac | 0x00800000; + frac |= 0x00800000; let t = 14 - exp; let a = (1 << (t - 1)) - 1; @@ -87,24 +84,18 @@ pub fn generate_texture_from_attrs( scales: &Float32Array, rots: &Float32Array, colors: &Uint8Array, - count: usize + count: usize, ) -> Result { let tex_width = 2048; let tex_height = ((2 * count) as f32 / tex_width as f32).ceil() as u32; let mut tex_data = vec![0u32; (tex_width * tex_height * 4) as usize]; - + let tex_data_c = unsafe { - std::slice::from_raw_parts_mut( - tex_data.as_mut_ptr() as *mut u8, - tex_data.len() * 4, - ) + std::slice::from_raw_parts_mut(tex_data.as_mut_ptr() as *mut u8, tex_data.len() * 4) }; - + let tex_data_f = unsafe { - std::slice::from_raw_parts_mut( - tex_data.as_mut_ptr() as *mut f32, - tex_data.len(), - ) + std::slice::from_raw_parts_mut(tex_data.as_mut_ptr() as *mut f32, tex_data.len()) }; let rotv: Vec = rots.to_vec(); @@ -113,43 +104,47 @@ pub fn generate_texture_from_attrs( let sclv: Vec = scales.to_vec(); for i in 0..count { - tex_data_f[8 * i + 0] = posv[3 * i + 0]; + tex_data_f[8 * i] = posv[3 * i]; tex_data_f[8 * i + 1] = posv[3 * i + 1]; tex_data_f[8 * i + 2] = posv[3 * i + 2]; //u8 offsets - tex_data_c[4 * (8 * i + 7) + 0] = clrv[4 * i + 0]; + tex_data_c[4 * (8 * i + 7)] = clrv[4 * i]; tex_data_c[4 * (8 * i + 7) + 1] = clrv[4 * i + 1]; tex_data_c[4 * (8 * i + 7) + 2] = clrv[4 * i + 2]; tex_data_c[4 * (8 * i + 7) + 3] = clrv[4 * i + 3]; - let r = rotv[4*i+3]; - let x = rotv[4*i+0]; - let y = rotv[4*i+1]; - let z = rotv[4*i+2]; + let r = rotv[4 * i + 3]; + let x = rotv[4 * i]; + let y = rotv[4 * i + 1]; + let z = rotv[4 * i + 2]; let r_matrix = [ 1.0 - 2.0 * (y * y + z * z), 2.0 * (x * y + r * z), 2.0 * (x * z - r * y), - 2.0 * (x * y - r * z), 1.0 - 2.0 * (x * x + z * z), 2.0 * (y * z + r * x), - 2.0 * (x * z + r * y), 2.0 * (y * z - r * x), 1.0 - 2.0 * (x * x + y * y), ]; // S * R multiplication - let s0 = 3 * i + 0; + let s0 = 3 * i; let s1 = 3 * i + 1; let s2 = 3 * i + 2; let m = [ - r_matrix[0] * sclv[s0], r_matrix[1] * sclv[s0], r_matrix[2] * sclv[s0], - r_matrix[3] * sclv[s1], r_matrix[4] * sclv[s1], r_matrix[5] * sclv[s1], - r_matrix[6] * sclv[s2], r_matrix[7] * sclv[s2], r_matrix[8] * sclv[s2], + r_matrix[0] * sclv[s0], + r_matrix[1] * sclv[s0], + r_matrix[2] * sclv[s0], + r_matrix[3] * sclv[s1], + r_matrix[4] * sclv[s1], + r_matrix[5] * sclv[s1], + r_matrix[6] * sclv[s2], + r_matrix[7] * sclv[s2], + r_matrix[8] * sclv[s2], ]; let sigma = [ m[0] * m[0] + m[3] * m[3] + m[6] * m[6], @@ -159,14 +154,17 @@ pub fn generate_texture_from_attrs( m[1] * m[2] + m[4] * m[5] + m[7] * m[8], m[2] * m[2] + m[5] * m[5] + m[8] * m[8], ]; - tex_data[8 * i + 4] = ( float_to_half(4.0 * sigma[0]) as u32 & 0xFFFF) | ((float_to_half(4.0 * sigma[1]) as u32 & 0xFFFF) << 16); - tex_data[8 * i + 5] = (float_to_half(4.0 * sigma[2]) as u32 & 0xFFFF) | ((float_to_half(4.0 * sigma[3]) as u32 & 0xFFFF) << 16); - tex_data[8 * i + 6] = (float_to_half(4.0 * sigma[4]) as u32 & 0xFFFF) | ((float_to_half(4.0 * sigma[5]) as u32 & 0xFFFF) << 16); + tex_data[8 * i + 4] = (float_to_half(4.0 * sigma[0]) as u32 & 0xFFFF) + | ((float_to_half(4.0 * sigma[1]) as u32 & 0xFFFF) << 16); + tex_data[8 * i + 5] = (float_to_half(4.0 * sigma[2]) as u32 & 0xFFFF) + | ((float_to_half(4.0 * sigma[3]) as u32 & 0xFFFF) << 16); + tex_data[8 * i + 6] = (float_to_half(4.0 * sigma[4]) as u32 & 0xFFFF) + | ((float_to_half(4.0 * sigma[5]) as u32 & 0xFFFF) << 16); } - + Ok(TextureData { data: tex_data, width: tex_width, height: tex_height, }) -} \ No newline at end of file +} diff --git a/wasm-splats/src/utils.rs b/wasm-splats/src/utils.rs deleted file mode 100644 index b1d7929..0000000 --- a/wasm-splats/src/utils.rs +++ /dev/null @@ -1,10 +0,0 @@ -pub fn set_panic_hook() { - // When the `console_error_panic_hook` feature is enabled, we can call the - // `set_panic_hook` function at least once during initialization, and then - // we will get better error messages if our code ever panics. - // - // For more details see - // https://github.com/rustwasm/console_error_panic_hook#readme - #[cfg(feature = "console_error_panic_hook")] - console_error_panic_hook::set_once(); -} From fc8cf13734358fbf566c3896b98bb06346b5fddd Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Wed, 15 Jan 2025 16:28:36 -0600 Subject: [PATCH 07/24] Started the CI configuration. --- .cargo/config.toml | 5 ++ .../.github => .github}/dependabot.yml | 0 .github/workflows/wasm-splats-ci.yml | 17 +++++ wasm-splats/.appveyor.yml | 11 --- wasm-splats/.cargo/config.toml | 2 - wasm-splats/.travis.yml | 69 ------------------- 6 files changed, 22 insertions(+), 82 deletions(-) create mode 100644 .cargo/config.toml rename {wasm-splats/.github => .github}/dependabot.yml (100%) create mode 100644 .github/workflows/wasm-splats-ci.yml delete mode 100644 wasm-splats/.appveyor.yml delete mode 100644 wasm-splats/.cargo/config.toml delete mode 100644 wasm-splats/.travis.yml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..d0c58e8 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,5 @@ +# You may be asking, "wait, why is this here and not in the pacakge directories?" +# As of January 2025, [per-package targets](https://github.com/rust-lang/cargo/issues/9406) hasn't hit stable Rust. Once that hits, we can move this back into the package directories. + +[build] +target = "wasm32-unknown-unknown" diff --git a/wasm-splats/.github/dependabot.yml b/.github/dependabot.yml similarity index 100% rename from wasm-splats/.github/dependabot.yml rename to .github/dependabot.yml diff --git a/.github/workflows/wasm-splats-ci.yml b/.github/workflows/wasm-splats-ci.yml new file mode 100644 index 0000000..8124ed2 --- /dev/null +++ b/.github/workflows/wasm-splats-ci.yml @@ -0,0 +1,17 @@ +name: wasm-splats-ci.yml +on: + push: + paths: + - 'wasm-splats/**' + - '.github/workflows/wasm-splats-ci.yml' + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Install wasm-pack + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + + - run: wasm-pack test wasm-splats --headless --chrome --firefox diff --git a/wasm-splats/.appveyor.yml b/wasm-splats/.appveyor.yml deleted file mode 100644 index 50910bd..0000000 --- a/wasm-splats/.appveyor.yml +++ /dev/null @@ -1,11 +0,0 @@ -install: - - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - - if not defined RUSTFLAGS rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain nightly - - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - - rustc -V - - cargo -V - -build: false - -test_script: - - cargo test --locked diff --git a/wasm-splats/.cargo/config.toml b/wasm-splats/.cargo/config.toml deleted file mode 100644 index f4e8c00..0000000 --- a/wasm-splats/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[build] -target = "wasm32-unknown-unknown" diff --git a/wasm-splats/.travis.yml b/wasm-splats/.travis.yml deleted file mode 100644 index 7a91325..0000000 --- a/wasm-splats/.travis.yml +++ /dev/null @@ -1,69 +0,0 @@ -language: rust -sudo: false - -cache: cargo - -matrix: - include: - - # Builds with wasm-pack. - - rust: beta - env: RUST_BACKTRACE=1 - addons: - firefox: latest - chrome: stable - before_script: - - (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update) - - (test -x $HOME/.cargo/bin/cargo-generate || cargo install --vers "^0.2" cargo-generate) - - cargo install-update -a - - curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f - script: - - cargo generate --git . --name testing - # Having a broken Cargo.toml (in that it has curlies in fields) anywhere - # in any of our parent dirs is problematic. - - mv Cargo.toml Cargo.toml.tmpl - - cd testing - - wasm-pack build - - wasm-pack test --chrome --firefox --headless - - # Builds on nightly. - - rust: nightly - env: RUST_BACKTRACE=1 - before_script: - - (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update) - - (test -x $HOME/.cargo/bin/cargo-generate || cargo install --vers "^0.2" cargo-generate) - - cargo install-update -a - - rustup target add wasm32-unknown-unknown - script: - - cargo generate --git . --name testing - - mv Cargo.toml Cargo.toml.tmpl - - cd testing - - cargo check - - cargo check --target wasm32-unknown-unknown - - cargo check --no-default-features - - cargo check --target wasm32-unknown-unknown --no-default-features - - cargo check --no-default-features --features console_error_panic_hook - - cargo check --target wasm32-unknown-unknown --no-default-features --features console_error_panic_hook - - cargo check --no-default-features --features "console_error_panic_hook wee_alloc" - - cargo check --target wasm32-unknown-unknown --no-default-features --features "console_error_panic_hook wee_alloc" - - # Builds on beta. - - rust: beta - env: RUST_BACKTRACE=1 - before_script: - - (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update) - - (test -x $HOME/.cargo/bin/cargo-generate || cargo install --vers "^0.2" cargo-generate) - - cargo install-update -a - - rustup target add wasm32-unknown-unknown - script: - - cargo generate --git . --name testing - - mv Cargo.toml Cargo.toml.tmpl - - cd testing - - cargo check - - cargo check --target wasm32-unknown-unknown - - cargo check --no-default-features - - cargo check --target wasm32-unknown-unknown --no-default-features - - cargo check --no-default-features --features console_error_panic_hook - - cargo check --target wasm32-unknown-unknown --no-default-features --features console_error_panic_hook - # Note: no enabling the `wee_alloc` feature here because it requires - # nightly for now. From 6f699d86556b2dc91285167424036e76c6989ef5 Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Wed, 15 Jan 2025 16:49:39 -0600 Subject: [PATCH 08/24] Added actions workflow --- .github/workflows/wasm-splats-ci.yml | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wasm-splats-ci.yml b/.github/workflows/wasm-splats-ci.yml index 8124ed2..16596a1 100644 --- a/.github/workflows/wasm-splats-ci.yml +++ b/.github/workflows/wasm-splats-ci.yml @@ -6,7 +6,8 @@ on: - '.github/workflows/wasm-splats-ci.yml' jobs: - test: + test_and_lint: + name: Testing and Linting runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -14,4 +15,27 @@ jobs: - name: Install wasm-pack run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - run: wasm-pack test wasm-splats --headless --chrome --firefox + - name: Run rustfmt + run: cargo fmt --all -- --check + + - name: Run clippy + run: cargo clippy --all-targets --all-features -- -D warnings + + # If you're adding a new package, you'll need to duplicate this step for it. + - name: Run wasm-splats tests + run: wasm-pack test --headless --chrome --firefox + working-directory: ./wasm-splats + pack: + name: Packaging for npm + runs-on: ubuntu-latest + needs: [test_and_lint] + steps: + - uses: actions/checkout@v2 + + - name: Install wasm-pack + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + + - name: Package wasm-splats + run: wasm-pack build ./wasm-splats --target web --out-dir ./wasm-splats/pkg + + ## TODO: Save artifacts to AWS. From 8d7e72d01066b4e3932eeb666462e21dcb0e267e Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Wed, 15 Jan 2025 16:56:41 -0600 Subject: [PATCH 09/24] Fixing a linting error I missed. --- .github/workflows/wasm-splats-ci.yml | 7 ++++--- wasm-splats/src/lib.rs | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/wasm-splats-ci.yml b/.github/workflows/wasm-splats-ci.yml index 16596a1..ccfe32a 100644 --- a/.github/workflows/wasm-splats-ci.yml +++ b/.github/workflows/wasm-splats-ci.yml @@ -1,4 +1,5 @@ -name: wasm-splats-ci.yml +# If you're adding a new package, you'll need to duplicate this workflow for it. +name: wasm-splats CI on: push: paths: @@ -19,12 +20,12 @@ jobs: run: cargo fmt --all -- --check - name: Run clippy - run: cargo clippy --all-targets --all-features -- -D warnings + run: cargo clippy --all-targets --all-features -- -Dwarnings - # If you're adding a new package, you'll need to duplicate this step for it. - name: Run wasm-splats tests run: wasm-pack test --headless --chrome --firefox working-directory: ./wasm-splats + pack: name: Packaging for npm runs-on: ubuntu-latest diff --git a/wasm-splats/src/lib.rs b/wasm-splats/src/lib.rs index 66c1526..5f55e00 100644 --- a/wasm-splats/src/lib.rs +++ b/wasm-splats/src/lib.rs @@ -22,8 +22,7 @@ pub fn generate_splat_texture_from_attrs( let texture_data = texture_gen::generate_texture_from_attrs(positions, scales, rotations, colors, count)?; - let js_data = - Uint32Array::new_with_length(texture_data.width() * texture_data.height() * 4); + let js_data = Uint32Array::new_with_length(texture_data.width() * texture_data.height() * 4); js_data.copy_from(&texture_data.data()); let result = Object::new(); From 200b5c4e6fed7b531559917a7c82ed64cfa1b153 Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Wed, 15 Jan 2025 17:04:52 -0600 Subject: [PATCH 10/24] Fixed missing triple in CI build --- .github/workflows/wasm-splats-ci.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wasm-splats-ci.yml b/.github/workflows/wasm-splats-ci.yml index ccfe32a..fc6cd58 100644 --- a/.github/workflows/wasm-splats-ci.yml +++ b/.github/workflows/wasm-splats-ci.yml @@ -13,6 +13,14 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Install latest stable with wasm32-unknown-unknown + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + target: wasm32-unknown-unknown + components: rustfmt, clippy + - name: Install wasm-pack run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh @@ -26,13 +34,22 @@ jobs: run: wasm-pack test --headless --chrome --firefox working-directory: ./wasm-splats + # TODO: Move this to a wasm-splats-deploy.yml file. pack: name: Packaging for npm runs-on: ubuntu-latest - needs: [test_and_lint] + needs: [ test_and_lint ] steps: - uses: actions/checkout@v2 + - name: Install latest stable with wasm32-unknown-unknown + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + target: wasm32-unknown-unknown + components: rustfmt, clippy + - name: Install wasm-pack run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh From 11263a20528c107772470b3921a0f7adcc61e6a3 Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Wed, 15 Jan 2025 17:10:23 -0600 Subject: [PATCH 11/24] Unblocking the build --- wasm-splats/tests/web.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wasm-splats/tests/web.rs b/wasm-splats/tests/web.rs index de5c1da..f99429f 100644 --- a/wasm-splats/tests/web.rs +++ b/wasm-splats/tests/web.rs @@ -9,5 +9,6 @@ wasm_bindgen_test_configure!(run_in_browser); #[wasm_bindgen_test] fn pass() { - assert_eq!(1 + 1, 2); + let two = 1 + 1; + assert_eq!(two, 2); } From bec73acdbebdb17ab1228d469686f3bef271ab6d Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Wed, 15 Jan 2025 17:24:33 -0600 Subject: [PATCH 12/24] Fixing the CI build step for wasm-splats and adding a pack step --- .github/workflows/wasm-splats-ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/wasm-splats-ci.yml b/.github/workflows/wasm-splats-ci.yml index fc6cd58..a0ebe4b 100644 --- a/.github/workflows/wasm-splats-ci.yml +++ b/.github/workflows/wasm-splats-ci.yml @@ -34,7 +34,6 @@ jobs: run: wasm-pack test --headless --chrome --firefox working-directory: ./wasm-splats - # TODO: Move this to a wasm-splats-deploy.yml file. pack: name: Packaging for npm runs-on: ubuntu-latest @@ -53,7 +52,10 @@ jobs: - name: Install wasm-pack run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - name: Package wasm-splats - run: wasm-pack build ./wasm-splats --target web --out-dir ./wasm-splats/pkg + - name: Build wasm-splats + run: wasm-pack build ./wasm-splats --target web --scope cesium --out-dir ./wasm-splats/pkg + + - name: Pack wasm-splats + run: wasm-pack pack ./wasm-splats/pkg ## TODO: Save artifacts to AWS. From 7bf52237ce352b50aa135d25640b770e40232111 Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Wed, 15 Jan 2025 17:29:17 -0600 Subject: [PATCH 13/24] Removing an unnecessary --out-dir command --- .github/workflows/wasm-splats-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wasm-splats-ci.yml b/.github/workflows/wasm-splats-ci.yml index a0ebe4b..9a1971e 100644 --- a/.github/workflows/wasm-splats-ci.yml +++ b/.github/workflows/wasm-splats-ci.yml @@ -53,7 +53,7 @@ jobs: run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - name: Build wasm-splats - run: wasm-pack build ./wasm-splats --target web --scope cesium --out-dir ./wasm-splats/pkg + run: wasm-pack build ./wasm-splats --target web --scope cesium - name: Pack wasm-splats run: wasm-pack pack ./wasm-splats/pkg From eed45adcf128d817e5f71aca2ebed3450c3dc96c Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Wed, 15 Jan 2025 17:32:08 -0600 Subject: [PATCH 14/24] Making sure the build step for packaging is using release --- .github/workflows/wasm-splats-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wasm-splats-ci.yml b/.github/workflows/wasm-splats-ci.yml index 9a1971e..3085962 100644 --- a/.github/workflows/wasm-splats-ci.yml +++ b/.github/workflows/wasm-splats-ci.yml @@ -53,7 +53,7 @@ jobs: run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - name: Build wasm-splats - run: wasm-pack build ./wasm-splats --target web --scope cesium + run: wasm-pack build ./wasm-splats --release --target web --scope cesium - name: Pack wasm-splats run: wasm-pack pack ./wasm-splats/pkg From 611ef98e908a7a7553af489418386c5fca54fc20 Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Wed, 15 Jan 2025 17:45:56 -0600 Subject: [PATCH 15/24] Using rust-toolchain instead of actions-rs as latter is deprecated. --- .github/workflows/wasm-splats-ci.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/wasm-splats-ci.yml b/.github/workflows/wasm-splats-ci.yml index 3085962..7915bdd 100644 --- a/.github/workflows/wasm-splats-ci.yml +++ b/.github/workflows/wasm-splats-ci.yml @@ -14,11 +14,10 @@ jobs: - uses: actions/checkout@v2 - name: Install latest stable with wasm32-unknown-unknown - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@v1 with: toolchain: stable - default: true - target: wasm32-unknown-unknown + targets: wasm32-unknown-unknown components: rustfmt, clippy - name: Install wasm-pack @@ -42,11 +41,10 @@ jobs: - uses: actions/checkout@v2 - name: Install latest stable with wasm32-unknown-unknown - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@v1 with: toolchain: stable - default: true - target: wasm32-unknown-unknown + targets: wasm32-unknown-unknown components: rustfmt, clippy - name: Install wasm-pack From 509e0e0d589dd8e4c3c83ca652d2b33fc4f76175 Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Mon, 10 Feb 2025 12:02:46 -0600 Subject: [PATCH 16/24] Created integration tests --- .github/workflows/wasm-splats-ci.yml | 7 +- wasm-splats/.gitattributes | 1 + wasm-splats/Cargo.toml | 6 +- wasm-splats/src/lib.rs | 5 +- wasm-splats/src/radix.rs | 128 +------- wasm-splats/src/radix_simd.rs | 298 ------------------ .../generate-splat-tex-attrs-input-data.json | 3 + .../generate-splat-tex-attrs-output-data.json | 3 + .../common/data/radix-sort-input-data.json | 3 + .../common/data/radix-sort-output-data.json | 3 + wasm-splats/tests/common/data_reader.rs | 42 +++ wasm-splats/tests/common/mod.rs | 3 + wasm-splats/tests/common/test_data.rs | 137 ++++++++ wasm-splats/tests/common/test_utils.rs | 14 + wasm-splats/tests/web.rs | 40 ++- 15 files changed, 256 insertions(+), 437 deletions(-) create mode 100644 wasm-splats/.gitattributes delete mode 100644 wasm-splats/src/radix_simd.rs create mode 100644 wasm-splats/tests/common/data/generate-splat-tex-attrs-input-data.json create mode 100644 wasm-splats/tests/common/data/generate-splat-tex-attrs-output-data.json create mode 100644 wasm-splats/tests/common/data/radix-sort-input-data.json create mode 100644 wasm-splats/tests/common/data/radix-sort-output-data.json create mode 100644 wasm-splats/tests/common/data_reader.rs create mode 100644 wasm-splats/tests/common/mod.rs create mode 100644 wasm-splats/tests/common/test_data.rs create mode 100644 wasm-splats/tests/common/test_utils.rs diff --git a/.github/workflows/wasm-splats-ci.yml b/.github/workflows/wasm-splats-ci.yml index 7915bdd..55d5421 100644 --- a/.github/workflows/wasm-splats-ci.yml +++ b/.github/workflows/wasm-splats-ci.yml @@ -53,7 +53,6 @@ jobs: - name: Build wasm-splats run: wasm-pack build ./wasm-splats --release --target web --scope cesium - - name: Pack wasm-splats - run: wasm-pack pack ./wasm-splats/pkg - - ## TODO: Save artifacts to AWS. +# TODO: Get rid of this when I no longer need it. +# - name: Pack wasm-splats +# run: wasm-pack publish ./wasm-splats/pkg diff --git a/wasm-splats/.gitattributes b/wasm-splats/.gitattributes new file mode 100644 index 0000000..6d7e777 --- /dev/null +++ b/wasm-splats/.gitattributes @@ -0,0 +1 @@ +tests/common/data/** filter=lfs diff=lfs merge=lfs -text diff --git a/wasm-splats/Cargo.toml b/wasm-splats/Cargo.toml index 47bcc6f..d843924 100644 --- a/wasm-splats/Cargo.toml +++ b/wasm-splats/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-splats" -version = "1.0.0" +version = "0.1.0-alpha" authors = ["Cesium GS, Inc. "] edition = "2021" @@ -22,7 +22,9 @@ web-sys = { version = "0.3.76", features = ["console"] } console_error_panic_hook = { version = "0.1.7", optional = true } [dev-dependencies] -wasm-bindgen-test = "0.3.49" +wasm-bindgen-test = "0.3" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" # Typically we wouldn't include profiles in a workspace project like this, but `wasm-pack` doesn't support workspaces yet. [profile.release] diff --git a/wasm-splats/src/lib.rs b/wasm-splats/src/lib.rs index 5f55e00..823569b 100644 --- a/wasm-splats/src/lib.rs +++ b/wasm-splats/src/lib.rs @@ -1,6 +1,5 @@ -mod radix; -mod radix_simd; -mod texture_gen; +pub mod radix; +pub mod texture_gen; use js_sys::{Float32Array, Object, Uint32Array, Uint8Array}; use wasm_bindgen::prelude::*; diff --git a/wasm-splats/src/radix.rs b/wasm-splats/src/radix.rs index 5d4dd4f..7ed234e 100644 --- a/wasm-splats/src/radix.rs +++ b/wasm-splats/src/radix.rs @@ -1,132 +1,6 @@ -use js_sys::{Float32Array, Uint32Array, Uint8Array}; +use js_sys::{Float32Array, Uint32Array}; use wasm_bindgen::prelude::*; -#[wasm_bindgen] -pub fn radix_sort_gaussians_attrs( - positions: &Float32Array, - scales: &Float32Array, - rotations: &Float32Array, - colors: &Uint8Array, - model_view: &Float32Array, - count: usize, -) -> Result { - if positions.length() as usize != count * 3 - || scales.length() as usize != count * 3 - || rotations.length() as usize != count * 4 - || colors.length() as usize != count * 4 - || model_view.length() != 16 - { - return Err(JsValue::from_str("Invalid array lengths")); - } - - //set capacity first - let positions_vec = positions.to_vec(); - let model_view_vec = model_view.to_vec(); - - let mut depth_values = vec![0i32; count]; - let mut max_depth = f32::NEG_INFINITY; - let mut min_depth = f32::INFINITY; - - for i in 0..count { - let depth = positions_vec[i * 3] * model_view_vec[2] - + positions_vec[i * 3 + 1] * model_view_vec[6] - + positions_vec[i * 3 + 2] * model_view_vec[10]; - - let depth_int = (depth * 4096.0) as i32; - depth_values[i] = depth_int; - max_depth = max_depth.max(depth_int as f32); - min_depth = min_depth.min(depth_int as f32); - } - - let depth_offset = (-min_depth) as i32; - for depth in depth_values.iter_mut() { - *depth += depth_offset; - } - - let mut indices: Vec = (0..count as u32).collect(); - let mut temp_depths = vec![0i32; count]; - let mut temp_indices = vec![0u32; count]; - - for shift in (0..32).step_by(8) { - let mut counts = [0u32; 256]; - - for &depth in depth_values.iter() { - let byte = ((depth >> shift) & 0xFF) as usize; - counts[byte] += 1; - } - - let mut total = 0; - for count in counts.iter_mut() { - let current = *count; - *count = total; - total += current; - } - - for i in 0..count { - let byte = ((depth_values[i] >> shift) & 0xFF) as usize; - let pos = counts[byte] as usize; - counts[byte] += 1; - - temp_depths[pos] = depth_values[i]; - temp_indices[pos] = indices[i]; - } - - depth_values.copy_from_slice(&temp_depths); - indices.copy_from_slice(&temp_indices); - } - - let mut new_positions: Vec = vec![0.0; count * 3]; - let mut new_scales: Vec = vec![0.0; count * 3]; - let mut new_rotations: Vec = vec![0.0; count * 4]; - let mut new_colors: Vec = vec![0; count * 4]; - - let scales_vec = scales.to_vec(); - let rotations_vec = rotations.to_vec(); - let colors_vec = colors.to_vec(); - - for i in 0..count { - let j = indices[i] as usize; - - new_positions[i * 3] = positions_vec[j * 3]; - new_positions[i * 3 + 1] = positions_vec[j * 3 + 1]; - new_positions[i * 3 + 2] = positions_vec[j * 3 + 2]; - - new_scales[i * 3] = scales_vec[j * 3]; - new_scales[i * 3 + 1] = scales_vec[j * 3 + 1]; - new_scales[i * 3 + 2] = scales_vec[j * 3 + 2]; - - new_rotations[i * 4] = rotations_vec[j * 4]; - new_rotations[i * 4 + 1] = rotations_vec[j * 4 + 1]; - new_rotations[i * 4 + 2] = rotations_vec[j * 4 + 2]; - new_rotations[i * 4 + 3] = rotations_vec[j * 4 + 3]; - - new_colors[i * 4] = colors_vec[j * 4]; - new_colors[i * 4 + 1] = colors_vec[j * 4 + 1]; - new_colors[i * 4 + 2] = colors_vec[j * 4 + 2]; - new_colors[i * 4 + 3] = colors_vec[j * 4 + 3]; - } - - let new_positions_array = Float32Array::new_with_length(count as u32 * 3); - new_positions_array.copy_from(&new_positions[..]); - - let new_scales_array = Float32Array::new_with_length(count as u32 * 3); - new_scales_array.copy_from(&new_scales[..]); - - let new_rotations_array = Float32Array::new_with_length(count as u32 * 4); - new_rotations_array.copy_from(&new_rotations[..]); - - let new_colors_array = Uint8Array::new_with_length(count as u32 * 4); - new_colors_array.copy_from(&new_colors[..]); - - let result = js_sys::Array::new(); - result.push(&new_positions_array); - result.push(&new_scales_array); - result.push(&new_rotations_array); - result.push(&new_colors_array); - - Ok(result) -} - #[wasm_bindgen] pub fn radix_sort_gaussians_indexes( positions: &Float32Array, diff --git a/wasm-splats/src/radix_simd.rs b/wasm-splats/src/radix_simd.rs deleted file mode 100644 index b899264..0000000 --- a/wasm-splats/src/radix_simd.rs +++ /dev/null @@ -1,298 +0,0 @@ -use js_sys::{Float32Array, Uint8Array}; -use std::arch::wasm32::*; -use wasm_bindgen::prelude::*; - -#[wasm_bindgen] -pub struct GSplatData { - positions: Vec, - scales: Vec, - rotations: Vec, - colors: Vec, - model_view: [f32; 16], - count: usize, -} - -#[wasm_bindgen] -impl GSplatData { - #[wasm_bindgen(constructor)] - pub fn new( - positions: Vec, - scales: Vec, - rotations: Vec, - colors: Vec, - model_view: Vec, - count: usize, - ) -> Self { - let mut model_view_array = [0.0; 16]; - model_view_array.copy_from_slice(&model_view); - - Self { - positions, - scales, - rotations, - colors, - model_view: model_view_array, - count, - } - } - - #[wasm_bindgen(js_name = fromFloat32Arrays)] - pub fn from_float32_arrays( - positions: Float32Array, - scales: Float32Array, - rotations: Float32Array, - colors: Uint8Array, - model_view: Float32Array, - count: usize, - ) -> Result { - if positions.length() as usize != count * 3 { - return Err(JsValue::from_str("Invalid positions length")); - } - if scales.length() as usize != count * 3 { - return Err(JsValue::from_str("Invalid scales length")); - } - if rotations.length() as usize != count * 4 { - return Err(JsValue::from_str("Invalid rotations length")); - } - if colors.length() as usize != count * 4 { - return Err(JsValue::from_str("Invalid colors length")); - } - if model_view.length() != 16 { - return Err(JsValue::from_str("Model view matrix must have 16 elements")); - } - - let positions: Vec = positions.to_vec(); - let scales: Vec = scales.to_vec(); - let rotations: Vec = rotations.to_vec(); - let colors: Vec = colors.to_vec(); - let model_view: Vec = model_view.to_vec(); - - Ok(GSplatData::new( - positions, scales, rotations, colors, model_view, count, - )) - } - - #[wasm_bindgen(js_name = getPositions)] - pub fn get_positions(&self) -> Float32Array { - let result = Float32Array::new_with_length(self.positions.len() as u32); - result.copy_from(&self.positions[..]); - result - } - - #[wasm_bindgen(js_name = getScales)] - pub fn get_scales(&self) -> Float32Array { - let result = Float32Array::new_with_length(self.scales.len() as u32); - result.copy_from(&self.scales[..]); - result - } - - #[wasm_bindgen(js_name = getRotations)] - pub fn get_rotations(&self) -> Float32Array { - let result = Float32Array::new_with_length(self.rotations.len() as u32); - result.copy_from(&self.rotations[..]); - result - } - - #[wasm_bindgen(js_name = getColors)] - pub fn get_colors(&self) -> Uint8Array { - let result = Uint8Array::new_with_length(self.colors.len() as u32); - result.copy_from(&self.colors[..]); - result - } -} - -#[target_feature(enable = "simd128")] -unsafe fn compute_depths_simd(positions: &[f32], model_view: &[f32], count: usize) -> Vec { - let mut depths = Vec::with_capacity(count); - let simd_count = count - (count % 4); - - let scale = f32x4(4096.0, 4096.0, 4096.0, 4096.0); - let mv2 = f32x4_splat(model_view[2]); - let mv6 = f32x4_splat(model_view[6]); - let mv10 = f32x4_splat(model_view[10]); - - for chunk_idx in (0..simd_count).step_by(4) { - let base_idx = chunk_idx * 3; - if base_idx + 11 >= positions.len() { - break; - } - - let pos = v128_load(positions[base_idx..].as_ptr() as *const v128); - let mut depth = f32x4_mul(pos, mv2); - - let pos_y = v128_load(positions[base_idx + 4..].as_ptr() as *const v128); - depth = f32x4_add(depth, f32x4_mul(pos_y, mv6)); - - let pos_z = v128_load(positions[base_idx + 8..].as_ptr() as *const v128); - depth = f32x4_add(depth, f32x4_mul(pos_z, mv10)); - - let depth_scaled = f32x4_mul(depth, scale); - let depth_int = i32x4_trunc_sat_f32x4(depth_scaled); - - let mut result = [0i32; 4]; - v128_store(result.as_mut_ptr() as *mut v128, depth_int); - depths.extend_from_slice(&result); - } - - let remainder_start = (count / 4) * 4; - for i in remainder_start..count { - let idx = i * 3; - if idx + 2 < positions.len() { - let depth = positions[idx] * model_view[2] - + positions[idx + 1] * model_view[6] - + positions[idx + 2] * model_view[10]; - depths.push((depth * 4096.0) as i32); - } - } - - depths.truncate(count); - depths -} - -#[target_feature(enable = "simd128")] -unsafe fn reorder_attributes_simd(data: &mut GSplatData, indices: &[u32]) { - let mut new_positions = vec![0.0; data.positions.len()]; - let mut new_scales = vec![0.0; data.scales.len()]; - let mut new_rotations = vec![0.0; data.rotations.len()]; - let mut new_colors = vec![0; data.colors.len()]; - - for (new_idx, &old_idx) in indices.iter().enumerate() { - let old_idx = old_idx as usize; - - if old_idx * 3 + 2 >= data.positions.len() || new_idx * 3 + 2 >= new_positions.len() { - break; - } - - let pos_idx = new_idx * 3; - let old_pos_idx = old_idx * 3; - new_positions[pos_idx..pos_idx + 3] - .copy_from_slice(&data.positions[old_pos_idx..old_pos_idx + 3]); - - if old_idx * 3 + 2 >= data.scales.len() || new_idx * 3 + 2 >= new_scales.len() { - break; - } - - let scale_idx = new_idx * 3; - let old_scale_idx = old_idx * 3; - new_scales[scale_idx..scale_idx + 3] - .copy_from_slice(&data.scales[old_scale_idx..old_scale_idx + 3]); - - if old_idx * 4 + 3 >= data.rotations.len() || new_idx * 4 + 3 >= new_rotations.len() { - break; - } - - let rot_idx = new_idx * 4; - let old_rot_idx = old_idx * 4; - new_rotations[rot_idx..rot_idx + 4] - .copy_from_slice(&data.rotations[old_rot_idx..old_rot_idx + 4]); - - if old_idx * 4 + 3 >= data.colors.len() || new_idx * 4 + 3 >= new_colors.len() { - break; - } - - let color_idx = new_idx * 4; - let old_color_idx = old_idx * 4; - new_colors[color_idx..color_idx + 4] - .copy_from_slice(&data.colors[old_color_idx..old_color_idx + 4]); - } - - data.positions = new_positions; - data.scales = new_scales; - data.rotations = new_rotations; - data.colors = new_colors; -} - -#[wasm_bindgen] -pub fn radix_sort_simd(data: &mut GSplatData) -> Result<(), JsValue> { - let count = data.count; - - if count * 3 > data.positions.len() - || count * 3 > data.scales.len() - || count * 4 > data.rotations.len() - || count * 4 > data.colors.len() - { - return Err(JsValue::from_str("Invalid input sizes")); - } - - let mut depths = unsafe { compute_depths_simd(&data.positions, &data.model_view, count) }; - let mut indices: Vec = (0..count as u32).collect(); - - let mut temp_depths = vec![0i32; count]; - let mut temp_indices = vec![0u32; count]; - - for shift in (0..32).step_by(8) { - let mut counts = [0u32; 256]; - - unsafe { count_frequencies_simd(&depths, shift, &mut counts) }; - - let mut total = 0u32; - for count in counts.iter_mut() { - let current = *count; - *count = total; - total += current; - } - - unsafe { - scatter_elements_simd( - &depths, - &indices, - shift, - &counts, - &mut temp_depths, - &mut temp_indices, - ) - }; - std::mem::swap(&mut depths, &mut temp_depths); - std::mem::swap(&mut indices, &mut temp_indices); - } - - unsafe { reorder_attributes_simd(data, &indices) }; - Ok(()) -} - -#[target_feature(enable = "simd128")] -unsafe fn count_frequencies_simd(depths: &[i32], shift: u32, counts: &mut [u32; 256]) { - unsafe { - let mask = i32x4_splat(0xFF); - - for chunk in depths.chunks_exact(4) { - let values = v128_load(chunk.as_ptr() as *const v128); - let shifted = i32x4_shr(values, shift); - let bytes = v128_and(shifted, mask); - - let mut result = [0i32; 4]; - v128_store(result.as_mut_ptr() as *mut v128, bytes); - - for &value in &result { - counts[value as usize] += 1; - } - } - } - - for &depth in depths.chunks_exact(4).remainder() { - let byte = ((depth >> shift) & 0xFF) as usize; - counts[byte] += 1; - } -} - -#[target_feature(enable = "simd128")] -unsafe fn scatter_elements_simd( - depths: &[i32], - indices: &[u32], - shift: u32, - counts: &[u32; 256], - temp_depths: &mut [i32], - temp_indices: &mut [u32], -) { - let mut offsets = counts.to_owned(); - - for (&depth, &index) in depths.iter().zip(indices.iter()) { - let byte = ((depth >> shift) & 0xFF) as usize; - let pos = offsets[byte] as usize; - - temp_depths[pos] = depth; - temp_indices[pos] = index; - - offsets[byte] += 1; - } -} diff --git a/wasm-splats/tests/common/data/generate-splat-tex-attrs-input-data.json b/wasm-splats/tests/common/data/generate-splat-tex-attrs-input-data.json new file mode 100644 index 0000000..b0046d8 --- /dev/null +++ b/wasm-splats/tests/common/data/generate-splat-tex-attrs-input-data.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82746fdfd8f87b9973bebaa55576c77d08485dcd824e9888ee2d97935d17ece1 +size 17729892 diff --git a/wasm-splats/tests/common/data/generate-splat-tex-attrs-output-data.json b/wasm-splats/tests/common/data/generate-splat-tex-attrs-output-data.json new file mode 100644 index 0000000..7d446e6 --- /dev/null +++ b/wasm-splats/tests/common/data/generate-splat-tex-attrs-output-data.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c8c06b792a3ae8e9ade2aa38b2104b33fb241093d515e6fd9feaf85621c0539 +size 6502585 diff --git a/wasm-splats/tests/common/data/radix-sort-input-data.json b/wasm-splats/tests/common/data/radix-sort-input-data.json new file mode 100644 index 0000000..221ad06 --- /dev/null +++ b/wasm-splats/tests/common/data/radix-sort-input-data.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8fd57e5615311bb76803ed0f7688d17cbac986bcaa98f58ce088334cbb73212e +size 5304026 diff --git a/wasm-splats/tests/common/data/radix-sort-output-data.json b/wasm-splats/tests/common/data/radix-sort-output-data.json new file mode 100644 index 0000000..2e99a41 --- /dev/null +++ b/wasm-splats/tests/common/data/radix-sort-output-data.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d61cd49a41f8dcec0a277a837e8d3e1967f1b36a038f5e8943257a347a3dfb7f +size 793805 diff --git a/wasm-splats/tests/common/data_reader.rs b/wasm-splats/tests/common/data_reader.rs new file mode 100644 index 0000000..232ee76 --- /dev/null +++ b/wasm-splats/tests/common/data_reader.rs @@ -0,0 +1,42 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Serialize, Deserialize, Debug)] +pub struct GenerateSplatTxtAttrsTestInput { + pub positions: Vec, + pub scales: Vec, + pub rotations: Vec, + pub colors: Vec, + pub count: usize, +} + +#[derive(Serialize, Deserialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct GenerateSplatTxtAttrsTestOutput { + pub texture_data: Vec, + pub width: u32, + pub height: u32, +} + +#[derive(Serialize, Deserialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct RadixSortTestInput { + pub position: Vec, + pub model_view: Vec, + pub idx_count: usize, + pub sort_type: String, +} + +#[derive(Serialize, Deserialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct RadixSortTestOutput { + pub sorted_idx: Vec, +} + +pub fn read_string_data(data: &str) -> Result> +where + T: for<'de> Deserialize<'de>, +{ + let u: T = serde_json::from_str(data)?; + + Ok(u) +} diff --git a/wasm-splats/tests/common/mod.rs b/wasm-splats/tests/common/mod.rs new file mode 100644 index 0000000..0c1e2f6 --- /dev/null +++ b/wasm-splats/tests/common/mod.rs @@ -0,0 +1,3 @@ +pub mod data_reader; +pub mod test_data; +pub mod test_utils; diff --git a/wasm-splats/tests/common/test_data.rs b/wasm-splats/tests/common/test_data.rs new file mode 100644 index 0000000..f815125 --- /dev/null +++ b/wasm-splats/tests/common/test_data.rs @@ -0,0 +1,137 @@ +use crate::common::data_reader::*; +use js_sys::{Float32Array, Uint8Array}; +use wasm_bindgen::JsValue; + +pub struct GenerateSplatTextureTestData { + in_positions: Float32Array, + in_scales: Float32Array, + in_rotations: Float32Array, + in_colors: Uint8Array, + in_count: usize, + out_texture_data: Vec, + out_width: u32, + out_height: u32, +} + +impl GenerateSplatTextureTestData { + pub fn new() -> Result { + let input_data: GenerateSplatTxtAttrsTestInput = read_string_data(include_str!( + "./data/generate-splat-tex-attrs-input-data.json" + )) + .map_err(|e| JsValue::from_str(&e.to_string()))?; + let output_data: GenerateSplatTxtAttrsTestOutput = read_string_data(include_str!( + "./data/generate-splat-tex-attrs-output-data.json" + )) + .map_err(|e| JsValue::from_str(&e.to_string()))?; + + let positions = Float32Array::new_with_length(input_data.positions.len() as u32); + positions.copy_from(&input_data.positions); + + let scales = Float32Array::new_with_length(input_data.scales.len() as u32); + scales.copy_from(&input_data.scales); + + let rotations = Float32Array::new_with_length(input_data.rotations.len() as u32); + rotations.copy_from(&input_data.rotations); + + let colors = Uint8Array::new_with_length(input_data.colors.len() as u32); + colors.copy_from(&input_data.colors); + + Ok(Self { + in_positions: positions, + in_scales: scales, + in_rotations: rotations, + in_colors: colors, + in_count: input_data.count, + out_texture_data: output_data.texture_data, + out_width: output_data.width, + out_height: output_data.height, + }) + } + + pub fn get_positions(&self) -> Float32Array { + self.in_positions.clone() + } + + pub fn get_scales(&self) -> Float32Array { + self.in_scales.clone() + } + + pub fn get_rotations(&self) -> Float32Array { + self.in_rotations.clone() + } + + pub fn get_colors(&self) -> Uint8Array { + self.in_colors.clone() + } + + pub fn get_count(&self) -> usize { + self.in_count + } + + pub fn get_texture_data(&self) -> Vec { + self.out_texture_data.clone() + } + + pub fn get_width(&self) -> u32 { + self.out_width + } + + pub fn get_height(&self) -> u32 { + self.out_height + } +} + +pub struct SortGaussianIndexesTestData { + in_positions: Float32Array, + in_model_view: Float32Array, + in_texture_width: u32, + in_count: usize, + out_sorted_idx: Vec, +} + +impl SortGaussianIndexesTestData { + pub fn new() -> Result { + let input_data: RadixSortTestInput = + read_string_data(include_str!("./data/radix-sort-input-data.json")) + .map_err(|e| JsValue::from_str(&e.to_string()))?; + let output_data: RadixSortTestOutput = + read_string_data(include_str!("./data/radix-sort-output-data.json")) + .map_err(|e| JsValue::from_str(&e.to_string()))?; + + let positions = Float32Array::new_with_length(input_data.position.len() as u32); + positions.copy_from(&input_data.position); + + let model_view = Float32Array::new_with_length(input_data.model_view.len() as u32); + model_view.copy_from(&input_data.model_view); + + let sorted_idx = output_data.sorted_idx; + + Ok(Self { + in_positions: positions, + in_model_view: model_view, + in_texture_width: 0, + in_count: input_data.idx_count, + out_sorted_idx: sorted_idx, + }) + } + + pub fn get_positions(&self) -> Float32Array { + self.in_positions.clone() + } + + pub fn get_model_view(&self) -> Float32Array { + self.in_model_view.clone() + } + + pub fn get_texture_width(&self) -> u32 { + self.in_texture_width + } + + pub fn get_count(&self) -> usize { + self.in_count + } + + pub fn get_sorted_idx(&self) -> Vec { + self.out_sorted_idx.clone() + } +} diff --git a/wasm-splats/tests/common/test_utils.rs b/wasm-splats/tests/common/test_utils.rs new file mode 100644 index 0000000..7ff5c62 --- /dev/null +++ b/wasm-splats/tests/common/test_utils.rs @@ -0,0 +1,14 @@ +use js_sys::Uint32Array; + +pub fn check_uint32array( + array: &Uint32Array, + expected: &[u32], +) -> Result<(), Box> { + let len = array.length(); + let mut actual = vec![0; len as usize]; + array.copy_to(&mut actual); + + assert_eq!(actual, expected); + + Ok(()) +} diff --git a/wasm-splats/tests/web.rs b/wasm-splats/tests/web.rs index f99429f..c0ee657 100644 --- a/wasm-splats/tests/web.rs +++ b/wasm-splats/tests/web.rs @@ -1,14 +1,48 @@ //! Test suite for the Web and headless browsers. #![cfg(target_arch = "wasm32")] +mod common; extern crate wasm_bindgen_test; +use crate::common::test_utils::check_uint32array; +use common::test_data; use wasm_bindgen_test::*; +use wasm_splats::radix::radix_sort_gaussians_indexes; +use wasm_splats::texture_gen::generate_texture_from_attrs; wasm_bindgen_test_configure!(run_in_browser); #[wasm_bindgen_test] -fn pass() { - let two = 1 + 1; - assert_eq!(two, 2); +fn test_generate_splat_texture_from_attrs() { + let test_data = test_data::GenerateSplatTextureTestData::new().unwrap(); + let positions = test_data.get_positions(); + let scales = test_data.get_scales(); + let rotations = test_data.get_rotations(); + let colors = test_data.get_colors(); + let count = test_data.get_count(); + let texture_data = test_data.get_texture_data(); + let width = test_data.get_width(); + let height = test_data.get_height(); + + let result = + generate_texture_from_attrs(&positions, &scales, &rotations, &colors, count).unwrap(); + + assert_eq!(result.data(), texture_data); + assert_eq!(result.width(), width); + assert_eq!(result.height(), height); +} + +#[wasm_bindgen_test] +fn test_radix_sort_gaussians_indexes() { + let test_data = test_data::SortGaussianIndexesTestData::new().unwrap(); + let positions = test_data.get_positions(); + let model_view = test_data.get_model_view(); + let texture_width = test_data.get_texture_width(); + let count = test_data.get_count(); + let sorted_idx = test_data.get_sorted_idx(); + + let result = + radix_sort_gaussians_indexes(&positions, &model_view, texture_width, count).unwrap(); + + check_uint32array(&result, sorted_idx.as_ref()).unwrap(); } From ea9710b838acc8b4a8995c0ebf42cfc7c32841f7 Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Mon, 10 Feb 2025 12:17:48 -0600 Subject: [PATCH 17/24] Enabled git lfs in the CI build checkout step --- .github/workflows/wasm-splats-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wasm-splats-ci.yml b/.github/workflows/wasm-splats-ci.yml index 55d5421..3451be4 100644 --- a/.github/workflows/wasm-splats-ci.yml +++ b/.github/workflows/wasm-splats-ci.yml @@ -11,7 +11,9 @@ jobs: name: Testing and Linting runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + lfs: true - name: Install latest stable with wasm32-unknown-unknown uses: dtolnay/rust-toolchain@v1 From d1d86f28cca6fbc99fe3256694d94823546dfc2b Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Tue, 18 Feb 2025 15:54:16 -0600 Subject: [PATCH 18/24] Updated documentation. --- CONTRIBUTING.md | 2 +- Documentation/BuildGuide.md | 1 - README.md | 79 +++++++++++++++++++++++++++++++ wasm-splats/README.md | 86 ++++++---------------------------- wasm-splats/src/lib.rs | 9 ++-- wasm-splats/src/radix.rs | 3 +- wasm-splats/src/texture_gen.rs | 14 +++++- 7 files changed, 112 insertions(+), 82 deletions(-) delete mode 100644 Documentation/BuildGuide.md create mode 100644 README.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1b034b3..4ae2421 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,7 +41,7 @@ For ideas for Cesium WASM Utilities code contributions, see: - issues labeled [`good first issue`](https://github.com/CesiumGS/cesium/labels/good%20first%20issue) and - issues labeled [`type - roadmap`](https://github.com/CesiumGS/cesium/labels/type%20-%20roadmap). -See the [Build Guide](Documentation/BuildGuide.md) for how to build and run Cesium on your system. +See the [README](README.md) for how to build and run Cesium on your system. Always feel free to introduce yourself on the [Cesium community forum](https://community.cesium.com/) to brainstorm ideas and ask for guidance. diff --git a/Documentation/BuildGuide.md b/Documentation/BuildGuide.md deleted file mode 100644 index 30404ce..0000000 --- a/Documentation/BuildGuide.md +++ /dev/null @@ -1 +0,0 @@ -TODO \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..8ddef3a --- /dev/null +++ b/README.md @@ -0,0 +1,79 @@ +# cesium-wasm-utils + +![Cesium](https://github.com/CesiumGS/cesium/wiki/logos/Cesium_Logo_Color.jpg) + +CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin. It uses WebGL for +hardware-accelerated graphics, and is cross-platform, cross-browser, and tuned for dynamic-data visualization. + +Built on open formats, CesiumJS is designed for robust interoperability and scaling for massive datasets. + +The `cesium-wasm-utils` mono-repository contains utilities for CesiumJS written in WebAssembly (Wasm) for +performance-critical tasks. + +**NOTE**: This repository is only required for development of these WebAssembly packages. If you are a CesiumJS user or +contributor, you do not need to clone this repository. Instead, follow the instructions in +the [CesiumJS README](https://github.com/CesiumGS/cesium/blob/main/README.md). + +## Packages in this Repository + +- [wasm-splats](wasm-splats/README.md): High-performance algorithms used in the rendering Gaussian Splats in CesiumJS. + +# Get Started + +These instructions assume that you already +have [CesiumJS](https://github.com/CesiumGS/cesium/blob/main/README.md#rocket-get-started) configured on your system. + +## Prerequisites + +- [Node.js](https://nodejs.org/en/download/) v22 or later. +- [Rust](https://www.rust-lang.org/tools/install) v1.55 or later. +- [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/) v0.13 or later. + +### Installation recommendations. + +#### Node.js + +##### Windows + +On Windows, we recommend using [chocolatey](https://chocolatey.org/) to install Node.js. + +```sh +choco install nodejs +``` + +##### Linux and macOS + +On Linux and macOS, we recommend using [nvm](https://github.com/nvm-sh/nvm) to install Node.js. + +See the [nvm README](https://github.com/nvm-sh/nvm/blob/master/README.md) for installation instructions. + +#### Rust + +On all platforms, we recommend using [rustup](https://rustup.rs/) to install Rust. + +See the [rust website](https://www.rust-lang.org/tools/install) for installation instructions. + +#### wasm-pack + +On all platforms, we recommend using the wasm-pack installer to install wasm-pack. + +See the [wasm-pack website](https://rustwasm.github.io/wasm-pack/installer/) for installation instructions. + +## Clone the Repository + +```sh +git clone git@github.com:CesiumGS/cesium-wasm-utils.git +``` + +## Generate Documentation and open in Browser + +To generate the documentation for all packages in the workspace and open in your default browser, run: + +```sh +cargo doc --no-deps --document-private-items --open +``` + +## Further instructions + +For further instructions on building and running the packages in this repository, see the README in each package +directory. diff --git a/wasm-splats/README.md b/wasm-splats/README.md index 6b68408..ce6efc2 100644 --- a/wasm-splats/README.md +++ b/wasm-splats/README.md @@ -1,84 +1,28 @@ -
+# wasm-splats -

wasm-pack-template

+The `wasm-splats` package contains high-performance algorithms used in the rendering Gaussian Splats in CesiumJS. - A template for kick starting a Rust and WebAssembly project using wasm-pack. +## Getting Started -

- Build Status -

+Follow the instructions in the [cesium-wasm-utils README](./README.md) to clone the repository and install +prerequisites. -

- Tutorial - | - Chat -

+### Building - Built with 🦀🕸 by The Rust and WebAssembly Working Group -
+To build the package, run: -## About - -[**📚 Read this template tutorial! 📚**][template-docs] - -This template is designed for compiling Rust libraries into WebAssembly and -publishing the resulting package to NPM. - -Be sure to check out [other `wasm-pack` tutorials online][tutorials] for other -templates and usages of `wasm-pack`. - -[tutorials]: https://rustwasm.github.io/docs/wasm-pack/tutorials/index.html -[template-docs]: https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html - -## 🚴 Usage - -### 🐑 Use `cargo generate` to Clone this Template - -[Learn more about `cargo generate` here.](https://github.com/ashleygwilliams/cargo-generate) - -``` -cargo generate --git https://github.com/rustwasm/wasm-pack-template.git --name my-project -cd my-project +```sh +wasm-pack build --release --target web --scope cesium ``` -### 🛠️ Build with `wasm-pack build` +This will output a `pkg` directory containing the compiled WebAssembly module and JavaScript bindings. -``` -wasm-pack build -``` +### Testing -### 🔬 Test in Headless Browsers with `wasm-pack test` +To run the unit and integration tests, run: +```sh +wasm-pack test --headless --chrome --firefox ``` -wasm-pack test --headless --firefox -``` - -### 🎁 Publish to NPM with `wasm-pack publish` - -``` -wasm-pack publish -``` - -## 🔋 Batteries Included - -* [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen) for communicating - between WebAssembly and JavaScript. -* [`console_error_panic_hook`](https://github.com/rustwasm/console_error_panic_hook) - for logging panic messages to the developer console. -* `LICENSE-APACHE` and `LICENSE-MIT`: most Rust projects are licensed this way, so these are included for you - -## License - -Licensed under either of - -* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) -* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) - -at your option. - -### Contribution -Unless you explicitly state otherwise, any contribution intentionally -submitted for inclusion in the work by you, as defined in the Apache-2.0 -license, shall be dual licensed as above, without any additional terms or -conditions. +In macOS, you can also add `--safari` to run the tests in Safari. diff --git a/wasm-splats/src/lib.rs b/wasm-splats/src/lib.rs index 823569b..a1e3c8a 100644 --- a/wasm-splats/src/lib.rs +++ b/wasm-splats/src/lib.rs @@ -4,12 +4,9 @@ pub mod texture_gen; use js_sys::{Float32Array, Object, Uint32Array, Uint8Array}; use wasm_bindgen::prelude::*; -#[wasm_bindgen] -extern "C" { - fn alert(s: &str); -} - -//Wrapper func. Most are called directly +/// Generate a splat texture from the given attributes. +/// +/// Wraps the [`texture_gen::generate_texture_from_attrs`] function for access from JavaScript. #[wasm_bindgen] pub fn generate_splat_texture_from_attrs( positions: &Float32Array, diff --git a/wasm-splats/src/radix.rs b/wasm-splats/src/radix.rs index 7ed234e..051b472 100644 --- a/wasm-splats/src/radix.rs +++ b/wasm-splats/src/radix.rs @@ -1,13 +1,14 @@ use js_sys::{Float32Array, Uint32Array}; use wasm_bindgen::prelude::*; +/// Sorts the Gaussian Splats by depth using a radix sort. #[wasm_bindgen] pub fn radix_sort_gaussians_indexes( positions: &Float32Array, model_view: &Float32Array, _texture_width: u32, // TODO: FIGURE OUT IF THIS IS NEEDED. count: usize, -) -> Result { +) -> Result { if positions.length() as usize != count * 3 { return Err(JsValue::from_str("Invalid positions length")); } diff --git a/wasm-splats/src/texture_gen.rs b/wasm-splats/src/texture_gen.rs index dbf9a22..739431a 100644 --- a/wasm-splats/src/texture_gen.rs +++ b/wasm-splats/src/texture_gen.rs @@ -1,30 +1,38 @@ use js_sys::{Float32Array, Uint8Array}; use wasm_bindgen::prelude::*; +/// Represents a texture data object. #[wasm_bindgen] pub struct TextureData { + /// The texture data. data: Vec, + /// Width of the texture in pixels. width: u32, + /// Height of the texture in pixels. height: u32, } #[wasm_bindgen] impl TextureData { + /// Getter for the underlying texture data. Always returns a copy. #[wasm_bindgen(getter)] pub fn data(&self) -> Vec { self.data.clone() } + /// Getter for the width of the texture in pixels. #[wasm_bindgen(getter)] pub fn width(&self) -> u32 { self.width } + /// Getter for the height of the texture in pixels. #[wasm_bindgen(getter)] pub fn height(&self) -> u32 { self.height } + /// Creates a new texture data object with the underlying data, width, and height. pub fn new(data: Vec, width: u32, height: u32) -> Self { TextureData { data, @@ -34,9 +42,10 @@ impl TextureData { } } -//Algorithm from ILM -//https://github.com/mitsuba-renderer/openexr/blob/master/IlmBase/Half/half.cpp +/// Converts a 32-bit float to a 16-bit integer. fn float_to_half(f: f32) -> i16 { + //Algorithm from ILM + //https://github.com/mitsuba-renderer/openexr/blob/master/IlmBase/Half/half.cpp let f_int = f.to_bits() as i32; let sign = (f_int >> 16) & 0x00008000; let mut exp = ((f_int >> 23) & 0x000000ff) - (127 - 15); @@ -78,6 +87,7 @@ fn float_to_half(f: f32) -> i16 { (sign | (exp << 10) | (frac >> 13)) as i16 } +/// Generates a texture from the given attributes. #[wasm_bindgen] pub fn generate_texture_from_attrs( positions: &Float32Array, From 2f0be3b18acf6074ffc4c885dbd483fa293742ee Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Tue, 18 Feb 2025 17:08:56 -0600 Subject: [PATCH 19/24] Cleaned up what we expose via bindgen. --- wasm-splats/src/lib.rs | 39 ++++++++++++--------------- wasm-splats/src/models.rs | 44 ++++++++++++++++++++++++++++++ wasm-splats/src/radix.rs | 2 -- wasm-splats/src/texture_gen.rs | 49 ++-------------------------------- 4 files changed, 63 insertions(+), 71 deletions(-) create mode 100644 wasm-splats/src/models.rs diff --git a/wasm-splats/src/lib.rs b/wasm-splats/src/lib.rs index a1e3c8a..03be4be 100644 --- a/wasm-splats/src/lib.rs +++ b/wasm-splats/src/lib.rs @@ -1,38 +1,33 @@ +pub mod models; pub mod radix; pub mod texture_gen; -use js_sys::{Float32Array, Object, Uint32Array, Uint8Array}; +use js_sys::{Float32Array, Uint32Array, Uint8Array}; use wasm_bindgen::prelude::*; +use crate::models::TextureData; /// Generate a splat texture from the given attributes. /// /// Wraps the [`texture_gen::generate_texture_from_attrs`] function for access from JavaScript. #[wasm_bindgen] -pub fn generate_splat_texture_from_attrs( +pub fn generate_splat_texture( positions: &Float32Array, scales: &Float32Array, rotations: &Float32Array, colors: &Uint8Array, count: usize, -) -> Result { - let texture_data = - texture_gen::generate_texture_from_attrs(positions, scales, rotations, colors, count)?; - - let js_data = Uint32Array::new_with_length(texture_data.width() * texture_data.height() * 4); - js_data.copy_from(&texture_data.data()); - - let result = Object::new(); - js_sys::Reflect::set(&result, &"data".into(), &js_data)?; - js_sys::Reflect::set( - &result, - &"width".into(), - &(texture_data.width() as f64).into(), - )?; - js_sys::Reflect::set( - &result, - &"height".into(), - &(texture_data.height() as f64).into(), - )?; +) -> Result { + texture_gen::generate_texture_from_attrs(positions, scales, rotations, colors, count) +} - Ok(result) +/// Sorts the Gaussian Splats by depth using a radix sort. +/// +/// Wraps the [`radix::radix_sort_gaussians_indexes`] function for access from JavaScript. +#[wasm_bindgen] +pub fn radix_sort_gaussians_indexes( + positions: &Float32Array, + model_view: &Float32Array, + count: usize, +) -> Result { + radix::radix_sort_gaussians_indexes(positions, model_view, count) } diff --git a/wasm-splats/src/models.rs b/wasm-splats/src/models.rs new file mode 100644 index 0000000..8a8eed3 --- /dev/null +++ b/wasm-splats/src/models.rs @@ -0,0 +1,44 @@ +//! Module encapsulating the data models exposed through WebAssembly. + +use wasm_bindgen::prelude::wasm_bindgen; + +/// A structure representing texture data. This is used to pass the texture data from generation in [`texture_gen`] to the JavaScript side. +#[wasm_bindgen] +pub struct TextureData { + /// The texture data. + data: Vec, + /// Width of the texture in pixels. + width: u32, + /// Height of the texture in pixels. + height: u32, +} + +#[wasm_bindgen] +impl TextureData { + /// Getter for the underlying texture data. Always returns a copy. + #[wasm_bindgen(getter)] + pub fn data(&self) -> Vec { + self.data.clone() + } + + /// Getter for the width of the texture in pixels. + #[wasm_bindgen(getter)] + pub fn width(&self) -> u32 { + self.width + } + + /// Getter for the height of the texture in pixels. + #[wasm_bindgen(getter)] + pub fn height(&self) -> u32 { + self.height + } + + /// Creates a new texture data object with the underlying data, width, and height. + pub fn new(data: Vec, width: u32, height: u32) -> Self { + TextureData { + data, + width, + height, + } + } +} diff --git a/wasm-splats/src/radix.rs b/wasm-splats/src/radix.rs index 051b472..7548560 100644 --- a/wasm-splats/src/radix.rs +++ b/wasm-splats/src/radix.rs @@ -2,11 +2,9 @@ use js_sys::{Float32Array, Uint32Array}; use wasm_bindgen::prelude::*; /// Sorts the Gaussian Splats by depth using a radix sort. -#[wasm_bindgen] pub fn radix_sort_gaussians_indexes( positions: &Float32Array, model_view: &Float32Array, - _texture_width: u32, // TODO: FIGURE OUT IF THIS IS NEEDED. count: usize, ) -> Result { if positions.length() as usize != count * 3 { diff --git a/wasm-splats/src/texture_gen.rs b/wasm-splats/src/texture_gen.rs index 739431a..d0e9ede 100644 --- a/wasm-splats/src/texture_gen.rs +++ b/wasm-splats/src/texture_gen.rs @@ -1,46 +1,6 @@ use js_sys::{Float32Array, Uint8Array}; use wasm_bindgen::prelude::*; - -/// Represents a texture data object. -#[wasm_bindgen] -pub struct TextureData { - /// The texture data. - data: Vec, - /// Width of the texture in pixels. - width: u32, - /// Height of the texture in pixels. - height: u32, -} - -#[wasm_bindgen] -impl TextureData { - /// Getter for the underlying texture data. Always returns a copy. - #[wasm_bindgen(getter)] - pub fn data(&self) -> Vec { - self.data.clone() - } - - /// Getter for the width of the texture in pixels. - #[wasm_bindgen(getter)] - pub fn width(&self) -> u32 { - self.width - } - - /// Getter for the height of the texture in pixels. - #[wasm_bindgen(getter)] - pub fn height(&self) -> u32 { - self.height - } - - /// Creates a new texture data object with the underlying data, width, and height. - pub fn new(data: Vec, width: u32, height: u32) -> Self { - TextureData { - data, - width, - height, - } - } -} +use crate::models::TextureData; /// Converts a 32-bit float to a 16-bit integer. fn float_to_half(f: f32) -> i16 { @@ -88,7 +48,6 @@ fn float_to_half(f: f32) -> i16 { } /// Generates a texture from the given attributes. -#[wasm_bindgen] pub fn generate_texture_from_attrs( positions: &Float32Array, scales: &Float32Array, @@ -172,9 +131,5 @@ pub fn generate_texture_from_attrs( | ((float_to_half(4.0 * sigma[5]) as u32 & 0xFFFF) << 16); } - Ok(TextureData { - data: tex_data, - width: tex_width, - height: tex_height, - }) + Ok(TextureData::new(tex_data, tex_width, tex_height)) } From d581a40e7c44fa4d7ff3cb6c32039a096e9afe37 Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Tue, 18 Feb 2025 17:13:57 -0600 Subject: [PATCH 20/24] Fixing the unit tests. --- wasm-splats/tests/web.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wasm-splats/tests/web.rs b/wasm-splats/tests/web.rs index c0ee657..2cc4ffa 100644 --- a/wasm-splats/tests/web.rs +++ b/wasm-splats/tests/web.rs @@ -37,12 +37,11 @@ fn test_radix_sort_gaussians_indexes() { let test_data = test_data::SortGaussianIndexesTestData::new().unwrap(); let positions = test_data.get_positions(); let model_view = test_data.get_model_view(); - let texture_width = test_data.get_texture_width(); let count = test_data.get_count(); let sorted_idx = test_data.get_sorted_idx(); let result = - radix_sort_gaussians_indexes(&positions, &model_view, texture_width, count).unwrap(); + radix_sort_gaussians_indexes(&positions, &model_view, count).unwrap(); check_uint32array(&result, sorted_idx.as_ref()).unwrap(); } From 10b291cee9d5649e78a56cdd359853c18ff24a03 Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Wed, 19 Feb 2025 13:08:21 -0600 Subject: [PATCH 21/24] Cleanup. --- wasm-splats/src/lib.rs | 6 ++++-- wasm-splats/src/radix.rs | 2 ++ wasm-splats/src/texture_gen.rs | 4 +++- wasm-splats/tests/web.rs | 3 +-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/wasm-splats/src/lib.rs b/wasm-splats/src/lib.rs index 03be4be..d5a0472 100644 --- a/wasm-splats/src/lib.rs +++ b/wasm-splats/src/lib.rs @@ -1,10 +1,12 @@ +//! Library containing high-performance functions for the Gaussian Splats rendering process within CesiumJS. + pub mod models; pub mod radix; pub mod texture_gen; +use crate::models::TextureData; use js_sys::{Float32Array, Uint32Array, Uint8Array}; use wasm_bindgen::prelude::*; -use crate::models::TextureData; /// Generate a splat texture from the given attributes. /// @@ -21,7 +23,7 @@ pub fn generate_splat_texture( } /// Sorts the Gaussian Splats by depth using a radix sort. -/// +/// /// Wraps the [`radix::radix_sort_gaussians_indexes`] function for access from JavaScript. #[wasm_bindgen] pub fn radix_sort_gaussians_indexes( diff --git a/wasm-splats/src/radix.rs b/wasm-splats/src/radix.rs index 7548560..b6d373f 100644 --- a/wasm-splats/src/radix.rs +++ b/wasm-splats/src/radix.rs @@ -1,3 +1,5 @@ +//! Radix sort implementation for sorting Gaussian Splats. + use js_sys::{Float32Array, Uint32Array}; use wasm_bindgen::prelude::*; diff --git a/wasm-splats/src/texture_gen.rs b/wasm-splats/src/texture_gen.rs index d0e9ede..a508458 100644 --- a/wasm-splats/src/texture_gen.rs +++ b/wasm-splats/src/texture_gen.rs @@ -1,6 +1,8 @@ +//! Generates textures for use within the Gaussian Splat shaders in CesiumJS. + +use crate::models::TextureData; use js_sys::{Float32Array, Uint8Array}; use wasm_bindgen::prelude::*; -use crate::models::TextureData; /// Converts a 32-bit float to a 16-bit integer. fn float_to_half(f: f32) -> i16 { diff --git a/wasm-splats/tests/web.rs b/wasm-splats/tests/web.rs index 2cc4ffa..83a15fd 100644 --- a/wasm-splats/tests/web.rs +++ b/wasm-splats/tests/web.rs @@ -40,8 +40,7 @@ fn test_radix_sort_gaussians_indexes() { let count = test_data.get_count(); let sorted_idx = test_data.get_sorted_idx(); - let result = - radix_sort_gaussians_indexes(&positions, &model_view, count).unwrap(); + let result = radix_sort_gaussians_indexes(&positions, &model_view, count).unwrap(); check_uint32array(&result, sorted_idx.as_ref()).unwrap(); } From df16000dab5b9b93bc76b6d5f7006a2ffd15c5ca Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Wed, 19 Feb 2025 14:28:21 -0600 Subject: [PATCH 22/24] Fixing a broken unit test. --- wasm-splats/tests/common/test_data.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/wasm-splats/tests/common/test_data.rs b/wasm-splats/tests/common/test_data.rs index f815125..4c5ac6b 100644 --- a/wasm-splats/tests/common/test_data.rs +++ b/wasm-splats/tests/common/test_data.rs @@ -84,7 +84,6 @@ impl GenerateSplatTextureTestData { pub struct SortGaussianIndexesTestData { in_positions: Float32Array, in_model_view: Float32Array, - in_texture_width: u32, in_count: usize, out_sorted_idx: Vec, } @@ -109,7 +108,6 @@ impl SortGaussianIndexesTestData { Ok(Self { in_positions: positions, in_model_view: model_view, - in_texture_width: 0, in_count: input_data.idx_count, out_sorted_idx: sorted_idx, }) @@ -123,10 +121,6 @@ impl SortGaussianIndexesTestData { self.in_model_view.clone() } - pub fn get_texture_width(&self) -> u32 { - self.in_texture_width - } - pub fn get_count(&self) -> usize { self.in_count } From 9b9581b953f9e8425ed0a8475a3648449f68723a Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Thu, 20 Feb 2025 14:35:09 -0600 Subject: [PATCH 23/24] Added CHANGES.md and other cleanup. --- .cargo/config.toml | 1 + .github/workflows/wasm-splats-ci.yml | 5 - CHANGES.md | 7 + CONTRIBUTING.md | 2 +- LICENSE.md | 914 --------------------------- README.md | 2 +- wasm-splats/Cargo.toml | 2 +- wasm-splats/README.md | 5 +- 8 files changed, 15 insertions(+), 923 deletions(-) create mode 100644 CHANGES.md diff --git a/.cargo/config.toml b/.cargo/config.toml index d0c58e8..2404f21 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,6 @@ # You may be asking, "wait, why is this here and not in the pacakge directories?" # As of January 2025, [per-package targets](https://github.com/rust-lang/cargo/issues/9406) hasn't hit stable Rust. Once that hits, we can move this back into the package directories. +# Issue for our tracking: https://github.com/CesiumGS/cesium-wasm-utils/issues/2 [build] target = "wasm32-unknown-unknown" diff --git a/.github/workflows/wasm-splats-ci.yml b/.github/workflows/wasm-splats-ci.yml index 3451be4..358f09c 100644 --- a/.github/workflows/wasm-splats-ci.yml +++ b/.github/workflows/wasm-splats-ci.yml @@ -1,4 +1,3 @@ -# If you're adding a new package, you'll need to duplicate this workflow for it. name: wasm-splats CI on: push: @@ -54,7 +53,3 @@ jobs: - name: Build wasm-splats run: wasm-pack build ./wasm-splats --release --target web --scope cesium - -# TODO: Get rid of this when I no longer need it. -# - name: Pack wasm-splats -# run: wasm-pack publish ./wasm-splats/pkg diff --git a/CHANGES.md b/CHANGES.md new file mode 100644 index 0000000..5264ecd --- /dev/null +++ b/CHANGES.md @@ -0,0 +1,7 @@ +# Change Log + +## @cesium/wasm-splats + +### 0.1.0-alpha.1 + +- Initial release of the `wasm-splats` package. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4ae2421..bfacc2b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,7 +20,7 @@ If a related issue does not exist, submit a new one. Please be concise and inclu - Screenshot or animated .gif if appropriate (try [LICEcap](http://www.cockos.com/licecap/)). For example, see [#3153](https://github.com/CesiumGS/cesium/issues/3153) in CesiumJS. Screenshots are particularly useful for exceptions and rendering artifacts. If it is a rendering artifact, also include the output of [webglreport.com](http://webglreport.com/). - Link to the thread if this was discussed on the Cesium forum or elsewhere. For example, see [#3045](https://github.com/CesiumGS/cesium/issues/3045) in CesiumJS. - Your operating system and version, browser and version, and video card. Are they all up-to-date? Is the issue specific to one of them? -- The version of Cesium. Did this work in a previous version? +- The version of CesiumJS. Did this work in a previous version? - Ideas for how to fix or workaround the issue. Also mention if you are willing to help fix it. If so, the Cesium team can often provide guidance and the issue may get fixed more quickly with your help. ## Getting Started Contributing diff --git a/LICENSE.md b/LICENSE.md index 5858130..bd93af5 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -201,917 +201,3 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - -Patents US9153063B2 US9865085B1 US10592242 - -Patents pending US15/829,786 US16/850,266 US16/851,958 - -# Third-Party Code - -CesiumJS includes the following third-party code. - -### Sean O'Neil - -http://sponeil.net/ - -> Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com) -> -> All rights reserved. -> -> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -> -> - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -> - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -> - Neither the name of the project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. -> -> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -### zip.js - -https://github.com/gildas-lormeau/zip.js - -> Copyright (c) 2013 Gildas Lormeau. All rights reserved. -> -> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -> -> 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -> -> 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -> -> 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. -> -> THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -### Autolinker.js - -https://github.com/gregjacobs/Autolinker.js - -The MIT License (MIT) - -> Copyright (c) 2015 Gregory Jacobs (http://greg-jacobs.com) - -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### tween.js - -https://github.com/sole/tween.js - -> Copyright (c) 2010-2012 Tween.js authors. -> -> Easing equations Copyright (c) 2001 Robert Penner http://robertpenner.com/easing/ -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### Knockout - -http://knockoutjs.com/ - -> (c) The Knockout.js team - http://knockoutjs.com/ -> License: MIT (http://www.opensource.org/licenses/mit-license.php) -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### Knockout ES5 plugin - -https://github.com/SteveSanderson/knockout-es5 - -> Copyright (c) Steve Sanderson -> MIT license -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### topojson-client - -https://github.com/topojson/topojson-client - -> Copyright 2012-2019 Michael Bostock -> -> Permission to use, copy, modify, and/or distribute this software for any purpose -> with or without fee is hereby granted, provided that the above copyright notice -> and this permission notice appear in all copies. -> -> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -> FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -> OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -> TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -> THIS SOFTWARE. - -### mersenne-twister.js - -https://gist.github.com/banksean/300494 - -> Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, -> All rights reserved. -> -> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -> -> 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -> -> 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -> -> 3. The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission. -> -> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -### NVIDIA GameWorks Graphics Samples - -https://github.com/NVIDIAGameWorks/GraphicsSamples - -> Copyright 2016 NVIDIA Corporation -> -> BY DOWNLOADING THE SOFTWARE AND OTHER AVAILABLE MATERIALS, YOU ("DEVELOPER") AGREE TO BE BOUND BY THE FOLLOWING TERMS AND CONDITIONS -> -> The materials available for download to Developers may include software in both sample source ("Source Code") and object code ("Object Code") versions, documentation ("Documentation"), certain art work ("Art Assets") and other materials (collectively, these materials referred to herein as "Materials"). Except as expressly indicated herein, all terms and conditions of this Agreement apply to all of the Materials. -> -> Except as expressly set forth herein, NVIDIA owns all of the Materials and makes them available to Developer only under the terms and conditions set forth in this Agreement. -> -> License: Subject to the terms of this Agreement, NVIDIA hereby grants to Developer a royalty-free, non-exclusive license to possess and to use the Materials. The following terms apply to the specified type of Material: -> -> Source Code: Developer shall have the right to modify and create derivative works with the Source Code. Developer shall own any derivative works ("Derivatives") it creates to the Source Code, provided that Developer uses the Materials in accordance with the terms of this Agreement. Developer may distribute the Derivatives, provided that all NVIDIA copyright notices and trademarks are used properly and the Derivatives include the following statement: "This software contains source code provided by NVIDIA Corporation." -> -> Object Code: Developer agrees not to disassemble, decompile or reverse engineer the Object Code versions of any of the Materials. Developer acknowledges that certain of the Materials provided in Object Code version may contain third party components that may be subject to restrictions, and expressly agrees not to attempt to modify or distribute such Materials without first receiving consent from NVIDIA. -> -> Art Assets: Developer shall have the right to modify and create Derivatives of the Art Assets, but may not distribute any of the Art Assets or Derivatives created therefrom without NVIDIA's prior written consent. -> -> Government End Users: If you are acquiring the Software on behalf of any unit or agency of the United States Government, the following provisions apply. The Government agrees the Software and documentation were developed at private expense and are provided with "RESTRICTED RIGHTS". Use, duplication, or disclosure by the Government is subject to restrictions as set forth in DFARS 227.7202-1(a) and 227.7202-3(a) (1995), DFARS 252.227-7013(c)(1)(ii) (Oct 1988), FAR 12.212(a)(1995), FAR 52.227-19, (June 1987) or FAR 52.227-14(ALT III) (June 1987),as amended from time to time. In the event that this License, or any part thereof, is deemed inconsistent with the minimum rights identified in the Restricted Rights provisions, the minimum rights shall prevail. -> No Other License. No rights or licenses are granted by NVIDIA under this License, expressly or by implication, with respect to any proprietary information or patent, copyright, trade secret or other intellectual property right owned or controlled by NVIDIA, except as expressly provided in this License. -> Term: This License is effective until terminated. NVIDIA may terminate this Agreement (and with it, all of Developer's right to the Materials) immediately upon written notice (which may include email) to Developer, with or without cause. -> -> Support: NVIDIA has no obligation to support or to continue providing or updating any of the Materials. -> -> No Warranty: THE SOFTWARE AND ANY OTHER MATERIALS PROVIDED BY NVIDIA TO DEVELOPER HEREUNDER ARE PROVIDED "AS IS." NVIDIA DISCLAIMS ALL WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -> -> LIMITATION OF LIABILITY: NVIDIA SHALL NOT BE LIABLE TO DEVELOPER, DEVELOPER'S CUSTOMERS, OR ANY OTHER PERSON OR ENTITY CLAIMING THROUGH OR UNDER DEVELOPER FOR ANY LOSS OF PROFITS, INCOME, SAVINGS, OR ANY OTHER CONSEQUENTIAL, INCIDENTAL, SPECIAL, PUNITIVE, DIRECT OR INDIRECT DAMAGES (WHETHER IN AN ACTION IN CONTRACT, TORT OR BASED ON A WARRANTY), EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF THE ESSENTIAL PURPOSE OF ANY LIMITED REMEDY. IN NO EVENT SHALL NVIDIA'S AGGREGATE LIABILITY TO DEVELOPER OR ANY OTHER PERSON OR ENTITY CLAIMING THROUGH OR UNDER DEVELOPER EXCEED THE AMOUNT OF MONEY ACTUALLY PAID BY DEVELOPER TO NVIDIA FOR THE SOFTWARE OR ANY OTHER MATERIALS. - -### NoSleep.js - -https://github.com/richtr/NoSleep.js - -> NoSleep.js v0.5.0 - git.io/vfn01 -> Rich Tibbett -> MIT license - -### jsep - -https://github.com/EricSmekens/jsep - -> Copyright (c) 2013 Stephen Oney, https://ericsmekens.github.io/jsep/ -> -> Permission is hereby granted, free of charge, to any person obtaining -> a copy of this software and associated documentation files (the -> "Software"), to deal in the Software without restriction, including -> without limitation the rights to use, copy, modify, merge, publish, -> distribute, sublicense, and/or sell copies of the Software, and to -> permit persons to whom the Software is furnished to do so, subject to -> the following conditions: -> -> The above copyright notice and this permission notice shall be -> included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -> LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### earcut - -https://github.com/mapbox/earcut - -> Copyright (c) 2016, Mapbox -> -> Permission to use, copy, modify, and/or distribute this software for any purpose -> with or without fee is hereby granted, provided that the above copyright notice -> and this permission notice appear in all copies. -> -> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -> FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -> OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -> TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -> THIS SOFTWARE. - -### kdbush - -https://github.com/mourner/kdbush - -> Copyright (c) 2016, Vladimir Agafonkin -> -> Permission to use, copy, modify, and/or distribute this software for any purpose -> with or without fee is hereby granted, provided that the above copyright notice -> and this permission notice appear in all copies. -> -> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -> FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -> OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -> TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -> THIS SOFTWARE. - -### rbush - -https://github.com/mourner/rbush - -> MIT License - -> Copyright (c) 2016 Vladimir Agafonkin - -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in -> all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -> THE SOFTWARE. - -### basis_universal - -https://github.com/BinomialLLC/basis_universal - -> Licensed under the Apache License, Version 2.0 (the "License"); you may not -> use this file except in compliance with the License. You may obtain a copy of -> the License at -> -> -> -> Unless required by applicable law or agreed to in writing, software -> distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -> WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -> License for the specific language governing permissions and limitations under -> the License. - -### KTX-Parse - -https://github.com/donmccurdy/KTX-Parse/ - -> (The MIT License) -> -> Copyright (c) 2020 Don McCurdy -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in -> all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -> THE SOFTWARE. - -### meshoptimizer - -https://github.com/zeux/meshoptimizer/blob/master/LICENSE.md - -> MIT License -> -> Copyright (c) 2016-2021 Arseny Kapoulkine -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -> SOFTWARE. - -### pako - -https://github.com/nodeca/pako - -> (The MIT License) -> -> Copyright (C) 2014-2017 by Vitaly Puzrin and Andrei Tuputcyn -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in -> all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -> THE SOFTWARE. - -### protobuf - -https://github.com/dcodeIO/ProtoBuf.js - -> Copyright (c) 2016, Daniel Wirtz All rights reserved. -> -> Redistribution and use in source and binary forms, with or without -> modification, are permitted provided that the following conditions are -> met: -> -> - Redistributions of source code must retain the above copyright -> notice, this list of conditions and the following disclaimer. -> - Redistributions in binary form must reproduce the above copyright -> notice, this list of conditions and the following disclaimer in the -> documentation and/or other materials provided with the distribution. -> - Neither the name of its author, nor the names of its contributors -> may be used to endorse or promote products derived from this software -> without specific prior written permission. -> -> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -> "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -> LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -> A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -> OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -> SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -> LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -> DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -> THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -> (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -> OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -### gltf-WebGL-PBR - -https://github.com/KhronosGroup/glTF-WebGL-PBR - -> The MIT License -> -> Copyright (c) 2016-2017 Mohamad Moneimne and Contributors -> -> Permission is hereby granted, free of charge, to any person obtaining -> a copy of this software and associated documentation files (the "Software"), -> to deal in the Software without restriction, including without limitation the -> rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -> sell copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in -> all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -> INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -> PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -> CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -> OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### ShaderFastLibs - -https://github.com/michaldrobot/ShaderFastLibs - -> The MIT License (MIT) -> -> Copyright (c) 2014 Michal Drobot -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### Draco - -https://github.com/google/draco - -> Licensed under the Apache License, Version 2.0 (the "License"); you may not -> use this file except in compliance with the License. You may obtain a copy of -> the License at -> -> -> -> Unless required by applicable law or agreed to in writing, software -> distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -> WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -> License for the specific language governing permissions and limitations under -> the License. - -### DOMPurify - -https://github.com/cure53/DOMPurify - -> DOMPurify -> Copyright 2015 Mario Heiderich -> -> DOMPurify is free software; you can redistribute it and/or modify it under the -> terms of either: -> -> a) the Apache License Version 2.0, or -> b) the Mozilla Public License Version 2.0 -> -> Licensed under the Apache License, Version 2.0 (the "License"); -> you may not use this file except in compliance with the License. -> You may obtain a copy of the License at -> -> http://www.apache.org/licenses/LICENSE-2.0 -> -> Unless required by applicable law or agreed to in writing, software -> distributed under the License is distributed on an "AS IS" BASIS, -> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -> See the License for the specific language governing permissions and -> limitations under the License. - -### LERC - -http://github.com/Esri/lerc/ - -> Copyright 2015 Esri -> -> Licensed under the Apache License, Version 2.0 (the "License"); -> you may not use this file except in compliance with the License. -> You may obtain a copy of the License at -> -> http://www.apache.org/licenses/LICENSE-2.0 -> -> Unless required by applicable law or agreed to in writing, software -> distributed under the License is distributed on an "AS IS" BASIS, -> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -> See the License for the specific language governing permissions and -> limitations under the License. -> -> A copy of the license and additional notices are located with the -> source distribution at: -> -> http://github.com/Esri/lerc/ - -### GraphemeSplitter - -https://github.com/orling/grapheme-splitter - -> The MIT License (MIT) -> -> Copyright (c) 2015 Orlin Georgiev -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### bitmap-sdf - -https://github.com/dy/bitmap-sdf - -> (c) 2017 Dima Yv. MIT License -> -> Development supported by plot.ly. - -### s2geometry - -https://github.com/google/s2geometry/blob/master/LICENSE - -> Apache License -> Version 2.0, January 2004 -> http://www.apache.org/licenses/ -> -> TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -> -> 1. Definitions. -> -> "License" shall mean the terms and conditions for use, reproduction, -> and distribution as defined by Sections 1 through 9 of this document. -> -> "Licensor" shall mean the copyright owner or entity authorized by -> the copyright owner that is granting the License. -> -> "Legal Entity" shall mean the union of the acting entity and all -> other entities that control, are controlled by, or are under common -> control with that entity. For the purposes of this definition, -> "control" means (i) the power, direct or indirect, to cause the -> direction or management of such entity, whether by contract or -> otherwise, or (ii) ownership of fifty percent (50%) or more of the -> outstanding shares, or (iii) beneficial ownership of such entity. -> -> "You" (or "Your") shall mean an individual or Legal Entity -> exercising permissions granted by this License. -> -> "Source" form shall mean the preferred form for making modifications, -> including but not limited to software source code, documentation -> source, and configuration files. -> -> "Object" form shall mean any form resulting from mechanical -> transformation or translation of a Source form, including but -> not limited to compiled object code, generated documentation, -> and conversions to other media types. -> -> "Work" shall mean the work of authorship, whether in Source or -> Object form, made available under the License, as indicated by a -> copyright notice that is included in or attached to the work -> (an example is provided in the Appendix below). -> -> "Derivative Works" shall mean any work, whether in Source or Object -> form, that is based on (or derived from) the Work and for which the -> editorial revisions, annotations, elaborations, or other modifications -> represent, as a whole, an original work of authorship. For the purposes -> of this License, Derivative Works shall not include works that remain -> separable from, or merely link (or bind by name) to the interfaces of, -> the Work and Derivative Works thereof. -> -> "Contribution" shall mean any work of authorship, including -> the original version of the Work and any modifications or additions -> to that Work or Derivative Works thereof, that is intentionally -> submitted to Licensor for inclusion in the Work by the copyright owner -> or by an individual or Legal Entity authorized to submit on behalf of -> the copyright owner. For the purposes of this definition, "submitted" -> means any form of electronic, verbal, or written communication sent -> to the Licensor or its representatives, including but not limited to -> communication on electronic mailing lists, source code control systems, -> and issue tracking systems that are managed by, or on behalf of, the -> Licensor for the purpose of discussing and improving the Work, but -> excluding communication that is conspicuously marked or otherwise -> designated in writing by the copyright owner as "Not a Contribution." -> -> "Contributor" shall mean Licensor and any individual or Legal Entity -> on behalf of whom a Contribution has been received by Licensor and -> subsequently incorporated within the Work. -> -> 2. Grant of Copyright License. Subject to the terms and conditions of -> this License, each Contributor hereby grants to You a perpetual, -> worldwide, non-exclusive, no-charge, royalty-free, irrevocable -> copyright license to reproduce, prepare Derivative Works of, -> publicly display, publicly perform, sublicense, and distribute the -> Work and such Derivative Works in Source or Object form. -> -> 3. Grant of Patent License. Subject to the terms and conditions of -> this License, each Contributor hereby grants to You a perpetual, -> worldwide, non-exclusive, no-charge, royalty-free, irrevocable -> (except as stated in this section) patent license to make, have made, -> use, offer to sell, sell, import, and otherwise transfer the Work, -> where such license applies only to those patent claims licensable -> by such Contributor that are necessarily infringed by their -> Contribution(s) alone or by combination of their Contribution(s) -> with the Work to which such Contribution(s) was submitted. If You -> institute patent litigation against any entity (including a -> cross-claim or counterclaim in a lawsuit) alleging that the Work -> or a Contribution incorporated within the Work constitutes direct -> or contributory patent infringement, then any patent licenses -> granted to You under this License for that Work shall terminate -> as of the date such litigation is filed. -> -> 4. Redistribution. You may reproduce and distribute copies of the -> Work or Derivative Works thereof in any medium, with or without -> modifications, and in Source or Object form, provided that You -> meet the following conditions: -> -> (a) You must give any other recipients of the Work or -> Derivative Works a copy of this License; and -> -> (b) You must cause any modified files to carry prominent notices -> stating that You changed the files; and -> -> (c) You must retain, in the Source form of any Derivative Works -> that You distribute, all copyright, patent, trademark, and -> attribution notices from the Source form of the Work, -> excluding those notices that do not pertain to any part of -> the Derivative Works; and -> -> (d) If the Work includes a "NOTICE" text file as part of its -> distribution, then any Derivative Works that You distribute must -> include a readable copy of the attribution notices contained -> within such NOTICE file, excluding those notices that do not -> pertain to any part of the Derivative Works, in at least one -> of the following places: within a NOTICE text file distributed -> as part of the Derivative Works; within the Source form or -> documentation, if provided along with the Derivative Works; or, -> within a display generated by the Derivative Works, if and -> wherever such third-party notices normally appear. The contents -> of the NOTICE file are for informational purposes only and -> do not modify the License. You may add Your own attribution -> notices within Derivative Works that You distribute, alongside -> or as an addendum to the NOTICE text from the Work, provided -> that such additional attribution notices cannot be construed -> as modifying the License. -> -> You may add Your own copyright statement to Your modifications and -> may provide additional or different license terms and conditions -> for use, reproduction, or distribution of Your modifications, or -> for any such Derivative Works as a whole, provided Your use, -> reproduction, and distribution of the Work otherwise complies with -> the conditions stated in this License. -> -> 5. Submission of Contributions. Unless You explicitly state otherwise, -> any Contribution intentionally submitted for inclusion in the Work -> by You to the Licensor shall be under the terms and conditions of -> this License, without any additional terms or conditions. -> Notwithstanding the above, nothing herein shall supersede or modify -> the terms of any separate license agreement you may have executed -> with Licensor regarding such Contributions. -> -> 6. Trademarks. This License does not grant permission to use the trade -> names, trademarks, service marks, or product names of the Licensor, -> except as required for reasonable and customary use in describing the -> origin of the Work and reproducing the content of the NOTICE file. -> -> 7. Disclaimer of Warranty. Unless required by applicable law or -> agreed to in writing, Licensor provides the Work (and each -> Contributor provides its Contributions) on an "AS IS" BASIS, -> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -> implied, including, without limitation, any warranties or conditions -> of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A -> PARTICULAR PURPOSE. You are solely responsible for determining the -> appropriateness of using or redistributing the Work and assume any -> risks associated with Your exercise of permissions under this License. -> -> 8. Limitation of Liability. In no event and under no legal theory, -> whether in tort (including negligence), contract, or otherwise, -> unless required by applicable law (such as deliberate and grossly -> negligent acts) or agreed to in writing, shall any Contributor be -> liable to You for damages, including any direct, indirect, special, -> incidental, or consequential damages of any character arising as a -> result of this License or out of the use or inability to use the -> Work (including but not limited to damages for loss of goodwill, -> work stoppage, computer failure or malfunction, or any and all -> other commercial damages or losses), even if such Contributor -> has been advised of the possibility of such damages. -> -> 9. Accepting Warranty or Additional Liability. While redistributing -> the Work or Derivative Works thereof, You may choose to offer, -> and charge a fee for, acceptance of support, warranty, indemnity, -> or other liability obligations and/or rights consistent with this -> License. However, in accepting such obligations, You may act only -> on Your own behalf and on Your sole responsibility, not on behalf -> of any other Contributor, and only if You agree to indemnify, -> defend, and hold each Contributor harmless for any liability -> incurred by, or claims asserted against, such Contributor by reason -> of your accepting any such warranty or additional liability. -> -> END OF TERMS AND CONDITIONS -> -> APPENDIX: How to apply the Apache License to your work. -> -> To apply the Apache License to your work, attach the following -> boilerplate notice, with the fields enclosed by brackets "[]" -> replaced with your own identifying information. (Don't include -> the brackets!) The text should be enclosed in the appropriate -> comment syntax for the file format. We also recommend that a -> file or class name and description of purpose be included on the -> same "printed page" as the copyright notice for easier -> identification within third-party archives. -> -> Copyright [yyyy] [name of copyright owner] -> -> Licensed under the Apache License, Version 2.0 (the "License"); -> you may not use this file except in compliance with the License. -> You may obtain a copy of the License at -> -> http://www.apache.org/licenses/LICENSE-2.0 -> -> Unless required by applicable law or agreed to in writing, software -> distributed under the License is distributed on an "AS IS" BASIS, -> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -> See the License for the specific language governing permissions and -> limitations under the License. - -### URI.js - -http://medialize.github.io/URI.js/ - -> The MIT License (MIT) -> -> Copyright (c) 2011 Rodney Rehm -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in -> all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -> THE SOFTWARE. - -# Tests - -The CesiumJS tests use the following third-party libraries and data. - -### Jasmine - -http://jasmine.github.io/ - -Copyright (c) 2008-2014 Pivotal Labs - -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -# CesiumJS Documentation - -The CesiumJS documentation files include the following third-party content. - -### Source Sans Pro (Font) - -Source® Sans Pro, Adobe's first open source typeface family, was designed by Paul D. Hunt. It is a sans serif typeface intended to work well in user interfaces. - -[SIL Open Font License, 1.1](http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL) ([text](http://scripts.sil.org/cms/scripts/render_download.php?format=file&media_id=OFL_plaintext&filename=OFL.txt)) - -# Example Applications - -The CesiumJS example applications include the following third-party libraries and data. - -### Dojo Toolkit - -http://dojotoolkit.org/ - -> Copyright (c) 2005-2015, The Dojo Foundation -> -> All rights reserved. -> -> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -> -> - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -> - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -> - Neither the name of the Dojo Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. -> -> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -### CodeMirror - -http://codemirror.net/ - -> Copyright (C) 2017 by Marijn Haverbeke and others -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -> -> Please note that some subdirectories of the CodeMirror distribution include their own LICENSE files, and are released under different licences. - -### clipboard.js - -https://clipboardjs.com/ - -> The MIT License (MIT) -> Copyright © 2018 Zeno Rocha -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### JSHint - -http://www.jshint.com/ - -> JSHint, by JSHint Community. -> -> Licensed under the same slightly modified MIT license that JSLint is. It stops evil-doers everywhere. -> -> JSHint is a derivative work of JSLint: -> -> Copyright (c) 2002 Douglas Crockford (www.JSLint.com) -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> The Software shall be used for Good, not Evil. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. JSHint was forked from the 2010-12-16 edition of JSLint. - -### Public domain data from Natural Earth - -Free vector and raster map data @ naturalearthdata.com - -Terms of use: http://www.naturalearthdata.com/about/terms-of-use/ - -### Data from JHT's Planetary Pixel Emporium - -Copyright (c) by James Hastings-Trew - -http://planetpixelemporium.com/ - -Copyright Information: http://planetpixelemporium.com/planets.html - -### Sky box images from NASA - -http://maps.jpl.nasa.gov/stars.html - -http://svs.gsfc.nasa.gov/vis/a000000/a003500/a003572/ - -Terms of use: http://www.nasa.gov/audience/formedia/features/MP_Photo_Guidelines.html - -### Some vector icons from (or inspired by) Raphaël JS - -http://raphaeljs.com/icons/ - -http://raphaeljs.com/license.html - -### Mouse and gesture vector icons made by Freepik from Flaticon.com - -Creative Commons Attribution 3.0 -https://web.archive.org/web/20140419110558/http://www.flaticon.com/terms-of-use - -### Maki icon set from Mapbox - -https://www.mapbox.com/maki/ - -https://github.com/mapbox/maki - -### Big Buck Bunny trailer - -Creative Commons Attribution 3.0 -(c) copyright 2008, Blender Foundation -www.bigbuckbunny.org - -### population909500.json - -https://github.com/dataarts/webgl-globe - -> Copyright 2011 Google Data Arts Team -> -> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at -> -> http://www.apache.org/licenses/LICENSE-2.0 -> -> Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - -### Wooden Watch Tower - -Creative Commons Attribution 3.0 -(c) copyright 2012, Dennis Haupt -http://www.blendswap.com/blends/view/61653 - -### Perc Lead Mine - -Creative Commons Attribution 4.0 International -(c) copyright 2019, Dr Edward Alan Lockhart -https://sketchfab.com/3d-models/parc-lead-mine-4759a23abbff454c8c682ff9b02ba111 - -### GitHub logo - -https://github.com/logos - -### GPX files - -Public domain -https://www.gpsvisualizer.com/examples/google_gpx.html - -Creative Commons Attribution-ShareAlike 2.0 -https://wiki.openstreetmap.org/wiki/GPX - -### Font Awesome Icon - -Font Awesome by Dave Gandy - http://fontawesome.io diff --git a/README.md b/README.md index 8ddef3a..eb1f2a3 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ the [CesiumJS README](https://github.com/CesiumGS/cesium/blob/main/README.md). ## Packages in this Repository -- [wasm-splats](wasm-splats/README.md): High-performance algorithms used in the rendering Gaussian Splats in CesiumJS. +- [wasm-splats](wasm-splats/README.md): High-performance algorithms used in the rendering of Gaussian Splats in CesiumJS. # Get Started diff --git a/wasm-splats/Cargo.toml b/wasm-splats/Cargo.toml index d843924..d078b94 100644 --- a/wasm-splats/Cargo.toml +++ b/wasm-splats/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-splats" -version = "0.1.0-alpha" +version = "0.1.0-alpha.1" authors = ["Cesium GS, Inc. "] edition = "2021" diff --git a/wasm-splats/README.md b/wasm-splats/README.md index ce6efc2..4205fc1 100644 --- a/wasm-splats/README.md +++ b/wasm-splats/README.md @@ -1,6 +1,9 @@ # wasm-splats -The `wasm-splats` package contains high-performance algorithms used in the rendering Gaussian Splats in CesiumJS. +[![wasm-splats CI](https://github.com/CesiumGS/cesium-wasm-utils/actions/workflows/wasm-splats-ci.yml/badge.svg)](https://github.com/CesiumGS/cesium-wasm-utils/actions/workflows/wasm-splats-ci.yml) +[![npm](https://img.shields.io/npm/v/@cesium/wasm-splats)](https://www.npmjs.com/package/@cesium/wasm-splats) + +The `wasm-splats` package contains high-performance algorithms used in the rendering of Gaussian Splats in CesiumJS. ## Getting Started From 0d17266727ac3ca0d8d0e4334772c40708db978d Mon Sep 17 00:00:00 2001 From: "Adam N. Morris" Date: Mon, 24 Feb 2025 15:31:27 -0600 Subject: [PATCH 24/24] Code review changes. --- CONTRIBUTING.md | 13 ++++--------- LICENSE.md | 2 +- README.md | 23 ++++++++++++++++++----- wasm-splats/Cargo.toml | 4 ++++ 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bfacc2b..0ecc556 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,7 +12,7 @@ To ensure an inclusive community, contributors and users in the Cesium community If you have a question, do not submit an issue; instead, search the [Cesium community forum](https://community.cesium.com/). The forum is very active and there are years of informative archives, often with answers from the core Cesium team. If you do not find an answer to your question, start a new thread, and you'll likely get a quick response. -If you think you've found a bug in Cesium WASM Utilities, first search the [issues](https://github.com/CesiumGS/cesium/issues). If an issue already exists, please add a comment expressing your interest and any additional information. This helps us prioritize issues. +If you think you've found a bug in Cesium WASM Utilities, first search the [issues](https://github.com/CesiumGS/cesium-wasm-utils/issues). If an issue already exists, please add a comment expressing your interest and any additional information. This helps us prioritize issues. If a related issue does not exist, submit a new one. Please be concise and include as much of the following information as is relevant: @@ -31,17 +31,12 @@ In addition to contributing core Cesium WASM Utilities code, we appreciate many - Being active on the [Cesium community forum](https://community.cesium.com/) by answering questions and providing input on Cesium's direction. - Showcasing your Cesium apps on [Cesium blog](https://cesium.com/blog/categories/userstories/). Contact us at hello@cesium.com. -- Writing tutorials, creating examples, and improving the reference documentation. See the issues labeled [category - doc](https://github.com/CesiumGS/cesium/labels/category%20-%20doc). +- Writing tutorials, creating examples, and improving the reference documentation. - Submitting issues as [described above](#submitting-an-issue). -- Triaging issues. Browse the [issues](https://github.com/CesiumGS/cesium/issues) and comment on issues that are no longer reproducible or on issues which you have additional information. +- Triaging issues. Browse the [issues](https://github.com/CesiumGS/cesium-wasm-utils/issues) and comment on issues that are no longer reproducible or on issues which you have additional information. - Creating ecosystem projects for [glTF](https://github.com/KhronosGroup/glTF/issues/456), [CZML](https://github.com/CesiumGS/cesium/wiki/CZML-Guide), and [3D Tiles](https://github.com/CesiumGS/3d-tiles). -For ideas for Cesium WASM Utilities code contributions, see: - -- issues labeled [`good first issue`](https://github.com/CesiumGS/cesium/labels/good%20first%20issue) and -- issues labeled [`type - roadmap`](https://github.com/CesiumGS/cesium/labels/type%20-%20roadmap). - -See the [README](README.md) for how to build and run Cesium on your system. +See the [README](README.md) for how to build and run on your system. Always feel free to introduce yourself on the [Cesium community forum](https://community.cesium.com/) to brainstorm ideas and ask for guidance. diff --git a/LICENSE.md b/LICENSE.md index bd93af5..d648ea6 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -188,7 +188,7 @@ APPENDIX: How to apply the Apache License to your work. same "printed page" as the copyright notice for easier identification within third-party archives. -Copyright 2011-2020 CesiumJS Contributors +Copyright 2011-2025 CesiumJS Contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index eb1f2a3..c173314 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,8 @@ the [CesiumJS README](https://github.com/CesiumGS/cesium/blob/main/README.md). ## Packages in this Repository -- [wasm-splats](wasm-splats/README.md): High-performance algorithms used in the rendering of Gaussian Splats in CesiumJS. +- [wasm-splats](wasm-splats/README.md): High-performance algorithms used in the rendering of Gaussian Splats in + CesiumJS. # Get Started @@ -29,7 +30,7 @@ have [CesiumJS](https://github.com/CesiumGS/cesium/blob/main/README.md#rocket-ge - [Rust](https://www.rust-lang.org/tools/install) v1.55 or later. - [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/) v0.13 or later. -### Installation recommendations. +### Installation recommendations #### Node.js @@ -59,13 +60,25 @@ On all platforms, we recommend using the wasm-pack installer to install wasm-pac See the [wasm-pack website](https://rustwasm.github.io/wasm-pack/installer/) for installation instructions. -## Clone the Repository +## Get the Code + +### You have commit access to `cesium-wasm-utils` + +Clone the repository: ```sh git clone git@github.com:CesiumGS/cesium-wasm-utils.git ``` -## Generate Documentation and open in Browser +### You do not have commit access to `cesium-wasm-utils` + +You need to fork `cesium-wasm-utils`: + +1. Fork the repository on GitHub. +2. Clone your fork, e.g., `git clone git@github.com:yourusername/cesium.git`. +3. Make changes in a branch, e.g., `git checkout -b my-feature`. + +## Generate Documentation and Open in Browser To generate the documentation for all packages in the workspace and open in your default browser, run: @@ -73,7 +86,7 @@ To generate the documentation for all packages in the workspace and open in your cargo doc --no-deps --document-private-items --open ``` -## Further instructions +## Further Instructions For further instructions on building and running the packages in this repository, see the README in each package directory. diff --git a/wasm-splats/Cargo.toml b/wasm-splats/Cargo.toml index d078b94..d3d439b 100644 --- a/wasm-splats/Cargo.toml +++ b/wasm-splats/Cargo.toml @@ -3,6 +3,10 @@ name = "wasm-splats" version = "0.1.0-alpha.1" authors = ["Cesium GS, Inc. "] edition = "2021" +homepage = "https://cesium.com/cesiumjs/" +repository = "https://github.com/CesiumGS/cesium-wasm-utils" +description = "Contains high-performance algorithms used in the rendering of Gaussian Splats in CesiumJS." +license = "Apache-2.0" [lib] crate-type = ["cdylib", "rlib"]