getProjectionMatrix
Declaration
fun getProjectionMatrix( zNear: Float, zFar: Float, viewportWidth: Int, viewportHeight: Int, deviceDisplayOrientation: Orientation? = null ): FloatArray
Summary
Parameters
| Name | Type | Summary |
|---|---|---|
| zNear | Float | Near plane distance |
| zFar | Float | Far plane distance (use 0 for infinite far) |
| viewportWidth | Int | Viewport width in pixels |
| viewportHeight | Int | Viewport height in pixels |
| deviceDisplayOrientation | Orientation? | Device orientation in Android UI convention (ROTATION_90 → LANDSCAPE_LEFT); defaults to [orientation] when null |
OpenGL-style projection matrix (column-major) from intrinsics for the given viewport and near/far.
Use with
getViewMatrixto render 3D content aligned with the playback camera.The frustum is cropped to the viewport's aspect ratio the same way
com.nianticspatial.nsdk.utils.ImageMath.displayTransformcrops the camera image, so 3D contentlines up with the displayed image. Passing the image resolution as the viewport gives the
uncropped projection.