@rtzh/engine 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/Build/Workers/chunk-243UEBJF.js +1045 -0
  2. package/Build/Workers/chunk-3NSMZ3XW.js +1067 -0
  3. package/Build/Workers/chunk-4DIL24GG.js +1460 -0
  4. package/Build/Workers/chunk-4FEDW3WT.js +299 -0
  5. package/Build/Workers/chunk-4SC4KVID.js +692 -0
  6. package/Build/Workers/chunk-53AFSDGM.js +37 -0
  7. package/Build/Workers/chunk-54SSO7NS.js +352 -0
  8. package/Build/Workers/chunk-5SVTAJRH.js +837 -0
  9. package/Build/Workers/chunk-5W4ISZGQ.js +1483 -0
  10. package/Build/Workers/chunk-64VDO4BW.js +114 -0
  11. package/Build/Workers/chunk-6AUSOZOL.js +476 -0
  12. package/Build/Workers/chunk-7MMYV5PM.js +288 -0
  13. package/Build/Workers/chunk-7QPQGSS3.js +57 -0
  14. package/Build/Workers/chunk-AEURJQ3B.js +73 -0
  15. package/Build/Workers/chunk-AMJRLIO3.js +414 -0
  16. package/Build/Workers/chunk-BCYABDWF.js +3514 -0
  17. package/Build/Workers/chunk-CTARL7CY.js +511 -0
  18. package/Build/Workers/chunk-DIA4J2DB.js +497 -0
  19. package/Build/Workers/chunk-E5BSDIGY.js +139 -0
  20. package/Build/Workers/chunk-EJVGOIOW.js +1317 -0
  21. package/Build/Workers/chunk-ERYOZBVC.js +171 -0
  22. package/Build/Workers/chunk-ET7LWDHA.js +58 -0
  23. package/Build/Workers/chunk-FSYQE5XE.js +55 -0
  24. package/Build/Workers/chunk-G7PGTG3P.js +387 -0
  25. package/Build/Workers/chunk-GZMTBQM2.js +1443 -0
  26. package/Build/Workers/chunk-HAR6Y2HP.js +1800 -0
  27. package/Build/Workers/chunk-HM4MH5IG.js +138 -0
  28. package/Build/Workers/chunk-IB2XQV6U.js +101 -0
  29. package/Build/Workers/chunk-IXM65GBF.js +256 -0
  30. package/Build/Workers/chunk-IYAZCFAC.js +642 -0
  31. package/Build/Workers/chunk-JRPAFYGJ.js +1054 -0
  32. package/Build/Workers/chunk-LPJHTJDQ.js +305 -0
  33. package/Build/Workers/chunk-LRW2QXMW.js +352 -0
  34. package/Build/Workers/chunk-MWN26ZEM.js +280 -0
  35. package/Build/Workers/chunk-NIWB6UMY.js +198 -0
  36. package/Build/Workers/chunk-O5QH7XD5.js +629 -0
  37. package/Build/Workers/chunk-OBM2JYMG.js +75 -0
  38. package/Build/Workers/chunk-ODZZZGXK.js +219 -0
  39. package/Build/Workers/chunk-QY55DT53.js +97 -0
  40. package/Build/Workers/chunk-R3PTQZ6H.js +44 -0
  41. package/Build/Workers/chunk-RT7PY6BH.js +2719 -0
  42. package/Build/Workers/chunk-SAD42JSM.js +102 -0
  43. package/Build/Workers/chunk-SFM3GNS2.js +682 -0
  44. package/Build/Workers/chunk-SLYUIIFB.js +455 -0
  45. package/Build/Workers/chunk-SQSWONTJ.js +241 -0
  46. package/Build/Workers/chunk-SRLJWNU2.js +368 -0
  47. package/Build/Workers/chunk-SZELHE7Q.js +163 -0
  48. package/Build/Workers/chunk-TBASKFFL.js +124 -0
  49. package/Build/Workers/chunk-TDGGEIZE.js +398 -0
  50. package/Build/Workers/chunk-U3VI26GL.js +162 -0
  51. package/Build/Workers/chunk-VLB25GGE.js +439 -0
  52. package/Build/Workers/chunk-W4DV7TAL.js +8366 -0
  53. package/Build/Workers/chunk-WFTPZ3ZX.js +788 -0
  54. package/Build/Workers/chunk-WWLWTSMV.js +55 -0
  55. package/Build/Workers/chunk-WX2ZANQC.js +940 -0
  56. package/Build/Workers/chunk-XFKTM6GN.js +2058 -0
  57. package/Build/Workers/chunk-Z5MHVJGN.js +778 -0
  58. package/Build/Workers/combineGeometry.js +24 -24
  59. package/Build/Workers/createBoxGeometry.js +18 -18
  60. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  61. package/Build/Workers/createCircleGeometry.js +26 -26
  62. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  63. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  64. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  65. package/Build/Workers/createCorridorGeometry.js +29 -29
  66. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  67. package/Build/Workers/createCylinderGeometry.js +20 -20
  68. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  69. package/Build/Workers/createEllipseGeometry.js +26 -26
  70. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  71. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  72. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  73. package/Build/Workers/createFrustumGeometry.js +18 -18
  74. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  75. package/Build/Workers/createGeometry.js +24 -24
  76. package/Build/Workers/createGroundPolylineGeometry.js +22 -22
  77. package/Build/Workers/createPlaneGeometry.js +16 -16
  78. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  79. package/Build/Workers/createPolygonGeometry.js +32 -32
  80. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  81. package/Build/Workers/createPolylineGeometry.js +25 -25
  82. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  83. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  84. package/Build/Workers/createRectangleGeometry.js +27 -27
  85. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  86. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  87. package/Build/Workers/createSphereGeometry.js +19 -19
  88. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  89. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  90. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  91. package/Build/Workers/createVectorTileGeometries.js +24 -24
  92. package/Build/Workers/createVectorTilePoints.js +13 -13
  93. package/Build/Workers/createVectorTilePolygons.js +22 -22
  94. package/Build/Workers/createVectorTilePolylines.js +14 -14
  95. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
  96. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  97. package/Build/Workers/createVerticesFromHeightmap.js +22 -22
  98. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
  99. package/Build/Workers/createWallGeometry.js +24 -24
  100. package/Build/Workers/createWallOutlineGeometry.js +23 -23
  101. package/Build/Workers/decodeDraco.js +10 -10
  102. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  103. package/Build/Workers/decodeI3S.js +10 -10
  104. package/Build/Workers/gaussianSplatSorter.js +4 -4
  105. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  106. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  107. package/Build/Workers/transcodeKTX2.js +6 -6
  108. package/Build/Workers/transferTypedArrayTest.js +1 -1
  109. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  110. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
  111. package/Source/Scene/Cesium3DTileset.js +4121 -4105
  112. package/Source/Scene/Model/BarycentricWireframePipelineStage.js +258 -79
  113. package/Source/Scene/Model/Model.js +3584 -3512
  114. package/Source/Scene/Model/Model3DTileContent.js +568 -568
  115. package/Source/Scene/Model/ModelRuntimePrimitive.js +391 -391
  116. package/Source/Scene/Model/WireframePipelineStage.js +122 -122
  117. package/Source/Shaders/Model/ModelFS.glsl +3 -1
  118. package/Source/Shaders/Model/ModelFS.js +3 -1
  119. package/index.d.ts +801 -773
  120. package/index.js +65 -65
  121. package/package.json +1 -1
