All files / engine/Source/Core FrustumGeometry.js

94.26% Statements 263/279
62.85% Branches 44/70
100% Functions 6/6
94.16% Lines 258/274

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584                                  1x 1x                               21x 20x 19x 18x     17x 17x 17x 17x         17x       17x 11x 11x 6x         17x 17x 17x 17x 17x 17x 17x           17x                                 1x   5x 4x     3x   3x 3x   3x   3x 3x 3x           3x 3x 3x 3x 3x 3x 3x   3x     1x 1x 1x 1x 1x                 1x   4x     3x   3x     3x 3x         3x                   3x 3x 3x         3x 3x         3x 3x   3x 3x                                                               78x   78x 312x 312x 312x 312x   312x 312x 312x 312x   312x 312x 312x 312x   312x     78x 78x 78x 78x 78x 78x 78x 78x     1x 1x 1x   1x 1x 1x 1x 1x 1x   1x   1x 1x 1x 1x 1x   1x 1x 4x     1x                   26x       26x 26x 26x   26x 26x 26x   26x 26x 26x   26x   26x       26x 26x 14x         14x         12x     26x 14x 14x   12x 12x 12x     26x 52x 208x         208x 96x 96x       96x 96x   96x         96x         96x 96x   96x   112x             112x 112x   112x 112x   112x 112x 112x     208x 208x 208x                     1x 13x 13x 13x 13x 13x 13x   13x 13x 13x                 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x     13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x     13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x     13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x   13x       13x               13x           13x     13x     13x     13x       13x 13x 13x   13x 13x 13x   13x 13x 13x 13x   13x 13x 13x                   13x 13x                   13x 13x 13x 13x   13x 13x           13x 13x           13x 13x           13x 13x               13x 13x 78x 78x   78x 78x 78x 78x 78x 78x     13x                
import BoundingSphere from "./BoundingSphere.js";
import Cartesian3 from "./Cartesian3.js";
import Cartesian4 from "./Cartesian4.js";
import Check from "./Check.js";
import ComponentDatatype from "./ComponentDatatype.js";
import defined from "./defined.js";
import Geometry from "./Geometry.js";
import GeometryAttribute from "./GeometryAttribute.js";
import GeometryAttributes from "./GeometryAttributes.js";
import Matrix3 from "./Matrix3.js";
import Matrix4 from "./Matrix4.js";
import OrthographicFrustum from "./OrthographicFrustum.js";
import PerspectiveFrustum from "./PerspectiveFrustum.js";
import PrimitiveType from "./PrimitiveType.js";
import Quaternion from "./Quaternion.js";
import VertexFormat from "./VertexFormat.js";
 
const PERSPECTIVE = 0;
const ORTHOGRAPHIC = 1;
 
/**
 * Describes a frustum at the given the origin and orientation.
 *
 * @alias FrustumGeometry
 * @constructor
 *
 * @param {object} options Object with the following properties:
 * @param {PerspectiveFrustum|OrthographicFrustum} options.frustum The frustum.
 * @param {Cartesian3} options.origin The origin of the frustum.
 * @param {Quaternion} options.orientation The orientation of the frustum.
 * @param {VertexFormat} [options.vertexFormat=VertexFormat.DEFAULT] The vertex attributes to be computed.
 */
function FrustumGeometry(options) {
  //>>includeStart('debug', pragmas.debug);
  Check.typeOf.object("options", options);
  Check.typeOf.object("options.frustum", options.frustum);
  Check.typeOf.object("options.origin", options.origin);
  Check.typeOf.object("options.orientation", options.orientation);
  //>>includeEnd('debug');
 
  const frustum = options.frustum;
  const orientation = options.orientation;
  const origin = options.origin;
  const vertexFormat = options.vertexFormat ?? VertexFormat.DEFAULT;
 
  // This is private because it is used by DebugCameraPrimitive to draw a multi-frustum by
  // creating multiple FrustumGeometry objects. This way the near plane of one frustum doesn't overlap
  // the far plane of another.
  const drawNearPlane = options._drawNearPlane ?? true;
 
  let frustumType;
  let frustumPackedLength;
  if (frustum instanceof PerspectiveFrustum) {
    frustumType = PERSPECTIVE;
    frustumPackedLength = PerspectiveFrustum.packedLength;
  } else Iif (frustum instanceof OrthographicFrustum) {
    frustumType = ORTHOGRAPHIC;
    frustumPackedLength = OrthographicFrustum.packedLength;
  }
 
  this._frustumType = frustumType;
  this._frustum = frustum.clone();
  this._origin = Cartesian3.clone(origin);
  this._orientation = Quaternion.clone(orientation);
  this._drawNearPlane = drawNearPlane;
  this._vertexFormat = vertexFormat;
  this._workerName = "createFrustumGeometry";
 
  /**
   * The number of elements used to pack the object into an array.
   * @type {number}
   */
  this.packedLength =
    2 +
    frustumPackedLength +
    Cartesian3.packedLength +
    Quaternion.packedLength +
    VertexFormat.packedLength;
}
 
