Function projectWorldToScreenToRef
-
projectWorldToScreenToRef<T extends ScreenProjectionResult>(
point: Vec3,
view: Mat4,
viewProjection: Mat4,
options: ScreenProjectionOptions,
result: T,
): TType Parameters
- T extends ScreenProjectionResult
Parameters
- point: Vec3
- view: Mat4
- viewProjection: Mat4
- options: ScreenProjectionOptions
- result: T
Returns T
Project a world-space point into canvas backing pixels and canvas-relative CSS pixels, writing every output field into
result.viewis required separately fromviewProjectionsobehindCameraworks for orthographic projections, whose homogeneous W remains 1. Coordinates are not clamped: finite offscreen points keep their extrapolated positions for edge-indicator placement.This function performs no allocations. When the matrices use a rebased coordinate frame, set
options.worldOriginto the absolute world position represented by their origin. Derive the matrices and viewport once per frame withgetViewMatrix,getViewProjectionMatrix,getEffectiveAspectRatio, andresolveCameraViewport, then reuse bothoptionsandresultfor each projected point.