@@ -0,0 +1,171 @@
1
+ /**
2
+ * @license
3
+ * Cesium - https://github.com/CesiumGS/cesium
4
+ * Version 0.0.6
5
+ *
6
+ * Copyright 2011-2022 Cesium Contributors
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ *
20
+ * Columbus View (Pat. Pend.)
21
+ *
22
+ * Portions licensed separately.
23
+ * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
+ */
25
+
26
+ import {
27
+ Cartesian4_default,
28
+ Matrix4_default
29
+ } from "./chunk-XFKTM6GN.js";
30
+ import {
31
+ Cartesian3_default
32
+ } from "./chunk-GZMTBQM2.js";
33
+ import {
34
+ Math_default
35
+ } from "./chunk-DIA4J2DB.js";
36
+ import {
37
+ Check_default,
38
+ DeveloperError_default
39
+ } from "./chunk-SZELHE7Q.js";
40
+ import {
41
+ defined_default
42
+ } from "./chunk-OBM2JYMG.js";
43
+
44
+ // packages/engine/Source/Core/Plane.js
45
+ function Plane(normal, distance) {
46
+ Check_default.typeOf.object("normal", normal);
47
+ if (!Math_default.equalsEpsilon(
48
+ Cartesian3_default.magnitude(normal),
49
+ 1,
50
+ Math_default.EPSILON6
51
+ )) {
52
+ throw new DeveloperError_default("normal must be normalized.");
53
+ }
54
+ Check_default.typeOf.number("distance", distance);
55
+ this.normal = Cartesian3_default.clone(normal);
56
+ this.distance = distance;
57
+ }
58
+ Plane.fromPointNormal = function(point, normal, result) {
59
+ Check_default.typeOf.object("point", point);
60
+ Check_default.typeOf.object("normal", normal);
61
+ if (!Math_default.equalsEpsilon(
62
+ Cartesian3_default.magnitude(normal),
63
+ 1,
64
+ Math_default.EPSILON6
65
+ )) {
66
+ throw new DeveloperError_default("normal must be normalized.");
67
+ }
68
+ const distance = -Cartesian3_default.dot(normal, point);
69
+ if (!defined_default(result)) {
70
+ return new Plane(normal, distance);
71
+ }
72
+ Cartesian3_default.clone(normal, result.normal);
73
+ result.distance = distance;
74
+ return result;
75
+ };
76
+ var scratchNormal = new Cartesian3_default();
77
+ Plane.fromCartesian4 = function(coefficients, result) {
78
+ Check_default.typeOf.object("coefficients", coefficients);
79
+ const normal = Cartesian3_default.fromCartesian4(coefficients, scratchNormal);
80
+ const distance = coefficients.w;
81
+ if (!Math_default.equalsEpsilon(
82
+ Cartesian3_default.magnitude(normal),
83
+ 1,
84
+ Math_default.EPSILON6
85
+ )) {
86
+ throw new DeveloperError_default("normal must be normalized.");
87
+ }
88
+ if (!defined_default(result)) {
89
+ return new Plane(normal, distance);
90
+ }
91
+ Cartesian3_default.clone(normal, result.normal);
92
+ result.distance = distance;
93
+ return result;
94
+ };
95
+ Plane.getPointDistance = function(plane, point) {
96
+ Check_default.typeOf.object("plane", plane);
97
+ Check_default.typeOf.object("point", point);
98
+ return Cartesian3_default.dot(plane.normal, point) + plane.distance;
99
+ };
100
+ var scratchCartesian = new Cartesian3_default();
101
+ Plane.projectPointOntoPlane = function(plane, point, result) {
102
+ Check_default.typeOf.object("plane", plane);
103
+ Check_default.typeOf.object("point", point);
104
+ if (!defined_default(result)) {
105
+ result = new Cartesian3_default();
106
+ }
107
+ const pointDistance = Plane.getPointDistance(plane, point);
108
+ const scaledNormal = Cartesian3_default.multiplyByScalar(
109
+ plane.normal,
110
+ pointDistance,
111
+ scratchCartesian
112
+ );
113
+ return Cartesian3_default.subtract(point, scaledNormal, result);
114
+ };
115
+ var scratchInverseTranspose = new Matrix4_default();
116
+ var scratchPlaneCartesian4 = new Cartesian4_default();
117
+ var scratchTransformNormal = new Cartesian3_default();
118
+ Plane.transform = function(plane, transform, result) {
119
+ Check_default.typeOf.object("plane", plane);
120
+ Check_default.typeOf.object("transform", transform);
121
+ const normal = plane.normal;
122
+ const distance = plane.distance;
123
+ const inverseTranspose = Matrix4_default.inverseTranspose(
124
+ transform,
125
+ scratchInverseTranspose
126
+ );
127
+ let planeAsCartesian4 = Cartesian4_default.fromElements(
128
+ normal.x,
129
+ normal.y,
130
+ normal.z,
131
+ distance,
132
+ scratchPlaneCartesian4
133
+ );
134
+ planeAsCartesian4 = Matrix4_default.multiplyByVector(
135
+ inverseTranspose,
136
+ planeAsCartesian4,
137
+ planeAsCartesian4
138
+ );
139
+ const transformedNormal = Cartesian3_default.fromCartesian4(
140
+ planeAsCartesian4,
141
+ scratchTransformNormal
142
+ );
143
+ planeAsCartesian4 = Cartesian4_default.divideByScalar(
144
+ planeAsCartesian4,
145
+ Cartesian3_default.magnitude(transformedNormal),
146
+ planeAsCartesian4
147
+ );
148
+ return Plane.fromCartesian4(planeAsCartesian4, result);
149
+ };
150
+ Plane.clone = function(plane, result) {
151
+ Check_default.typeOf.object("plane", plane);
152
+ if (!defined_default(result)) {
153
+ return new Plane(plane.normal, plane.distance);
154
+ }
155
+ Cartesian3_default.clone(plane.normal, result.normal);
156
+ result.distance = plane.distance;
157
+ return result;
158
+ };
159
+ Plane.equals = function(left, right) {
160
+ Check_default.typeOf.object("left", left);
161
+ Check_default.typeOf.object("right", right);
162
+ return left.distance === right.distance && Cartesian3_default.equals(left.normal, right.normal);
163
+ };
164
+ Plane.ORIGIN_XY_PLANE = Object.freeze(new Plane(Cartesian3_default.UNIT_Z, 0));
165
+ Plane.ORIGIN_YZ_PLANE = Object.freeze(new Plane(Cartesian3_default.UNIT_X, 0));
166
+ Plane.ORIGIN_ZX_PLANE = Object.freeze(new Plane(Cartesian3_default.UNIT_Y, 0));
167
+ var Plane_default = Plane;
168
+
169
+ export {
170
+ Plane_default
171
+ };
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @license
3
+ * Cesium - https://github.com/CesiumGS/cesium
4
+ * Version 0.0.6
5
+ *
6
+ * Copyright 2011-2022 Cesium Contributors
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ *
20
+ * Columbus View (Pat. Pend.)
21
+ *
22
+ * Portions licensed separately.
23
+ * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
+ */
25
+
26
+ import {
27
+ defined_default
28
+ } from "./chunk-OBM2JYMG.js";
29
+
30
+ // packages/engine/Source/Core/RuntimeError.js
31
+ function RuntimeError(message) {
32
+ this.name = "RuntimeError";
33
+ this.message = message;
34
+ let stack;
35
+ try {
36
+ throw new Error();
37
+ } catch (e) {
38
+ stack = e.stack;
39
+ }
40
+ this.stack = stack;
41
+ }
42
+ if (defined_default(Object.create)) {
43
+ RuntimeError.prototype = Object.create(Error.prototype);
44
+ RuntimeError.prototype.constructor = RuntimeError;
45
+ }
46
+ RuntimeError.prototype.toString = function() {
47
+ let str = `${this.name}: ${this.message}`;
48
+ if (defined_default(this.stack)) {
49
+ str += `
50
+ ${this.stack.toString()}`;
51
+ }
52
+ return str;
53
+ };
54
+ var RuntimeError_default = RuntimeError;
55
+
56
+ export {
57
+ RuntimeError_default
58
+ };
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @license
3
+ * Cesium - https://github.com/CesiumGS/cesium
4
+ * Version 0.0.6
5
+ *
6
+ * Copyright 2011-2022 Cesium Contributors
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ *
20
+ * Columbus View (Pat. Pend.)
21
+ *
22
+ * Portions licensed separately.
23
+ * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
+ */
25
+
26
+
27
+ // packages/engine/Source/Core/Intersect.js
28
+ var Intersect = {
29
+ /**
30
+ * Represents that an object is not contained within the frustum.
31
+ *
32
+ * @type {number}
33
+ * @constant
34
+ */
35
+ OUTSIDE: -1,
36
+ /**
37
+ * Represents that an object intersects one of the frustum's planes.
38
+ *
39
+ * @type {number}
40
+ * @constant
41
+ */
42
+ INTERSECTING: 0,
43
+ /**
44
+ * Represents that an object is fully within the frustum.
45
+ *
46
+ * @type {number}
47
+ * @constant
48
+ */
49
+ INSIDE: 1
50
+ };
51
+ var Intersect_default = Object.freeze(Intersect);
52
+
53
+ export {
54
+ Intersect_default
55
+ };
@@ -0,0 +1,387 @@
1
+ /**
2
+ * @license
3
+ * Cesium - https://github.com/CesiumGS/cesium
4
+ * Version 0.0.6
5
+ *
6
+ * Copyright 2011-2022 Cesium Contributors
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ *
20
+ * Columbus View (Pat. Pend.)
21
+ *
22
+ * Portions licensed separately.
23
+ * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
+ */
25
+
26
+ import {
27
+ EllipseGeometryLibrary_default
28
+ } from "./chunk-LPJHTJDQ.js";
29
+ import {
30
+ GeometryOffsetAttribute_default
31
+ } from "./chunk-53AFSDGM.js";
32
+ import {
33
+ IndexDatatype_default
34
+ } from "./chunk-E5BSDIGY.js";
35
+ import {
36
+ GeometryAttributes_default
37
+ } from "./chunk-R3PTQZ6H.js";
38
+ import {
39
+ GeometryAttribute_default,
40
+ Geometry_default,
41
+ PrimitiveType_default
42
+ } from "./chunk-4FEDW3WT.js";
43
+ import {
44
+ BoundingSphere_default
45
+ } from "./chunk-WX2ZANQC.js";
46
+ import {
47
+ ComponentDatatype_default
48
+ } from "./chunk-IXM65GBF.js";
49
+ import {
50
+ Ellipsoid_default
51
+ } from "./chunk-4DIL24GG.js";
52
+ import {
53
+ Cartesian3_default,
54
+ Frozen_default
55
+ } from "./chunk-GZMTBQM2.js";
56
+ import {
57
+ Math_default
58
+ } from "./chunk-DIA4J2DB.js";
59
+ import {
60
+ DeveloperError_default
61
+ } from "./chunk-SZELHE7Q.js";
62
+ import {
63
+ defined_default
64
+ } from "./chunk-OBM2JYMG.js";
65
+
66
+ // packages/engine/Source/Core/EllipseOutlineGeometry.js
67
+ var scratchCartesian1 = new Cartesian3_default();
68
+ var boundingSphereCenter = new Cartesian3_default();
69
+ function computeEllipse(options) {
70
+ const center = options.center;
71
+ boundingSphereCenter = Cartesian3_default.multiplyByScalar(
72
+ options.ellipsoid.geodeticSurfaceNormal(center, boundingSphereCenter),
73
+ options.height,
74
+ boundingSphereCenter
75
+ );
76
+ boundingSphereCenter = Cartesian3_default.add(
77
+ center,
78
+ boundingSphereCenter,
79
+ boundingSphereCenter
80
+ );
81
+ const boundingSphere = new BoundingSphere_default(
82
+ boundingSphereCenter,
83
+ options.semiMajorAxis
84
+ );
85
+ const positions = EllipseGeometryLibrary_default.computeEllipsePositions(
86
+ options,
87
+ false,
88
+ true
89
+ ).outerPositions;
90
+ const attributes = new GeometryAttributes_default({
91
+ position: new GeometryAttribute_default({
92
+ componentDatatype: ComponentDatatype_default.DOUBLE,
93
+ componentsPerAttribute: 3,
94
+ values: EllipseGeometryLibrary_default.raisePositionsToHeight(
95
+ positions,
96
+ options,
97
+ false
98
+ )
99
+ })
100
+ });
101
+ const length = positions.length / 3;
102
+ const indices = IndexDatatype_default.createTypedArray(length, length * 2);
103
+ let index = 0;
104
+ for (let i = 0; i < length; ++i) {
105
+ indices[index++] = i;
106
+ indices[index++] = (i + 1) % length;
107
+ }
108
+ return {
109
+ boundingSphere,
110
+ attributes,
111
+ indices
112
+ };
113
+ }
114
+ var topBoundingSphere = new BoundingSphere_default();
115
+ var bottomBoundingSphere = new BoundingSphere_default();
116
+ function computeExtrudedEllipse(options) {
117
+ const center = options.center;
118
+ const ellipsoid = options.ellipsoid;
119
+ const semiMajorAxis = options.semiMajorAxis;
120
+ let scaledNormal = Cartesian3_default.multiplyByScalar(
121
+ ellipsoid.geodeticSurfaceNormal(center, scratchCartesian1),
122
+ options.height,
123
+ scratchCartesian1
124
+ );
125
+ topBoundingSphere.center = Cartesian3_default.add(
126
+ center,
127
+ scaledNormal,
128
+ topBoundingSphere.center
129
+ );
130
+ topBoundingSphere.radius = semiMajorAxis;
131
+ scaledNormal = Cartesian3_default.multiplyByScalar(
132
+ ellipsoid.geodeticSurfaceNormal(center, scaledNormal),
133
+ options.extrudedHeight,
134
+ scaledNormal
135
+ );
136
+ bottomBoundingSphere.center = Cartesian3_default.add(
137
+ center,
138
+ scaledNormal,
139
+ bottomBoundingSphere.center
140
+ );
141
+ bottomBoundingSphere.radius = semiMajorAxis;
142
+ let positions = EllipseGeometryLibrary_default.computeEllipsePositions(
143
+ options,
144
+ false,
145
+ true
146
+ ).outerPositions;
147
+ const attributes = new GeometryAttributes_default({
148
+ position: new GeometryAttribute_default({
149
+ componentDatatype: ComponentDatatype_default.DOUBLE,
150
+ componentsPerAttribute: 3,
151
+ values: EllipseGeometryLibrary_default.raisePositionsToHeight(
152
+ positions,
153
+ options,
154
+ true
155
+ )
156
+ })
157
+ });
158
+ positions = attributes.position.values;
159
+ const boundingSphere = BoundingSphere_default.union(
160
+ topBoundingSphere,
161
+ bottomBoundingSphere
162
+ );
163
+ let length = positions.length / 3;
164
+ if (defined_default(options.offsetAttribute)) {
165
+ let applyOffset = new Uint8Array(length);
166
+ if (options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
167
+ applyOffset = applyOffset.fill(1, 0, length / 2);
168
+ } else {
169
+ const offsetValue = options.offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
170
+ applyOffset = applyOffset.fill(offsetValue);
171
+ }
172
+ attributes.applyOffset = new GeometryAttribute_default({
173
+ componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
174
+ componentsPerAttribute: 1,
175
+ values: applyOffset
176
+ });
177
+ }
178
+ let numberOfVerticalLines = options.numberOfVerticalLines ?? 16;
179
+ numberOfVerticalLines = Math_default.clamp(
180
+ numberOfVerticalLines,
181
+ 0,
182
+ length / 2
183
+ );
184
+ const indices = IndexDatatype_default.createTypedArray(
185
+ length,
186
+ length * 2 + numberOfVerticalLines * 2
187
+ );
188
+ length /= 2;
189
+ let index = 0;
190
+ let i;
191
+ for (i = 0; i < length; ++i) {
192
+ indices[index++] = i;
193
+ indices[index++] = (i + 1) % length;
194
+ indices[index++] = i + length;
195
+ indices[index++] = (i + 1) % length + length;
196
+ }
197
+ let numSide;
198
+ if (numberOfVerticalLines > 0) {
199
+ const numSideLines = Math.min(numberOfVerticalLines, length);
200
+ numSide = Math.round(length / numSideLines);
201
+ const maxI = Math.min(numSide * numberOfVerticalLines, length);
202
+ for (i = 0; i < maxI; i += numSide) {
203
+ indices[index++] = i;
204
+ indices[index++] = i + length;
205
+ }
206
+ }
207
+ return {
208
+ boundingSphere,
209
+ attributes,
210
+ indices
211
+ };
212
+ }
213
+ function EllipseOutlineGeometry(options) {
214
+ options = options ?? Frozen_default.EMPTY_OBJECT;
215
+ const center = options.center;
216
+ const ellipsoid = options.ellipsoid ?? Ellipsoid_default.default;
217
+ const semiMajorAxis = options.semiMajorAxis;
218
+ const semiMinorAxis = options.semiMinorAxis;
219
+ const granularity = options.granularity ?? Math_default.RADIANS_PER_DEGREE;
220
+ if (!defined_default(center)) {
221
+ throw new DeveloperError_default("center is required.");
222
+ }
223
+ if (!defined_default(semiMajorAxis)) {
224
+ throw new DeveloperError_default("semiMajorAxis is required.");
225
+ }
226
+ if (!defined_default(semiMinorAxis)) {
227
+ throw new DeveloperError_default("semiMinorAxis is required.");
228
+ }
229
+ if (semiMajorAxis < semiMinorAxis) {
230
+ throw new DeveloperError_default(
231
+ "semiMajorAxis must be greater than or equal to the semiMinorAxis."
232
+ );
233
+ }
234
+ if (granularity <= 0) {
235
+ throw new DeveloperError_default("granularity must be greater than zero.");
236
+ }
237
+ const height = options.height ?? 0;
238
+ const extrudedHeight = options.extrudedHeight ?? height;
239
+ this._center = Cartesian3_default.clone(center);
240
+ this._semiMajorAxis = semiMajorAxis;
241
+ this._semiMinorAxis = semiMinorAxis;
242
+ this._ellipsoid = Ellipsoid_default.clone(ellipsoid);
243
+ this._rotation = options.rotation ?? 0;
244
+ this._height = Math.max(extrudedHeight, height);
245
+ this._granularity = granularity;
246
+ this._extrudedHeight = Math.min(extrudedHeight, height);
247
+ this._numberOfVerticalLines = Math.max(
248
+ options.numberOfVerticalLines ?? 16,
249
+ 0
250
+ );
251
+ this._offsetAttribute = options.offsetAttribute;
252
+ this._workerName = "createEllipseOutlineGeometry";
253
+ }
254
+ EllipseOutlineGeometry.packedLength = Cartesian3_default.packedLength + Ellipsoid_default.packedLength + 8;
255
+ EllipseOutlineGeometry.pack = function(value, array, startingIndex) {
256
+ if (!defined_default(value)) {
257
+ throw new DeveloperError_default("value is required");
258
+ }
259
+ if (!defined_default(array)) {
260
+ throw new DeveloperError_default("array is required");
261
+ }
262
+ startingIndex = startingIndex ?? 0;
263
+ Cartesian3_default.pack(value._center, array, startingIndex);
264
+ startingIndex += Cartesian3_default.packedLength;
265
+ Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
266
+ startingIndex += Ellipsoid_default.packedLength;
267
+ array[startingIndex++] = value._semiMajorAxis;
268
+ array[startingIndex++] = value._semiMinorAxis;
269
+ array[startingIndex++] = value._rotation;
270
+ array[startingIndex++] = value._height;
271
+ array[startingIndex++] = value._granularity;
272
+ array[startingIndex++] = value._extrudedHeight;
273
+ array[startingIndex++] = value._numberOfVerticalLines;
274
+ array[startingIndex] = value._offsetAttribute ?? -1;
275
+ return array;
276
+ };
277
+ var scratchCenter = new Cartesian3_default();
278
+ var scratchEllipsoid = new Ellipsoid_default();
279
+ var scratchOptions = {
280
+ center: scratchCenter,
281
+ ellipsoid: scratchEllipsoid,
282
+ semiMajorAxis: void 0,
283
+ semiMinorAxis: void 0,
284
+ rotation: void 0,
285
+ height: void 0,
286
+ granularity: void 0,
287
+ extrudedHeight: void 0,
288
+ numberOfVerticalLines: void 0,
289
+ offsetAttribute: void 0
290
+ };
291
+ EllipseOutlineGeometry.unpack = function(array, startingIndex, result) {
292
+ if (!defined_default(array)) {
293
+ throw new DeveloperError_default("array is required");
294
+ }
295
+ startingIndex = startingIndex ?? 0;
296
+ const center = Cartesian3_default.unpack(array, startingIndex, scratchCenter);
297
+ startingIndex += Cartesian3_default.packedLength;
298
+ const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
299
+ startingIndex += Ellipsoid_default.packedLength;
300
+ const semiMajorAxis = array[startingIndex++];
301
+ const semiMinorAxis = array[startingIndex++];
302
+ const rotation = array[startingIndex++];
303
+ const height = array[startingIndex++];
304
+ const granularity = array[startingIndex++];
305
+ const extrudedHeight = array[startingIndex++];
306
+ const numberOfVerticalLines = array[startingIndex++];
307
+ const offsetAttribute = array[startingIndex];
308
+ if (!defined_default(result)) {
309
+ scratchOptions.height = height;
310
+ scratchOptions.extrudedHeight = extrudedHeight;
311
+ scratchOptions.granularity = granularity;
312
+ scratchOptions.rotation = rotation;
313
+ scratchOptions.semiMajorAxis = semiMajorAxis;
314
+ scratchOptions.semiMinorAxis = semiMinorAxis;
315
+ scratchOptions.numberOfVerticalLines = numberOfVerticalLines;
316
+ scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
317
+ return new EllipseOutlineGeometry(scratchOptions);
318
+ }
319
+ result._center = Cartesian3_default.clone(center, result._center);
320
+ result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
321
+ result._semiMajorAxis = semiMajorAxis;
322
+ result._semiMinorAxis = semiMinorAxis;
323
+ result._rotation = rotation;
324
+ result._height = height;
325
+ result._granularity = granularity;
326
+ result._extrudedHeight = extrudedHeight;
327
+ result._numberOfVerticalLines = numberOfVerticalLines;
328
+ result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
329
+ return result;
330
+ };
331
+ EllipseOutlineGeometry.createGeometry = function(ellipseGeometry) {
332
+ if (ellipseGeometry._semiMajorAxis <= 0 || ellipseGeometry._semiMinorAxis <= 0) {
333
+ return;
334
+ }
335
+ const height = ellipseGeometry._height;
336
+ const extrudedHeight = ellipseGeometry._extrudedHeight;
337
+ const extrude = !Math_default.equalsEpsilon(
338
+ height,
339
+ extrudedHeight,
340
+ 0,
341
+ Math_default.EPSILON2
342
+ );
343
+ ellipseGeometry._center = ellipseGeometry._ellipsoid.scaleToGeodeticSurface(
344
+ ellipseGeometry._center,
345
+ ellipseGeometry._center
346
+ );
347
+ const options = {
348
+ center: ellipseGeometry._center,
349
+ semiMajorAxis: ellipseGeometry._semiMajorAxis,
350
+ semiMinorAxis: ellipseGeometry._semiMinorAxis,
351
+ ellipsoid: ellipseGeometry._ellipsoid,
352
+ rotation: ellipseGeometry._rotation,
353
+ height,
354
+ granularity: ellipseGeometry._granularity,
355
+ numberOfVerticalLines: ellipseGeometry._numberOfVerticalLines
356
+ };
357
+ let geometry;
358
+ if (extrude) {
359
+ options.extrudedHeight = extrudedHeight;
360
+ options.offsetAttribute = ellipseGeometry._offsetAttribute;
361
+ geometry = computeExtrudedEllipse(options);
362
+ } else {
363
+ geometry = computeEllipse(options);
364
+ if (defined_default(ellipseGeometry._offsetAttribute)) {
365
+ const length = geometry.attributes.position.values.length;
366
+ const offsetValue = ellipseGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
367
+ const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
368
+ geometry.attributes.applyOffset = new GeometryAttribute_default({
369
+ componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
370
+ componentsPerAttribute: 1,
371
+ values: applyOffset
372
+ });
373
+ }
374
+ }
375
+ return new Geometry_default({
376
+ attributes: geometry.attributes,
377
+ indices: geometry.indices,
378
+ primitiveType: PrimitiveType_default.LINES,
379
+ boundingSphere: geometry.boundingSphere,
380
+ offsetAttribute: ellipseGeometry._offsetAttribute
381
+ });
382
+ };
383
+ var EllipseOutlineGeometry_default = EllipseOutlineGeometry;
384
+
385
+ export {
386
+ EllipseOutlineGeometry_default
387
+ };