computeViewportTransformation

fun computeViewportTransformation(viewport: Any? = definedExternally, nearDepthRange: Double? = definedExternally, farDepthRange: Double? = definedExternally, result: Matrix4? = definedExternally): Matrix4(source)

Computes a Matrix4 instance that transforms from normalized device coordinates to window coordinates.

// Create viewport transformation using an explicit viewport and depth range.
const m = Matrix4.computeViewportTransformation({
x : 0.0,
y : 0.0,
width : 1024.0,
height : 768.0
}, 0.0, 1.0, new Matrix4());

Return

The modified result parameter.

Parameters

viewport

The viewport's corners as shown in Example 1. Default value - { x : 0.0, y : 0.0, width : 0.0, height : 0.0 }

nearDepthRange

The near plane distance in window coordinates. Default value - 0.0

farDepthRange

The far plane distance in window coordinates. Default value - 1.0

result

The object in which the result will be stored.

See also