voxolith

makeRay()

Reconstruct the world-space ray through a client (pixel) coordinate, matching the shader's per-pixel ray basis. Returns the camera origin + a (non-unit) dir. clientX/clientY are pointer-event coordinates; the canvas's CSS box and backing-store aspect are read, so this needs a browser.

function makeRay(
   canvas: HTMLCanvasElement, 
   frame: CameraFrame, 
   clientX: number, 
   clientY: number
): object;

Defined in: ray.ts:39

Parameters

ParameterType
canvasHTMLCanvasElement
frameCameraFrame
clientXnumber
clientYnumber

Returns

object

dir

dir: Vec3;

origin

origin: Vec3;

On this page