/**
 * Stores the provided instance into the provided array.
 *
 * @param {FrustumGeometry} value The value to pack.
 * @param {number[]} array The array to pack into.
 * @param {number} [startingIndex=0] The index into the array at which to start packing the elements.
 *
 * @returns {number[]} The array that was packed into
 */
FrustumGeometry.pack = function (value, array, startingIndex) {
  //>>includeStart('debug', pragmas.debug);
  Check.typeOf.object("value", value);
  Check.defined("array", array);
  //>>includeEnd('debug');
 
  startingIndex = startingIndex ?? 0;
 
  const frustumType = value._frustumType;
  const frustum = value._frustum;
 
  array[startingIndex++] = frustumType;
 
  if (frustumType === PERSPECTIVE) {
    PerspectiveFrustum.pack(frustum, array, startingIndex);
    startingIndex += PerspectiveFrustum.packedLength;
  } else E{
    OrthographicFrustum.pack(frustum, array, startingIndex);
    startingIndex += OrthographicFrustum.packedLength;
  }
 
  Cartesian3.pack(value._origin, array, startingIndex);
  startingIndex += Cartesian3.packedLength;
  Quaternion.pack(value._orientation, array, startingIndex);
  startingIndex += Quaternion.packedLength;
  VertexFormat.pack(value._vertexFormat, array, startingIndex);
  startingIndex += VertexFormat.packedLength;
  array[startingIndex] = value._drawNearPlane ? 1.0 : 0.0;
 
  return array;
};
 
const scratchPackPerspective = new PerspectiveFrustum();
const scratchPackOrthographic = new OrthographicFrustum();
const scratchPackQuaternion = new Quaternion();
const scratchPackorigin = new Cartesian3();
const scratchVertexFormat = new VertexFormat();
 
/**
 * Retrieves an instance from a packed array.
 *
 * @param {number[]} array The packed array.
 * @param {number} [startingIndex=0] The starting index of the element to be unpacked.
 * @param {FrustumGeometry} [result] The object into which to store the result.
 */
FrustumGeometry.unpack = function (array, startingIndex, result) {
  //>>includeStart('debug', pragmas.debug);
  Check.defined("array", array);
  //>>includeEnd('debug');
 
  startingIndex = startingIndex ?? 0;
 
  const frustumType = array[startingIndex++];
 
  let frustum;
  if (frustumType === PERSPECTIVE) {
    frustum = PerspectiveFrustum.unpack(
      array,
      startingIndex,
      scratchPackPerspective,
    );
    startingIndex += PerspectiveFrustum.packedLength;
  } else E{
    frustum = OrthographicFrustum.unpack(
      array,
      startingIndex,
      scratchPackOrthographic,
    );
    startingIndex += OrthographicFrustum.packedLength;
  }
 
  const origin = Cartesian3.unpack(array, startingIndex, scratchPackorigin);
  startingIndex += Cartesian3.packedLength;
  const orientation = Quaternion.unpack(
    array,
    startingIndex,
    scratchPackQuaternion,
  );
  startingIndex += Quaternion.packedLength;
  const vertexFormat = VertexFormat.unpack(
    array,
    startingIndex,
    scratchVertexFormat,
  );
  startingIndex += VertexFormat.packedLength;
  const drawNearPlane = array[startingIndex] === 1.0;
 
  Eif (!defined(result)) {
    return new FrustumGeometry({
      frustum: frustum,
      origin: origin,
      orientation: orientation,
      vertexFormat: vertexFormat,
      _drawNearPlane: drawNearPlane,
    });
  }
 
  const frustumResult =
    frustumType === result._frustumType ? result._frustum : undefined;
  result._frustum = frustum.clone(frustumResult);
 
  result._frustumType = frustumType;
  result._origin = Cartesian3.clone(origin, result._origin);
  result._orientation = Quaternion.clone(orientation, result._orientation);
  result._vertexFormat = VertexFormat.clone(vertexFormat, result._vertexFormat);
  result._drawNearPlane = drawNearPlane;
 
  return result;
};
 
