1 line
144 KiB
Plaintext
1 line
144 KiB
Plaintext
|
{"version":3,"file":"FrustumGeometry-a0a0f5aa.js","sources":["../../../../Source/Core/CullingVolume.js","../../../../Source/Core/OrthographicOffCenterFrustum.js","../../../../Source/Core/OrthographicFrustum.js","../../../../Source/Core/PerspectiveOffCenterFrustum.js","../../../../Source/Core/PerspectiveFrustum.js","../../../../Source/Core/FrustumGeometry.js"],"sourcesContent":["import Cartesian3 from \"./Cartesian3.js\";\nimport Cartesian4 from \"./Cartesian4.js\";\nimport defaultValue from \"./defaultValue.js\";\nimport defined from \"./defined.js\";\nimport DeveloperError from \"./DeveloperError.js\";\nimport Intersect from \"./Intersect.js\";\nimport Plane from \"./Plane.js\";\n\n/**\n * The culling volume defined by planes.\n *\n * @alias CullingVolume\n * @constructor\n *\n * @param {Cartesian4[]} [planes] An array of clipping planes.\n */\nfunction CullingVolume(planes) {\n /**\n * Each plane is represented by a Cartesian4 object, where the x, y, and z components\n * define the unit vector normal to the plane, and the w component is the distance of the\n * plane from the origin.\n * @type {Cartesian4[]}\n * @default []\n */\n this.planes = defaultValue(planes, []);\n}\n\nconst faces = [new Cartesian3(), new Cartesian3(), new Cartesian3()];\nCartesian3.clone(Cartesian3.UNIT_X, faces[0]);\nCartesian3.clone(Cartesian3.UNIT_Y, faces[1]);\nCartesian3.clone(Cartesian3.UNIT_Z, faces[2]);\n\nconst scratchPlaneCenter = new Cartesian3();\nconst scratchPlaneNormal = new Cartesian3();\nconst scratchPlane = new Plane(new Cartesian3(1.0, 0.0, 0.0), 0.0);\n\n/**\n * Constructs a culling volume from a bounding sphere. Creates six planes that create a box containing the sphere.\n * The planes are aligned to the x, y, and z axes in world coordinates.\n *\n * @param {BoundingSphere} boundingSphere The bounding sphere used to create the culling volume.\n * @param {CullingVolume} [result] The object onto which to store the result.\n * @returns {CullingVolume} The culling volume created from the bounding sphere.\n */\nCullingVolume.fromBoundingSphere = function (boundingSphere, result) {\n //>>includeStart('debug', pragmas.debug);\n if (!defined(boundingSphere)) {\n throw new DeveloperError(\"boundingSphere is required.\");\n }\n //>>includeEnd('debug');\n\n if (!defined(result)) {\n result = new CullingVolume();\n }\n\n const length = faces.length;\n const planes = result.planes;\n planes.length = 2 * length;\n\n const center = boundingSphere.center;\n const radius = boundingSphere.radius;\n\n let planeIndex = 0;\n\n for (let i = 0; i < length; ++i) {\n const faceNormal = faces[i];\n\n let plane0 = planes[planeIndex];\n let plane1 = planes[planeIndex + 1];\n\n if (!defined(plane0)) {\n plane0 = planes[planeIndex] = new Cartesian4();\n }\n if (!defined(plane1)) {\n plane1 = planes[planeIndex + 1] = new Cartesian4();\n }\n\n Cartesian3.multiplyByScalar(faceNormal, -radius, scratchPlaneCenter);\n Cartesian3.add(center, scratchPlaneCenter, scratchPlaneCenter);\n\n plane0.x = faceNormal.x;\n plane0.y = faceNormal.y;\n plane0.z = faceNormal.z;\n plane0.w = -Cartesian3.dot(faceNormal, scratchPlaneCenter);\n\n Cartesian3.multiplyByScalar(faceNormal, radius, scratchPlaneCenter);\n Cartesian3.add(center, scratchPlaneCenter, scratchPlaneCenter);\n\n plane1.x = -faceNormal.x;\n plane1.y = -faceNormal.y;\n plane1.z = -faceNormal.z;\n plane1.w = -Cartesian3.dot(\n Cartesian3.negate(faceNormal, scratchPlaneNormal),\n scratchPlaneCenter\n );\n\n planeIndex += 2;\n }\n\n return result;\n};\n\n/**\n * Determines whether a bounding volume intersects the culling volume.\n *\n * @param {Object} boundingVolume The bounding volume whose intersection with the culling volume is to be tested.\n * @returns {Intersect} Intersect.OUTSIDE, Intersect.INTERSECTING, or Intersect.INSIDE.\n */\nCullingVolume.prototype.computeVisibility = function (boundingVolume) {\n //>>includeStart('debug', pragmas.debug);\n if (!defined(boundingVolume)) {\n thr
|