Skip to content

Commit 860b44c

Browse files
committed
fix vrm viewer web
1 parent 6c1319c commit 860b44c

6 files changed

Lines changed: 46 additions & 31 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ jobs:
1212
with:
1313
remove-android: true
1414
remove-cached-tools: true
15-
# remove-codeql: true
16-
# remove-docker-images: true
17-
# remove-dotnet: true
18-
# remove-haskell: true
19-
# remove-large-packages: true
2015
- uses: actions/checkout@v6
2116
with:
2217
ref: ${{ github.event.pull_request.head.ref }}

Cargo.lock

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/bevy_vrm/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ pub mod mtoon {
2222

2323
pub use serde_vrm::vrm0::BoneName;
2424

25-
pub struct VrmPlugin;
2625
pub struct VrmPlugins;
2726

2827
impl PluginGroup for VrmPlugins {
@@ -33,6 +32,8 @@ impl PluginGroup for VrmPlugins {
3332
}
3433
}
3534

35+
pub struct VrmPlugin;
36+
3637
impl Plugin for VrmPlugin {
3738
fn build(&self, app: &mut App) {
3839
// TODO: Dont use default GltfKunPlugin

crates/vrm_viewer/Cargo.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ version.workspace = true
1010
workspace = true
1111

1212
[dependencies]
13-
bevy = { default-features = true, features = ["wayland"], workspace = true }
13+
bevy = { default-features = true, workspace = true }
1414
bevy_egui.workspace = true
1515
bevy_panorbit_camera.workspace = true
1616
bevy_vrm.workspace = true
1717

1818
[target.'cfg(target_family = "wasm")'.dependencies]
19-
getrandom = { default-features = false, features = [
20-
"wasm_js",
21-
], version = "0.4.2" } # https://github.com/bevyengine/bevy/issues/17699
22-
wasm-bindgen = "0.2.117"
19+
libm = "0.2.16"
20+
wasm-bindgen = "=0.2.114"

crates/vrm_viewer/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ _: {
8686
cargoArgs
8787
// {
8888
pname = "${pname}_web";
89-
wasm-bindgen-cli = pkgs.wasm-bindgen-cli_0_2_104;
89+
wasm-bindgen-cli = pkgs.wasm-bindgen-cli_0_2_114;
9090
}
9191
);
9292
};

crates/vrm_viewer/src/main.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
use bevy::prelude::*;
22
use vrm_viewer::VrmViewerPlugin;
33

4+
// Errors without this, don't know why its needed.
5+
#[cfg(target_arch = "wasm32")]
6+
mod wasm_math {
7+
#[unsafe(no_mangle)]
8+
pub extern "C" fn acosh(x: f64) -> f64 {
9+
libm::acosh(x)
10+
}
11+
#[unsafe(no_mangle)]
12+
pub extern "C" fn acoshf(x: f32) -> f32 {
13+
libm::acoshf(x)
14+
}
15+
#[unsafe(no_mangle)]
16+
pub extern "C" fn asinh(x: f64) -> f64 {
17+
libm::asinh(x)
18+
}
19+
#[unsafe(no_mangle)]
20+
pub extern "C" fn asinhf(x: f32) -> f32 {
21+
libm::asinhf(x)
22+
}
23+
}
24+
425
fn main() {
526
App::new().add_plugins(VrmViewerPlugin).run();
627
}

0 commit comments

Comments
 (0)