(screenX: number, screenY: number)
| 412 | * Must be called after beginMode3D() so the camera matrices are set. |
| 413 | */ |
| 414 | export function pickScene(screenX: number, screenY: number): PickHit { |
| 415 | const hit = bloom_scene_pick(screenX, screenY) !== 0; |
| 416 | if (!hit) { |
| 417 | return { |
| 418 | hit: false, |
| 419 | handle: 0, |
| 420 | distance: 0, |
| 421 | point: { x: 0, y: 0, z: 0 }, |
| 422 | normal: { x: 0, y: 0, z: 0 }, |
| 423 | }; |
| 424 | } |
| 425 | return { |
| 426 | hit: true, |
| 427 | handle: bloom_pick_hit_handle(), |
| 428 | distance: bloom_pick_hit_distance(), |
| 429 | point: { |
| 430 | x: bloom_pick_hit_x(), |
| 431 | y: bloom_pick_hit_y(), |
| 432 | z: bloom_pick_hit_z(), |
| 433 | }, |
| 434 | normal: { |
| 435 | x: bloom_pick_hit_normal_x(), |
| 436 | y: bloom_pick_hit_normal_y(), |
| 437 | z: bloom_pick_hit_normal_z(), |
| 438 | }, |
| 439 | }; |
| 440 | } |
| 441 | |
| 442 | // ============================================================ |
| 443 | // Geometry Generation |
no test coverage detected