function getAttributes(
  offset,
  normals,
  tangents,
  bitangents,
  st,
  normal,
  tangent,
  bitangent,
) {
  const stOffset = (offset / 3) * 2;
 
  for (let i = 0; i < 4; ++i) {
    Eif (defined(normals)) {
      normals[offset] = normal.x;
      normals[offset + 1] = normal.y;
      normals[offset + 2] = normal.z;
    }
    Eif (defined(tangents)) {
      tangents[offset] = tangent.x;
      tangents[offset + 1] = tangent.y;
      tangents[offset + 2] = tangent.z;
    }
    Eif (defined(bitangents)) {
      bitangents[offset] = bitangent.x;
      bitangents[offset + 1] = bitangent.y;
      bitangents[offset + 2] = bitangent.z;
    }
    offset += 3;
  }
 
  st[stOffset] = 0.0;
  st[stOffset + 1] = 0.0;
  st[stOffset + 2] = 1.0;
  st[stOffset + 3] = 0.0;
  st[stOffset + 4] = 1.0;
  st[stOffset + 5] = 1.0;
  st[stOffset + 6] = 0.0;
  st[stOffset + 7] = 1.0;
}
 
const scratchRotationMatrix = new Matrix3();
const scratchViewMatrix = new Matrix4();
const scratchInverseMatrix = new Matrix4();
 
const scratchXDirection = new Cartesian3();
const scratchYDirection = new Cartesian3();
const scratchZDirection = new Cartesian3();
const scratchNegativeX = new Cartesian3();
const scratchNegativeY = new Cartesian3();
const scratchNegativeZ = new Cartesian3();
 
const frustumSplits = new Array(3);
 
const frustumCornersNDC = new Array(4);
frustumCornersNDC[0] = new Cartesian4(-1.0, -1.0, 1.0, 1.0);
frustumCornersNDC[1] = new Cartesian4(1.0, -1.0, 1.0, 1.0);
frustumCornersNDC[2] = new Cartesian4(1.0, 1.0, 1.0, 1.0);
frustumCornersNDC[3] = new Cartesian4(-1.0, 1.0, 1.0, 1.0);
 
const scratchFrustumCorners = new Array(4);
for (let i = 0; i < 4; ++i) {
  scratchFrustumCorners[i] = new Cartesian4();
}
 
FrustumGeometry._computeNearFarPlanes = function (
  origin,
  orientation,
  frustumType,
  frustum,
  positions,
  xDirection,
  yDirection,
  zDirection,
) {
  const rotationMatrix = Matrix3.fromQuaternion(
    orientation,
    scratchRotationMatrix,
  );
  let x = xDirection ?? scratchXDirection;
  let y = yDirection ?? scratchYDirection;
  let z = zDirection ?? scratchZDirection;
 
  x = Matrix3.getColumn(rotationMatrix, 0, x);
  y = Matrix3.getColumn(rotationMatrix, 1, y);
  z = Matrix3.getColumn(rotationMatrix, 2, z);
 
  Cartesian3.normalize(x, x);
  Cartesian3.normalize(y, y);
  Cartesian3.normalize(z, z);
 
  Cartesian3.negate(x, x);
 
  const view = Matrix4.computeView(origin, z, y, x, scratchViewMatrix);
 
  let inverseView;
  let inverseViewProjection;
  const projection = frustum.projectionMatrix;
  if (frustumType === PERSPECTIVE) {
    const viewProjection = Matrix4.multiply(
      projection,
      view,
      scratchInverseMatrix,
    );
    inverseViewProjection = Matrix4.inverse(
      viewProjection,
      scratchInverseMatrix,
    );
  } else {
    inverseView = Matrix4.inverseTransformation(view, scratchInverseMatrix);
  }
 
  if (defined(inverseViewProjection)) {
    frustumSplits[0] = frustum.near;
    frustumSplits[1] = frustum.far;
  } else {
    frustumSplits[0] = 0.0;
    frustumSplits[1] = frustum.near;
    frustumSplits[2] = frustum.far;
  }
 
  for (let i = 0; i < 2; ++i) {
    for (let j = 0; j < 4; ++j) {
      let corner = Cartesian4.clone(
        frustumCornersNDC[j],
        scratchFrustumCorners[j],
      );
 
      if (!defined(inverseViewProjection)) {
        const offCenterFrustum = frustum.offCenterFrustum;
        Iif (defined(offCenterFrustum)) {
          frustum = offCenterFrustum;
        }
 
        const near = frustumSplits[i];
        const far = frustumSplits[i + 1];
 
        corner.x =
          (corner.x * (frustum.right - frustum.left) +
            frustum.left +
            frustum.right) *
          0.5;
        corner.y =
          (corner.y * (frustum.top - frustum.bottom) +
            frustum.bottom +
            frustum.top) *
          0.5;
        corner.z = (corner.z * (near - far) - near - far) * 0.5;
        corner.w = 1.0;
 
        Matrix4.multiplyByVector(inverseView, corner, corner);
      } else {
        corner = Matrix4.multiplyByVector(
          inverseViewProjection,
          corner,
          corner,
        );
 
        // Reverse perspective divide
        const w = 1.0 / corner.w;
        Cartesian3.multiplyByScalar(corner, w, corner);
 
        Cartesian3.subtract(corner, origin, corner);
        Cartesian3.normalize(corner, corner);
 
        const fac = Cartesian3.dot(z, corner);
        Cartesian3.multiplyByScalar(corner, frustumSplits[i] / fac, corner);
        Cartesian3.add(corner, origin, corner);
      }
 
      positions[12 * i + j * 3] = corner.x;
      positions[12 * i + j * 3 + 1] = corner.y;
      positions[12 * i + j * 3 + 2] = corner.z;
    }
  }
};
 
