Compare commits
No commits in common. "GameOfLife" and "main" have entirely different histories.
GameOfLife
...
main
8 changed files with 174 additions and 88 deletions
147
Cargo.lock
generated
147
Cargo.lock
generated
|
|
@ -373,6 +373,12 @@ dependencies = [
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "base64"
|
||||||
|
version = "0.22.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bevy"
|
name = "bevy"
|
||||||
version = "0.18.0"
|
version = "0.18.0"
|
||||||
|
|
@ -417,6 +423,7 @@ dependencies = [
|
||||||
"bevy_derive",
|
"bevy_derive",
|
||||||
"bevy_ecs",
|
"bevy_ecs",
|
||||||
"bevy_math",
|
"bevy_math",
|
||||||
|
"bevy_mesh",
|
||||||
"bevy_platform",
|
"bevy_platform",
|
||||||
"bevy_reflect",
|
"bevy_reflect",
|
||||||
"bevy_time",
|
"bevy_time",
|
||||||
|
|
@ -772,6 +779,7 @@ dependencies = [
|
||||||
"bevy_color",
|
"bevy_color",
|
||||||
"bevy_ecs",
|
"bevy_ecs",
|
||||||
"bevy_gizmos_macros",
|
"bevy_gizmos_macros",
|
||||||
|
"bevy_light",
|
||||||
"bevy_math",
|
"bevy_math",
|
||||||
"bevy_reflect",
|
"bevy_reflect",
|
||||||
"bevy_time",
|
"bevy_time",
|
||||||
|
|
@ -805,6 +813,7 @@ dependencies = [
|
||||||
"bevy_image",
|
"bevy_image",
|
||||||
"bevy_math",
|
"bevy_math",
|
||||||
"bevy_mesh",
|
"bevy_mesh",
|
||||||
|
"bevy_pbr",
|
||||||
"bevy_render",
|
"bevy_render",
|
||||||
"bevy_shader",
|
"bevy_shader",
|
||||||
"bevy_sprite_render",
|
"bevy_sprite_render",
|
||||||
|
|
@ -814,6 +823,42 @@ dependencies = [
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bevy_gltf"
|
||||||
|
version = "0.18.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "08372f222676dba313061fc71128209b82f9711e7c5cba222b5c34bf1c5c70fe"
|
||||||
|
dependencies = [
|
||||||
|
"async-lock",
|
||||||
|
"base64",
|
||||||
|
"bevy_animation",
|
||||||
|
"bevy_app",
|
||||||
|
"bevy_asset",
|
||||||
|
"bevy_camera",
|
||||||
|
"bevy_color",
|
||||||
|
"bevy_ecs",
|
||||||
|
"bevy_image",
|
||||||
|
"bevy_light",
|
||||||
|
"bevy_math",
|
||||||
|
"bevy_mesh",
|
||||||
|
"bevy_pbr",
|
||||||
|
"bevy_platform",
|
||||||
|
"bevy_reflect",
|
||||||
|
"bevy_render",
|
||||||
|
"bevy_scene",
|
||||||
|
"bevy_tasks",
|
||||||
|
"bevy_transform",
|
||||||
|
"fixedbitset",
|
||||||
|
"gltf",
|
||||||
|
"itertools 0.14.0",
|
||||||
|
"percent-encoding",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"smallvec",
|
||||||
|
"thiserror 2.0.18",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bevy_image"
|
name = "bevy_image"
|
||||||
version = "0.18.0"
|
version = "0.18.0"
|
||||||
|
|
@ -834,7 +879,9 @@ dependencies = [
|
||||||
"guillotiere",
|
"guillotiere",
|
||||||
"half",
|
"half",
|
||||||
"image",
|
"image",
|
||||||
|
"ktx2",
|
||||||
"rectangle-pack",
|
"rectangle-pack",
|
||||||
|
"ruzstd",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 2.0.18",
|
"thiserror 2.0.18",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
|
@ -898,9 +945,11 @@ dependencies = [
|
||||||
"bevy_gilrs",
|
"bevy_gilrs",
|
||||||
"bevy_gizmos",
|
"bevy_gizmos",
|
||||||
"bevy_gizmos_render",
|
"bevy_gizmos_render",
|
||||||
|
"bevy_gltf",
|
||||||
"bevy_image",
|
"bevy_image",
|
||||||
"bevy_input",
|
"bevy_input",
|
||||||
"bevy_input_focus",
|
"bevy_input_focus",
|
||||||
|
"bevy_light",
|
||||||
"bevy_log",
|
"bevy_log",
|
||||||
"bevy_math",
|
"bevy_math",
|
||||||
"bevy_mesh",
|
"bevy_mesh",
|
||||||
|
|
@ -2588,6 +2637,42 @@ dependencies = [
|
||||||
"web-sys",
|
"web-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gltf"
|
||||||
|
version = "1.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e3ce1918195723ce6ac74e80542c5a96a40c2b26162c1957a5cd70799b8cacf7"
|
||||||
|
dependencies = [
|
||||||
|
"byteorder",
|
||||||
|
"gltf-json",
|
||||||
|
"lazy_static",
|
||||||
|
"serde_json",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gltf-derive"
|
||||||
|
version = "1.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "14070e711538afba5d6c807edb74bcb84e5dbb9211a3bf5dea0dfab5b24f4c51"
|
||||||
|
dependencies = [
|
||||||
|
"inflections",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gltf-json"
|
||||||
|
version = "1.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6176f9d60a7eab0a877e8e96548605dedbde9190a7ae1e80bbcc1c9af03ab14"
|
||||||
|
dependencies = [
|
||||||
|
"gltf-derive",
|
||||||
|
"serde",
|
||||||
|
"serde_derive",
|
||||||
|
"serde_json",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glutin_wgl_sys"
|
name = "glutin_wgl_sys"
|
||||||
version = "0.6.1"
|
version = "0.6.1"
|
||||||
|
|
@ -2877,6 +2962,12 @@ dependencies = [
|
||||||
"serde_core",
|
"serde_core",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "inflections"
|
||||||
|
version = "1.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a257582fdcde896fd96463bf2d40eefea0580021c0712a0e2b028b60b47a837a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "inotify"
|
name = "inotify"
|
||||||
version = "0.11.0"
|
version = "0.11.0"
|
||||||
|
|
@ -2964,9 +3055,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "js-sys"
|
name = "js-sys"
|
||||||
version = "0.3.87"
|
version = "0.3.85"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "93f0862381daaec758576dcc22eb7bbf4d7efd67328553f3b45a412a51a3fb21"
|
checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
|
|
@ -2989,6 +3080,15 @@ version = "3.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
|
checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ktx2"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ff7f53bdf698e7aa7ec916411bbdc8078135da11b66db5182675b2227f6c0d07"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.11.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazy_static"
|
name = "lazy_static"
|
||||||
version = "1.5.0"
|
version = "1.5.0"
|
||||||
|
|
@ -4196,6 +4296,15 @@ version = "1.0.22"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ruzstd"
|
||||||
|
version = "0.8.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e5ff0cc5e135c8870a775d3320910cd9b564ec036b4dc0b8741629020be63f01"
|
||||||
|
dependencies = [
|
||||||
|
"twox-hash",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ryu"
|
name = "ryu"
|
||||||
version = "1.0.23"
|
version = "1.0.23"
|
||||||
|
|
@ -4509,9 +4618,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.117"
|
version = "2.0.116"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
checksum = "3df424c70518695237746f84cede799c9c58fcb37450d7b23716568cc8bc69cb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
@ -4876,6 +4985,12 @@ dependencies = [
|
||||||
"core_maths",
|
"core_maths",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "twox-hash"
|
||||||
|
version = "2.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9ea3136b675547379c4bd395ca6b938e5ad3c3d20fad76e7fe85f9e0d011419c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typeid"
|
name = "typeid"
|
||||||
version = "1.0.3"
|
version = "1.0.3"
|
||||||
|
|
@ -5013,9 +5128,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen"
|
name = "wasm-bindgen"
|
||||||
version = "0.2.110"
|
version = "0.2.108"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1de241cdc66a9d91bd84f097039eb140cdc6eec47e0cdbaf9d932a1dd6c35866"
|
checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
|
@ -5026,9 +5141,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-futures"
|
name = "wasm-bindgen-futures"
|
||||||
version = "0.4.60"
|
version = "0.4.58"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a42e96ea38f49b191e08a1bab66c7ffdba24b06f9995b39a9dd60222e5b6f1da"
|
checksum = "70a6e77fd0ae8029c9ea0063f87c46fde723e7d887703d74ad2616d792e51e6f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
|
@ -5040,9 +5155,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro"
|
name = "wasm-bindgen-macro"
|
||||||
version = "0.2.110"
|
version = "0.2.108"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e12fdf6649048f2e3de6d7d5ff3ced779cdedee0e0baffd7dff5cdfa3abc8a52"
|
checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"wasm-bindgen-macro-support",
|
"wasm-bindgen-macro-support",
|
||||||
|
|
@ -5050,9 +5165,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro-support"
|
name = "wasm-bindgen-macro-support"
|
||||||
version = "0.2.110"
|
version = "0.2.108"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0e63d1795c565ac3462334c1e396fd46dbf481c40f51f5072c310717bc4fb309"
|
checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bumpalo",
|
"bumpalo",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
|
@ -5063,9 +5178,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-shared"
|
name = "wasm-bindgen-shared"
|
||||||
version = "0.2.110"
|
version = "0.2.108"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e9f9cdac23a5ce71f6bf9f8824898a501e511892791ea2a0c6b8568c68b9cb53"
|
checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
@ -5214,9 +5329,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "web-sys"
|
name = "web-sys"
|
||||||
version = "0.3.87"
|
version = "0.3.85"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f2c7c5718134e770ee62af3b6b4a84518ec10101aad610c024b64d6ff29bb1ff"
|
checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
|
|
|
||||||
19
Cargo.toml
19
Cargo.toml
|
|
@ -2,21 +2,6 @@
|
||||||
members = ["app", "server"]
|
members = ["app", "server"]
|
||||||
resolver = "3"
|
resolver = "3"
|
||||||
|
|
||||||
# Enable more optimization in the release profile at the cost of compile time.
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
# Compile the entire crate as one unit.
|
lto = "thin"
|
||||||
# Slows compile times, marginal improvements.
|
opt-level = 'z'
|
||||||
codegen-units = 1
|
|
||||||
# Do a second optimization pass over the entire program, including dependencies.
|
|
||||||
# Slows compile times, marginal improvements.
|
|
||||||
lto = true
|
|
||||||
|
|
||||||
# Optimize for size in the wasm-release profile to reduce load times and bandwidth usage on web.
|
|
||||||
[profile.wasm-release]
|
|
||||||
# Default to release profile values.
|
|
||||||
inherits = "release"
|
|
||||||
# Optimize with size in mind (also try "z", sometimes it is better).
|
|
||||||
# Slightly slows compile times, great improvements to file size and runtime performance.
|
|
||||||
opt-level = "z"
|
|
||||||
# Strip all debugging information from the binary to slightly reduce file size.
|
|
||||||
strip = "debuginfo"
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy = { version = "0.18", default-features = false, features = [
|
bevy = { version = "0.18", default-features = false, features = [
|
||||||
"2d",
|
"3d",
|
||||||
"keyboard",
|
"tonemapping_luts",
|
||||||
"web",
|
"web",
|
||||||
"webgl2",
|
"webgl2",
|
||||||
] }
|
] }
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,47 @@
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
|
|
||||||
const ALIVE_COLOR: [u8; 4] = [0, 255, 136, 255];
|
|
||||||
const DEAD_COLOR: [u8; 4] = [18, 18, 32, 255];
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
.add_plugins(DefaultPlugins.set(WindowPlugin {
|
.add_plugins(DefaultPlugins.set(WindowPlugin {
|
||||||
primary_window: Some(Window {
|
primary_window: Some(Window {
|
||||||
title: "Game of Life".into(),
|
|
||||||
fit_canvas_to_parent: true,
|
fit_canvas_to_parent: true,
|
||||||
|
prevent_default_event_handling: false,
|
||||||
canvas: Some("#bevy-canvas".into()),
|
canvas: Some("#bevy-canvas".into()),
|
||||||
..default()
|
..default()
|
||||||
}),
|
}),
|
||||||
..default()
|
..default()
|
||||||
}))
|
}))
|
||||||
|
.add_systems(Startup, setup)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn setup(
|
||||||
|
mut commands: Commands,
|
||||||
|
mut meshes: ResMut<Assets<Mesh>>,
|
||||||
|
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||||
|
) {
|
||||||
|
commands.spawn((
|
||||||
|
Mesh3d(meshes.add(Circle::new(4.0))),
|
||||||
|
MeshMaterial3d(materials.add(Color::WHITE)),
|
||||||
|
Transform::from_rotation(Quat::from_rotation_x(-std::f32::consts::FRAC_PI_2)),
|
||||||
|
));
|
||||||
|
|
||||||
|
commands.spawn((
|
||||||
|
Mesh3d(meshes.add(Cuboid::new(1.0, 1.0, 1.0))),
|
||||||
|
MeshMaterial3d(materials.add(Color::srgb_u8(124, 144, 255))),
|
||||||
|
Transform::from_xyz(0.0, 0.5, 0.0),
|
||||||
|
));
|
||||||
|
|
||||||
|
commands.spawn((
|
||||||
|
PointLight {
|
||||||
|
shadows_enabled: true,
|
||||||
|
..default()
|
||||||
|
},
|
||||||
|
Transform::from_xyz(4.0, 8.0, 4.0),
|
||||||
|
));
|
||||||
|
|
||||||
|
commands.spawn((
|
||||||
|
Camera3d::default(),
|
||||||
|
Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,21 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
PROFILE="${1:-wasm-release}"
|
PROFILE="${1:-release}"
|
||||||
|
|
||||||
if [ "$PROFILE" = "dev" ]; then
|
if [ "$PROFILE" = "dev" ]; then
|
||||||
PROFILE_DIR="debug"
|
PROFILE_DIR="debug"
|
||||||
CARGO_FLAGS=""
|
CARGO_FLAGS=""
|
||||||
else
|
else
|
||||||
PROFILE_DIR=$PROFILE
|
PROFILE_DIR="release"
|
||||||
CARGO_FLAGS="--profile wasm-release"
|
CARGO_FLAGS="--release"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cargo build $CARGO_FLAGS --target wasm32-unknown-unknown -p app
|
cargo build $CARGO_FLAGS --target wasm32-unknown-unknown -p app
|
||||||
|
|
||||||
mkdir -p static
|
mkdir -p static
|
||||||
wasm-bindgen --out-name app \
|
wasm-bindgen --out-name 3dscene \
|
||||||
--out-dir static \
|
--out-dir static \
|
||||||
--target web \
|
--target web \
|
||||||
"target/wasm32-unknown-unknown/$PROFILE_DIR/app.wasm"
|
"target/wasm32-unknown-unknown/$PROFILE_DIR/app.wasm"
|
||||||
|
|
||||||
# Optimize the WASM file for size
|
|
||||||
if [ "$PROFILE" = "wasm-release" ]; then
|
|
||||||
wasm-opt -Oz -o static/app_bg.wasm static/app_bg.wasm
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp web/index.html static/
|
cp web/index.html static/
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,6 @@
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
rustToolchain
|
rustToolchain
|
||||||
pkgs.wasm-bindgen-cli
|
pkgs.wasm-bindgen-cli
|
||||||
pkgs.binaryen
|
|
||||||
pkgs.just
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
35
justfile
35
justfile
|
|
@ -1,35 +0,0 @@
|
||||||
# Default: build WASM app for release
|
|
||||||
default:
|
|
||||||
just build
|
|
||||||
|
|
||||||
# Build the WASM app (default: release)
|
|
||||||
build profile="wasm-release":
|
|
||||||
./build-wasm.sh {{ profile }}
|
|
||||||
|
|
||||||
# Build for development (faster compile, no wasm-opt)
|
|
||||||
build-dev:
|
|
||||||
./build-wasm.sh dev
|
|
||||||
|
|
||||||
# Build the server binary
|
|
||||||
build-server:
|
|
||||||
cargo build --release -p server
|
|
||||||
|
|
||||||
# Build everything: WASM app + server
|
|
||||||
build-all profile="wasm-release":
|
|
||||||
./build-wasm.sh {{ profile }}
|
|
||||||
cargo build --release -p server
|
|
||||||
|
|
||||||
# Serve the site locally (builds WASM first, then runs server on :3000)
|
|
||||||
serve profile="wasm-release":
|
|
||||||
./build-wasm.sh {{ profile }}
|
|
||||||
cargo run --release -p server
|
|
||||||
|
|
||||||
# Development: build WASM (dev profile) and run server with hot reload
|
|
||||||
dev:
|
|
||||||
./build-wasm.sh dev
|
|
||||||
cargo run --release -p server
|
|
||||||
|
|
||||||
# Clean build artifacts
|
|
||||||
clean:
|
|
||||||
cargo clean
|
|
||||||
rm -rf static/*
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Bevy App</title>
|
<title>3D Scene</title>
|
||||||
<style>
|
<style>
|
||||||
html,
|
html,
|
||||||
body {
|
body {
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
<body>
|
<body>
|
||||||
<canvas id="bevy-canvas"></canvas>
|
<canvas id="bevy-canvas"></canvas>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import init from './app.js';
|
import init from './3dscene.js';
|
||||||
init();
|
init();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue