projectPlanes method

dynamic projectPlanes(
  1. dynamic planes,
  2. dynamic camera,
  3. dynamic dstOffset,
  4. dynamic skipTransform,
)

Implementation

projectPlanes(planes, camera, dstOffset, skipTransform) {
  var nPlanes = planes != null ? planes.length : 0;
  var dstArray;

  if (nPlanes != 0) {
    dstArray = uniform["value"];

    if (skipTransform != true || dstArray == null) {
      var flatSize = dstOffset + nPlanes * 4, viewMatrix = camera.matrixWorldInverse;

      viewNormalMatrix.getNormalMatrix(viewMatrix);

      if (dstArray == null || dstArray.length < flatSize) {
        dstArray = List<num>.filled(flatSize, 0.0);
      }

      for (var i = 0, i4 = dstOffset; i != nPlanes; ++i, i4 += 4) {
        plane.copy(planes[i]).applyMatrix4(viewMatrix, viewNormalMatrix);

        plane.normal.toArray(dstArray, i4);
        dstArray[i4 + 3] = plane.constant;
      }
    }

    uniform["value"] = dstArray;
    uniform["needsUpdate"] = true;
  }

  numPlanes = nPlanes;
  numIntersection = 0;

  return dstArray;
}