PerspectiveProjection.fromDepth constructor

PerspectiveProjection.fromDepth(
  1. num depth,
  2. num scale
)

Creates a perspective projection with custom depth and scale values.

The depth defines the distance to the farthest display object after the 3D transformation. The scale defines the distortion of the 3D objects caused by an imaginary lense.

The values used by the default constructor are 10000 and 10.

Implementation

PerspectiveProjection.fromDepth(num depth, num scale) {
  perspectiveMatrix3D.setIdentity();
  perspectiveMatrix3D.data[10] = 1.0 / depth;
  perspectiveMatrix3D.data[14] = scale / depth;
}