projectPlanes method

List<double>? projectPlanes([
  1. dynamic planes,
  2. dynamic camera,
  3. dynamic dstOffset,
  4. dynamic skipTransform,
])

Implementation

List<double>? projectPlanes([planes, camera, dstOffset, skipTransform]) {
  final nPlanes = planes != null ? planes.length : 0;
  List<double>? dstArray;

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

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

      viewNormalMatrix.getNormalMatrix(viewMatrix);

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

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

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

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

  numPlanes = nPlanes;
  numIntersection = 0;

  return dstArray;
}