/**
 * Computes the geometric representation of a frustum, including its vertices, indices, and a bounding sphere.
 *
 * @param {FrustumGeometry} frustumGeometry A description of the frustum.
 * @returns {Geometry|undefined} The computed vertices and indices.
 */
FrustumGeometry.createGeometry = function (frustumGeometry) {
  const frustumType = frustumGeometry._frustumType;
  const frustum = frustumGeometry._frustum;
  const origin = frustumGeometry._origin;
  const orientation = frustumGeometry._orientation;
  const drawNearPlane = frustumGeometry._drawNearPlane;
  const vertexFormat = frustumGeometry._vertexFormat;
 
  const numberOfPlanes = drawNearPlane ? 6 : 5;
  let positions = new Float64Array(3 * 4 * 6);
  FrustumGeometry._computeNearFarPlanes(
    origin,
    orientation,
    frustumType,
    frustum,
    positions,
  );
 
  // -x plane
  let offset = 3 * 4 * 2;
  positions[offset] = positions[3 * 4];
  positions[offset + 1] = positions[3 * 4 + 1];
  positions[offset + 2] = positions[3 * 4 + 2];
  positions[offset + 3] = positions[0];
  positions[offset + 4] = positions[1];
  positions[offset + 5] = positions[2];
  positions[offset + 6] = positions[3 * 3];
  positions[offset + 7] = positions[3 * 3 + 1];
  positions[offset + 8] = positions[3 * 3 + 2];
  positions[offset + 9] = positions[3 * 7];
  positions[offset + 10] = positions[3 * 7 + 1];
  positions[offset + 11] = positions[3 * 7 + 2];
 
  // -y plane
  offset += 3 * 4;
  positions[offset] = positions[3 * 5];
  positions[offset + 1] = positions[3 * 5 + 1];
  positions[offset + 2] = positions[3 * 5 + 2];
  positions[offset + 3] = positions[3];
  positions[offset + 4] = positions[3 + 1];
  positions[offset + 5] = positions[3 + 2];
  positions[offset + 6] = positions[0];
  positions[offset + 7] = positions[1];
  positions[offset + 8] = positions[2];
  positions[offset + 9] = positions[3 * 4];
  positions[offset + 10] = positions[3 * 4 + 1];
  positions[offset + 11] = positions[3 * 4 + 2];
 
  // +x plane
  offset += 3 * 4;
  positions[offset] = positions[3];
  positions[offset + 1] = positions[3 + 1];
  positions[offset + 2] = positions[3 + 2];
  positions[offset + 3] = positions[3 * 5];
  positions[offset + 4] = positions[3 * 5 + 1];
  positions[offset + 5] = positions[3 * 5 + 2];
  positions[offset + 6] = positions[3 * 6];
  positions[offset + 7] = positions[3 * 6 + 1];
  positions[offset + 8] = positions[3 * 6 + 2];
  positions[offset + 9] = positions[3 * 2];
  positions[offset + 10] = positions[3 * 2 + 1];
  positions[offset + 11] = positions[3 * 2 + 2];
 
  // +y plane
  offset += 3 * 4;
  positions[offset] = positions[3 * 2];
  positions[offset + 1] = positions[3 * 2 + 1];
  positions[offset + 2] = positions[3 * 2 + 2];
  positions[offset + 3] = positions[3 * 6];
  positions[offset + 4] = positions[3 * 6 + 1];
  positions[offset + 5] = positions[3 * 6 + 2];
  positions[offset + 6] = positions[3 * 7];
  positions[offset + 7] = positions[3 * 7 + 1];
  positions[offset + 8] = positions[3 * 7 + 2];
  positions[offset + 9] = positions[3 * 3];
  positions[offset + 10] = positions[3 * 3 + 1];
  positions[offset + 11] = positions[3 * 3 + 2];
 
  Iif (!drawNearPlane) {
    positions = positions.subarray(3 * 4);
  }
 
  const attributes = new GeometryAttributes({
    position: new GeometryAttribute({
      componentDatatype: ComponentDatatype.DOUBLE,
      componentsPerAttribute: 3,
      values: positions,
    }),
  });
 
  Eif (
    defined(vertexFormat.normal) ||
    defined(vertexFormat.tangent) ||
    defined(vertexFormat.bitangent) ||
    defined(vertexFormat.st)
  ) {
    const normals = defined(vertexFormat.normal)
      ? new Float32Array(3 * 4 * numberOfPlanes)
      : undefined;
    const tangents = defined(vertexFormat.tangent)
      ? new Float32Array(3 * 4 * numberOfPlanes)
      : undefined;
    const bitangents = defined(vertexFormat.bitangent)
      ? new Float32Array(3 * 4 * numberOfPlanes)
      : undefined;
    const st = defined(vertexFormat.st)
      ? new Float32Array(2 * 4 * numberOfPlanes)
      : undefined;
 
    const x = scratchXDirection;
    const y = scratchYDirection;
    const z = scratchZDirection;
 
    const negativeX = Cartesian3.negate(x, scratchNegativeX);
    const negativeY = Cartesian3.negate(y, scratchNegativeY);
    const negativeZ = Cartesian3.negate(z, scratchNegativeZ);
 
    offset = 0;
    Eif (drawNearPlane) {
      getAttributes(offset, normals, tangents, bitangents, st, negativeZ, x, y); // near
      offset += 3 * 4;
    }
    getAttributes(offset, normals, tangents, bitangents, st, z, negativeX, y); // far
    offset += 3 * 4;
    getAttributes(
      offset,
      normals,
      tangents,
      bitangents,
      st,
      negativeX,
      negativeZ,
      y,
    ); // -x
    offset += 3 * 4;
    getAttributes(
      offset,
      normals,
      tangents,
      bitangents,
      st,
      negativeY,
      negativeZ,
      negativeX,
    ); // -y
    offset += 3 * 4;
    getAttributes(offset, normals, tangents, bitangents, st, x, z, y); // +x
    offset += 3 * 4;
    getAttributes(offset, normals, tangents, bitangents, st, y, z, negativeX); // +y
 
    Eif (defined(normals)) {
      attributes.normal = new GeometryAttribute({
        componentDatatype: ComponentDatatype.FLOAT,
        componentsPerAttribute: 3,
        values: normals,
      });
    }
    Eif (defined(tangents)) {
      attributes.tangent = new GeometryAttribute({
        componentDatatype: ComponentDatatype.FLOAT,
        componentsPerAttribute: 3,
        values: tangents,
      });
    }
    Eif (defined(bitangents)) {
      attributes.bitangent = new GeometryAttribute({
        componentDatatype: ComponentDatatype.FLOAT,
        componentsPerAttribute: 3,
        values: bitangents,
      });
    }
    Eif (defined(st)) {
      attributes.st = new GeometryAttribute({
        componentDatatype: ComponentDatatype.FLOAT,
        componentsPerAttribute: 2,
        values: st,
      });
    }
  }
 
  const indices = new Uint16Array(6 * numberOfPlanes);
  for (let i = 0; i < numberOfPlanes; ++i) {
    const indexOffset = i * 6;
    const index = i * 4;
 
    indices[indexOffset] = index;
    indices[indexOffset + 1] = index + 1;
    indices[indexOffset + 2] = index + 2;
    indices[indexOffset + 3] = index;
    indices[indexOffset + 4] = index + 2;
    indices[indexOffset + 5] = index + 3;
  }
 
  return new Geometry({
    attributes: attributes,
    indices: indices,
    primitiveType: PrimitiveType.TRIANGLES,
    boundingSphere: BoundingSphere.fromVertices(positions),
  });
};
export default FrustumGeometry;