unProject

fun unProject(x: Double, y: Double, viewport: Viewport, nearResult: Vec3, farResult: Vec3): Boolean

Un-projects a screen coordinate point to Cartesian coordinates at the near clip plane and the far clip plane. This method assumes this matrix represents an inverse modelview-projection matrix. The result of this method is undefined if this matrix is not an inverse modelview-projection matrix.
The screen point is understood to be in OpenGL screen coordinates, with the origin in the bottom-left corner and axes that extend up and to the right from the origin.
This function stores the un-projected points in the result argument, and a boolean value indicating whether the un-projection is successful.

Return

true if the transformation is successful, otherwise false

Parameters

x

the screen point's X component

y

the screen point's Y component

viewport

the viewport defining the screen point's coordinate system

nearResult

a pre-allocated Vec3 in which to return the un-projected near clip plane point

farResult

a pre-allocated Vec3 in which to return the un-projected far clip plane point


fun unProject(x: Double, y: Double, z: Double, viewport: Viewport, result: Vec3): Boolean

Un-projects a screen coordinate point at a given normalized depth to Cartesian coordinates. This method assumes this matrix represents an inverse modelview-projection matrix; the result is undefined otherwise.
The screen point is in OpenGL screen coordinates (origin at the bottom-left). The depth value is the normalized depth-buffer value in [0, 1] as read from the depth buffer at the screen point.

Return

true if the un-projection is successful, otherwise false

Parameters

x

the screen point's X component

y

the screen point's Y component

z

the normalized depth value in [0, 1]

viewport

the viewport defining the screen point's coordinate system

result

a pre-allocated Vec3 in which to return the un-projected Cartesian point