Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,8 @@ required-features = ["headless"]

[[example]]
name = "logo"
path = "examples/logo/src/main.rs"
path = "examples/logo/src/main.rs"

[[example]]
name = "camera_view"
path = "examples/camera_view/src/main.rs"
20 changes: 20 additions & 0 deletions examples/camera_view/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "camera_view"
version = "0.1.0"
authors = ["Asger Nyman Christiansen <asgernyman@gmail.com>", "Alan Everett <thatcomputerguy0101@gmail.com>"]
edition = "2021"

[lib]
crate-type = ["cdylib"]

[dependencies]
three-d = { path = "../../", features=["egui-gui"] }
three-d-asset = {version = "0.7"}
cgmath = "0.18"

[target.'cfg(target_arch = "wasm32")'.dependencies]
log = "0.4"
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
console_error_panic_hook = "0.1"
console_log = "1"
19 changes: 19 additions & 0 deletions examples/camera_view/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#![allow(special_module_name)]
mod main;

// Entry point for wasm
#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;

#[cfg(target_arch = "wasm32")]
#[wasm_bindgen(start)]
pub fn start() -> Result<(), JsValue> {
console_log::init_with_level(log::Level::Debug).unwrap();

use log::info;
info!("Logging works!");

std::panic::set_hook(Box::new(console_error_panic_hook::hook));
main::main();
Ok(())
}
Loading