Skip to content

Commit

Permalink
Fix wasm build
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy-xr committed Sep 24, 2024
1 parent 48d6fda commit c33deba
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions runtime/functor-runtime-web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,18 @@ async fn run_async() -> Result<(), JsValue> {
let scene_context = SceneContext::new();

*g.borrow_mut() = Some(Closure::new(move || {
let now = performance.now() as f32;
let frame_time = FrameTime {
dts: (now - last_time) / 1000.0,
tts: (now - initial_time) / 1000.0,
};

last_time = now;
let render_ctx = RenderContext {
gl: &gl,
shader_version,
asset_cache: asset_cache.clone(),
frame_time: frame_time.clone(),
};

let projection_matrix: Matrix4<f32> =
Expand All @@ -198,14 +206,7 @@ async fn run_async() -> Result<(), JsValue> {

// let scene = Scene3D::cube();

let now = performance.now() as f32;
let frameTime = FrameTime {
dts: (now - last_time) / 1000.0,
tts: (now - initial_time) / 1000.0,
};
last_time = now;

let val = game_render(functor_runtime_common::to_js_value(&frameTime));
let val = game_render(functor_runtime_common::to_js_value(&frame_time));
web_sys::console::log_2(&JsValue::from_str("calling render"), &val);

let scene: Scene3D = functor_runtime_common::from_js_value(val);
Expand Down

0 comments on commit c33deba

Please sign in to comment.