summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-01-22 09:29:20 -0500
committerLLLL Colonq <llll@colonq>2025-01-22 09:29:20 -0500
commit39a0ff935e6298193188d8569ae3cbb96807f34c (patch)
treed046b1b2485a4941cb69e0e1cc60759cfac04e41
parent47fe18171569582d1af9401013c57045b59f3774 (diff)
Update
-rw-r--r--Cargo.lock56
-rw-r--r--Cargo.toml7
m---------deps/gltf0
-rw-r--r--index.html2
-rw-r--r--src/lib.rs25
-rw-r--r--src/main.rs8
6 files changed, 83 insertions, 15 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 6cc6179..663c60a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1597,6 +1597,29 @@ dependencies = [
]
[[package]]
+name = "parking_lot"
+version = "0.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
+dependencies = [
+ "lock_api",
+ "parking_lot_core",
+]
+
+[[package]]
+name = "parking_lot_core"
+version = "0.9.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "redox_syscall 0.5.8",
+ "smallvec",
+ "windows-targets 0.52.6",
+]
+
+[[package]]
name = "paste"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1779,6 +1802,15 @@ dependencies = [
]
[[package]]
+name = "redox_syscall"
+version = "0.5.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834"
+dependencies = [
+ "bitflags 2.6.0",
+]
+
+[[package]]
name = "regex"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2099,6 +2131,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
+name = "signal-hook-registry"
+version = "1.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1"
+dependencies = [
+ "libc",
+]
+
+[[package]]
name = "simd-adler32"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2379,6 +2420,7 @@ dependencies = [
"sdl2",
"serde",
"tobj",
+ "tokio",
"tracing-wasm",
"wasm-bindgen",
"wasm-bindgen-futures",
@@ -2499,12 +2541,26 @@ dependencies = [
"bytes",
"libc",
"mio",
+ "parking_lot",
"pin-project-lite",
+ "signal-hook-registry",
"socket2",
+ "tokio-macros",
"windows-sys 0.52.0",
]
[[package]]
+name = "tokio-macros"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
name = "tokio-native-tls"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 47ed866..a21500d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,6 +7,10 @@ edition = "2021"
[lib]
crate-type = ["cdylib", "rlib"]
+[[bin]]
+name = "tel"
+path = "src/main.rs"
+
[profile.release]
opt-level = 2
codegen-units = 1
@@ -44,4 +48,5 @@ web-sys = { version = "*", features = ["Document", "Window", "Element", "HtmlCan
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
env_logger = "*"
sdl2 = "*"
-kira = "0.9.6" \ No newline at end of file
+kira = "0.9.6"
+tokio = { version = "*", features = ["full"] } \ No newline at end of file
diff --git a/deps/gltf b/deps/gltf
-Subproject 9763a5abe8c168eb1282a037ff16668542fe2a6
+Subproject 2aa1baec59d0a86384e78a3fbaa441f8f39ed71
diff --git a/index.html b/index.html
index b47c5e1..be4cfac 100644
--- a/index.html
+++ b/index.html
@@ -6,7 +6,7 @@
<meta charset="UTF-8">
<link data-trunk rel="copy-file" href="helpers.js" />
<script type="module" src="helpers.js"></script>
- <link data-trunk rel="rust" data-wasm-opt="2" />
+ <link data-trunk rel="rust" data-wasm-opt="2" data-target-name="teleia" />
<base data-trunk-public-url />
<meta name="theme-color" media="(prefers-color-scheme: light)" content="white">
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#404040">
diff --git a/src/lib.rs b/src/lib.rs
index db802f0..78202b0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -12,7 +12,6 @@ pub mod shadow;
pub mod audio;
pub mod net;
-#[cfg(target_arch = "wasm32")]
use std::ops::Rem;
#[cfg(target_arch = "wasm32")]
@@ -273,8 +272,8 @@ where
#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
-#[cfg(target_arch = "wasm32")]
-struct TestGame {
+
+pub struct TestGame {
font: font::Bitmap,
tt: font::TrueType,
cube: mesh::Mesh,
@@ -282,21 +281,21 @@ struct TestGame {
tex: texture::Texture,
shader: shader::Shader,
}
-#[cfg(target_arch = "wasm32")]
+
impl TestGame {
pub async fn new(ctx: &context::Context) -> Self {
Self {
font: font::Bitmap::new(ctx),
tt: font::TrueType::new(ctx, 12.0, include_bytes!("assets/fonts/ComicNeue-Regular.ttf")),
cube: mesh::Mesh::from_obj(ctx, include_bytes!("assets/meshes/cube.obj")),
- // fox: scene::Scene::from_gltf(ctx, include_bytes!("assets/scenes/fox.glb")),
- fox: scene::Scene::from_gltf(ctx, include_bytes!("/home/llll/src/colonq/assets/lcolonq_flat.vrm")),
+ fox: scene::Scene::from_gltf(ctx, include_bytes!("assets/scenes/fox.glb")),
+ // fox: scene::Scene::from_gltf(ctx, include_bytes!("/home/llll/src/colonq/assets/lcolonq_flat.vrm")),
tex: texture::Texture::new(ctx, include_bytes!("assets/textures/test.png")),
shader: shader::Shader::new(ctx, include_str!("assets/shaders/scene/vert.glsl"), include_str!("assets/shaders/scene/frag.glsl")),
}
}
}
-#[cfg(target_arch = "wasm32")]
+
impl state::Game for TestGame {
fn update(&mut self, ctx: &context::Context, st: &mut state::State) -> Option<()> {
st.move_camera(
@@ -308,16 +307,16 @@ impl state::Game for TestGame {
Some(())
}
fn render(&mut self, ctx: &context::Context, st: &mut state::State) -> Option<()> {
- if let Some(n) = self.fox.nodes_by_name.get("J_Bip_C_Neck").and_then(|i| self.fox.nodes.get_mut(*i)) {
- n.transform *= glam::Mat4::from_rotation_z(0.05);
- }
- // self.fox.reflect_animation("Run", (st.tick as f32 / 60.0).rem(3.0));
+ // if let Some(n) = self.fox.nodes_by_name.get("J_Bip_C_Neck").and_then(|i| self.fox.nodes.get_mut(*i)) {
+ // n.transform *= glam::Mat4::from_rotation_z(0.05);
+ // }
+ self.fox.reflect_animation("Run", (st.tick as f32 / 60.0).rem(3.0));
st.bind_3d(ctx, &self.shader);
self.shader.set_position_3d(
ctx,
&glam::Mat4::from_scale_rotation_translation(
- // glam::Vec3::new(0.005, 0.005, 0.005),
- glam::Vec3::new(1.0, 1.0, 1.0),
+ glam::Vec3::new(0.005, 0.005, 0.005),
+ // glam::Vec3::new(1.0, 1.0, 1.0),
glam::Quat::from_rotation_y(st.tick as f32 / 60.0),
glam::Vec3::new(0.0, -0.2, 0.0),
),
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..5bbebd1
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,8 @@
+#[cfg(target_arch = "wasm32")]
+pub fn main() {}
+
+#[cfg(not(target_arch = "wasm32"))]
+#[tokio::main]
+pub async fn main() {
+ teleia::run("teleia test", 240, 160, teleia::TestGame::new).await;
+}