@rtzh/engine 0.0.1 → 0.0.3
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.
- package/Source/Scene/GltfLoader.js +2 -2
- package/Source/Scene/Model/CustomShader.js +2 -2
- package/index.js +504 -504
- package/package.json +1 -1
- package/Build/ThirdParty/Workers/zip-web-worker.js +0 -640
- package/Build/Workers/chunk-245NZYCR.js +0 -124
- package/Build/Workers/chunk-25BA4527.js +0 -837
- package/Build/Workers/chunk-4HXPSZRC.js +0 -1483
- package/Build/Workers/chunk-4Z26IS65.js +0 -3514
- package/Build/Workers/chunk-55IROWAX.js +0 -139
- package/Build/Workers/chunk-56XTN5NJ.js +0 -1800
- package/Build/Workers/chunk-5VZISKJF.js +0 -629
- package/Build/Workers/chunk-5WAG5YKS.js +0 -368
- package/Build/Workers/chunk-66YGZWBI.js +0 -1317
- package/Build/Workers/chunk-6H33B6OL.js +0 -37
- package/Build/Workers/chunk-6LZBBEA7.js +0 -439
- package/Build/Workers/chunk-6XJO625E.js +0 -497
- package/Build/Workers/chunk-75UGCVME.js +0 -102
- package/Build/Workers/chunk-7B23DD46.js +0 -1054
- package/Build/Workers/chunk-7NCJH26L.js +0 -352
- package/Build/Workers/chunk-AIW5F22O.js +0 -352
- package/Build/Workers/chunk-AL22JVIA.js +0 -256
- package/Build/Workers/chunk-AVSQILVI.js +0 -75
- package/Build/Workers/chunk-B2VFNYD7.js +0 -280
- package/Build/Workers/chunk-BOV6T7FO.js +0 -44
- package/Build/Workers/chunk-DP76S3IQ.js +0 -1067
- package/Build/Workers/chunk-EDIUN7V3.js +0 -219
- package/Build/Workers/chunk-EKMWNF4U.js +0 -55
- package/Build/Workers/chunk-ELXGXAYS.js +0 -682
- package/Build/Workers/chunk-FVYRV2T6.js +0 -455
- package/Build/Workers/chunk-GDIBU55R.js +0 -778
- package/Build/Workers/chunk-HAY6YE7M.js +0 -97
- package/Build/Workers/chunk-I76SRIKN.js +0 -138
- package/Build/Workers/chunk-IELTSYPZ.js +0 -241
- package/Build/Workers/chunk-J4MIJCN5.js +0 -171
- package/Build/Workers/chunk-JFO3ELF3.js +0 -642
- package/Build/Workers/chunk-K4IMD7KH.js +0 -162
- package/Build/Workers/chunk-KFMCOG26.js +0 -692
- package/Build/Workers/chunk-KH2OWUUA.js +0 -163
- package/Build/Workers/chunk-KQIZ7AFF.js +0 -8366
- package/Build/Workers/chunk-KVE5EAPO.js +0 -398
- package/Build/Workers/chunk-OAOREOSO.js +0 -940
- package/Build/Workers/chunk-OFJRMGNX.js +0 -788
- package/Build/Workers/chunk-PLLZB3R4.js +0 -198
- package/Build/Workers/chunk-POY6ZE32.js +0 -2058
- package/Build/Workers/chunk-PV5B2YNB.js +0 -2719
- package/Build/Workers/chunk-Q2DXNFYW.js +0 -414
- package/Build/Workers/chunk-QWV2DM66.js +0 -1443
- package/Build/Workers/chunk-R73BHGGI.js +0 -305
- package/Build/Workers/chunk-S3AE3MZZ.js +0 -511
- package/Build/Workers/chunk-SBFTVHRW.js +0 -57
- package/Build/Workers/chunk-SOR7PD4V.js +0 -114
- package/Build/Workers/chunk-TO7TWUET.js +0 -476
- package/Build/Workers/chunk-TSAJNE4K.js +0 -101
- package/Build/Workers/chunk-TWF4XRZ6.js +0 -73
- package/Build/Workers/chunk-UTWLMOPM.js +0 -387
- package/Build/Workers/chunk-UYT2PBMV.js +0 -58
- package/Build/Workers/chunk-WAS3IHIQ.js +0 -288
- package/Build/Workers/chunk-WO5ZNC7S.js +0 -1045
- package/Build/Workers/chunk-X65Y2JSA.js +0 -55
- package/Build/Workers/chunk-XOVHLPKW.js +0 -299
- package/Build/Workers/chunk-YPGJSFOO.js +0 -1460
- package/Build/Workers/combineGeometry.js +0 -66
- package/Build/Workers/createBoxGeometry.js +0 -58
- package/Build/Workers/createBoxOutlineGeometry.js +0 -231
- package/Build/Workers/createCircleGeometry.js +0 -201
- package/Build/Workers/createCircleOutlineGeometry.js +0 -147
- package/Build/Workers/createCoplanarPolygonGeometry.js +0 -505
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +0 -225
- package/Build/Workers/createCorridorGeometry.js +0 -1258
- package/Build/Workers/createCorridorOutlineGeometry.js +0 -563
- package/Build/Workers/createCylinderGeometry.js +0 -60
- package/Build/Workers/createCylinderOutlineGeometry.js +0 -231
- package/Build/Workers/createEllipseGeometry.js +0 -72
- package/Build/Workers/createEllipseOutlineGeometry.js +0 -65
- package/Build/Workers/createEllipsoidGeometry.js +0 -59
- package/Build/Workers/createEllipsoidOutlineGeometry.js +0 -61
- package/Build/Workers/createFrustumGeometry.js +0 -58
- package/Build/Workers/createFrustumOutlineGeometry.js +0 -234
- package/Build/Workers/createGeometry.js +0 -173
- package/Build/Workers/createGroundPolylineGeometry.js +0 -1602
- package/Build/Workers/createPlaneGeometry.js +0 -223
- package/Build/Workers/createPlaneOutlineGeometry.js +0 -124
- package/Build/Workers/createPolygonGeometry.js +0 -1404
- package/Build/Workers/createPolygonOutlineGeometry.js +0 -532
- package/Build/Workers/createPolylineGeometry.js +0 -491
- package/Build/Workers/createPolylineVolumeGeometry.js +0 -374
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +0 -272
- package/Build/Workers/createRectangleGeometry.js +0 -1264
- package/Build/Workers/createRectangleOutlineGeometry.js +0 -476
- package/Build/Workers/createSimplePolylineGeometry.js +0 -397
- package/Build/Workers/createSphereGeometry.js +0 -116
- package/Build/Workers/createSphereOutlineGeometry.js +0 -116
- package/Build/Workers/createTaskProcessorWorker.js +0 -32
- package/Build/Workers/createVectorTileClampedPolylines.js +0 -492
- package/Build/Workers/createVectorTileGeometries.js +0 -387
- package/Build/Workers/createVectorTilePoints.js +0 -114
- package/Build/Workers/createVectorTilePolygons.js +0 -386
- package/Build/Workers/createVectorTilePolylines.js +0 -262
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +0 -91
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +0 -565
- package/Build/Workers/createVerticesFromHeightmap.js +0 -2254
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +0 -499
- package/Build/Workers/createWallGeometry.js +0 -487
- package/Build/Workers/createWallOutlineGeometry.js +0 -335
- package/Build/Workers/decodeDraco.js +0 -369
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +0 -2680
- package/Build/Workers/decodeI3S.js +0 -1339
- package/Build/Workers/gaussianSplatSorter.js +0 -62
- package/Build/Workers/gaussianSplatTextureGenerator.js +0 -68
- package/Build/Workers/incrementallyBuildTerrainPicker.js +0 -121
- package/Build/Workers/transcodeKTX2.js +0 -3463
- package/Build/Workers/transferTypedArrayTest.js +0 -41
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +0 -820
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +0 -95
|
@@ -1,1258 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
-
* Version 0.0.1
|
|
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
|
-
CorridorGeometryLibrary_default
|
|
28
|
-
} from "./chunk-TO7TWUET.js";
|
|
29
|
-
import {
|
|
30
|
-
CornerType_default
|
|
31
|
-
} from "./chunk-KFMCOG26.js";
|
|
32
|
-
import "./chunk-Q2DXNFYW.js";
|
|
33
|
-
import "./chunk-AIW5F22O.js";
|
|
34
|
-
import {
|
|
35
|
-
GeometryOffsetAttribute_default
|
|
36
|
-
} from "./chunk-6H33B6OL.js";
|
|
37
|
-
import {
|
|
38
|
-
VertexFormat_default
|
|
39
|
-
} from "./chunk-I76SRIKN.js";
|
|
40
|
-
import "./chunk-WAS3IHIQ.js";
|
|
41
|
-
import "./chunk-K4IMD7KH.js";
|
|
42
|
-
import {
|
|
43
|
-
PolygonPipeline_default
|
|
44
|
-
} from "./chunk-WO5ZNC7S.js";
|
|
45
|
-
import {
|
|
46
|
-
arrayRemoveDuplicates_default
|
|
47
|
-
} from "./chunk-HAY6YE7M.js";
|
|
48
|
-
import "./chunk-FVYRV2T6.js";
|
|
49
|
-
import "./chunk-66YGZWBI.js";
|
|
50
|
-
import "./chunk-J4MIJCN5.js";
|
|
51
|
-
import {
|
|
52
|
-
IndexDatatype_default
|
|
53
|
-
} from "./chunk-55IROWAX.js";
|
|
54
|
-
import {
|
|
55
|
-
GeometryAttributes_default
|
|
56
|
-
} from "./chunk-BOV6T7FO.js";
|
|
57
|
-
import {
|
|
58
|
-
GeometryAttribute_default,
|
|
59
|
-
Geometry_default,
|
|
60
|
-
PrimitiveType_default
|
|
61
|
-
} from "./chunk-XOVHLPKW.js";
|
|
62
|
-
import {
|
|
63
|
-
BoundingSphere_default
|
|
64
|
-
} from "./chunk-OAOREOSO.js";
|
|
65
|
-
import "./chunk-EKMWNF4U.js";
|
|
66
|
-
import {
|
|
67
|
-
Rectangle_default
|
|
68
|
-
} from "./chunk-KQIZ7AFF.js";
|
|
69
|
-
import "./chunk-POY6ZE32.js";
|
|
70
|
-
import {
|
|
71
|
-
ComponentDatatype_default
|
|
72
|
-
} from "./chunk-AL22JVIA.js";
|
|
73
|
-
import "./chunk-5VZISKJF.js";
|
|
74
|
-
import "./chunk-UYT2PBMV.js";
|
|
75
|
-
import {
|
|
76
|
-
Cartographic_default,
|
|
77
|
-
Ellipsoid_default
|
|
78
|
-
} from "./chunk-YPGJSFOO.js";
|
|
79
|
-
import {
|
|
80
|
-
Cartesian3_default,
|
|
81
|
-
Frozen_default
|
|
82
|
-
} from "./chunk-QWV2DM66.js";
|
|
83
|
-
import {
|
|
84
|
-
Math_default
|
|
85
|
-
} from "./chunk-6XJO625E.js";
|
|
86
|
-
import {
|
|
87
|
-
Check_default
|
|
88
|
-
} from "./chunk-KH2OWUUA.js";
|
|
89
|
-
import {
|
|
90
|
-
defined_default
|
|
91
|
-
} from "./chunk-AVSQILVI.js";
|
|
92
|
-
|
|
93
|
-
// packages/engine/Source/Core/CorridorGeometry.js
|
|
94
|
-
var cartesian1 = new Cartesian3_default();
|
|
95
|
-
var cartesian2 = new Cartesian3_default();
|
|
96
|
-
var cartesian3 = new Cartesian3_default();
|
|
97
|
-
var cartesian4 = new Cartesian3_default();
|
|
98
|
-
var cartesian5 = new Cartesian3_default();
|
|
99
|
-
var cartesian6 = new Cartesian3_default();
|
|
100
|
-
var scratch1 = new Cartesian3_default();
|
|
101
|
-
var scratch2 = new Cartesian3_default();
|
|
102
|
-
function scaleToSurface(positions, ellipsoid) {
|
|
103
|
-
for (let i = 0; i < positions.length; i++) {
|
|
104
|
-
positions[i] = ellipsoid.scaleToGeodeticSurface(positions[i], positions[i]);
|
|
105
|
-
}
|
|
106
|
-
return positions;
|
|
107
|
-
}
|
|
108
|
-
function addNormals(attr, normal, left, front, back, vertexFormat) {
|
|
109
|
-
const normals = attr.normals;
|
|
110
|
-
const tangents = attr.tangents;
|
|
111
|
-
const bitangents = attr.bitangents;
|
|
112
|
-
const forward = Cartesian3_default.normalize(
|
|
113
|
-
Cartesian3_default.cross(left, normal, scratch1),
|
|
114
|
-
scratch1
|
|
115
|
-
);
|
|
116
|
-
if (vertexFormat.normal) {
|
|
117
|
-
CorridorGeometryLibrary_default.addAttribute(normals, normal, front, back);
|
|
118
|
-
}
|
|
119
|
-
if (vertexFormat.tangent) {
|
|
120
|
-
CorridorGeometryLibrary_default.addAttribute(tangents, forward, front, back);
|
|
121
|
-
}
|
|
122
|
-
if (vertexFormat.bitangent) {
|
|
123
|
-
CorridorGeometryLibrary_default.addAttribute(bitangents, left, front, back);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
function combine(computedPositions, vertexFormat, ellipsoid) {
|
|
127
|
-
const positions = computedPositions.positions;
|
|
128
|
-
const corners = computedPositions.corners;
|
|
129
|
-
const endPositions = computedPositions.endPositions;
|
|
130
|
-
const computedLefts = computedPositions.lefts;
|
|
131
|
-
const computedNormals = computedPositions.normals;
|
|
132
|
-
const attributes = new GeometryAttributes_default();
|
|
133
|
-
let corner;
|
|
134
|
-
let leftCount = 0;
|
|
135
|
-
let rightCount = 0;
|
|
136
|
-
let i;
|
|
137
|
-
let indicesLength = 0;
|
|
138
|
-
let length;
|
|
139
|
-
for (i = 0; i < positions.length; i += 2) {
|
|
140
|
-
length = positions[i].length - 3;
|
|
141
|
-
leftCount += length;
|
|
142
|
-
indicesLength += length * 2;
|
|
143
|
-
rightCount += positions[i + 1].length - 3;
|
|
144
|
-
}
|
|
145
|
-
leftCount += 3;
|
|
146
|
-
rightCount += 3;
|
|
147
|
-
for (i = 0; i < corners.length; i++) {
|
|
148
|
-
corner = corners[i];
|
|
149
|
-
const leftSide = corners[i].leftPositions;
|
|
150
|
-
if (defined_default(leftSide)) {
|
|
151
|
-
length = leftSide.length;
|
|
152
|
-
leftCount += length;
|
|
153
|
-
indicesLength += length;
|
|
154
|
-
} else {
|
|
155
|
-
length = corners[i].rightPositions.length;
|
|
156
|
-
rightCount += length;
|
|
157
|
-
indicesLength += length;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
const addEndPositions = defined_default(endPositions);
|
|
161
|
-
let endPositionLength;
|
|
162
|
-
if (addEndPositions) {
|
|
163
|
-
endPositionLength = endPositions[0].length - 3;
|
|
164
|
-
leftCount += endPositionLength;
|
|
165
|
-
rightCount += endPositionLength;
|
|
166
|
-
endPositionLength /= 3;
|
|
167
|
-
indicesLength += endPositionLength * 6;
|
|
168
|
-
}
|
|
169
|
-
const size = leftCount + rightCount;
|
|
170
|
-
const finalPositions = new Float64Array(size);
|
|
171
|
-
const normals = vertexFormat.normal ? new Float32Array(size) : void 0;
|
|
172
|
-
const tangents = vertexFormat.tangent ? new Float32Array(size) : void 0;
|
|
173
|
-
const bitangents = vertexFormat.bitangent ? new Float32Array(size) : void 0;
|
|
174
|
-
const attr = {
|
|
175
|
-
normals,
|
|
176
|
-
tangents,
|
|
177
|
-
bitangents
|
|
178
|
-
};
|
|
179
|
-
let front = 0;
|
|
180
|
-
let back = size - 1;
|
|
181
|
-
let UL, LL, UR, LR;
|
|
182
|
-
let normal = cartesian1;
|
|
183
|
-
let left = cartesian2;
|
|
184
|
-
let rightPos, leftPos;
|
|
185
|
-
const halfLength = endPositionLength / 2;
|
|
186
|
-
const indices = IndexDatatype_default.createTypedArray(size / 3, indicesLength);
|
|
187
|
-
let index = 0;
|
|
188
|
-
if (addEndPositions) {
|
|
189
|
-
leftPos = cartesian3;
|
|
190
|
-
rightPos = cartesian4;
|
|
191
|
-
const firstEndPositions = endPositions[0];
|
|
192
|
-
normal = Cartesian3_default.fromArray(computedNormals, 0, normal);
|
|
193
|
-
left = Cartesian3_default.fromArray(computedLefts, 0, left);
|
|
194
|
-
for (i = 0; i < halfLength; i++) {
|
|
195
|
-
leftPos = Cartesian3_default.fromArray(
|
|
196
|
-
firstEndPositions,
|
|
197
|
-
(halfLength - 1 - i) * 3,
|
|
198
|
-
leftPos
|
|
199
|
-
);
|
|
200
|
-
rightPos = Cartesian3_default.fromArray(
|
|
201
|
-
firstEndPositions,
|
|
202
|
-
(halfLength + i) * 3,
|
|
203
|
-
rightPos
|
|
204
|
-
);
|
|
205
|
-
CorridorGeometryLibrary_default.addAttribute(finalPositions, rightPos, front);
|
|
206
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
207
|
-
finalPositions,
|
|
208
|
-
leftPos,
|
|
209
|
-
void 0,
|
|
210
|
-
back
|
|
211
|
-
);
|
|
212
|
-
addNormals(attr, normal, left, front, back, vertexFormat);
|
|
213
|
-
LL = front / 3;
|
|
214
|
-
LR = LL + 1;
|
|
215
|
-
UL = (back - 2) / 3;
|
|
216
|
-
UR = UL - 1;
|
|
217
|
-
indices[index++] = UL;
|
|
218
|
-
indices[index++] = LL;
|
|
219
|
-
indices[index++] = UR;
|
|
220
|
-
indices[index++] = UR;
|
|
221
|
-
indices[index++] = LL;
|
|
222
|
-
indices[index++] = LR;
|
|
223
|
-
front += 3;
|
|
224
|
-
back -= 3;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
let posIndex = 0;
|
|
228
|
-
let compIndex = 0;
|
|
229
|
-
let rightEdge = positions[posIndex++];
|
|
230
|
-
let leftEdge = positions[posIndex++];
|
|
231
|
-
finalPositions.set(rightEdge, front);
|
|
232
|
-
finalPositions.set(leftEdge, back - leftEdge.length + 1);
|
|
233
|
-
left = Cartesian3_default.fromArray(computedLefts, compIndex, left);
|
|
234
|
-
let rightNormal;
|
|
235
|
-
let leftNormal;
|
|
236
|
-
length = leftEdge.length - 3;
|
|
237
|
-
for (i = 0; i < length; i += 3) {
|
|
238
|
-
rightNormal = ellipsoid.geodeticSurfaceNormal(
|
|
239
|
-
Cartesian3_default.fromArray(rightEdge, i, scratch1),
|
|
240
|
-
scratch1
|
|
241
|
-
);
|
|
242
|
-
leftNormal = ellipsoid.geodeticSurfaceNormal(
|
|
243
|
-
Cartesian3_default.fromArray(leftEdge, length - i, scratch2),
|
|
244
|
-
scratch2
|
|
245
|
-
);
|
|
246
|
-
normal = Cartesian3_default.normalize(
|
|
247
|
-
Cartesian3_default.add(rightNormal, leftNormal, normal),
|
|
248
|
-
normal
|
|
249
|
-
);
|
|
250
|
-
addNormals(attr, normal, left, front, back, vertexFormat);
|
|
251
|
-
LL = front / 3;
|
|
252
|
-
LR = LL + 1;
|
|
253
|
-
UL = (back - 2) / 3;
|
|
254
|
-
UR = UL - 1;
|
|
255
|
-
indices[index++] = UL;
|
|
256
|
-
indices[index++] = LL;
|
|
257
|
-
indices[index++] = UR;
|
|
258
|
-
indices[index++] = UR;
|
|
259
|
-
indices[index++] = LL;
|
|
260
|
-
indices[index++] = LR;
|
|
261
|
-
front += 3;
|
|
262
|
-
back -= 3;
|
|
263
|
-
}
|
|
264
|
-
rightNormal = ellipsoid.geodeticSurfaceNormal(
|
|
265
|
-
Cartesian3_default.fromArray(rightEdge, length, scratch1),
|
|
266
|
-
scratch1
|
|
267
|
-
);
|
|
268
|
-
leftNormal = ellipsoid.geodeticSurfaceNormal(
|
|
269
|
-
Cartesian3_default.fromArray(leftEdge, length, scratch2),
|
|
270
|
-
scratch2
|
|
271
|
-
);
|
|
272
|
-
normal = Cartesian3_default.normalize(
|
|
273
|
-
Cartesian3_default.add(rightNormal, leftNormal, normal),
|
|
274
|
-
normal
|
|
275
|
-
);
|
|
276
|
-
compIndex += 3;
|
|
277
|
-
for (i = 0; i < corners.length; i++) {
|
|
278
|
-
let j;
|
|
279
|
-
corner = corners[i];
|
|
280
|
-
const l = corner.leftPositions;
|
|
281
|
-
const r = corner.rightPositions;
|
|
282
|
-
let pivot;
|
|
283
|
-
let start;
|
|
284
|
-
let outsidePoint = cartesian6;
|
|
285
|
-
let previousPoint = cartesian3;
|
|
286
|
-
let nextPoint = cartesian4;
|
|
287
|
-
normal = Cartesian3_default.fromArray(computedNormals, compIndex, normal);
|
|
288
|
-
if (defined_default(l)) {
|
|
289
|
-
addNormals(attr, normal, left, void 0, back, vertexFormat);
|
|
290
|
-
back -= 3;
|
|
291
|
-
pivot = LR;
|
|
292
|
-
start = UR;
|
|
293
|
-
for (j = 0; j < l.length / 3; j++) {
|
|
294
|
-
outsidePoint = Cartesian3_default.fromArray(l, j * 3, outsidePoint);
|
|
295
|
-
indices[index++] = pivot;
|
|
296
|
-
indices[index++] = start - j - 1;
|
|
297
|
-
indices[index++] = start - j;
|
|
298
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
299
|
-
finalPositions,
|
|
300
|
-
outsidePoint,
|
|
301
|
-
void 0,
|
|
302
|
-
back
|
|
303
|
-
);
|
|
304
|
-
previousPoint = Cartesian3_default.fromArray(
|
|
305
|
-
finalPositions,
|
|
306
|
-
(start - j - 1) * 3,
|
|
307
|
-
previousPoint
|
|
308
|
-
);
|
|
309
|
-
nextPoint = Cartesian3_default.fromArray(finalPositions, pivot * 3, nextPoint);
|
|
310
|
-
left = Cartesian3_default.normalize(
|
|
311
|
-
Cartesian3_default.subtract(previousPoint, nextPoint, left),
|
|
312
|
-
left
|
|
313
|
-
);
|
|
314
|
-
addNormals(attr, normal, left, void 0, back, vertexFormat);
|
|
315
|
-
back -= 3;
|
|
316
|
-
}
|
|
317
|
-
outsidePoint = Cartesian3_default.fromArray(
|
|
318
|
-
finalPositions,
|
|
319
|
-
pivot * 3,
|
|
320
|
-
outsidePoint
|
|
321
|
-
);
|
|
322
|
-
previousPoint = Cartesian3_default.subtract(
|
|
323
|
-
Cartesian3_default.fromArray(finalPositions, start * 3, previousPoint),
|
|
324
|
-
outsidePoint,
|
|
325
|
-
previousPoint
|
|
326
|
-
);
|
|
327
|
-
nextPoint = Cartesian3_default.subtract(
|
|
328
|
-
Cartesian3_default.fromArray(finalPositions, (start - j) * 3, nextPoint),
|
|
329
|
-
outsidePoint,
|
|
330
|
-
nextPoint
|
|
331
|
-
);
|
|
332
|
-
left = Cartesian3_default.normalize(
|
|
333
|
-
Cartesian3_default.add(previousPoint, nextPoint, left),
|
|
334
|
-
left
|
|
335
|
-
);
|
|
336
|
-
addNormals(attr, normal, left, front, void 0, vertexFormat);
|
|
337
|
-
front += 3;
|
|
338
|
-
} else {
|
|
339
|
-
addNormals(attr, normal, left, front, void 0, vertexFormat);
|
|
340
|
-
front += 3;
|
|
341
|
-
pivot = UR;
|
|
342
|
-
start = LR;
|
|
343
|
-
for (j = 0; j < r.length / 3; j++) {
|
|
344
|
-
outsidePoint = Cartesian3_default.fromArray(r, j * 3, outsidePoint);
|
|
345
|
-
indices[index++] = pivot;
|
|
346
|
-
indices[index++] = start + j;
|
|
347
|
-
indices[index++] = start + j + 1;
|
|
348
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
349
|
-
finalPositions,
|
|
350
|
-
outsidePoint,
|
|
351
|
-
front
|
|
352
|
-
);
|
|
353
|
-
previousPoint = Cartesian3_default.fromArray(
|
|
354
|
-
finalPositions,
|
|
355
|
-
pivot * 3,
|
|
356
|
-
previousPoint
|
|
357
|
-
);
|
|
358
|
-
nextPoint = Cartesian3_default.fromArray(
|
|
359
|
-
finalPositions,
|
|
360
|
-
(start + j) * 3,
|
|
361
|
-
nextPoint
|
|
362
|
-
);
|
|
363
|
-
left = Cartesian3_default.normalize(
|
|
364
|
-
Cartesian3_default.subtract(previousPoint, nextPoint, left),
|
|
365
|
-
left
|
|
366
|
-
);
|
|
367
|
-
addNormals(attr, normal, left, front, void 0, vertexFormat);
|
|
368
|
-
front += 3;
|
|
369
|
-
}
|
|
370
|
-
outsidePoint = Cartesian3_default.fromArray(
|
|
371
|
-
finalPositions,
|
|
372
|
-
pivot * 3,
|
|
373
|
-
outsidePoint
|
|
374
|
-
);
|
|
375
|
-
previousPoint = Cartesian3_default.subtract(
|
|
376
|
-
Cartesian3_default.fromArray(finalPositions, (start + j) * 3, previousPoint),
|
|
377
|
-
outsidePoint,
|
|
378
|
-
previousPoint
|
|
379
|
-
);
|
|
380
|
-
nextPoint = Cartesian3_default.subtract(
|
|
381
|
-
Cartesian3_default.fromArray(finalPositions, start * 3, nextPoint),
|
|
382
|
-
outsidePoint,
|
|
383
|
-
nextPoint
|
|
384
|
-
);
|
|
385
|
-
left = Cartesian3_default.normalize(
|
|
386
|
-
Cartesian3_default.negate(Cartesian3_default.add(nextPoint, previousPoint, left), left),
|
|
387
|
-
left
|
|
388
|
-
);
|
|
389
|
-
addNormals(attr, normal, left, void 0, back, vertexFormat);
|
|
390
|
-
back -= 3;
|
|
391
|
-
}
|
|
392
|
-
rightEdge = positions[posIndex++];
|
|
393
|
-
leftEdge = positions[posIndex++];
|
|
394
|
-
rightEdge.splice(0, 3);
|
|
395
|
-
leftEdge.splice(leftEdge.length - 3, 3);
|
|
396
|
-
finalPositions.set(rightEdge, front);
|
|
397
|
-
finalPositions.set(leftEdge, back - leftEdge.length + 1);
|
|
398
|
-
length = leftEdge.length - 3;
|
|
399
|
-
compIndex += 3;
|
|
400
|
-
left = Cartesian3_default.fromArray(computedLefts, compIndex, left);
|
|
401
|
-
for (j = 0; j < leftEdge.length; j += 3) {
|
|
402
|
-
rightNormal = ellipsoid.geodeticSurfaceNormal(
|
|
403
|
-
Cartesian3_default.fromArray(rightEdge, j, scratch1),
|
|
404
|
-
scratch1
|
|
405
|
-
);
|
|
406
|
-
leftNormal = ellipsoid.geodeticSurfaceNormal(
|
|
407
|
-
Cartesian3_default.fromArray(leftEdge, length - j, scratch2),
|
|
408
|
-
scratch2
|
|
409
|
-
);
|
|
410
|
-
normal = Cartesian3_default.normalize(
|
|
411
|
-
Cartesian3_default.add(rightNormal, leftNormal, normal),
|
|
412
|
-
normal
|
|
413
|
-
);
|
|
414
|
-
addNormals(attr, normal, left, front, back, vertexFormat);
|
|
415
|
-
LR = front / 3;
|
|
416
|
-
LL = LR - 1;
|
|
417
|
-
UR = (back - 2) / 3;
|
|
418
|
-
UL = UR + 1;
|
|
419
|
-
indices[index++] = UL;
|
|
420
|
-
indices[index++] = LL;
|
|
421
|
-
indices[index++] = UR;
|
|
422
|
-
indices[index++] = UR;
|
|
423
|
-
indices[index++] = LL;
|
|
424
|
-
indices[index++] = LR;
|
|
425
|
-
front += 3;
|
|
426
|
-
back -= 3;
|
|
427
|
-
}
|
|
428
|
-
front -= 3;
|
|
429
|
-
back += 3;
|
|
430
|
-
}
|
|
431
|
-
normal = Cartesian3_default.fromArray(
|
|
432
|
-
computedNormals,
|
|
433
|
-
computedNormals.length - 3,
|
|
434
|
-
normal
|
|
435
|
-
);
|
|
436
|
-
addNormals(attr, normal, left, front, back, vertexFormat);
|
|
437
|
-
if (addEndPositions) {
|
|
438
|
-
front += 3;
|
|
439
|
-
back -= 3;
|
|
440
|
-
leftPos = cartesian3;
|
|
441
|
-
rightPos = cartesian4;
|
|
442
|
-
const lastEndPositions = endPositions[1];
|
|
443
|
-
for (i = 0; i < halfLength; i++) {
|
|
444
|
-
leftPos = Cartesian3_default.fromArray(
|
|
445
|
-
lastEndPositions,
|
|
446
|
-
(endPositionLength - i - 1) * 3,
|
|
447
|
-
leftPos
|
|
448
|
-
);
|
|
449
|
-
rightPos = Cartesian3_default.fromArray(lastEndPositions, i * 3, rightPos);
|
|
450
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
451
|
-
finalPositions,
|
|
452
|
-
leftPos,
|
|
453
|
-
void 0,
|
|
454
|
-
back
|
|
455
|
-
);
|
|
456
|
-
CorridorGeometryLibrary_default.addAttribute(finalPositions, rightPos, front);
|
|
457
|
-
addNormals(attr, normal, left, front, back, vertexFormat);
|
|
458
|
-
LR = front / 3;
|
|
459
|
-
LL = LR - 1;
|
|
460
|
-
UR = (back - 2) / 3;
|
|
461
|
-
UL = UR + 1;
|
|
462
|
-
indices[index++] = UL;
|
|
463
|
-
indices[index++] = LL;
|
|
464
|
-
indices[index++] = UR;
|
|
465
|
-
indices[index++] = UR;
|
|
466
|
-
indices[index++] = LL;
|
|
467
|
-
indices[index++] = LR;
|
|
468
|
-
front += 3;
|
|
469
|
-
back -= 3;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
attributes.position = new GeometryAttribute_default({
|
|
473
|
-
componentDatatype: ComponentDatatype_default.DOUBLE,
|
|
474
|
-
componentsPerAttribute: 3,
|
|
475
|
-
values: finalPositions
|
|
476
|
-
});
|
|
477
|
-
if (vertexFormat.st) {
|
|
478
|
-
const st = new Float32Array(size / 3 * 2);
|
|
479
|
-
let rightSt;
|
|
480
|
-
let leftSt;
|
|
481
|
-
let stIndex = 0;
|
|
482
|
-
if (addEndPositions) {
|
|
483
|
-
leftCount /= 3;
|
|
484
|
-
rightCount /= 3;
|
|
485
|
-
const theta = Math.PI / (endPositionLength + 1);
|
|
486
|
-
leftSt = 1 / (leftCount - endPositionLength + 1);
|
|
487
|
-
rightSt = 1 / (rightCount - endPositionLength + 1);
|
|
488
|
-
let a;
|
|
489
|
-
const halfEndPos = endPositionLength / 2;
|
|
490
|
-
for (i = halfEndPos + 1; i < endPositionLength + 1; i++) {
|
|
491
|
-
a = Math_default.PI_OVER_TWO + theta * i;
|
|
492
|
-
st[stIndex++] = rightSt * (1 + Math.cos(a));
|
|
493
|
-
st[stIndex++] = 0.5 * (1 + Math.sin(a));
|
|
494
|
-
}
|
|
495
|
-
for (i = 1; i < rightCount - endPositionLength + 1; i++) {
|
|
496
|
-
st[stIndex++] = i * rightSt;
|
|
497
|
-
st[stIndex++] = 0;
|
|
498
|
-
}
|
|
499
|
-
for (i = endPositionLength; i > halfEndPos; i--) {
|
|
500
|
-
a = Math_default.PI_OVER_TWO - i * theta;
|
|
501
|
-
st[stIndex++] = 1 - rightSt * (1 + Math.cos(a));
|
|
502
|
-
st[stIndex++] = 0.5 * (1 + Math.sin(a));
|
|
503
|
-
}
|
|
504
|
-
for (i = halfEndPos; i > 0; i--) {
|
|
505
|
-
a = Math_default.PI_OVER_TWO - theta * i;
|
|
506
|
-
st[stIndex++] = 1 - leftSt * (1 + Math.cos(a));
|
|
507
|
-
st[stIndex++] = 0.5 * (1 + Math.sin(a));
|
|
508
|
-
}
|
|
509
|
-
for (i = leftCount - endPositionLength; i > 0; i--) {
|
|
510
|
-
st[stIndex++] = i * leftSt;
|
|
511
|
-
st[stIndex++] = 1;
|
|
512
|
-
}
|
|
513
|
-
for (i = 1; i < halfEndPos + 1; i++) {
|
|
514
|
-
a = Math_default.PI_OVER_TWO + theta * i;
|
|
515
|
-
st[stIndex++] = leftSt * (1 + Math.cos(a));
|
|
516
|
-
st[stIndex++] = 0.5 * (1 + Math.sin(a));
|
|
517
|
-
}
|
|
518
|
-
} else {
|
|
519
|
-
leftCount /= 3;
|
|
520
|
-
rightCount /= 3;
|
|
521
|
-
leftSt = 1 / (leftCount - 1);
|
|
522
|
-
rightSt = 1 / (rightCount - 1);
|
|
523
|
-
for (i = 0; i < rightCount; i++) {
|
|
524
|
-
st[stIndex++] = i * rightSt;
|
|
525
|
-
st[stIndex++] = 0;
|
|
526
|
-
}
|
|
527
|
-
for (i = leftCount; i > 0; i--) {
|
|
528
|
-
st[stIndex++] = (i - 1) * leftSt;
|
|
529
|
-
st[stIndex++] = 1;
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
attributes.st = new GeometryAttribute_default({
|
|
533
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
534
|
-
componentsPerAttribute: 2,
|
|
535
|
-
values: st
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
if (vertexFormat.normal) {
|
|
539
|
-
attributes.normal = new GeometryAttribute_default({
|
|
540
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
541
|
-
componentsPerAttribute: 3,
|
|
542
|
-
values: attr.normals
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
if (vertexFormat.tangent) {
|
|
546
|
-
attributes.tangent = new GeometryAttribute_default({
|
|
547
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
548
|
-
componentsPerAttribute: 3,
|
|
549
|
-
values: attr.tangents
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
if (vertexFormat.bitangent) {
|
|
553
|
-
attributes.bitangent = new GeometryAttribute_default({
|
|
554
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
555
|
-
componentsPerAttribute: 3,
|
|
556
|
-
values: attr.bitangents
|
|
557
|
-
});
|
|
558
|
-
}
|
|
559
|
-
return {
|
|
560
|
-
attributes,
|
|
561
|
-
indices
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
function extrudedAttributes(attributes, vertexFormat) {
|
|
565
|
-
if (!vertexFormat.normal && !vertexFormat.tangent && !vertexFormat.bitangent && !vertexFormat.st) {
|
|
566
|
-
return attributes;
|
|
567
|
-
}
|
|
568
|
-
const positions = attributes.position.values;
|
|
569
|
-
let topNormals;
|
|
570
|
-
let topBitangents;
|
|
571
|
-
if (vertexFormat.normal || vertexFormat.bitangent) {
|
|
572
|
-
topNormals = attributes.normal.values;
|
|
573
|
-
topBitangents = attributes.bitangent.values;
|
|
574
|
-
}
|
|
575
|
-
const size = attributes.position.values.length / 18;
|
|
576
|
-
const threeSize = size * 3;
|
|
577
|
-
const twoSize = size * 2;
|
|
578
|
-
const sixSize = threeSize * 2;
|
|
579
|
-
let i;
|
|
580
|
-
if (vertexFormat.normal || vertexFormat.bitangent || vertexFormat.tangent) {
|
|
581
|
-
const normals = vertexFormat.normal ? new Float32Array(threeSize * 6) : void 0;
|
|
582
|
-
const tangents = vertexFormat.tangent ? new Float32Array(threeSize * 6) : void 0;
|
|
583
|
-
const bitangents = vertexFormat.bitangent ? new Float32Array(threeSize * 6) : void 0;
|
|
584
|
-
let topPosition = cartesian1;
|
|
585
|
-
let bottomPosition = cartesian2;
|
|
586
|
-
let previousPosition = cartesian3;
|
|
587
|
-
let normal = cartesian4;
|
|
588
|
-
let tangent = cartesian5;
|
|
589
|
-
let bitangent = cartesian6;
|
|
590
|
-
let attrIndex = sixSize;
|
|
591
|
-
for (i = 0; i < threeSize; i += 3) {
|
|
592
|
-
const attrIndexOffset = attrIndex + sixSize;
|
|
593
|
-
topPosition = Cartesian3_default.fromArray(positions, i, topPosition);
|
|
594
|
-
bottomPosition = Cartesian3_default.fromArray(
|
|
595
|
-
positions,
|
|
596
|
-
i + threeSize,
|
|
597
|
-
bottomPosition
|
|
598
|
-
);
|
|
599
|
-
previousPosition = Cartesian3_default.fromArray(
|
|
600
|
-
positions,
|
|
601
|
-
(i + 3) % threeSize,
|
|
602
|
-
previousPosition
|
|
603
|
-
);
|
|
604
|
-
bottomPosition = Cartesian3_default.subtract(
|
|
605
|
-
bottomPosition,
|
|
606
|
-
topPosition,
|
|
607
|
-
bottomPosition
|
|
608
|
-
);
|
|
609
|
-
previousPosition = Cartesian3_default.subtract(
|
|
610
|
-
previousPosition,
|
|
611
|
-
topPosition,
|
|
612
|
-
previousPosition
|
|
613
|
-
);
|
|
614
|
-
normal = Cartesian3_default.normalize(
|
|
615
|
-
Cartesian3_default.cross(bottomPosition, previousPosition, normal),
|
|
616
|
-
normal
|
|
617
|
-
);
|
|
618
|
-
if (vertexFormat.normal) {
|
|
619
|
-
CorridorGeometryLibrary_default.addAttribute(normals, normal, attrIndexOffset);
|
|
620
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
621
|
-
normals,
|
|
622
|
-
normal,
|
|
623
|
-
attrIndexOffset + 3
|
|
624
|
-
);
|
|
625
|
-
CorridorGeometryLibrary_default.addAttribute(normals, normal, attrIndex);
|
|
626
|
-
CorridorGeometryLibrary_default.addAttribute(normals, normal, attrIndex + 3);
|
|
627
|
-
}
|
|
628
|
-
if (vertexFormat.tangent || vertexFormat.bitangent) {
|
|
629
|
-
bitangent = Cartesian3_default.fromArray(topNormals, i, bitangent);
|
|
630
|
-
if (vertexFormat.bitangent) {
|
|
631
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
632
|
-
bitangents,
|
|
633
|
-
bitangent,
|
|
634
|
-
attrIndexOffset
|
|
635
|
-
);
|
|
636
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
637
|
-
bitangents,
|
|
638
|
-
bitangent,
|
|
639
|
-
attrIndexOffset + 3
|
|
640
|
-
);
|
|
641
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
642
|
-
bitangents,
|
|
643
|
-
bitangent,
|
|
644
|
-
attrIndex
|
|
645
|
-
);
|
|
646
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
647
|
-
bitangents,
|
|
648
|
-
bitangent,
|
|
649
|
-
attrIndex + 3
|
|
650
|
-
);
|
|
651
|
-
}
|
|
652
|
-
if (vertexFormat.tangent) {
|
|
653
|
-
tangent = Cartesian3_default.normalize(
|
|
654
|
-
Cartesian3_default.cross(bitangent, normal, tangent),
|
|
655
|
-
tangent
|
|
656
|
-
);
|
|
657
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
658
|
-
tangents,
|
|
659
|
-
tangent,
|
|
660
|
-
attrIndexOffset
|
|
661
|
-
);
|
|
662
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
663
|
-
tangents,
|
|
664
|
-
tangent,
|
|
665
|
-
attrIndexOffset + 3
|
|
666
|
-
);
|
|
667
|
-
CorridorGeometryLibrary_default.addAttribute(tangents, tangent, attrIndex);
|
|
668
|
-
CorridorGeometryLibrary_default.addAttribute(
|
|
669
|
-
tangents,
|
|
670
|
-
tangent,
|
|
671
|
-
attrIndex + 3
|
|
672
|
-
);
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
attrIndex += 6;
|
|
676
|
-
}
|
|
677
|
-
if (vertexFormat.normal) {
|
|
678
|
-
normals.set(topNormals);
|
|
679
|
-
for (i = 0; i < threeSize; i += 3) {
|
|
680
|
-
normals[i + threeSize] = -topNormals[i];
|
|
681
|
-
normals[i + threeSize + 1] = -topNormals[i + 1];
|
|
682
|
-
normals[i + threeSize + 2] = -topNormals[i + 2];
|
|
683
|
-
}
|
|
684
|
-
attributes.normal.values = normals;
|
|
685
|
-
} else {
|
|
686
|
-
attributes.normal = void 0;
|
|
687
|
-
}
|
|
688
|
-
if (vertexFormat.bitangent) {
|
|
689
|
-
bitangents.set(topBitangents);
|
|
690
|
-
bitangents.set(topBitangents, threeSize);
|
|
691
|
-
attributes.bitangent.values = bitangents;
|
|
692
|
-
} else {
|
|
693
|
-
attributes.bitangent = void 0;
|
|
694
|
-
}
|
|
695
|
-
if (vertexFormat.tangent) {
|
|
696
|
-
const topTangents = attributes.tangent.values;
|
|
697
|
-
tangents.set(topTangents);
|
|
698
|
-
tangents.set(topTangents, threeSize);
|
|
699
|
-
attributes.tangent.values = tangents;
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
if (vertexFormat.st) {
|
|
703
|
-
const topSt = attributes.st.values;
|
|
704
|
-
const st = new Float32Array(twoSize * 6);
|
|
705
|
-
st.set(topSt);
|
|
706
|
-
st.set(topSt, twoSize);
|
|
707
|
-
let index = twoSize * 2;
|
|
708
|
-
for (let j = 0; j < 2; j++) {
|
|
709
|
-
st[index++] = topSt[0];
|
|
710
|
-
st[index++] = topSt[1];
|
|
711
|
-
for (i = 2; i < twoSize; i += 2) {
|
|
712
|
-
const s = topSt[i];
|
|
713
|
-
const t = topSt[i + 1];
|
|
714
|
-
st[index++] = s;
|
|
715
|
-
st[index++] = t;
|
|
716
|
-
st[index++] = s;
|
|
717
|
-
st[index++] = t;
|
|
718
|
-
}
|
|
719
|
-
st[index++] = topSt[0];
|
|
720
|
-
st[index++] = topSt[1];
|
|
721
|
-
}
|
|
722
|
-
attributes.st.values = st;
|
|
723
|
-
}
|
|
724
|
-
return attributes;
|
|
725
|
-
}
|
|
726
|
-
function addWallPositions(positions, index, wallPositions) {
|
|
727
|
-
wallPositions[index++] = positions[0];
|
|
728
|
-
wallPositions[index++] = positions[1];
|
|
729
|
-
wallPositions[index++] = positions[2];
|
|
730
|
-
for (let i = 3; i < positions.length; i += 3) {
|
|
731
|
-
const x = positions[i];
|
|
732
|
-
const y = positions[i + 1];
|
|
733
|
-
const z = positions[i + 2];
|
|
734
|
-
wallPositions[index++] = x;
|
|
735
|
-
wallPositions[index++] = y;
|
|
736
|
-
wallPositions[index++] = z;
|
|
737
|
-
wallPositions[index++] = x;
|
|
738
|
-
wallPositions[index++] = y;
|
|
739
|
-
wallPositions[index++] = z;
|
|
740
|
-
}
|
|
741
|
-
wallPositions[index++] = positions[0];
|
|
742
|
-
wallPositions[index++] = positions[1];
|
|
743
|
-
wallPositions[index++] = positions[2];
|
|
744
|
-
return wallPositions;
|
|
745
|
-
}
|
|
746
|
-
function computePositionsExtruded(params, vertexFormat) {
|
|
747
|
-
const topVertexFormat = new VertexFormat_default({
|
|
748
|
-
position: vertexFormat.position,
|
|
749
|
-
normal: vertexFormat.normal || vertexFormat.bitangent || params.shadowVolume,
|
|
750
|
-
tangent: vertexFormat.tangent,
|
|
751
|
-
bitangent: vertexFormat.normal || vertexFormat.bitangent,
|
|
752
|
-
st: vertexFormat.st
|
|
753
|
-
});
|
|
754
|
-
const ellipsoid = params.ellipsoid;
|
|
755
|
-
const computedPositions = CorridorGeometryLibrary_default.computePositions(params);
|
|
756
|
-
const attr = combine(computedPositions, topVertexFormat, ellipsoid);
|
|
757
|
-
const height = params.height;
|
|
758
|
-
const extrudedHeight = params.extrudedHeight;
|
|
759
|
-
let attributes = attr.attributes;
|
|
760
|
-
const indices = attr.indices;
|
|
761
|
-
let positions = attributes.position.values;
|
|
762
|
-
let length = positions.length;
|
|
763
|
-
const newPositions = new Float64Array(length * 6);
|
|
764
|
-
let extrudedPositions = new Float64Array(length);
|
|
765
|
-
extrudedPositions.set(positions);
|
|
766
|
-
let wallPositions = new Float64Array(length * 4);
|
|
767
|
-
positions = PolygonPipeline_default.scaleToGeodeticHeight(
|
|
768
|
-
positions,
|
|
769
|
-
height,
|
|
770
|
-
ellipsoid
|
|
771
|
-
);
|
|
772
|
-
wallPositions = addWallPositions(positions, 0, wallPositions);
|
|
773
|
-
extrudedPositions = PolygonPipeline_default.scaleToGeodeticHeight(
|
|
774
|
-
extrudedPositions,
|
|
775
|
-
extrudedHeight,
|
|
776
|
-
ellipsoid
|
|
777
|
-
);
|
|
778
|
-
wallPositions = addWallPositions(
|
|
779
|
-
extrudedPositions,
|
|
780
|
-
length * 2,
|
|
781
|
-
wallPositions
|
|
782
|
-
);
|
|
783
|
-
newPositions.set(positions);
|
|
784
|
-
newPositions.set(extrudedPositions, length);
|
|
785
|
-
newPositions.set(wallPositions, length * 2);
|
|
786
|
-
attributes.position.values = newPositions;
|
|
787
|
-
attributes = extrudedAttributes(attributes, vertexFormat);
|
|
788
|
-
let i;
|
|
789
|
-
const size = length / 3;
|
|
790
|
-
if (params.shadowVolume) {
|
|
791
|
-
const topNormals = attributes.normal.values;
|
|
792
|
-
length = topNormals.length;
|
|
793
|
-
let extrudeNormals = new Float32Array(length * 6);
|
|
794
|
-
for (i = 0; i < length; i++) {
|
|
795
|
-
topNormals[i] = -topNormals[i];
|
|
796
|
-
}
|
|
797
|
-
extrudeNormals.set(topNormals, length);
|
|
798
|
-
extrudeNormals = addWallPositions(topNormals, length * 4, extrudeNormals);
|
|
799
|
-
attributes.extrudeDirection = new GeometryAttribute_default({
|
|
800
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
801
|
-
componentsPerAttribute: 3,
|
|
802
|
-
values: extrudeNormals
|
|
803
|
-
});
|
|
804
|
-
if (!vertexFormat.normal) {
|
|
805
|
-
attributes.normal = void 0;
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
if (defined_default(params.offsetAttribute)) {
|
|
809
|
-
let applyOffset = new Uint8Array(size * 6);
|
|
810
|
-
if (params.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
|
|
811
|
-
applyOffset = applyOffset.fill(1, 0, size).fill(1, size * 2, size * 4);
|
|
812
|
-
} else {
|
|
813
|
-
const applyOffsetValue = params.offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
|
|
814
|
-
applyOffset = applyOffset.fill(applyOffsetValue);
|
|
815
|
-
}
|
|
816
|
-
attributes.applyOffset = new GeometryAttribute_default({
|
|
817
|
-
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
|
|
818
|
-
componentsPerAttribute: 1,
|
|
819
|
-
values: applyOffset
|
|
820
|
-
});
|
|
821
|
-
}
|
|
822
|
-
const iLength = indices.length;
|
|
823
|
-
const twoSize = size + size;
|
|
824
|
-
const newIndices = IndexDatatype_default.createTypedArray(
|
|
825
|
-
newPositions.length / 3,
|
|
826
|
-
iLength * 2 + twoSize * 3
|
|
827
|
-
);
|
|
828
|
-
newIndices.set(indices);
|
|
829
|
-
let index = iLength;
|
|
830
|
-
for (i = 0; i < iLength; i += 3) {
|
|
831
|
-
const v0 = indices[i];
|
|
832
|
-
const v1 = indices[i + 1];
|
|
833
|
-
const v2 = indices[i + 2];
|
|
834
|
-
newIndices[index++] = v2 + size;
|
|
835
|
-
newIndices[index++] = v1 + size;
|
|
836
|
-
newIndices[index++] = v0 + size;
|
|
837
|
-
}
|
|
838
|
-
let UL, LL, UR, LR;
|
|
839
|
-
for (i = 0; i < twoSize; i += 2) {
|
|
840
|
-
UL = i + twoSize;
|
|
841
|
-
LL = UL + twoSize;
|
|
842
|
-
UR = UL + 1;
|
|
843
|
-
LR = LL + 1;
|
|
844
|
-
newIndices[index++] = UL;
|
|
845
|
-
newIndices[index++] = LL;
|
|
846
|
-
newIndices[index++] = UR;
|
|
847
|
-
newIndices[index++] = UR;
|
|
848
|
-
newIndices[index++] = LL;
|
|
849
|
-
newIndices[index++] = LR;
|
|
850
|
-
}
|
|
851
|
-
return {
|
|
852
|
-
attributes,
|
|
853
|
-
indices: newIndices
|
|
854
|
-
};
|
|
855
|
-
}
|
|
856
|
-
var scratchCartesian1 = new Cartesian3_default();
|
|
857
|
-
var scratchCartesian2 = new Cartesian3_default();
|
|
858
|
-
var scratchCartographic = new Cartographic_default();
|
|
859
|
-
function computeOffsetPoints(position1, position2, ellipsoid, halfWidth, min, max) {
|
|
860
|
-
const direction = Cartesian3_default.subtract(
|
|
861
|
-
position2,
|
|
862
|
-
position1,
|
|
863
|
-
scratchCartesian1
|
|
864
|
-
);
|
|
865
|
-
Cartesian3_default.normalize(direction, direction);
|
|
866
|
-
const normal = ellipsoid.geodeticSurfaceNormal(position1, scratchCartesian2);
|
|
867
|
-
const offsetDirection = Cartesian3_default.cross(
|
|
868
|
-
direction,
|
|
869
|
-
normal,
|
|
870
|
-
scratchCartesian1
|
|
871
|
-
);
|
|
872
|
-
Cartesian3_default.multiplyByScalar(offsetDirection, halfWidth, offsetDirection);
|
|
873
|
-
let minLat = min.latitude;
|
|
874
|
-
let minLon = min.longitude;
|
|
875
|
-
let maxLat = max.latitude;
|
|
876
|
-
let maxLon = max.longitude;
|
|
877
|
-
Cartesian3_default.add(position1, offsetDirection, scratchCartesian2);
|
|
878
|
-
ellipsoid.cartesianToCartographic(scratchCartesian2, scratchCartographic);
|
|
879
|
-
let lat = scratchCartographic.latitude;
|
|
880
|
-
let lon = scratchCartographic.longitude;
|
|
881
|
-
minLat = Math.min(minLat, lat);
|
|
882
|
-
minLon = Math.min(minLon, lon);
|
|
883
|
-
maxLat = Math.max(maxLat, lat);
|
|
884
|
-
maxLon = Math.max(maxLon, lon);
|
|
885
|
-
Cartesian3_default.subtract(position1, offsetDirection, scratchCartesian2);
|
|
886
|
-
ellipsoid.cartesianToCartographic(scratchCartesian2, scratchCartographic);
|
|
887
|
-
lat = scratchCartographic.latitude;
|
|
888
|
-
lon = scratchCartographic.longitude;
|
|
889
|
-
minLat = Math.min(minLat, lat);
|
|
890
|
-
minLon = Math.min(minLon, lon);
|
|
891
|
-
maxLat = Math.max(maxLat, lat);
|
|
892
|
-
maxLon = Math.max(maxLon, lon);
|
|
893
|
-
min.latitude = minLat;
|
|
894
|
-
min.longitude = minLon;
|
|
895
|
-
max.latitude = maxLat;
|
|
896
|
-
max.longitude = maxLon;
|
|
897
|
-
}
|
|
898
|
-
var scratchCartesianOffset = new Cartesian3_default();
|
|
899
|
-
var scratchCartesianEnds = new Cartesian3_default();
|
|
900
|
-
var scratchCartographicMin = new Cartographic_default();
|
|
901
|
-
var scratchCartographicMax = new Cartographic_default();
|
|
902
|
-
function computeRectangle(positions, ellipsoid, width, cornerType, result) {
|
|
903
|
-
positions = scaleToSurface(positions, ellipsoid);
|
|
904
|
-
const cleanPositions = arrayRemoveDuplicates_default(
|
|
905
|
-
positions,
|
|
906
|
-
Cartesian3_default.equalsEpsilon
|
|
907
|
-
);
|
|
908
|
-
const length = cleanPositions.length;
|
|
909
|
-
if (length < 2 || width <= 0) {
|
|
910
|
-
return new Rectangle_default();
|
|
911
|
-
}
|
|
912
|
-
const halfWidth = width * 0.5;
|
|
913
|
-
scratchCartographicMin.latitude = Number.POSITIVE_INFINITY;
|
|
914
|
-
scratchCartographicMin.longitude = Number.POSITIVE_INFINITY;
|
|
915
|
-
scratchCartographicMax.latitude = Number.NEGATIVE_INFINITY;
|
|
916
|
-
scratchCartographicMax.longitude = Number.NEGATIVE_INFINITY;
|
|
917
|
-
let lat, lon;
|
|
918
|
-
if (cornerType === CornerType_default.ROUNDED) {
|
|
919
|
-
const first = cleanPositions[0];
|
|
920
|
-
Cartesian3_default.subtract(first, cleanPositions[1], scratchCartesianOffset);
|
|
921
|
-
Cartesian3_default.normalize(scratchCartesianOffset, scratchCartesianOffset);
|
|
922
|
-
Cartesian3_default.multiplyByScalar(
|
|
923
|
-
scratchCartesianOffset,
|
|
924
|
-
halfWidth,
|
|
925
|
-
scratchCartesianOffset
|
|
926
|
-
);
|
|
927
|
-
Cartesian3_default.add(first, scratchCartesianOffset, scratchCartesianEnds);
|
|
928
|
-
ellipsoid.cartesianToCartographic(
|
|
929
|
-
scratchCartesianEnds,
|
|
930
|
-
scratchCartographic
|
|
931
|
-
);
|
|
932
|
-
lat = scratchCartographic.latitude;
|
|
933
|
-
lon = scratchCartographic.longitude;
|
|
934
|
-
scratchCartographicMin.latitude = Math.min(
|
|
935
|
-
scratchCartographicMin.latitude,
|
|
936
|
-
lat
|
|
937
|
-
);
|
|
938
|
-
scratchCartographicMin.longitude = Math.min(
|
|
939
|
-
scratchCartographicMin.longitude,
|
|
940
|
-
lon
|
|
941
|
-
);
|
|
942
|
-
scratchCartographicMax.latitude = Math.max(
|
|
943
|
-
scratchCartographicMax.latitude,
|
|
944
|
-
lat
|
|
945
|
-
);
|
|
946
|
-
scratchCartographicMax.longitude = Math.max(
|
|
947
|
-
scratchCartographicMax.longitude,
|
|
948
|
-
lon
|
|
949
|
-
);
|
|
950
|
-
}
|
|
951
|
-
for (let i = 0; i < length - 1; ++i) {
|
|
952
|
-
computeOffsetPoints(
|
|
953
|
-
cleanPositions[i],
|
|
954
|
-
cleanPositions[i + 1],
|
|
955
|
-
ellipsoid,
|
|
956
|
-
halfWidth,
|
|
957
|
-
scratchCartographicMin,
|
|
958
|
-
scratchCartographicMax
|
|
959
|
-
);
|
|
960
|
-
}
|
|
961
|
-
const last = cleanPositions[length - 1];
|
|
962
|
-
Cartesian3_default.subtract(last, cleanPositions[length - 2], scratchCartesianOffset);
|
|
963
|
-
Cartesian3_default.normalize(scratchCartesianOffset, scratchCartesianOffset);
|
|
964
|
-
Cartesian3_default.multiplyByScalar(
|
|
965
|
-
scratchCartesianOffset,
|
|
966
|
-
halfWidth,
|
|
967
|
-
scratchCartesianOffset
|
|
968
|
-
);
|
|
969
|
-
Cartesian3_default.add(last, scratchCartesianOffset, scratchCartesianEnds);
|
|
970
|
-
computeOffsetPoints(
|
|
971
|
-
last,
|
|
972
|
-
scratchCartesianEnds,
|
|
973
|
-
ellipsoid,
|
|
974
|
-
halfWidth,
|
|
975
|
-
scratchCartographicMin,
|
|
976
|
-
scratchCartographicMax
|
|
977
|
-
);
|
|
978
|
-
if (cornerType === CornerType_default.ROUNDED) {
|
|
979
|
-
ellipsoid.cartesianToCartographic(
|
|
980
|
-
scratchCartesianEnds,
|
|
981
|
-
scratchCartographic
|
|
982
|
-
);
|
|
983
|
-
lat = scratchCartographic.latitude;
|
|
984
|
-
lon = scratchCartographic.longitude;
|
|
985
|
-
scratchCartographicMin.latitude = Math.min(
|
|
986
|
-
scratchCartographicMin.latitude,
|
|
987
|
-
lat
|
|
988
|
-
);
|
|
989
|
-
scratchCartographicMin.longitude = Math.min(
|
|
990
|
-
scratchCartographicMin.longitude,
|
|
991
|
-
lon
|
|
992
|
-
);
|
|
993
|
-
scratchCartographicMax.latitude = Math.max(
|
|
994
|
-
scratchCartographicMax.latitude,
|
|
995
|
-
lat
|
|
996
|
-
);
|
|
997
|
-
scratchCartographicMax.longitude = Math.max(
|
|
998
|
-
scratchCartographicMax.longitude,
|
|
999
|
-
lon
|
|
1000
|
-
);
|
|
1001
|
-
}
|
|
1002
|
-
const rectangle = defined_default(result) ? result : new Rectangle_default();
|
|
1003
|
-
rectangle.north = scratchCartographicMax.latitude;
|
|
1004
|
-
rectangle.south = scratchCartographicMin.latitude;
|
|
1005
|
-
rectangle.east = scratchCartographicMax.longitude;
|
|
1006
|
-
rectangle.west = scratchCartographicMin.longitude;
|
|
1007
|
-
return rectangle;
|
|
1008
|
-
}
|
|
1009
|
-
function CorridorGeometry(options) {
|
|
1010
|
-
options = options ?? Frozen_default.EMPTY_OBJECT;
|
|
1011
|
-
const positions = options.positions;
|
|
1012
|
-
const width = options.width;
|
|
1013
|
-
Check_default.defined("options.positions", positions);
|
|
1014
|
-
Check_default.defined("options.width", width);
|
|
1015
|
-
const height = options.height ?? 0;
|
|
1016
|
-
const extrudedHeight = options.extrudedHeight ?? height;
|
|
1017
|
-
this._positions = positions;
|
|
1018
|
-
this._ellipsoid = Ellipsoid_default.clone(options.ellipsoid ?? Ellipsoid_default.default);
|
|
1019
|
-
this._vertexFormat = VertexFormat_default.clone(
|
|
1020
|
-
options.vertexFormat ?? VertexFormat_default.DEFAULT
|
|
1021
|
-
);
|
|
1022
|
-
this._width = width;
|
|
1023
|
-
this._height = Math.max(height, extrudedHeight);
|
|
1024
|
-
this._extrudedHeight = Math.min(height, extrudedHeight);
|
|
1025
|
-
this._cornerType = options.cornerType ?? CornerType_default.ROUNDED;
|
|
1026
|
-
this._granularity = options.granularity ?? Math_default.RADIANS_PER_DEGREE;
|
|
1027
|
-
this._shadowVolume = options.shadowVolume ?? false;
|
|
1028
|
-
this._workerName = "createCorridorGeometry";
|
|
1029
|
-
this._offsetAttribute = options.offsetAttribute;
|
|
1030
|
-
this._rectangle = void 0;
|
|
1031
|
-
this.packedLength = 1 + positions.length * Cartesian3_default.packedLength + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + 7;
|
|
1032
|
-
}
|
|
1033
|
-
CorridorGeometry.pack = function(value, array, startingIndex) {
|
|
1034
|
-
Check_default.defined("value", value);
|
|
1035
|
-
Check_default.defined("array", array);
|
|
1036
|
-
startingIndex = startingIndex ?? 0;
|
|
1037
|
-
const positions = value._positions;
|
|
1038
|
-
const length = positions.length;
|
|
1039
|
-
array[startingIndex++] = length;
|
|
1040
|
-
for (let i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
|
|
1041
|
-
Cartesian3_default.pack(positions[i], array, startingIndex);
|
|
1042
|
-
}
|
|
1043
|
-
Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
|
|
1044
|
-
startingIndex += Ellipsoid_default.packedLength;
|
|
1045
|
-
VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
|
|
1046
|
-
startingIndex += VertexFormat_default.packedLength;
|
|
1047
|
-
array[startingIndex++] = value._width;
|
|
1048
|
-
array[startingIndex++] = value._height;
|
|
1049
|
-
array[startingIndex++] = value._extrudedHeight;
|
|
1050
|
-
array[startingIndex++] = value._cornerType;
|
|
1051
|
-
array[startingIndex++] = value._granularity;
|
|
1052
|
-
array[startingIndex++] = value._shadowVolume ? 1 : 0;
|
|
1053
|
-
array[startingIndex] = value._offsetAttribute ?? -1;
|
|
1054
|
-
return array;
|
|
1055
|
-
};
|
|
1056
|
-
var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
|
|
1057
|
-
var scratchVertexFormat = new VertexFormat_default();
|
|
1058
|
-
var scratchOptions = {
|
|
1059
|
-
positions: void 0,
|
|
1060
|
-
ellipsoid: scratchEllipsoid,
|
|
1061
|
-
vertexFormat: scratchVertexFormat,
|
|
1062
|
-
width: void 0,
|
|
1063
|
-
height: void 0,
|
|
1064
|
-
extrudedHeight: void 0,
|
|
1065
|
-
cornerType: void 0,
|
|
1066
|
-
granularity: void 0,
|
|
1067
|
-
shadowVolume: void 0,
|
|
1068
|
-
offsetAttribute: void 0
|
|
1069
|
-
};
|
|
1070
|
-
CorridorGeometry.unpack = function(array, startingIndex, result) {
|
|
1071
|
-
Check_default.defined("array", array);
|
|
1072
|
-
startingIndex = startingIndex ?? 0;
|
|
1073
|
-
const length = array[startingIndex++];
|
|
1074
|
-
const positions = new Array(length);
|
|
1075
|
-
for (let i = 0; i < length; ++i, startingIndex += Cartesian3_default.packedLength) {
|
|
1076
|
-
positions[i] = Cartesian3_default.unpack(array, startingIndex);
|
|
1077
|
-
}
|
|
1078
|
-
const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
|
|
1079
|
-
startingIndex += Ellipsoid_default.packedLength;
|
|
1080
|
-
const vertexFormat = VertexFormat_default.unpack(
|
|
1081
|
-
array,
|
|
1082
|
-
startingIndex,
|
|
1083
|
-
scratchVertexFormat
|
|
1084
|
-
);
|
|
1085
|
-
startingIndex += VertexFormat_default.packedLength;
|
|
1086
|
-
const width = array[startingIndex++];
|
|
1087
|
-
const height = array[startingIndex++];
|
|
1088
|
-
const extrudedHeight = array[startingIndex++];
|
|
1089
|
-
const cornerType = array[startingIndex++];
|
|
1090
|
-
const granularity = array[startingIndex++];
|
|
1091
|
-
const shadowVolume = array[startingIndex++] === 1;
|
|
1092
|
-
const offsetAttribute = array[startingIndex];
|
|
1093
|
-
if (!defined_default(result)) {
|
|
1094
|
-
scratchOptions.positions = positions;
|
|
1095
|
-
scratchOptions.width = width;
|
|
1096
|
-
scratchOptions.height = height;
|
|
1097
|
-
scratchOptions.extrudedHeight = extrudedHeight;
|
|
1098
|
-
scratchOptions.cornerType = cornerType;
|
|
1099
|
-
scratchOptions.granularity = granularity;
|
|
1100
|
-
scratchOptions.shadowVolume = shadowVolume;
|
|
1101
|
-
scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
|
|
1102
|
-
return new CorridorGeometry(scratchOptions);
|
|
1103
|
-
}
|
|
1104
|
-
result._positions = positions;
|
|
1105
|
-
result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
|
|
1106
|
-
result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
|
|
1107
|
-
result._width = width;
|
|
1108
|
-
result._height = height;
|
|
1109
|
-
result._extrudedHeight = extrudedHeight;
|
|
1110
|
-
result._cornerType = cornerType;
|
|
1111
|
-
result._granularity = granularity;
|
|
1112
|
-
result._shadowVolume = shadowVolume;
|
|
1113
|
-
result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
|
|
1114
|
-
return result;
|
|
1115
|
-
};
|
|
1116
|
-
CorridorGeometry.computeRectangle = function(options, result) {
|
|
1117
|
-
options = options ?? Frozen_default.EMPTY_OBJECT;
|
|
1118
|
-
const positions = options.positions;
|
|
1119
|
-
const width = options.width;
|
|
1120
|
-
Check_default.defined("options.positions", positions);
|
|
1121
|
-
Check_default.defined("options.width", width);
|
|
1122
|
-
const ellipsoid = options.ellipsoid ?? Ellipsoid_default.default;
|
|
1123
|
-
const cornerType = options.cornerType ?? CornerType_default.ROUNDED;
|
|
1124
|
-
return computeRectangle(positions, ellipsoid, width, cornerType, result);
|
|
1125
|
-
};
|
|
1126
|
-
CorridorGeometry.createGeometry = function(corridorGeometry) {
|
|
1127
|
-
let positions = corridorGeometry._positions;
|
|
1128
|
-
const width = corridorGeometry._width;
|
|
1129
|
-
const ellipsoid = corridorGeometry._ellipsoid;
|
|
1130
|
-
positions = scaleToSurface(positions, ellipsoid);
|
|
1131
|
-
const cleanPositions = arrayRemoveDuplicates_default(
|
|
1132
|
-
positions,
|
|
1133
|
-
Cartesian3_default.equalsEpsilon
|
|
1134
|
-
);
|
|
1135
|
-
if (cleanPositions.length < 2 || width <= 0) {
|
|
1136
|
-
return;
|
|
1137
|
-
}
|
|
1138
|
-
const height = corridorGeometry._height;
|
|
1139
|
-
const extrudedHeight = corridorGeometry._extrudedHeight;
|
|
1140
|
-
const extrude = !Math_default.equalsEpsilon(
|
|
1141
|
-
height,
|
|
1142
|
-
extrudedHeight,
|
|
1143
|
-
0,
|
|
1144
|
-
Math_default.EPSILON2
|
|
1145
|
-
);
|
|
1146
|
-
const vertexFormat = corridorGeometry._vertexFormat;
|
|
1147
|
-
const params = {
|
|
1148
|
-
ellipsoid,
|
|
1149
|
-
positions: cleanPositions,
|
|
1150
|
-
width,
|
|
1151
|
-
cornerType: corridorGeometry._cornerType,
|
|
1152
|
-
granularity: corridorGeometry._granularity,
|
|
1153
|
-
saveAttributes: true
|
|
1154
|
-
};
|
|
1155
|
-
let attr;
|
|
1156
|
-
if (extrude) {
|
|
1157
|
-
params.height = height;
|
|
1158
|
-
params.extrudedHeight = extrudedHeight;
|
|
1159
|
-
params.shadowVolume = corridorGeometry._shadowVolume;
|
|
1160
|
-
params.offsetAttribute = corridorGeometry._offsetAttribute;
|
|
1161
|
-
attr = computePositionsExtruded(params, vertexFormat);
|
|
1162
|
-
} else {
|
|
1163
|
-
const computedPositions = CorridorGeometryLibrary_default.computePositions(params);
|
|
1164
|
-
attr = combine(computedPositions, vertexFormat, ellipsoid);
|
|
1165
|
-
attr.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
|
|
1166
|
-
attr.attributes.position.values,
|
|
1167
|
-
height,
|
|
1168
|
-
ellipsoid
|
|
1169
|
-
);
|
|
1170
|
-
if (defined_default(corridorGeometry._offsetAttribute)) {
|
|
1171
|
-
const applyOffsetValue = corridorGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
|
|
1172
|
-
const length = attr.attributes.position.values.length;
|
|
1173
|
-
const applyOffset = new Uint8Array(length / 3).fill(applyOffsetValue);
|
|
1174
|
-
attr.attributes.applyOffset = new GeometryAttribute_default({
|
|
1175
|
-
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
|
|
1176
|
-
componentsPerAttribute: 1,
|
|
1177
|
-
values: applyOffset
|
|
1178
|
-
});
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
const attributes = attr.attributes;
|
|
1182
|
-
const boundingSphere = BoundingSphere_default.fromVertices(
|
|
1183
|
-
attributes.position.values,
|
|
1184
|
-
void 0,
|
|
1185
|
-
3
|
|
1186
|
-
);
|
|
1187
|
-
if (!vertexFormat.position) {
|
|
1188
|
-
attr.attributes.position.values = void 0;
|
|
1189
|
-
}
|
|
1190
|
-
return new Geometry_default({
|
|
1191
|
-
attributes,
|
|
1192
|
-
indices: attr.indices,
|
|
1193
|
-
primitiveType: PrimitiveType_default.TRIANGLES,
|
|
1194
|
-
boundingSphere,
|
|
1195
|
-
offsetAttribute: corridorGeometry._offsetAttribute
|
|
1196
|
-
});
|
|
1197
|
-
};
|
|
1198
|
-
CorridorGeometry.createShadowVolume = function(corridorGeometry, minHeightFunc, maxHeightFunc) {
|
|
1199
|
-
const granularity = corridorGeometry._granularity;
|
|
1200
|
-
const ellipsoid = corridorGeometry._ellipsoid;
|
|
1201
|
-
const minHeight = minHeightFunc(granularity, ellipsoid);
|
|
1202
|
-
const maxHeight = maxHeightFunc(granularity, ellipsoid);
|
|
1203
|
-
return new CorridorGeometry({
|
|
1204
|
-
positions: corridorGeometry._positions,
|
|
1205
|
-
width: corridorGeometry._width,
|
|
1206
|
-
cornerType: corridorGeometry._cornerType,
|
|
1207
|
-
ellipsoid,
|
|
1208
|
-
granularity,
|
|
1209
|
-
extrudedHeight: minHeight,
|
|
1210
|
-
height: maxHeight,
|
|
1211
|
-
vertexFormat: VertexFormat_default.POSITION_ONLY,
|
|
1212
|
-
shadowVolume: true
|
|
1213
|
-
});
|
|
1214
|
-
};
|
|
1215
|
-
Object.defineProperties(CorridorGeometry.prototype, {
|
|
1216
|
-
/**
|
|
1217
|
-
* @private
|
|
1218
|
-
*/
|
|
1219
|
-
rectangle: {
|
|
1220
|
-
get: function() {
|
|
1221
|
-
if (!defined_default(this._rectangle)) {
|
|
1222
|
-
this._rectangle = computeRectangle(
|
|
1223
|
-
this._positions,
|
|
1224
|
-
this._ellipsoid,
|
|
1225
|
-
this._width,
|
|
1226
|
-
this._cornerType
|
|
1227
|
-
);
|
|
1228
|
-
}
|
|
1229
|
-
return this._rectangle;
|
|
1230
|
-
}
|
|
1231
|
-
},
|
|
1232
|
-
/**
|
|
1233
|
-
* For remapping texture coordinates when rendering CorridorGeometries as GroundPrimitives.
|
|
1234
|
-
*
|
|
1235
|
-
* Corridors don't support stRotation,
|
|
1236
|
-
* so just return the corners of the original system.
|
|
1237
|
-
* @private
|
|
1238
|
-
*/
|
|
1239
|
-
textureCoordinateRotationPoints: {
|
|
1240
|
-
get: function() {
|
|
1241
|
-
return [0, 0, 0, 1, 1, 0];
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
});
|
|
1245
|
-
var CorridorGeometry_default = CorridorGeometry;
|
|
1246
|
-
|
|
1247
|
-
// packages/engine/Source/Workers/createCorridorGeometry.js
|
|
1248
|
-
function createCorridorGeometry(corridorGeometry, offset) {
|
|
1249
|
-
if (defined_default(offset)) {
|
|
1250
|
-
corridorGeometry = CorridorGeometry_default.unpack(corridorGeometry, offset);
|
|
1251
|
-
}
|
|
1252
|
-
corridorGeometry._ellipsoid = Ellipsoid_default.clone(corridorGeometry._ellipsoid);
|
|
1253
|
-
return CorridorGeometry_default.createGeometry(corridorGeometry);
|
|
1254
|
-
}
|
|
1255
|
-
var createCorridorGeometry_default = createCorridorGeometry;
|
|
1256
|
-
export {
|
|
1257
|
-
createCorridorGeometry_default as default
|
|
1258
|
-
};
|