@rtzh/engine 0.0.5 → 0.0.7
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/Build/Workers/chunk-243UEBJF.js +1045 -0
- package/Build/Workers/chunk-2UNHFFAZ.js +352 -0
- package/Build/Workers/chunk-2Y2KA6PM.js +387 -0
- package/Build/Workers/chunk-2ZXYLPPT.js +163 -0
- package/Build/Workers/chunk-32ZGDYJY.js +3514 -0
- package/Build/Workers/chunk-3NSMZ3XW.js +1067 -0
- package/Build/Workers/chunk-3WT5VKYM.js +101 -0
- package/Build/Workers/chunk-4DIL24GG.js +1460 -0
- package/Build/Workers/chunk-4FEDW3WT.js +299 -0
- package/Build/Workers/chunk-4IXXMXPJ.js +682 -0
- package/Build/Workers/chunk-4SC4KVID.js +692 -0
- package/Build/Workers/chunk-52UUGJQ6.js +288 -0
- package/Build/Workers/chunk-53AFSDGM.js +37 -0
- package/Build/Workers/chunk-54LZ6OUD.js +1067 -0
- package/Build/Workers/chunk-54SSO7NS.js +352 -0
- package/Build/Workers/chunk-565HBO3F.js +352 -0
- package/Build/Workers/chunk-5L3PEFKO.js +629 -0
- package/Build/Workers/chunk-5RMI6LFO.js +692 -0
- package/Build/Workers/chunk-5SVTAJRH.js +837 -0
- package/Build/Workers/chunk-5VDZEVQX.js +788 -0
- package/Build/Workers/chunk-5VWFNSLF.js +44 -0
- package/Build/Workers/chunk-5W4ISZGQ.js +1483 -0
- package/Build/Workers/chunk-5ZMMQ7HE.js +37 -0
- package/Build/Workers/chunk-64VDO4BW.js +114 -0
- package/Build/Workers/chunk-6AUSOZOL.js +476 -0
- package/Build/Workers/chunk-6BIU5AL4.js +692 -0
- package/Build/Workers/chunk-6KA3AJM6.js +455 -0
- package/Build/Workers/chunk-6MYDYE24.js +280 -0
- package/Build/Workers/chunk-6RUDXAFC.js +2719 -0
- package/Build/Workers/chunk-6YSUD2OH.js +219 -0
- package/Build/Workers/chunk-6YT2LZ3Z.js +1443 -0
- package/Build/Workers/chunk-73EGVDOC.js +398 -0
- package/Build/Workers/chunk-7BOVULMD.js +44 -0
- package/Build/Workers/chunk-7KOMCIWI.js +8366 -0
- package/Build/Workers/chunk-7MMYV5PM.js +288 -0
- package/Build/Workers/chunk-7QPQGSS3.js +57 -0
- package/Build/Workers/chunk-AEURJQ3B.js +73 -0
- package/Build/Workers/chunk-AMJRLIO3.js +414 -0
- package/Build/Workers/chunk-APOATHFZ.js +138 -0
- package/Build/Workers/chunk-AVNHAFMV.js +114 -0
- package/Build/Workers/chunk-AWMYTHW4.js +101 -0
- package/Build/Workers/chunk-BCYABDWF.js +3514 -0
- package/Build/Workers/chunk-BJHSYHOQ.js +97 -0
- package/Build/Workers/chunk-BM6ZG63T.js +171 -0
- package/Build/Workers/chunk-C3G2NDXM.js +162 -0
- package/Build/Workers/chunk-CTARL7CY.js +511 -0
- package/Build/Workers/chunk-DIA4J2DB.js +497 -0
- package/Build/Workers/chunk-E3NHG3TR.js +1460 -0
- package/Build/Workers/chunk-E5BSDIGY.js +139 -0
- package/Build/Workers/chunk-EDVAQGDJ.js +2719 -0
- package/Build/Workers/chunk-EFHDO3L2.js +102 -0
- package/Build/Workers/chunk-EJVGOIOW.js +1317 -0
- package/Build/Workers/chunk-EPVJ5OOH.js +8366 -0
- package/Build/Workers/chunk-ERYOZBVC.js +171 -0
- package/Build/Workers/chunk-ET7LWDHA.js +58 -0
- package/Build/Workers/chunk-EWDHM5NC.js +37 -0
- package/Build/Workers/chunk-F4Q3VOCC.js +1317 -0
- package/Build/Workers/chunk-FCSN7XOU.js +55 -0
- package/Build/Workers/chunk-FD62YGTB.js +219 -0
- package/Build/Workers/chunk-FHM3HFYM.js +1045 -0
- package/Build/Workers/chunk-FNI64UKI.js +57 -0
- package/Build/Workers/chunk-FRUZKVBP.js +352 -0
- package/Build/Workers/chunk-FSYQE5XE.js +55 -0
- package/Build/Workers/chunk-FYW5UQ24.js +837 -0
- package/Build/Workers/chunk-FYZVCB32.js +75 -0
- package/Build/Workers/chunk-G7PGTG3P.js +387 -0
- package/Build/Workers/chunk-GAQXLBFJ.js +1483 -0
- package/Build/Workers/chunk-GEH53ULL.js +299 -0
- package/Build/Workers/chunk-GLA2PT5T.js +476 -0
- package/Build/Workers/chunk-GWLEBUVI.js +2058 -0
- package/Build/Workers/chunk-GYIGOBV2.js +439 -0
- package/Build/Workers/chunk-GZMTBQM2.js +1443 -0
- package/Build/Workers/chunk-H2MM7FMU.js +1054 -0
- package/Build/Workers/chunk-H33FCT5U.js +940 -0
- package/Build/Workers/chunk-HAR6Y2HP.js +1800 -0
- package/Build/Workers/chunk-HBL3QZ2L.js +642 -0
- package/Build/Workers/chunk-HEKLTOOR.js +1443 -0
- package/Build/Workers/chunk-HM4MH5IG.js +138 -0
- package/Build/Workers/chunk-I5JHYEIE.js +241 -0
- package/Build/Workers/chunk-IB2XQV6U.js +101 -0
- package/Build/Workers/chunk-IC2JHDCI.js +114 -0
- package/Build/Workers/chunk-IEEHNZ36.js +241 -0
- package/Build/Workers/chunk-IRG63TBY.js +55 -0
- package/Build/Workers/chunk-IXM65GBF.js +256 -0
- package/Build/Workers/chunk-IY53MZW2.js +58 -0
- package/Build/Workers/chunk-IYAZCFAC.js +642 -0
- package/Build/Workers/chunk-J2CUNLQP.js +940 -0
- package/Build/Workers/chunk-J766O3PA.js +256 -0
- package/Build/Workers/chunk-JRPAFYGJ.js +1054 -0
- package/Build/Workers/chunk-JWEZXKBE.js +73 -0
- package/Build/Workers/chunk-KFOT2YV5.js +138 -0
- package/Build/Workers/chunk-KGQGZ7PF.js +778 -0
- package/Build/Workers/chunk-KMZXZUA7.js +1460 -0
- package/Build/Workers/chunk-KOVKY3HB.js +198 -0
- package/Build/Workers/chunk-KQ4ET526.js +163 -0
- package/Build/Workers/chunk-L2QIVAZV.js +3514 -0
- package/Build/Workers/chunk-LGMONS4O.js +1317 -0
- package/Build/Workers/chunk-LJHG4PJQ.js +305 -0
- package/Build/Workers/chunk-LNS36LUZ.js +2058 -0
- package/Build/Workers/chunk-LPJHTJDQ.js +305 -0
- package/Build/Workers/chunk-LRW2QXMW.js +352 -0
- package/Build/Workers/chunk-LUUEGFLT.js +305 -0
- package/Build/Workers/chunk-LW2VGHDM.js +1800 -0
- package/Build/Workers/chunk-LXM2ZC4V.js +288 -0
- package/Build/Workers/chunk-LXMLERGC.js +1067 -0
- package/Build/Workers/chunk-MEFWVMG6.js +788 -0
- package/Build/Workers/chunk-MJVNNURF.js +368 -0
- package/Build/Workers/chunk-MWN26ZEM.js +280 -0
- package/Build/Workers/chunk-NIWB6UMY.js +198 -0
- package/Build/Workers/chunk-NJEG7WRW.js +387 -0
- package/Build/Workers/chunk-O224ZEA5.js +58 -0
- package/Build/Workers/chunk-O5ICO3AS.js +682 -0
- package/Build/Workers/chunk-O5QH7XD5.js +629 -0
- package/Build/Workers/chunk-O6T3T3V3.js +97 -0
- package/Build/Workers/chunk-OBM2JYMG.js +75 -0
- package/Build/Workers/chunk-ODZZZGXK.js +219 -0
- package/Build/Workers/chunk-OFTWEOW2.js +1483 -0
- package/Build/Workers/chunk-OIJH6LAY.js +497 -0
- package/Build/Workers/chunk-OJFVD5ZS.js +778 -0
- package/Build/Workers/chunk-OJNPKCEL.js +73 -0
- package/Build/Workers/chunk-PQLZOYZE.js +642 -0
- package/Build/Workers/chunk-PU44PXY2.js +75 -0
- package/Build/Workers/chunk-Q36VXWGP.js +57 -0
- package/Build/Workers/chunk-Q4XPVYXJ.js +476 -0
- package/Build/Workers/chunk-QGXE4VZ3.js +55 -0
- package/Build/Workers/chunk-QIEHP7O4.js +280 -0
- package/Build/Workers/chunk-QY55DT53.js +97 -0
- package/Build/Workers/chunk-R3PTQZ6H.js +44 -0
- package/Build/Workers/chunk-RJVB3K2X.js +511 -0
- package/Build/Workers/chunk-RORZNBGJ.js +299 -0
- package/Build/Workers/chunk-RRBGLANL.js +55 -0
- package/Build/Workers/chunk-RT7PY6BH.js +2719 -0
- package/Build/Workers/chunk-SAD42JSM.js +102 -0
- package/Build/Workers/chunk-SBR7MW44.js +139 -0
- package/Build/Workers/chunk-SFM3GNS2.js +682 -0
- package/Build/Workers/chunk-SKXE77AM.js +139 -0
- package/Build/Workers/chunk-SLYUIIFB.js +455 -0
- package/Build/Workers/chunk-SQSWONTJ.js +241 -0
- package/Build/Workers/chunk-SRLJWNU2.js +368 -0
- package/Build/Workers/chunk-SZELHE7Q.js +163 -0
- package/Build/Workers/chunk-T4LDJBKR.js +124 -0
- package/Build/Workers/chunk-TBASKFFL.js +124 -0
- package/Build/Workers/chunk-TDGGEIZE.js +398 -0
- package/Build/Workers/chunk-TQ63SH2Z.js +352 -0
- package/Build/Workers/chunk-U3VI26GL.js +162 -0
- package/Build/Workers/chunk-U77FLUQF.js +368 -0
- package/Build/Workers/chunk-UIYQEJ5H.js +1054 -0
- package/Build/Workers/chunk-UJ72JOGF.js +511 -0
- package/Build/Workers/chunk-UY7I27VQ.js +1800 -0
- package/Build/Workers/chunk-VLB25GGE.js +439 -0
- package/Build/Workers/chunk-VVKDT4J7.js +837 -0
- package/Build/Workers/chunk-VXDOONLH.js +162 -0
- package/Build/Workers/chunk-W4DV7TAL.js +8366 -0
- package/Build/Workers/chunk-WFTPZ3ZX.js +788 -0
- package/Build/Workers/chunk-WLIQ26XU.js +455 -0
- package/Build/Workers/chunk-WOEPS2UA.js +171 -0
- package/Build/Workers/chunk-WWLWTSMV.js +55 -0
- package/Build/Workers/chunk-WX2ZANQC.js +940 -0
- package/Build/Workers/chunk-XEB4GEXW.js +629 -0
- package/Build/Workers/chunk-XFKTM6GN.js +2058 -0
- package/Build/Workers/chunk-XKBR7TJB.js +398 -0
- package/Build/Workers/chunk-XYRT4RDI.js +1045 -0
- package/Build/Workers/chunk-XZINQPR6.js +124 -0
- package/Build/Workers/chunk-YLKTSY65.js +414 -0
- package/Build/Workers/chunk-YLSZYTTO.js +102 -0
- package/Build/Workers/chunk-YQXKIGXX.js +414 -0
- package/Build/Workers/chunk-YR3LX3PR.js +497 -0
- package/Build/Workers/chunk-Z5MHVJGN.js +778 -0
- package/Build/Workers/chunk-ZBRVFEGF.js +256 -0
- package/Build/Workers/chunk-ZCPCQJBX.js +198 -0
- package/Build/Workers/chunk-ZS7KQSEM.js +439 -0
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +22 -22
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +32 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
- package/Build/Workers/createPolylineGeometry.js +25 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
- package/Build/Workers/createSimplePolylineGeometry.js +23 -23
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +23 -23
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Scene/Cesium3DTileset.js +4163 -4105
- package/Source/Scene/Model/BarycentricWireframePipelineStage.js +327 -73
- package/Source/Scene/Model/Model.js +3631 -3512
- package/Source/Scene/Model/Model3DTileContent.js +585 -568
- package/Source/Scene/Model/ModelRuntimePrimitive.js +391 -391
- package/Source/Scene/Model/WireframePipelineStage.js +122 -122
- package/Source/Shaders/Model/ModelFS.glsl +38 -2
- package/Source/Shaders/Model/ModelFS.js +38 -2
- package/Source/Shaders/Model/ModelVS.glsl +3 -0
- package/Source/Shaders/Model/ModelVS.js +3 -0
- package/index.d.ts +801 -773
- package/index.js +145 -145
- package/package.json +1 -1
|
@@ -0,0 +1,398 @@
|
|
|
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
|
+
CylinderGeometryLibrary_default
|
|
28
|
+
} from "./chunk-AEURJQ3B.js";
|
|
29
|
+
import {
|
|
30
|
+
GeometryOffsetAttribute_default
|
|
31
|
+
} from "./chunk-53AFSDGM.js";
|
|
32
|
+
import {
|
|
33
|
+
VertexFormat_default
|
|
34
|
+
} from "./chunk-HM4MH5IG.js";
|
|
35
|
+
import {
|
|
36
|
+
IndexDatatype_default
|
|
37
|
+
} from "./chunk-E5BSDIGY.js";
|
|
38
|
+
import {
|
|
39
|
+
GeometryAttributes_default
|
|
40
|
+
} from "./chunk-R3PTQZ6H.js";
|
|
41
|
+
import {
|
|
42
|
+
GeometryAttribute_default,
|
|
43
|
+
Geometry_default,
|
|
44
|
+
PrimitiveType_default
|
|
45
|
+
} from "./chunk-4FEDW3WT.js";
|
|
46
|
+
import {
|
|
47
|
+
BoundingSphere_default
|
|
48
|
+
} from "./chunk-WX2ZANQC.js";
|
|
49
|
+
import {
|
|
50
|
+
ComponentDatatype_default
|
|
51
|
+
} from "./chunk-IXM65GBF.js";
|
|
52
|
+
import {
|
|
53
|
+
Cartesian2_default
|
|
54
|
+
} from "./chunk-4DIL24GG.js";
|
|
55
|
+
import {
|
|
56
|
+
Cartesian3_default,
|
|
57
|
+
Frozen_default
|
|
58
|
+
} from "./chunk-GZMTBQM2.js";
|
|
59
|
+
import {
|
|
60
|
+
Math_default
|
|
61
|
+
} from "./chunk-DIA4J2DB.js";
|
|
62
|
+
import {
|
|
63
|
+
DeveloperError_default
|
|
64
|
+
} from "./chunk-SZELHE7Q.js";
|
|
65
|
+
import {
|
|
66
|
+
defined_default
|
|
67
|
+
} from "./chunk-OBM2JYMG.js";
|
|
68
|
+
|
|
69
|
+
// packages/engine/Source/Core/CylinderGeometry.js
|
|
70
|
+
var radiusScratch = new Cartesian2_default();
|
|
71
|
+
var normalScratch = new Cartesian3_default();
|
|
72
|
+
var bitangentScratch = new Cartesian3_default();
|
|
73
|
+
var tangentScratch = new Cartesian3_default();
|
|
74
|
+
var positionScratch = new Cartesian3_default();
|
|
75
|
+
function CylinderGeometry(options) {
|
|
76
|
+
options = options ?? Frozen_default.EMPTY_OBJECT;
|
|
77
|
+
const length = options.length;
|
|
78
|
+
const topRadius = options.topRadius;
|
|
79
|
+
const bottomRadius = options.bottomRadius;
|
|
80
|
+
const vertexFormat = options.vertexFormat ?? VertexFormat_default.DEFAULT;
|
|
81
|
+
const slices = options.slices ?? 128;
|
|
82
|
+
if (!defined_default(length)) {
|
|
83
|
+
throw new DeveloperError_default("options.length must be defined.");
|
|
84
|
+
}
|
|
85
|
+
if (!defined_default(topRadius)) {
|
|
86
|
+
throw new DeveloperError_default("options.topRadius must be defined.");
|
|
87
|
+
}
|
|
88
|
+
if (!defined_default(bottomRadius)) {
|
|
89
|
+
throw new DeveloperError_default("options.bottomRadius must be defined.");
|
|
90
|
+
}
|
|
91
|
+
if (slices < 3) {
|
|
92
|
+
throw new DeveloperError_default(
|
|
93
|
+
"options.slices must be greater than or equal to 3."
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
if (defined_default(options.offsetAttribute) && options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
|
|
97
|
+
throw new DeveloperError_default(
|
|
98
|
+
"GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry."
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
this._length = length;
|
|
102
|
+
this._topRadius = topRadius;
|
|
103
|
+
this._bottomRadius = bottomRadius;
|
|
104
|
+
this._vertexFormat = VertexFormat_default.clone(vertexFormat);
|
|
105
|
+
this._slices = slices;
|
|
106
|
+
this._offsetAttribute = options.offsetAttribute;
|
|
107
|
+
this._workerName = "createCylinderGeometry";
|
|
108
|
+
}
|
|
109
|
+
CylinderGeometry.packedLength = VertexFormat_default.packedLength + 5;
|
|
110
|
+
CylinderGeometry.pack = function(value, array, startingIndex) {
|
|
111
|
+
if (!defined_default(value)) {
|
|
112
|
+
throw new DeveloperError_default("value is required");
|
|
113
|
+
}
|
|
114
|
+
if (!defined_default(array)) {
|
|
115
|
+
throw new DeveloperError_default("array is required");
|
|
116
|
+
}
|
|
117
|
+
startingIndex = startingIndex ?? 0;
|
|
118
|
+
VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
|
|
119
|
+
startingIndex += VertexFormat_default.packedLength;
|
|
120
|
+
array[startingIndex++] = value._length;
|
|
121
|
+
array[startingIndex++] = value._topRadius;
|
|
122
|
+
array[startingIndex++] = value._bottomRadius;
|
|
123
|
+
array[startingIndex++] = value._slices;
|
|
124
|
+
array[startingIndex] = value._offsetAttribute ?? -1;
|
|
125
|
+
return array;
|
|
126
|
+
};
|
|
127
|
+
var scratchVertexFormat = new VertexFormat_default();
|
|
128
|
+
var scratchOptions = {
|
|
129
|
+
vertexFormat: scratchVertexFormat,
|
|
130
|
+
length: void 0,
|
|
131
|
+
topRadius: void 0,
|
|
132
|
+
bottomRadius: void 0,
|
|
133
|
+
slices: void 0,
|
|
134
|
+
offsetAttribute: void 0
|
|
135
|
+
};
|
|
136
|
+
CylinderGeometry.unpack = function(array, startingIndex, result) {
|
|
137
|
+
if (!defined_default(array)) {
|
|
138
|
+
throw new DeveloperError_default("array is required");
|
|
139
|
+
}
|
|
140
|
+
startingIndex = startingIndex ?? 0;
|
|
141
|
+
const vertexFormat = VertexFormat_default.unpack(
|
|
142
|
+
array,
|
|
143
|
+
startingIndex,
|
|
144
|
+
scratchVertexFormat
|
|
145
|
+
);
|
|
146
|
+
startingIndex += VertexFormat_default.packedLength;
|
|
147
|
+
const length = array[startingIndex++];
|
|
148
|
+
const topRadius = array[startingIndex++];
|
|
149
|
+
const bottomRadius = array[startingIndex++];
|
|
150
|
+
const slices = array[startingIndex++];
|
|
151
|
+
const offsetAttribute = array[startingIndex];
|
|
152
|
+
if (!defined_default(result)) {
|
|
153
|
+
scratchOptions.length = length;
|
|
154
|
+
scratchOptions.topRadius = topRadius;
|
|
155
|
+
scratchOptions.bottomRadius = bottomRadius;
|
|
156
|
+
scratchOptions.slices = slices;
|
|
157
|
+
scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
|
|
158
|
+
return new CylinderGeometry(scratchOptions);
|
|
159
|
+
}
|
|
160
|
+
result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
|
|
161
|
+
result._length = length;
|
|
162
|
+
result._topRadius = topRadius;
|
|
163
|
+
result._bottomRadius = bottomRadius;
|
|
164
|
+
result._slices = slices;
|
|
165
|
+
result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
|
|
166
|
+
return result;
|
|
167
|
+
};
|
|
168
|
+
CylinderGeometry.createGeometry = function(cylinderGeometry) {
|
|
169
|
+
let length = cylinderGeometry._length;
|
|
170
|
+
const topRadius = cylinderGeometry._topRadius;
|
|
171
|
+
const bottomRadius = cylinderGeometry._bottomRadius;
|
|
172
|
+
const vertexFormat = cylinderGeometry._vertexFormat;
|
|
173
|
+
const slices = cylinderGeometry._slices;
|
|
174
|
+
if (length <= 0 || topRadius < 0 || bottomRadius < 0 || topRadius === 0 && bottomRadius === 0) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const twoSlices = slices + slices;
|
|
178
|
+
const threeSlices = slices + twoSlices;
|
|
179
|
+
const numVertices = twoSlices + twoSlices;
|
|
180
|
+
const positions = CylinderGeometryLibrary_default.computePositions(
|
|
181
|
+
length,
|
|
182
|
+
topRadius,
|
|
183
|
+
bottomRadius,
|
|
184
|
+
slices,
|
|
185
|
+
true
|
|
186
|
+
);
|
|
187
|
+
const st = vertexFormat.st ? new Float32Array(numVertices * 2) : void 0;
|
|
188
|
+
const normals = vertexFormat.normal ? new Float32Array(numVertices * 3) : void 0;
|
|
189
|
+
const tangents = vertexFormat.tangent ? new Float32Array(numVertices * 3) : void 0;
|
|
190
|
+
const bitangents = vertexFormat.bitangent ? new Float32Array(numVertices * 3) : void 0;
|
|
191
|
+
let i;
|
|
192
|
+
const computeNormal = vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent;
|
|
193
|
+
if (computeNormal) {
|
|
194
|
+
const computeTangent = vertexFormat.tangent || vertexFormat.bitangent;
|
|
195
|
+
let normalIndex = 0;
|
|
196
|
+
let tangentIndex = 0;
|
|
197
|
+
let bitangentIndex = 0;
|
|
198
|
+
const theta = Math.atan2(bottomRadius - topRadius, length);
|
|
199
|
+
const normal = normalScratch;
|
|
200
|
+
normal.z = Math.sin(theta);
|
|
201
|
+
const normalScale = Math.cos(theta);
|
|
202
|
+
let tangent = tangentScratch;
|
|
203
|
+
let bitangent = bitangentScratch;
|
|
204
|
+
for (i = 0; i < slices; i++) {
|
|
205
|
+
const angle = i / slices * Math_default.TWO_PI;
|
|
206
|
+
const x = normalScale * Math.cos(angle);
|
|
207
|
+
const y = normalScale * Math.sin(angle);
|
|
208
|
+
if (computeNormal) {
|
|
209
|
+
normal.x = x;
|
|
210
|
+
normal.y = y;
|
|
211
|
+
if (computeTangent) {
|
|
212
|
+
tangent = Cartesian3_default.normalize(
|
|
213
|
+
Cartesian3_default.cross(Cartesian3_default.UNIT_Z, normal, tangent),
|
|
214
|
+
tangent
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
if (vertexFormat.normal) {
|
|
218
|
+
normals[normalIndex++] = normal.x;
|
|
219
|
+
normals[normalIndex++] = normal.y;
|
|
220
|
+
normals[normalIndex++] = normal.z;
|
|
221
|
+
normals[normalIndex++] = normal.x;
|
|
222
|
+
normals[normalIndex++] = normal.y;
|
|
223
|
+
normals[normalIndex++] = normal.z;
|
|
224
|
+
}
|
|
225
|
+
if (vertexFormat.tangent) {
|
|
226
|
+
tangents[tangentIndex++] = tangent.x;
|
|
227
|
+
tangents[tangentIndex++] = tangent.y;
|
|
228
|
+
tangents[tangentIndex++] = tangent.z;
|
|
229
|
+
tangents[tangentIndex++] = tangent.x;
|
|
230
|
+
tangents[tangentIndex++] = tangent.y;
|
|
231
|
+
tangents[tangentIndex++] = tangent.z;
|
|
232
|
+
}
|
|
233
|
+
if (vertexFormat.bitangent) {
|
|
234
|
+
bitangent = Cartesian3_default.normalize(
|
|
235
|
+
Cartesian3_default.cross(normal, tangent, bitangent),
|
|
236
|
+
bitangent
|
|
237
|
+
);
|
|
238
|
+
bitangents[bitangentIndex++] = bitangent.x;
|
|
239
|
+
bitangents[bitangentIndex++] = bitangent.y;
|
|
240
|
+
bitangents[bitangentIndex++] = bitangent.z;
|
|
241
|
+
bitangents[bitangentIndex++] = bitangent.x;
|
|
242
|
+
bitangents[bitangentIndex++] = bitangent.y;
|
|
243
|
+
bitangents[bitangentIndex++] = bitangent.z;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
for (i = 0; i < slices; i++) {
|
|
248
|
+
if (vertexFormat.normal) {
|
|
249
|
+
normals[normalIndex++] = 0;
|
|
250
|
+
normals[normalIndex++] = 0;
|
|
251
|
+
normals[normalIndex++] = -1;
|
|
252
|
+
}
|
|
253
|
+
if (vertexFormat.tangent) {
|
|
254
|
+
tangents[tangentIndex++] = 1;
|
|
255
|
+
tangents[tangentIndex++] = 0;
|
|
256
|
+
tangents[tangentIndex++] = 0;
|
|
257
|
+
}
|
|
258
|
+
if (vertexFormat.bitangent) {
|
|
259
|
+
bitangents[bitangentIndex++] = 0;
|
|
260
|
+
bitangents[bitangentIndex++] = -1;
|
|
261
|
+
bitangents[bitangentIndex++] = 0;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
for (i = 0; i < slices; i++) {
|
|
265
|
+
if (vertexFormat.normal) {
|
|
266
|
+
normals[normalIndex++] = 0;
|
|
267
|
+
normals[normalIndex++] = 0;
|
|
268
|
+
normals[normalIndex++] = 1;
|
|
269
|
+
}
|
|
270
|
+
if (vertexFormat.tangent) {
|
|
271
|
+
tangents[tangentIndex++] = 1;
|
|
272
|
+
tangents[tangentIndex++] = 0;
|
|
273
|
+
tangents[tangentIndex++] = 0;
|
|
274
|
+
}
|
|
275
|
+
if (vertexFormat.bitangent) {
|
|
276
|
+
bitangents[bitangentIndex++] = 0;
|
|
277
|
+
bitangents[bitangentIndex++] = 1;
|
|
278
|
+
bitangents[bitangentIndex++] = 0;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
const numIndices = 12 * slices - 12;
|
|
283
|
+
const indices = IndexDatatype_default.createTypedArray(numVertices, numIndices);
|
|
284
|
+
let index = 0;
|
|
285
|
+
let j = 0;
|
|
286
|
+
for (i = 0; i < slices - 1; i++) {
|
|
287
|
+
indices[index++] = j;
|
|
288
|
+
indices[index++] = j + 2;
|
|
289
|
+
indices[index++] = j + 3;
|
|
290
|
+
indices[index++] = j;
|
|
291
|
+
indices[index++] = j + 3;
|
|
292
|
+
indices[index++] = j + 1;
|
|
293
|
+
j += 2;
|
|
294
|
+
}
|
|
295
|
+
indices[index++] = twoSlices - 2;
|
|
296
|
+
indices[index++] = 0;
|
|
297
|
+
indices[index++] = 1;
|
|
298
|
+
indices[index++] = twoSlices - 2;
|
|
299
|
+
indices[index++] = 1;
|
|
300
|
+
indices[index++] = twoSlices - 1;
|
|
301
|
+
for (i = 1; i < slices - 1; i++) {
|
|
302
|
+
indices[index++] = twoSlices + i + 1;
|
|
303
|
+
indices[index++] = twoSlices + i;
|
|
304
|
+
indices[index++] = twoSlices;
|
|
305
|
+
}
|
|
306
|
+
for (i = 1; i < slices - 1; i++) {
|
|
307
|
+
indices[index++] = threeSlices;
|
|
308
|
+
indices[index++] = threeSlices + i;
|
|
309
|
+
indices[index++] = threeSlices + i + 1;
|
|
310
|
+
}
|
|
311
|
+
let textureCoordIndex = 0;
|
|
312
|
+
if (vertexFormat.st) {
|
|
313
|
+
const rad = Math.max(topRadius, bottomRadius);
|
|
314
|
+
for (i = 0; i < numVertices; i++) {
|
|
315
|
+
const position = Cartesian3_default.fromArray(positions, i * 3, positionScratch);
|
|
316
|
+
st[textureCoordIndex++] = (position.x + rad) / (2 * rad);
|
|
317
|
+
st[textureCoordIndex++] = (position.y + rad) / (2 * rad);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
const attributes = new GeometryAttributes_default();
|
|
321
|
+
if (vertexFormat.position) {
|
|
322
|
+
attributes.position = new GeometryAttribute_default({
|
|
323
|
+
componentDatatype: ComponentDatatype_default.DOUBLE,
|
|
324
|
+
componentsPerAttribute: 3,
|
|
325
|
+
values: positions
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
if (vertexFormat.normal) {
|
|
329
|
+
attributes.normal = new GeometryAttribute_default({
|
|
330
|
+
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
331
|
+
componentsPerAttribute: 3,
|
|
332
|
+
values: normals
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
if (vertexFormat.tangent) {
|
|
336
|
+
attributes.tangent = new GeometryAttribute_default({
|
|
337
|
+
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
338
|
+
componentsPerAttribute: 3,
|
|
339
|
+
values: tangents
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
if (vertexFormat.bitangent) {
|
|
343
|
+
attributes.bitangent = new GeometryAttribute_default({
|
|
344
|
+
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
345
|
+
componentsPerAttribute: 3,
|
|
346
|
+
values: bitangents
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
if (vertexFormat.st) {
|
|
350
|
+
attributes.st = new GeometryAttribute_default({
|
|
351
|
+
componentDatatype: ComponentDatatype_default.FLOAT,
|
|
352
|
+
componentsPerAttribute: 2,
|
|
353
|
+
values: st
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
radiusScratch.x = length * 0.5;
|
|
357
|
+
radiusScratch.y = Math.max(bottomRadius, topRadius);
|
|
358
|
+
const boundingSphere = new BoundingSphere_default(
|
|
359
|
+
Cartesian3_default.ZERO,
|
|
360
|
+
Cartesian2_default.magnitude(radiusScratch)
|
|
361
|
+
);
|
|
362
|
+
if (defined_default(cylinderGeometry._offsetAttribute)) {
|
|
363
|
+
length = positions.length;
|
|
364
|
+
const offsetValue = cylinderGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
|
|
365
|
+
const applyOffset = new Uint8Array(length / 3).fill(offsetValue);
|
|
366
|
+
attributes.applyOffset = new GeometryAttribute_default({
|
|
367
|
+
componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
|
|
368
|
+
componentsPerAttribute: 1,
|
|
369
|
+
values: applyOffset
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
return new Geometry_default({
|
|
373
|
+
attributes,
|
|
374
|
+
indices,
|
|
375
|
+
primitiveType: PrimitiveType_default.TRIANGLES,
|
|
376
|
+
boundingSphere,
|
|
377
|
+
offsetAttribute: cylinderGeometry._offsetAttribute
|
|
378
|
+
});
|
|
379
|
+
};
|
|
380
|
+
var unitCylinderGeometry;
|
|
381
|
+
CylinderGeometry.getUnitCylinder = function() {
|
|
382
|
+
if (!defined_default(unitCylinderGeometry)) {
|
|
383
|
+
unitCylinderGeometry = CylinderGeometry.createGeometry(
|
|
384
|
+
new CylinderGeometry({
|
|
385
|
+
topRadius: 1,
|
|
386
|
+
bottomRadius: 1,
|
|
387
|
+
length: 1,
|
|
388
|
+
vertexFormat: VertexFormat_default.POSITION_ONLY
|
|
389
|
+
})
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
return unitCylinderGeometry;
|
|
393
|
+
};
|
|
394
|
+
var CylinderGeometry_default = CylinderGeometry;
|
|
395
|
+
|
|
396
|
+
export {
|
|
397
|
+
CylinderGeometry_default
|
|
398
|
+
};
|