@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,505 +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
|
-
BoundingRectangle_default
|
|
28
|
-
} from "./chunk-EDIUN7V3.js";
|
|
29
|
-
import {
|
|
30
|
-
CoplanarPolygonGeometryLibrary_default
|
|
31
|
-
} from "./chunk-245NZYCR.js";
|
|
32
|
-
import "./chunk-25BA4527.js";
|
|
33
|
-
import {
|
|
34
|
-
PolygonGeometryLibrary_default
|
|
35
|
-
} from "./chunk-7B23DD46.js";
|
|
36
|
-
import "./chunk-X65Y2JSA.js";
|
|
37
|
-
import {
|
|
38
|
-
GeometryInstance_default
|
|
39
|
-
} from "./chunk-SBFTVHRW.js";
|
|
40
|
-
import {
|
|
41
|
-
GeometryPipeline_default
|
|
42
|
-
} from "./chunk-PV5B2YNB.js";
|
|
43
|
-
import "./chunk-6LZBBEA7.js";
|
|
44
|
-
import "./chunk-75UGCVME.js";
|
|
45
|
-
import {
|
|
46
|
-
VertexFormat_default
|
|
47
|
-
} from "./chunk-I76SRIKN.js";
|
|
48
|
-
import "./chunk-WAS3IHIQ.js";
|
|
49
|
-
import "./chunk-K4IMD7KH.js";
|
|
50
|
-
import {
|
|
51
|
-
PolygonPipeline_default
|
|
52
|
-
} from "./chunk-WO5ZNC7S.js";
|
|
53
|
-
import {
|
|
54
|
-
arrayRemoveDuplicates_default
|
|
55
|
-
} from "./chunk-HAY6YE7M.js";
|
|
56
|
-
import "./chunk-FVYRV2T6.js";
|
|
57
|
-
import "./chunk-66YGZWBI.js";
|
|
58
|
-
import "./chunk-J4MIJCN5.js";
|
|
59
|
-
import {
|
|
60
|
-
IndexDatatype_default
|
|
61
|
-
} from "./chunk-55IROWAX.js";
|
|
62
|
-
import {
|
|
63
|
-
GeometryAttributes_default
|
|
64
|
-
} from "./chunk-BOV6T7FO.js";
|
|
65
|
-
import {
|
|
66
|
-
GeometryAttribute_default,
|
|
67
|
-
Geometry_default,
|
|
68
|
-
PrimitiveType_default
|
|
69
|
-
} from "./chunk-XOVHLPKW.js";
|
|
70
|
-
import {
|
|
71
|
-
BoundingSphere_default
|
|
72
|
-
} from "./chunk-OAOREOSO.js";
|
|
73
|
-
import "./chunk-EKMWNF4U.js";
|
|
74
|
-
import {
|
|
75
|
-
Quaternion_default
|
|
76
|
-
} from "./chunk-KQIZ7AFF.js";
|
|
77
|
-
import "./chunk-POY6ZE32.js";
|
|
78
|
-
import {
|
|
79
|
-
ComponentDatatype_default
|
|
80
|
-
} from "./chunk-AL22JVIA.js";
|
|
81
|
-
import "./chunk-5VZISKJF.js";
|
|
82
|
-
import "./chunk-UYT2PBMV.js";
|
|
83
|
-
import {
|
|
84
|
-
Cartesian2_default,
|
|
85
|
-
Ellipsoid_default
|
|
86
|
-
} from "./chunk-YPGJSFOO.js";
|
|
87
|
-
import {
|
|
88
|
-
Cartesian3_default,
|
|
89
|
-
Frozen_default,
|
|
90
|
-
Matrix3_default
|
|
91
|
-
} from "./chunk-QWV2DM66.js";
|
|
92
|
-
import {
|
|
93
|
-
Math_default
|
|
94
|
-
} from "./chunk-6XJO625E.js";
|
|
95
|
-
import {
|
|
96
|
-
Check_default
|
|
97
|
-
} from "./chunk-KH2OWUUA.js";
|
|
98
|
-
import {
|
|
99
|
-
defined_default
|
|
100
|
-
} from "./chunk-AVSQILVI.js";
|
|
101
|
-
|
|
102
|
-
// packages/engine/Source/Core/CoplanarPolygonGeometry.js
|
|
103
|
-
var scratchPosition = new Cartesian3_default();
|
|
104
|
-
var scratchBR = new BoundingRectangle_default();
|
|
105
|
-
var stScratch = new Cartesian2_default();
|
|
106
|
-
var textureCoordinatesOrigin = new Cartesian2_default();
|
|
107
|
-
var scratchNormal = new Cartesian3_default();
|
|
108
|
-
var scratchTangent = new Cartesian3_default();
|
|
109
|
-
var scratchBitangent = new Cartesian3_default();
|
|
110
|
-
var centerScratch = new Cartesian3_default();
|
|
111
|
-
var axis1Scratch = new Cartesian3_default();
|
|
112
|
-
var axis2Scratch = new Cartesian3_default();
|
|
113
|
-
var quaternionScratch = new Quaternion_default();
|
|
114
|
-
var textureMatrixScratch = new Matrix3_default();
|
|
115
|
-
var tangentRotationScratch = new Matrix3_default();
|
|
116
|
-
var surfaceNormalScratch = new Cartesian3_default();
|
|
117
|
-
function createGeometryFromPolygon(polygon, vertexFormat, boundingRectangle, stRotation, hardcodedTextureCoordinates, projectPointTo2D, normal, tangent, bitangent) {
|
|
118
|
-
const positions = polygon.positions;
|
|
119
|
-
let indices = PolygonPipeline_default.triangulate(polygon.positions2D, polygon.holes);
|
|
120
|
-
if (indices.length < 3) {
|
|
121
|
-
indices = [0, 1, 2];
|
|
122
|
-
}
|
|
123
|
-
const newIndices = IndexDatatype_default.createTypedArray(
|
|
124
|
-
positions.length,
|
|
125
|
-
indices.length
|
|
126
|
-
);
|
|
127
|
-
newIndices.set(indices);
|
|
128
|
-
let textureMatrix = textureMatrixScratch;
|
|
129
|
-
if (stRotation !== 0) {
|
|
130
|
-
let rotation = Quaternion_default.fromAxisAngle(
|
|
131
|
-
normal,
|
|
132
|
-
stRotation,
|
|
133
|
-
quaternionScratch
|
|
134
|
-
);
|
|
135
|
-
textureMatrix = Matrix3_default.fromQuaternion(rotation, textureMatrix);
|
|
136
|
-
if (vertexFormat.tangent || vertexFormat.bitangent) {
|
|
137
|
-
rotation = Quaternion_default.fromAxisAngle(
|
|
138
|
-
normal,
|
|
139
|
-
-stRotation,
|
|
140
|
-
quaternionScratch
|
|
141
|
-
);
|
|
142
|
-
const tangentRotation = Matrix3_default.fromQuaternion(
|
|
143
|
-
rotation,
|
|
144
|
-
tangentRotationScratch
|
|
145
|
-
);
|
|
146
|
-
tangent = Cartesian3_default.normalize(
|
|
147
|
-
Matrix3_default.multiplyByVector(tangentRotation, tangent, tangent),
|
|
148
|
-
tangent
|
|
149
|
-
);
|
|
150
|
-
if (vertexFormat.bitangent) {
|
|
151
|
-
bitangent = Cartesian3_default.normalize(
|
|
152
|
-
Cartesian3_default.cross(normal, tangent, bitangent),
|
|
153
|
-
bitangent
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
} else {
|
|
158
|
-
textureMatrix = Matrix3_default.clone(Matrix3_default.IDENTITY, textureMatrix);
|
|
159
|
-
}
|
|
160
|
-
const stOrigin = textureCoordinatesOrigin;
|
|
161
|
-
if (vertexFormat.st) {
|
|
162
|
-
stOrigin.x = boundingRectangle.x;
|
|
163
|
-
stOrigin.y = boundingRectangle.y;
|
|
164
|
-
}
|
|
165
|
-
const length = positions.length;
|
|
166
|
-
const size = length * 3;
|
|
167
|
-
const flatPositions = new Float64Array(size);
|
|
168
|
-
const normals = vertexFormat.normal ? new Float32Array(size) : void 0;
|
|
169
|
-
const tangents = vertexFormat.tangent ? new Float32Array(size) : void 0;
|
|
170
|
-
const bitangents = vertexFormat.bitangent ? new Float32Array(size) : void 0;
|
|
171
|
-
const textureCoordinates = vertexFormat.st ? new Float32Array(length * 2) : void 0;
|
|
172
|
-
let positionIndex = 0;
|
|
173
|
-
let normalIndex = 0;
|
|
174
|
-
let bitangentIndex = 0;
|
|
175
|
-
let tangentIndex = 0;
|
|
176
|
-
let stIndex = 0;
|
|
177
|
-
for (let i = 0; i < length; i++) {
|
|
178
|
-
const position = positions[i];
|
|
179
|
-
flatPositions[positionIndex++] = position.x;
|
|
180
|
-
flatPositions[positionIndex++] = position.y;
|
|
181
|
-
flatPositions[positionIndex++] = position.z;
|
|
182
|
-
if (vertexFormat.st) {
|
|
183
|
-
if (defined_default(hardcodedTextureCoordinates) && hardcodedTextureCoordinates.positions.length === length) {
|
|
184
|
-
textureCoordinates[stIndex++] = hardcodedTextureCoordinates.positions[i].x;
|
|
185
|
-
textureCoordinates[stIndex++] = hardcodedTextureCoordinates.positions[i].y;
|
|
186
|
-
} else {
|
|
187
|
-
const p = Matrix3_default.multiplyByVector(
|
|
188
|
-
textureMatrix,
|
|
189
|
-
position,
|
|
190
|
-
scratchPosition
|
|
191
|
-
);
|
|
192
|
-
const st = projectPointTo2D(p, stScratch);
|
|
193
|
-
Cartesian2_default.subtract(st, stOrigin, st);
|
|
194
|
-
const stx = Math_default.clamp(st.x / boundingRectangle.width, 0, 1);
|
|
195
|
-
const sty = Math_default.clamp(st.y / boundingRectangle.height, 0, 1);
|
|
196
|
-
textureCoordinates[stIndex++] = stx;
|
|
197
|
-
textureCoordinates[stIndex++] = sty;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
if (vertexFormat.normal) {
|
|
201
|
-
normals[normalIndex++] = normal.x;
|
|
202
|
-
normals[normalIndex++] = normal.y;
|
|
203
|
-
normals[normalIndex++] = normal.z;
|
|
204
|
-
}
|
|
205
|
-
if (vertexFormat.tangent) {
|
|
206
|
-
tangents[tangentIndex++] = tangent.x;
|
|
207
|
-
tangents[tangentIndex++] = tangent.y;
|
|
208
|
-
tangents[tangentIndex++] = tangent.z;
|
|
209
|
-
}
|
|
210
|
-
if (vertexFormat.bitangent) {
|
|
211
|
-
bitangents[bitangentIndex++] = bitangent.x;
|
|
212
|
-
bitangents[bitangentIndex++] = bitangent.y;
|
|
213
|
-
bitangents[bitangentIndex++] = bitangent.z;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
const attributes = new GeometryAttributes_default();
|
|
217
|
-
if (vertexFormat.position) {
|
|
218
|
-
attributes.position = new GeometryAttribute_default({
|
|
219
|
-
componentDatatype: ComponentDatatype_default.DOUBLE,
|
|
220
|
-
componentsPerAttribute: 3,
|
|
221
|
-
values: flatPositions
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
if (vertexFormat.normal) {
|
|
225
|
-
attributes.normal = new GeometryAttribute_default({
|
|
226
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
227
|
-
componentsPerAttribute: 3,
|
|
228
|
-
values: normals
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
if (vertexFormat.tangent) {
|
|
232
|
-
attributes.tangent = new GeometryAttribute_default({
|
|
233
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
234
|
-
componentsPerAttribute: 3,
|
|
235
|
-
values: tangents
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
if (vertexFormat.bitangent) {
|
|
239
|
-
attributes.bitangent = new GeometryAttribute_default({
|
|
240
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
241
|
-
componentsPerAttribute: 3,
|
|
242
|
-
values: bitangents
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
if (vertexFormat.st) {
|
|
246
|
-
attributes.st = new GeometryAttribute_default({
|
|
247
|
-
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
248
|
-
componentsPerAttribute: 2,
|
|
249
|
-
values: textureCoordinates
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
return new Geometry_default({
|
|
253
|
-
attributes,
|
|
254
|
-
indices: newIndices,
|
|
255
|
-
primitiveType: PrimitiveType_default.TRIANGLES
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
function CoplanarPolygonGeometry(options) {
|
|
259
|
-
options = options ?? Frozen_default.EMPTY_OBJECT;
|
|
260
|
-
const polygonHierarchy = options.polygonHierarchy;
|
|
261
|
-
const textureCoordinates = options.textureCoordinates;
|
|
262
|
-
Check_default.defined("options.polygonHierarchy", polygonHierarchy);
|
|
263
|
-
const vertexFormat = options.vertexFormat ?? VertexFormat_default.DEFAULT;
|
|
264
|
-
this._vertexFormat = VertexFormat_default.clone(vertexFormat);
|
|
265
|
-
this._polygonHierarchy = polygonHierarchy;
|
|
266
|
-
this._stRotation = options.stRotation ?? 0;
|
|
267
|
-
this._ellipsoid = Ellipsoid_default.clone(options.ellipsoid ?? Ellipsoid_default.default);
|
|
268
|
-
this._workerName = "createCoplanarPolygonGeometry";
|
|
269
|
-
this._textureCoordinates = textureCoordinates;
|
|
270
|
-
this.packedLength = PolygonGeometryLibrary_default.computeHierarchyPackedLength(
|
|
271
|
-
polygonHierarchy,
|
|
272
|
-
Cartesian3_default
|
|
273
|
-
) + VertexFormat_default.packedLength + Ellipsoid_default.packedLength + (defined_default(textureCoordinates) ? PolygonGeometryLibrary_default.computeHierarchyPackedLength(
|
|
274
|
-
textureCoordinates,
|
|
275
|
-
Cartesian2_default
|
|
276
|
-
) : 1) + 2;
|
|
277
|
-
}
|
|
278
|
-
CoplanarPolygonGeometry.fromPositions = function(options) {
|
|
279
|
-
options = options ?? Frozen_default.EMPTY_OBJECT;
|
|
280
|
-
Check_default.defined("options.positions", options.positions);
|
|
281
|
-
const newOptions = {
|
|
282
|
-
polygonHierarchy: {
|
|
283
|
-
positions: options.positions
|
|
284
|
-
},
|
|
285
|
-
vertexFormat: options.vertexFormat,
|
|
286
|
-
stRotation: options.stRotation,
|
|
287
|
-
ellipsoid: options.ellipsoid,
|
|
288
|
-
textureCoordinates: options.textureCoordinates
|
|
289
|
-
};
|
|
290
|
-
return new CoplanarPolygonGeometry(newOptions);
|
|
291
|
-
};
|
|
292
|
-
CoplanarPolygonGeometry.pack = function(value, array, startingIndex) {
|
|
293
|
-
Check_default.typeOf.object("value", value);
|
|
294
|
-
Check_default.defined("array", array);
|
|
295
|
-
startingIndex = startingIndex ?? 0;
|
|
296
|
-
startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
|
|
297
|
-
value._polygonHierarchy,
|
|
298
|
-
array,
|
|
299
|
-
startingIndex,
|
|
300
|
-
Cartesian3_default
|
|
301
|
-
);
|
|
302
|
-
Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
|
|
303
|
-
startingIndex += Ellipsoid_default.packedLength;
|
|
304
|
-
VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
|
|
305
|
-
startingIndex += VertexFormat_default.packedLength;
|
|
306
|
-
array[startingIndex++] = value._stRotation;
|
|
307
|
-
if (defined_default(value._textureCoordinates)) {
|
|
308
|
-
startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
|
|
309
|
-
value._textureCoordinates,
|
|
310
|
-
array,
|
|
311
|
-
startingIndex,
|
|
312
|
-
Cartesian2_default
|
|
313
|
-
);
|
|
314
|
-
} else {
|
|
315
|
-
array[startingIndex++] = -1;
|
|
316
|
-
}
|
|
317
|
-
array[startingIndex++] = value.packedLength;
|
|
318
|
-
return array;
|
|
319
|
-
};
|
|
320
|
-
var scratchEllipsoid = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
|
|
321
|
-
var scratchVertexFormat = new VertexFormat_default();
|
|
322
|
-
var scratchOptions = {
|
|
323
|
-
polygonHierarchy: {}
|
|
324
|
-
};
|
|
325
|
-
CoplanarPolygonGeometry.unpack = function(array, startingIndex, result) {
|
|
326
|
-
Check_default.defined("array", array);
|
|
327
|
-
startingIndex = startingIndex ?? 0;
|
|
328
|
-
const polygonHierarchy = PolygonGeometryLibrary_default.unpackPolygonHierarchy(
|
|
329
|
-
array,
|
|
330
|
-
startingIndex,
|
|
331
|
-
Cartesian3_default
|
|
332
|
-
);
|
|
333
|
-
startingIndex = polygonHierarchy.startingIndex;
|
|
334
|
-
delete polygonHierarchy.startingIndex;
|
|
335
|
-
const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
|
|
336
|
-
startingIndex += Ellipsoid_default.packedLength;
|
|
337
|
-
const vertexFormat = VertexFormat_default.unpack(
|
|
338
|
-
array,
|
|
339
|
-
startingIndex,
|
|
340
|
-
scratchVertexFormat
|
|
341
|
-
);
|
|
342
|
-
startingIndex += VertexFormat_default.packedLength;
|
|
343
|
-
const stRotation = array[startingIndex++];
|
|
344
|
-
const textureCoordinates = array[startingIndex] === -1 ? void 0 : PolygonGeometryLibrary_default.unpackPolygonHierarchy(
|
|
345
|
-
array,
|
|
346
|
-
startingIndex,
|
|
347
|
-
Cartesian2_default
|
|
348
|
-
);
|
|
349
|
-
if (defined_default(textureCoordinates)) {
|
|
350
|
-
startingIndex = textureCoordinates.startingIndex;
|
|
351
|
-
delete textureCoordinates.startingIndex;
|
|
352
|
-
} else {
|
|
353
|
-
startingIndex++;
|
|
354
|
-
}
|
|
355
|
-
const packedLength = array[startingIndex++];
|
|
356
|
-
if (!defined_default(result)) {
|
|
357
|
-
result = new CoplanarPolygonGeometry(scratchOptions);
|
|
358
|
-
}
|
|
359
|
-
result._polygonHierarchy = polygonHierarchy;
|
|
360
|
-
result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
|
|
361
|
-
result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
|
|
362
|
-
result._stRotation = stRotation;
|
|
363
|
-
result._textureCoordinates = textureCoordinates;
|
|
364
|
-
result.packedLength = packedLength;
|
|
365
|
-
return result;
|
|
366
|
-
};
|
|
367
|
-
CoplanarPolygonGeometry.createGeometry = function(polygonGeometry) {
|
|
368
|
-
const vertexFormat = polygonGeometry._vertexFormat;
|
|
369
|
-
const polygonHierarchy = polygonGeometry._polygonHierarchy;
|
|
370
|
-
const stRotation = polygonGeometry._stRotation;
|
|
371
|
-
const textureCoordinates = polygonGeometry._textureCoordinates;
|
|
372
|
-
const hasTextureCoordinates = defined_default(textureCoordinates);
|
|
373
|
-
let outerPositions = polygonHierarchy.positions;
|
|
374
|
-
outerPositions = arrayRemoveDuplicates_default(
|
|
375
|
-
outerPositions,
|
|
376
|
-
Cartesian3_default.equalsEpsilon,
|
|
377
|
-
true
|
|
378
|
-
);
|
|
379
|
-
if (outerPositions.length < 3) {
|
|
380
|
-
return;
|
|
381
|
-
}
|
|
382
|
-
let normal = scratchNormal;
|
|
383
|
-
let tangent = scratchTangent;
|
|
384
|
-
let bitangent = scratchBitangent;
|
|
385
|
-
let axis1 = axis1Scratch;
|
|
386
|
-
const axis2 = axis2Scratch;
|
|
387
|
-
const validGeometry = CoplanarPolygonGeometryLibrary_default.computeProjectTo2DArguments(
|
|
388
|
-
outerPositions,
|
|
389
|
-
centerScratch,
|
|
390
|
-
axis1,
|
|
391
|
-
axis2
|
|
392
|
-
);
|
|
393
|
-
if (!validGeometry) {
|
|
394
|
-
return void 0;
|
|
395
|
-
}
|
|
396
|
-
normal = Cartesian3_default.cross(axis1, axis2, normal);
|
|
397
|
-
normal = Cartesian3_default.normalize(normal, normal);
|
|
398
|
-
if (!Cartesian3_default.equalsEpsilon(
|
|
399
|
-
centerScratch,
|
|
400
|
-
Cartesian3_default.ZERO,
|
|
401
|
-
Math_default.EPSILON6
|
|
402
|
-
)) {
|
|
403
|
-
const surfaceNormal = polygonGeometry._ellipsoid.geodeticSurfaceNormal(
|
|
404
|
-
centerScratch,
|
|
405
|
-
surfaceNormalScratch
|
|
406
|
-
);
|
|
407
|
-
if (Cartesian3_default.dot(normal, surfaceNormal) < 0) {
|
|
408
|
-
normal = Cartesian3_default.negate(normal, normal);
|
|
409
|
-
axis1 = Cartesian3_default.negate(axis1, axis1);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
const projectPoints = CoplanarPolygonGeometryLibrary_default.createProjectPointsTo2DFunction(
|
|
413
|
-
centerScratch,
|
|
414
|
-
axis1,
|
|
415
|
-
axis2
|
|
416
|
-
);
|
|
417
|
-
const projectPoint = CoplanarPolygonGeometryLibrary_default.createProjectPointTo2DFunction(
|
|
418
|
-
centerScratch,
|
|
419
|
-
axis1,
|
|
420
|
-
axis2
|
|
421
|
-
);
|
|
422
|
-
if (vertexFormat.tangent) {
|
|
423
|
-
tangent = Cartesian3_default.clone(axis1, tangent);
|
|
424
|
-
}
|
|
425
|
-
if (vertexFormat.bitangent) {
|
|
426
|
-
bitangent = Cartesian3_default.clone(axis2, bitangent);
|
|
427
|
-
}
|
|
428
|
-
const results = PolygonGeometryLibrary_default.polygonsFromHierarchy(
|
|
429
|
-
polygonHierarchy,
|
|
430
|
-
hasTextureCoordinates,
|
|
431
|
-
projectPoints,
|
|
432
|
-
false
|
|
433
|
-
);
|
|
434
|
-
const hierarchy = results.hierarchy;
|
|
435
|
-
const polygons = results.polygons;
|
|
436
|
-
const dummyFunction = function(identity) {
|
|
437
|
-
return identity;
|
|
438
|
-
};
|
|
439
|
-
const textureCoordinatePolygons = hasTextureCoordinates ? PolygonGeometryLibrary_default.polygonsFromHierarchy(
|
|
440
|
-
textureCoordinates,
|
|
441
|
-
true,
|
|
442
|
-
dummyFunction,
|
|
443
|
-
false
|
|
444
|
-
).polygons : void 0;
|
|
445
|
-
if (hierarchy.length === 0) {
|
|
446
|
-
return;
|
|
447
|
-
}
|
|
448
|
-
outerPositions = hierarchy[0].outerRing;
|
|
449
|
-
const boundingSphere = BoundingSphere_default.fromPoints(outerPositions);
|
|
450
|
-
const boundingRectangle = PolygonGeometryLibrary_default.computeBoundingRectangle(
|
|
451
|
-
normal,
|
|
452
|
-
projectPoint,
|
|
453
|
-
outerPositions,
|
|
454
|
-
stRotation,
|
|
455
|
-
scratchBR
|
|
456
|
-
);
|
|
457
|
-
const geometries = [];
|
|
458
|
-
for (let i = 0; i < polygons.length; i++) {
|
|
459
|
-
const geometryInstance = new GeometryInstance_default({
|
|
460
|
-
geometry: createGeometryFromPolygon(
|
|
461
|
-
polygons[i],
|
|
462
|
-
vertexFormat,
|
|
463
|
-
boundingRectangle,
|
|
464
|
-
stRotation,
|
|
465
|
-
hasTextureCoordinates ? textureCoordinatePolygons[i] : void 0,
|
|
466
|
-
projectPoint,
|
|
467
|
-
normal,
|
|
468
|
-
tangent,
|
|
469
|
-
bitangent
|
|
470
|
-
)
|
|
471
|
-
});
|
|
472
|
-
geometries.push(geometryInstance);
|
|
473
|
-
}
|
|
474
|
-
const geometry = GeometryPipeline_default.combineInstances(geometries)[0];
|
|
475
|
-
geometry.attributes.position.values = new Float64Array(
|
|
476
|
-
geometry.attributes.position.values
|
|
477
|
-
);
|
|
478
|
-
geometry.indices = IndexDatatype_default.createTypedArray(
|
|
479
|
-
geometry.attributes.position.values.length / 3,
|
|
480
|
-
geometry.indices
|
|
481
|
-
);
|
|
482
|
-
const attributes = geometry.attributes;
|
|
483
|
-
if (!vertexFormat.position) {
|
|
484
|
-
delete attributes.position;
|
|
485
|
-
}
|
|
486
|
-
return new Geometry_default({
|
|
487
|
-
attributes,
|
|
488
|
-
indices: geometry.indices,
|
|
489
|
-
primitiveType: geometry.primitiveType,
|
|
490
|
-
boundingSphere
|
|
491
|
-
});
|
|
492
|
-
};
|
|
493
|
-
var CoplanarPolygonGeometry_default = CoplanarPolygonGeometry;
|
|
494
|
-
|
|
495
|
-
// packages/engine/Source/Workers/createCoplanarPolygonGeometry.js
|
|
496
|
-
function createCoplanarPolygonGeometry(polygonGeometry, offset) {
|
|
497
|
-
if (defined_default(offset)) {
|
|
498
|
-
polygonGeometry = CoplanarPolygonGeometry_default.unpack(polygonGeometry, offset);
|
|
499
|
-
}
|
|
500
|
-
return CoplanarPolygonGeometry_default.createGeometry(polygonGeometry);
|
|
501
|
-
}
|
|
502
|
-
var createCoplanarPolygonGeometry_default = createCoplanarPolygonGeometry;
|
|
503
|
-
export {
|
|
504
|
-
createCoplanarPolygonGeometry_default as default
|
|
505
|
-
};
|