Files
yawn/renderer/src/lib.rs
T
Akash ShakdwipeeaandAmp b295c0bf0b separate out renderer crate (#13)
* add keyboard handler

* some cleanup

* add l key binding

* Fix WASM shared memory generation for Rust nightly 2025-10-20+

Add explicit linker flags for shared memory generation after Rust PR #147225
removed automatic flags with +atomics. This fixes DataCloneError when sharing
memory with workers.

Changes:
- Add --shared-memory, --max-memory, --import-memory flags
- Export TLS symbols: __wasm_init_tls, __tls_size, __tls_align, __tls_base
- Update both Cargo.toml and package.json build scripts

Amp-Thread-ID: https://ampcode.com/threads/T-41d99b69-5754-4fdf-b06e-a46343fa7485
Co-authored-by: Amp <amp@ampcode.com>

* add a level-editor crate

* remove redundant worker setup

* simplify app setup

* add SceneBuilder

* separate out default scene implementation in a crate

* define default method for MeshBuilder

---------

Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 18:08:02 +05:30

31 lines
776 B
Rust

pub mod app_setup;
pub mod camera;
pub mod gltf;
pub mod message;
pub mod platform;
pub mod renderer;
/// Worker entrypoint helper - executes the closure it is spawned with
/// Applications should export this with #[wasm_bindgen]
pub fn worker_entrypoint_impl(ptr: u32) {
let work = unsafe { Box::from_raw(ptr as *mut Box<dyn FnOnce()>) };
(*work)();
}
/// Macro to export the worker_entrypoint function in application crates
///
/// Usage:
/// ```rust
/// use renderer::export_worker_entrypoint;
/// export_worker_entrypoint!();
/// ```
#[macro_export]
macro_rules! export_worker_entrypoint {
() => {
#[wasm_bindgen::prelude::wasm_bindgen]
pub fn worker_entrypoint(ptr: u32) {
$crate::worker_entrypoint_impl(ptr);
}
};
}