MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / bloom_scene_pick

Function bloom_scene_pick

native/web/src/lib.rs:1691–1707  ·  view source on GitHub ↗
(screen_x: f64, screen_y: f64)

Source from the content-addressed store, hash-verified

1689
1690#[wasm_bindgen]
1691pub fn bloom_scene_pick(screen_x: f64, screen_y: f64) -> f64 {
1692 let eng = engine();
1693 let inv_vp = eng.renderer.inverse_vp_matrix();
1694 let cam_pos = eng.renderer.camera_pos();
1695 let w = eng.renderer.width() as f32;
1696 let h = eng.renderer.height() as f32;
1697
1698 let (origin, direction) = bloom_shared::picking::screen_to_ray(
1699 screen_x as f32, screen_y as f32,
1700 w, h, &inv_vp, &cam_pos,
1701 );
1702
1703 let result = bloom_shared::picking::raycast_scene(&eng.scene, &origin, &direction);
1704 let hit = result.hit;
1705 unsafe { LAST_PICK = Some(result); }
1706 if hit { 1.0 } else { 0.0 }
1707}
1708
1709#[wasm_bindgen]
1710pub fn bloom_pick_hit_handle() -> f64 {

Callers 1

pickSceneFunction · 0.50

Calls 7

screen_to_rayFunction · 0.85
raycast_sceneFunction · 0.85
inverse_vp_matrixMethod · 0.80
camera_posMethod · 0.80
engineFunction · 0.70
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected