@cesium/engine 25.0.0 → 26.0.0
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-GPIGURCG.js → chunk-3VFEWOBI.js} +7 -7
- package/Build/Workers/{chunk-BTX2NL3P.js → chunk-424RNO3D.js} +18 -18
- package/Build/Workers/{chunk-HSVQATK2.js → chunk-4MGMYHOO.js} +6 -6
- package/Build/Workers/{chunk-FIBS5S7R.js → chunk-4S7IE3LB.js} +2 -2
- package/Build/Workers/{chunk-A7ZBMVFS.js → chunk-52JDLOEM.js} +14 -14
- package/Build/Workers/{chunk-ZCCIIBZT.js → chunk-54I6Y66F.js} +6 -6
- package/Build/Workers/{chunk-J647NNZW.js → chunk-6YEE6JDR.js} +6 -6
- package/Build/Workers/{chunk-HVMG6AG4.js → chunk-7J2HKPRH.js} +9 -9
- package/Build/Workers/{chunk-K6NFIRFB.js → chunk-7WM2PX4V.js} +5 -5
- package/Build/Workers/{chunk-3LSD7OOA.js → chunk-ACXQXN46.js} +16 -16
- package/Build/Workers/{chunk-CZ23Y3RM.js → chunk-AYKR4VBR.js} +2 -2
- package/Build/Workers/{chunk-4MTRQFJP.js → chunk-C6J67V5A.js} +1 -1
- package/Build/Workers/{chunk-WTQGE7Q6.js → chunk-C6KNZ7T4.js} +17 -17
- package/Build/Workers/{chunk-AWFZHD2B.js → chunk-CFQP6LYM.js} +4 -4
- package/Build/Workers/{chunk-ST2UWDUU.js → chunk-CXOYE2WM.js} +5 -5
- package/Build/Workers/{chunk-H2A4USJR.js → chunk-CZEYZU4N.js} +10 -10
- package/Build/Workers/{chunk-DFEI5MAV.js → chunk-DBOEKL43.js} +7 -7
- package/Build/Workers/{chunk-A7A433MD.js → chunk-DDWSZVMY.js} +5 -5
- package/Build/Workers/{chunk-J7KQEKPK.js → chunk-DOBXCNC3.js} +13 -13
- package/Build/Workers/{chunk-URUCCIPS.js → chunk-E7VQ76KE.js} +6 -6
- package/Build/Workers/{chunk-ZAPOS52G.js → chunk-EBSIOBXY.js} +8 -8
- package/Build/Workers/{chunk-3VDDRF2E.js → chunk-EF2QYXGA.js} +14 -14
- package/Build/Workers/{chunk-WN6P5UDH.js → chunk-EPYXRCDB.js} +12 -12
- package/Build/Workers/{chunk-EZARA5FJ.js → chunk-F6QDY6HU.js} +13 -13
- package/Build/Workers/{chunk-GL7DNVUS.js → chunk-FRQZECAO.js} +5 -5
- package/Build/Workers/{chunk-VQKLRBIK.js → chunk-G7PXZRVF.js} +7 -7
- package/Build/Workers/{chunk-4QQXGTCE.js → chunk-INUEEEQA.js} +8 -8
- package/Build/Workers/{chunk-ITD2IN7N.js → chunk-IRBKFCEJ.js} +2 -2
- package/Build/Workers/{chunk-6SDGQI27.js → chunk-IYOUHCZB.js} +1 -1
- package/Build/Workers/{chunk-DYT5NR6P.js → chunk-J6BWOHUF.js} +3 -3
- package/Build/Workers/{chunk-4GF4MVPY.js → chunk-KFSTQKNM.js} +7 -7
- package/Build/Workers/{chunk-4XXHJI6Y.js → chunk-KKOSKAZB.js} +17 -17
- package/Build/Workers/{chunk-WC57YYBN.js → chunk-KSSWJIZW.js} +2 -2
- package/Build/Workers/{chunk-5T6QQAJW.js → chunk-M3B5JKSM.js} +1 -1
- package/Build/Workers/{chunk-QO2CGXMP.js → chunk-MPZHGZU6.js} +6 -6
- package/Build/Workers/{chunk-WUBKZFF6.js → chunk-MYP774IS.js} +9 -9
- package/Build/Workers/{chunk-WNN5D4W3.js → chunk-O3EA5HS7.js} +10 -10
- package/Build/Workers/{chunk-77RL3MBD.js → chunk-P3CK7MCY.js} +25 -4
- package/Build/Workers/{chunk-QXNQQYPV.js → chunk-Q3PY526V.js} +8 -8
- package/Build/Workers/{chunk-CKQP3DSS.js → chunk-QN67VG36.js} +6 -6
- package/Build/Workers/{chunk-ACFFCHHZ.js → chunk-QRWGUWI6.js} +11 -11
- package/Build/Workers/{chunk-LH5SF3XV.js → chunk-S4MCOY6I.js} +5 -5
- package/Build/Workers/{chunk-FVLVVOBQ.js → chunk-SMQZZOW6.js} +10 -10
- package/Build/Workers/{chunk-TA777BGS.js → chunk-TKKIREQ6.js} +1 -1
- package/Build/Workers/{chunk-AEAVLYPS.js → chunk-U3ZA64U7.js} +2 -2
- package/Build/Workers/{chunk-7LSFAEWF.js → chunk-UA25D5MX.js} +10 -10
- package/Build/Workers/{chunk-J3OFS2RD.js → chunk-UOOIQ3KX.js} +12 -12
- package/Build/Workers/{chunk-ND3NTTOF.js → chunk-V7VQKN6N.js} +6 -6
- package/Build/Workers/{chunk-I3A6DXYZ.js → chunk-VQYETPWC.js} +4 -4
- package/Build/Workers/{chunk-35H3UBIO.js → chunk-VWV2IJRB.js} +11 -11
- package/Build/Workers/{chunk-QSDY4NS7.js → chunk-XZMBNNDX.js} +9 -9
- package/Build/Workers/{chunk-TAI4HLII.js → chunk-Y57HREW5.js} +4 -4
- package/Build/Workers/{chunk-3TKLDHV3.js → chunk-Y5BF6AFU.js} +2 -2
- package/Build/Workers/{chunk-3XY3MVPG.js → chunk-YLY7NKAB.js} +4 -4
- package/Build/Workers/{chunk-BVAIWR7O.js → chunk-ZK3CF7ZD.js} +12 -12
- package/Build/Workers/{chunk-DH26SNAB.js → chunk-ZP7JMQV4.js} +1 -1
- package/Build/Workers/{chunk-3RFFPH4M.js → chunk-ZZ46LWL6.js} +1 -1
- 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/Core/Cartesian2.js +1 -1
- package/Source/Core/Cartesian3.js +1 -1
- package/Source/Core/Cartesian4.js +1 -1
- package/Source/Core/ComponentDatatype.js +35 -0
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/MapProjection.js +1 -0
- package/Source/Core/Matrix2.js +1 -1
- package/Source/Core/Matrix3.js +1 -1
- package/Source/Core/Matrix4.js +1 -1
- package/Source/Core/Resource.js +1 -1
- package/Source/Core/ScreenSpaceEventHandler.js +51 -41
- package/Source/Core/createColorRamp.js +37 -0
- package/Source/Core/globalTypes.js +25 -0
- package/Source/Renderer/Pass.js +3 -2
- package/Source/Renderer/createUniform.js +346 -239
- package/Source/Renderer/createUniformArray.js +494 -381
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/BufferPoint.js +1 -0
- package/Source/Scene/BufferPointCollection.js +14 -1
- package/Source/Scene/BufferPolygon.js +3 -2
- package/Source/Scene/BufferPolygonCollection.js +10 -0
- package/Source/Scene/BufferPolyline.js +1 -0
- package/Source/Scene/BufferPolylineCollection.js +2 -0
- package/Source/Scene/BufferPrimitiveCollection.js +79 -28
- package/Source/Scene/CameraEventAggregator.js +30 -18
- package/Source/Scene/Cesium3DTile.js +54 -1
- package/Source/Scene/Cesium3DTileContent.js +195 -254
- package/Source/Scene/Cesium3DTileContentFactory.js +10 -2
- package/Source/Scene/Cesium3DTileset.js +45 -5
- package/Source/Scene/Composite3DTileContent.js +254 -292
- package/Source/Scene/EdgeDisplayMode.js +50 -0
- package/Source/Scene/Empty3DTileContent.js +100 -132
- package/Source/Scene/GaussianSplat3DTileContent.js +436 -478
- package/Source/Scene/GeoJsonPrimitive.js +874 -0
- package/Source/Scene/Geometry3DTileContent.js +151 -185
- package/Source/Scene/GltfLoader.js +109 -0
- package/Source/Scene/Implicit3DTileContent.js +179 -214
- package/Source/Scene/MVTDataProvider.js +147 -0
- package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +79 -311
- package/Source/Scene/Model/Model.js +34 -0
- package/Source/Scene/Model/Model3DTileContent.js +424 -458
- package/Source/Scene/Model/ModelDrawCommand.js +31 -3
- package/Source/Scene/Model/ModelUtility.js +4 -0
- package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +466 -150
- package/Source/Scene/ModelComponents.js +39 -1
- package/Source/Scene/Multiple3DTileContent.js +291 -334
- package/Source/Scene/Scene.js +26 -0
- package/Source/Scene/Tileset3DTileContent.js +113 -146
- package/Source/Scene/UrlTemplate3DTilesDataProvider.js +499 -0
- package/Source/Scene/Vector3DTileContent.js +205 -234
- package/Source/Scene/VectorGltf3DTileContent.js +85 -36
- package/Source/Scene/VoxelPrimitive.js +159 -175
- package/Source/Scene/VoxelProvider.js +64 -91
- package/Source/Scene/buildVectorGltfFromMVT.js +1059 -0
- package/Source/Scene/buildVoxelCustomShader.js +199 -0
- package/Source/Scene/decodeMVT.js +634 -0
- package/Source/Scene/renderBufferPointCollection.js +110 -64
- package/Source/Scene/renderBufferPolygonCollection.js +102 -55
- package/Source/Scene/renderBufferPolylineCollection.js +365 -166
- package/Source/Shaders/BufferPointMaterialFS.glsl +1 -0
- package/Source/Shaders/BufferPointMaterialFS.js +1 -0
- package/Source/Shaders/BufferPointMaterialVS.glsl +19 -9
- package/Source/Shaders/BufferPointMaterialVS.js +20 -10
- package/Source/Shaders/BufferPolygonMaterialVS.glsl +13 -4
- package/Source/Shaders/BufferPolygonMaterialVS.js +14 -5
- package/Source/Shaders/BufferPolylineMaterialVS.glsl +16 -2
- package/Source/Shaders/BufferPolylineMaterialVS.js +17 -3
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.js +11 -0
- package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
- package/Source/Shaders/Builtin/CzmBuiltins.js +2 -0
- package/Source/Shaders/Model/EdgeVisibilityStageVS.glsl +0 -1
- package/Source/Shaders/Model/EdgeVisibilityStageVS.js +0 -1
- package/index.d.ts +253 -35
- package/index.js +71 -62
- package/package.json +2 -2
|
@@ -22,6 +22,7 @@ import AttributeCompression from "../Core/AttributeCompression.js";
|
|
|
22
22
|
import IndexDatatype from "../Core/IndexDatatype.js";
|
|
23
23
|
import PolylineCommon from "../Shaders/PolylineCommon.js";
|
|
24
24
|
import BufferPolylineMaterial from "./BufferPolylineMaterial.js";
|
|
25
|
+
import BlendOption from "./BlendOption.js";
|
|
25
26
|
|
|
26
27
|
/** @import FrameState from "./FrameState.js"; */
|
|
27
28
|
/** @import BufferPolylineCollection from "./BufferPolylineCollection.js"; */
|
|
@@ -29,15 +30,16 @@ import BufferPolylineMaterial from "./BufferPolylineMaterial.js";
|
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* TODO(PR#13211): Need 'keyof' syntax to avoid duplicating attribute names.
|
|
32
|
-
* @typedef {'positionHigh' | 'positionLow' | 'prevPositionHigh' | 'prevPositionLow' | 'nextPositionHigh' | 'nextPositionLow' | 'pickColor' | 'showColorWidthAndTexCoord'} BufferPolylineAttribute
|
|
33
|
+
* @typedef {'positionHigh' | 'positionLow' | 'prevPositionHigh' | 'prevPositionLow' | 'nextPositionHigh' | 'nextPositionLow' | 'pickColor' | 'showColorWidthAndTexCoord' | 'alpha'} BufferPolylineAttribute
|
|
33
34
|
* @ignore
|
|
34
35
|
*/
|
|
35
36
|
|
|
36
37
|
/**
|
|
38
|
+
* Attribute locations when using 64-bit position precision.
|
|
37
39
|
* @type {Record<BufferPolylineAttribute, number>}
|
|
38
40
|
* @ignore
|
|
39
41
|
*/
|
|
40
|
-
const
|
|
42
|
+
const BufferPolylineAttributeLocationsFloat64 = {
|
|
41
43
|
positionHigh: 0,
|
|
42
44
|
positionLow: 1,
|
|
43
45
|
prevPositionHigh: 2,
|
|
@@ -46,12 +48,27 @@ const BufferPolylineAttributeLocations = {
|
|
|
46
48
|
nextPositionLow: 5,
|
|
47
49
|
pickColor: 6,
|
|
48
50
|
showColorWidthAndTexCoord: 7,
|
|
51
|
+
alpha: 8,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Attribute locations when using <= 32-bit position precision.
|
|
56
|
+
* @type {Record<string, number>}
|
|
57
|
+
* @ignore
|
|
58
|
+
*/
|
|
59
|
+
const BufferPolylineAttributeLocations = {
|
|
60
|
+
position: 0,
|
|
61
|
+
prevPosition: 1,
|
|
62
|
+
nextPosition: 2,
|
|
63
|
+
pickColor: 3,
|
|
64
|
+
showColorWidthAndTexCoord: 4,
|
|
65
|
+
alpha: 5,
|
|
49
66
|
};
|
|
50
67
|
|
|
51
68
|
/**
|
|
52
69
|
* @typedef {object} BufferPolylineRenderContext
|
|
53
70
|
* @property {VertexArray} [vertexArray]
|
|
54
|
-
* @property {Record<
|
|
71
|
+
* @property {Record<string, TypedArray>} [attributeArrays]
|
|
55
72
|
* @property {TypedArray} [indexArray]
|
|
56
73
|
* @property {RenderState} [renderState]
|
|
57
74
|
* @property {ShaderProgram} [shaderProgram]
|
|
@@ -94,6 +111,10 @@ const nextCartesianEnc = new EncodedCartesian3();
|
|
|
94
111
|
function renderBufferPolylineCollection(collection, frameState, renderContext) {
|
|
95
112
|
const context = frameState.context;
|
|
96
113
|
renderContext = renderContext || { destroy: destroyRenderContext };
|
|
114
|
+
const useFloat64 = collection._positionDatatype === ComponentDatatype.DOUBLE;
|
|
115
|
+
const attributeLocations = useFloat64
|
|
116
|
+
? BufferPolylineAttributeLocationsFloat64
|
|
117
|
+
: BufferPolylineAttributeLocations;
|
|
97
118
|
|
|
98
119
|
if (
|
|
99
120
|
!defined(renderContext.attributeArrays) ||
|
|
@@ -112,14 +133,35 @@ function renderBufferPolylineCollection(collection, frameState, renderContext) {
|
|
|
112
133
|
);
|
|
113
134
|
|
|
114
135
|
renderContext.attributeArrays = {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
136
|
+
...(!useFloat64
|
|
137
|
+
? {
|
|
138
|
+
// @ts-expect-error https://github.com/CesiumGS/cesium/issues/13420
|
|
139
|
+
position: ComponentDatatype.createTypedArray(
|
|
140
|
+
collection._positionDatatype,
|
|
141
|
+
vertexCountMax * 3,
|
|
142
|
+
),
|
|
143
|
+
// @ts-expect-error https://github.com/CesiumGS/cesium/issues/13420
|
|
144
|
+
prevPosition: ComponentDatatype.createTypedArray(
|
|
145
|
+
collection._positionDatatype,
|
|
146
|
+
vertexCountMax * 3,
|
|
147
|
+
),
|
|
148
|
+
// @ts-expect-error https://github.com/CesiumGS/cesium/issues/13420
|
|
149
|
+
nextPosition: ComponentDatatype.createTypedArray(
|
|
150
|
+
collection._positionDatatype,
|
|
151
|
+
vertexCountMax * 3,
|
|
152
|
+
),
|
|
153
|
+
}
|
|
154
|
+
: {
|
|
155
|
+
positionHigh: new Float32Array(vertexCountMax * 3),
|
|
156
|
+
positionLow: new Float32Array(vertexCountMax * 3),
|
|
157
|
+
prevPositionHigh: new Float32Array(vertexCountMax * 3),
|
|
158
|
+
prevPositionLow: new Float32Array(vertexCountMax * 3),
|
|
159
|
+
nextPositionHigh: new Float32Array(vertexCountMax * 3),
|
|
160
|
+
nextPositionLow: new Float32Array(vertexCountMax * 3),
|
|
161
|
+
}),
|
|
121
162
|
pickColor: new Uint8Array(vertexCountMax * 4),
|
|
122
163
|
showColorWidthAndTexCoord: new Float32Array(vertexCountMax * 4),
|
|
164
|
+
alpha: new Uint8Array(vertexCountMax),
|
|
123
165
|
};
|
|
124
166
|
}
|
|
125
167
|
|
|
@@ -128,15 +170,10 @@ function renderBufferPolylineCollection(collection, frameState, renderContext) {
|
|
|
128
170
|
const { attributeArrays } = renderContext;
|
|
129
171
|
|
|
130
172
|
const indexArray = renderContext.indexArray;
|
|
131
|
-
const positionHighArray = attributeArrays.positionHigh;
|
|
132
|
-
const positionLowArray = attributeArrays.positionLow;
|
|
133
|
-
const prevPositionHighArray = attributeArrays.prevPositionHigh;
|
|
134
|
-
const prevPositionLowArray = attributeArrays.prevPositionLow;
|
|
135
|
-
const nextPositionHighArray = attributeArrays.nextPositionHigh;
|
|
136
|
-
const nextPositionLowArray = attributeArrays.nextPositionLow;
|
|
137
173
|
const pickColorArray = attributeArrays.pickColor;
|
|
138
174
|
const showColorWidthAndTexCoordArray =
|
|
139
175
|
attributeArrays.showColorWidthAndTexCoord;
|
|
176
|
+
const alphaArray = attributeArrays.alpha;
|
|
140
177
|
|
|
141
178
|
for (let i = _dirtyOffset, il = _dirtyOffset + _dirtyCount; i < il; i++) {
|
|
142
179
|
collection.get(i, polyline);
|
|
@@ -145,99 +182,208 @@ function renderBufferPolylineCollection(collection, frameState, renderContext) {
|
|
|
145
182
|
continue;
|
|
146
183
|
}
|
|
147
184
|
|
|
148
|
-
const cartesianArray = polyline.getPositions();
|
|
149
185
|
polyline.getMaterial(material);
|
|
150
186
|
const encodedColor = AttributeCompression.encodeRGB8(material.color);
|
|
187
|
+
const colorAlpha = material.color.alpha;
|
|
151
188
|
Color.fromRgba(polyline._pickId, pickColor);
|
|
152
189
|
const show = polyline.show;
|
|
153
190
|
|
|
154
191
|
let vOffset = polyline.vertexOffset * 2; // vertex offset
|
|
155
192
|
let iOffset = (polyline.vertexOffset - i) * 6; // index offset
|
|
156
193
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
194
|
+
const jl = polyline.vertexCount;
|
|
195
|
+
|
|
196
|
+
if (!useFloat64) {
|
|
197
|
+
const posView = collection._positionView;
|
|
198
|
+
const posStart = polyline.vertexOffset * 3;
|
|
199
|
+
const posArray = attributeArrays.position;
|
|
200
|
+
const prevPosArray = attributeArrays.prevPosition;
|
|
201
|
+
const nextPosArray = attributeArrays.nextPosition;
|
|
202
|
+
|
|
203
|
+
for (let j = 0; j < jl; j++) {
|
|
204
|
+
const isFirstSegment = j === 0;
|
|
205
|
+
const isLastSegment = j === jl - 1;
|
|
206
|
+
|
|
207
|
+
const cx = posView[posStart + j * 3];
|
|
208
|
+
const cy = posView[posStart + j * 3 + 1];
|
|
209
|
+
const cz = posView[posStart + j * 3 + 2];
|
|
210
|
+
|
|
211
|
+
let px, py, pz, nx, ny, nz;
|
|
212
|
+
|
|
213
|
+
if (isFirstSegment) {
|
|
214
|
+
nx = posView[posStart + 1 * 3];
|
|
215
|
+
ny = posView[posStart + 1 * 3 + 1];
|
|
216
|
+
nz = posView[posStart + 1 * 3 + 2];
|
|
217
|
+
// Mirror current over next to get synthetic prev.
|
|
218
|
+
px = 2 * cx - nx;
|
|
219
|
+
py = 2 * cy - ny;
|
|
220
|
+
pz = 2 * cz - nz;
|
|
221
|
+
} else if (isLastSegment) {
|
|
222
|
+
px = posView[posStart + (j - 1) * 3];
|
|
223
|
+
py = posView[posStart + (j - 1) * 3 + 1];
|
|
224
|
+
pz = posView[posStart + (j - 1) * 3 + 2];
|
|
225
|
+
// Mirror current over prev to get synthetic next.
|
|
226
|
+
nx = 2 * cx - px;
|
|
227
|
+
ny = 2 * cy - py;
|
|
228
|
+
nz = 2 * cz - pz;
|
|
229
|
+
} else {
|
|
230
|
+
px = posView[posStart + (j - 1) * 3];
|
|
231
|
+
py = posView[posStart + (j - 1) * 3 + 1];
|
|
232
|
+
pz = posView[posStart + (j - 1) * 3 + 2];
|
|
233
|
+
nx = posView[posStart + (j + 1) * 3];
|
|
234
|
+
ny = posView[posStart + (j + 1) * 3 + 1];
|
|
235
|
+
nz = posView[posStart + (j + 1) * 3 + 2];
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (!isLastSegment) {
|
|
239
|
+
indexArray[iOffset] = vOffset;
|
|
240
|
+
indexArray[iOffset + 1] = vOffset + 1;
|
|
241
|
+
indexArray[iOffset + 2] = vOffset + 2;
|
|
242
|
+
indexArray[iOffset + 3] = vOffset + 2;
|
|
243
|
+
indexArray[iOffset + 4] = vOffset + 1;
|
|
244
|
+
indexArray[iOffset + 5] = vOffset + 3;
|
|
245
|
+
iOffset += 6;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Write each vertex twice for the quad.
|
|
249
|
+
for (let k = 0; k < 2; k++) {
|
|
250
|
+
posArray[vOffset * 3] = cx;
|
|
251
|
+
posArray[vOffset * 3 + 1] = cy;
|
|
252
|
+
posArray[vOffset * 3 + 2] = cz;
|
|
253
|
+
|
|
254
|
+
prevPosArray[vOffset * 3] = px;
|
|
255
|
+
prevPosArray[vOffset * 3 + 1] = py;
|
|
256
|
+
prevPosArray[vOffset * 3 + 2] = pz;
|
|
257
|
+
|
|
258
|
+
nextPosArray[vOffset * 3] = nx;
|
|
259
|
+
nextPosArray[vOffset * 3 + 1] = ny;
|
|
260
|
+
nextPosArray[vOffset * 3 + 2] = nz;
|
|
261
|
+
|
|
262
|
+
pickColorArray[vOffset * 4] = Color.floatToByte(pickColor.red);
|
|
263
|
+
pickColorArray[vOffset * 4 + 1] = Color.floatToByte(
|
|
264
|
+
pickColor.green,
|
|
265
|
+
);
|
|
266
|
+
pickColorArray[vOffset * 4 + 2] = Color.floatToByte(pickColor.blue);
|
|
267
|
+
pickColorArray[vOffset * 4 + 3] = Color.floatToByte(
|
|
268
|
+
pickColor.alpha,
|
|
269
|
+
);
|
|
270
|
+
|
|
271
|
+
showColorWidthAndTexCoordArray[vOffset * 4] = show ? 1 : 0;
|
|
272
|
+
showColorWidthAndTexCoordArray[vOffset * 4 + 1] = encodedColor;
|
|
273
|
+
showColorWidthAndTexCoordArray[vOffset * 4 + 2] = material.width;
|
|
274
|
+
showColorWidthAndTexCoordArray[vOffset * 4 + 3] = j / (jl - 1);
|
|
275
|
+
|
|
276
|
+
alphaArray[vOffset] = colorAlpha * 255.0;
|
|
277
|
+
|
|
278
|
+
vOffset++;
|
|
279
|
+
}
|
|
179
280
|
}
|
|
281
|
+
} else {
|
|
282
|
+
const cartesianArray = polyline.getPositions();
|
|
180
283
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
indexArray[iOffset + 1] = vOffset + 1;
|
|
185
|
-
indexArray[iOffset + 2] = vOffset + 2;
|
|
186
|
-
|
|
187
|
-
indexArray[iOffset + 3] = vOffset + 2;
|
|
188
|
-
indexArray[iOffset + 4] = vOffset + 1;
|
|
189
|
-
indexArray[iOffset + 5] = vOffset + 3;
|
|
190
|
-
|
|
191
|
-
iOffset += 6;
|
|
192
|
-
}
|
|
284
|
+
for (let j = 0; j < jl; j++) {
|
|
285
|
+
const isFirstSegment = j === 0;
|
|
286
|
+
const isLastSegment = j === jl - 1;
|
|
193
287
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
288
|
+
// For first/last vertices, infer missing vertices by mirroring the segment.
|
|
289
|
+
// @ts-expect-error TODO(tsd-jsdoc): See https://github.com/CesiumGS/cesium/pull/13302.
|
|
290
|
+
Cartesian3.fromArray(cartesianArray, j * 3, cartesian);
|
|
291
|
+
if (isFirstSegment) {
|
|
292
|
+
// @ts-expect-error TODO(tsd-jsdoc): See https://github.com/CesiumGS/cesium/pull/13302.
|
|
293
|
+
Cartesian3.fromArray(cartesianArray, (j + 1) * 3, nextCartesian);
|
|
294
|
+
Cartesian3.subtract(cartesian, nextCartesian, prevCartesian);
|
|
295
|
+
Cartesian3.add(cartesian, prevCartesian, prevCartesian);
|
|
296
|
+
} else if (isLastSegment) {
|
|
297
|
+
// @ts-expect-error TODO(tsd-jsdoc): See https://github.com/CesiumGS/cesium/pull/13302.
|
|
298
|
+
Cartesian3.fromArray(cartesianArray, (j - 1) * 3, prevCartesian);
|
|
299
|
+
Cartesian3.subtract(cartesian, prevCartesian, nextCartesian);
|
|
300
|
+
Cartesian3.add(cartesian, nextCartesian, nextCartesian);
|
|
301
|
+
} else {
|
|
302
|
+
// @ts-expect-error TODO(tsd-jsdoc): See https://github.com/CesiumGS/cesium/pull/13302.
|
|
303
|
+
Cartesian3.fromArray(cartesianArray, (j - 1) * 3, prevCartesian);
|
|
304
|
+
// @ts-expect-error TODO(tsd-jsdoc): See https://github.com/CesiumGS/cesium/pull/13302.
|
|
305
|
+
Cartesian3.fromArray(cartesianArray, (j + 1) * 3, nextCartesian);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// For each segment, draw two triangles.
|
|
309
|
+
if (!isLastSegment) {
|
|
310
|
+
indexArray[iOffset] = vOffset;
|
|
311
|
+
indexArray[iOffset + 1] = vOffset + 1;
|
|
312
|
+
indexArray[iOffset + 2] = vOffset + 2;
|
|
313
|
+
|
|
314
|
+
indexArray[iOffset + 3] = vOffset + 2;
|
|
315
|
+
indexArray[iOffset + 4] = vOffset + 1;
|
|
316
|
+
indexArray[iOffset + 5] = vOffset + 3;
|
|
317
|
+
|
|
318
|
+
iOffset += 6;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
EncodedCartesian3.fromCartesian(cartesian, cartesianEnc);
|
|
322
|
+
EncodedCartesian3.fromCartesian(prevCartesian, prevCartesianEnc);
|
|
323
|
+
EncodedCartesian3.fromCartesian(nextCartesian, nextCartesianEnc);
|
|
324
|
+
|
|
325
|
+
// TODO(donmccurdy): Diverging from PolylineCollection.js, which writes
|
|
326
|
+
// internal vertices to buffer 4x, not 2x. Not sure that's needed?
|
|
327
|
+
for (let k = 0; k < 2; k++) {
|
|
328
|
+
// Position.
|
|
329
|
+
attributeArrays.positionHigh[vOffset * 3] = cartesianEnc.high.x;
|
|
330
|
+
attributeArrays.positionHigh[vOffset * 3 + 1] = cartesianEnc.high.y;
|
|
331
|
+
attributeArrays.positionHigh[vOffset * 3 + 2] = cartesianEnc.high.z;
|
|
332
|
+
|
|
333
|
+
attributeArrays.positionLow[vOffset * 3] = cartesianEnc.low.x;
|
|
334
|
+
attributeArrays.positionLow[vOffset * 3 + 1] = cartesianEnc.low.y;
|
|
335
|
+
attributeArrays.positionLow[vOffset * 3 + 2] = cartesianEnc.low.z;
|
|
336
|
+
|
|
337
|
+
// Previous position.
|
|
338
|
+
attributeArrays.prevPositionHigh[vOffset * 3] =
|
|
339
|
+
prevCartesianEnc.high.x;
|
|
340
|
+
attributeArrays.prevPositionHigh[vOffset * 3 + 1] =
|
|
341
|
+
prevCartesianEnc.high.y;
|
|
342
|
+
attributeArrays.prevPositionHigh[vOffset * 3 + 2] =
|
|
343
|
+
prevCartesianEnc.high.z;
|
|
344
|
+
|
|
345
|
+
attributeArrays.prevPositionLow[vOffset * 3] =
|
|
346
|
+
prevCartesianEnc.low.x;
|
|
347
|
+
attributeArrays.prevPositionLow[vOffset * 3 + 1] =
|
|
348
|
+
prevCartesianEnc.low.y;
|
|
349
|
+
attributeArrays.prevPositionLow[vOffset * 3 + 2] =
|
|
350
|
+
prevCartesianEnc.low.z;
|
|
351
|
+
|
|
352
|
+
// Next position.
|
|
353
|
+
attributeArrays.nextPositionHigh[vOffset * 3] =
|
|
354
|
+
nextCartesianEnc.high.x;
|
|
355
|
+
attributeArrays.nextPositionHigh[vOffset * 3 + 1] =
|
|
356
|
+
nextCartesianEnc.high.y;
|
|
357
|
+
attributeArrays.nextPositionHigh[vOffset * 3 + 2] =
|
|
358
|
+
nextCartesianEnc.high.z;
|
|
359
|
+
|
|
360
|
+
attributeArrays.nextPositionLow[vOffset * 3] =
|
|
361
|
+
nextCartesianEnc.low.x;
|
|
362
|
+
attributeArrays.nextPositionLow[vOffset * 3 + 1] =
|
|
363
|
+
nextCartesianEnc.low.y;
|
|
364
|
+
attributeArrays.nextPositionLow[vOffset * 3 + 2] =
|
|
365
|
+
nextCartesianEnc.low.z;
|
|
366
|
+
|
|
367
|
+
// Pick ID.
|
|
368
|
+
pickColorArray[vOffset * 4] = Color.floatToByte(pickColor.red);
|
|
369
|
+
pickColorArray[vOffset * 4 + 1] = Color.floatToByte(
|
|
370
|
+
pickColor.green,
|
|
371
|
+
);
|
|
372
|
+
pickColorArray[vOffset * 4 + 2] = Color.floatToByte(pickColor.blue);
|
|
373
|
+
pickColorArray[vOffset * 4 + 3] = Color.floatToByte(
|
|
374
|
+
pickColor.alpha,
|
|
375
|
+
);
|
|
376
|
+
|
|
377
|
+
// Properties.
|
|
378
|
+
showColorWidthAndTexCoordArray[vOffset * 4] = show ? 1 : 0;
|
|
379
|
+
showColorWidthAndTexCoordArray[vOffset * 4 + 1] = encodedColor;
|
|
380
|
+
showColorWidthAndTexCoordArray[vOffset * 4 + 2] = material.width;
|
|
381
|
+
showColorWidthAndTexCoordArray[vOffset * 4 + 3] = j / (jl - 1); // texcoord.s
|
|
382
|
+
|
|
383
|
+
alphaArray[vOffset] = colorAlpha * 255.0;
|
|
384
|
+
|
|
385
|
+
vOffset++;
|
|
386
|
+
}
|
|
241
387
|
}
|
|
242
388
|
}
|
|
243
389
|
|
|
@@ -260,84 +406,130 @@ function renderBufferPolylineCollection(collection, frameState, renderContext) {
|
|
|
260
406
|
}),
|
|
261
407
|
|
|
262
408
|
attributes: [
|
|
409
|
+
...(!useFloat64
|
|
410
|
+
? [
|
|
411
|
+
{
|
|
412
|
+
index: BufferPolylineAttributeLocations.position,
|
|
413
|
+
componentDatatype: collection._positionDatatype,
|
|
414
|
+
componentsPerAttribute: 3,
|
|
415
|
+
normalize: collection._positionNormalized,
|
|
416
|
+
vertexBuffer: Buffer.createVertexBuffer({
|
|
417
|
+
typedArray: attributeArrays.position,
|
|
418
|
+
context,
|
|
419
|
+
usage: BufferUsage.STATIC_DRAW,
|
|
420
|
+
}),
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
index: BufferPolylineAttributeLocations.prevPosition,
|
|
424
|
+
componentDatatype: collection._positionDatatype,
|
|
425
|
+
componentsPerAttribute: 3,
|
|
426
|
+
normalize: collection._positionNormalized,
|
|
427
|
+
vertexBuffer: Buffer.createVertexBuffer({
|
|
428
|
+
typedArray: attributeArrays.prevPosition,
|
|
429
|
+
context,
|
|
430
|
+
usage: BufferUsage.STATIC_DRAW,
|
|
431
|
+
}),
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
index: BufferPolylineAttributeLocations.nextPosition,
|
|
435
|
+
componentDatatype: collection._positionDatatype,
|
|
436
|
+
componentsPerAttribute: 3,
|
|
437
|
+
normalize: collection._positionNormalized,
|
|
438
|
+
vertexBuffer: Buffer.createVertexBuffer({
|
|
439
|
+
typedArray: attributeArrays.nextPosition,
|
|
440
|
+
context,
|
|
441
|
+
usage: BufferUsage.STATIC_DRAW,
|
|
442
|
+
}),
|
|
443
|
+
},
|
|
444
|
+
]
|
|
445
|
+
: [
|
|
446
|
+
{
|
|
447
|
+
index: BufferPolylineAttributeLocationsFloat64.positionHigh,
|
|
448
|
+
componentDatatype: ComponentDatatype.FLOAT,
|
|
449
|
+
componentsPerAttribute: 3,
|
|
450
|
+
vertexBuffer: Buffer.createVertexBuffer({
|
|
451
|
+
typedArray: attributeArrays.positionHigh,
|
|
452
|
+
context,
|
|
453
|
+
usage: BufferUsage.STATIC_DRAW,
|
|
454
|
+
}),
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
index: BufferPolylineAttributeLocationsFloat64.positionLow,
|
|
458
|
+
componentDatatype: ComponentDatatype.FLOAT,
|
|
459
|
+
componentsPerAttribute: 3,
|
|
460
|
+
vertexBuffer: Buffer.createVertexBuffer({
|
|
461
|
+
typedArray: attributeArrays.positionLow,
|
|
462
|
+
context,
|
|
463
|
+
usage: BufferUsage.STATIC_DRAW,
|
|
464
|
+
}),
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
index: BufferPolylineAttributeLocationsFloat64.prevPositionHigh,
|
|
468
|
+
componentDatatype: ComponentDatatype.FLOAT,
|
|
469
|
+
componentsPerAttribute: 3,
|
|
470
|
+
vertexBuffer: Buffer.createVertexBuffer({
|
|
471
|
+
typedArray: attributeArrays.prevPositionHigh,
|
|
472
|
+
context,
|
|
473
|
+
usage: BufferUsage.STATIC_DRAW,
|
|
474
|
+
}),
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
index: BufferPolylineAttributeLocationsFloat64.prevPositionLow,
|
|
478
|
+
componentDatatype: ComponentDatatype.FLOAT,
|
|
479
|
+
componentsPerAttribute: 3,
|
|
480
|
+
vertexBuffer: Buffer.createVertexBuffer({
|
|
481
|
+
typedArray: attributeArrays.prevPositionLow,
|
|
482
|
+
context,
|
|
483
|
+
usage: BufferUsage.STATIC_DRAW,
|
|
484
|
+
}),
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
index: BufferPolylineAttributeLocationsFloat64.nextPositionHigh,
|
|
488
|
+
componentDatatype: ComponentDatatype.FLOAT,
|
|
489
|
+
componentsPerAttribute: 3,
|
|
490
|
+
vertexBuffer: Buffer.createVertexBuffer({
|
|
491
|
+
typedArray: attributeArrays.nextPositionHigh,
|
|
492
|
+
context,
|
|
493
|
+
usage: BufferUsage.STATIC_DRAW,
|
|
494
|
+
}),
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
index: BufferPolylineAttributeLocationsFloat64.nextPositionLow,
|
|
498
|
+
componentDatatype: ComponentDatatype.FLOAT,
|
|
499
|
+
componentsPerAttribute: 3,
|
|
500
|
+
vertexBuffer: Buffer.createVertexBuffer({
|
|
501
|
+
typedArray: attributeArrays.nextPositionLow,
|
|
502
|
+
context,
|
|
503
|
+
usage: BufferUsage.STATIC_DRAW,
|
|
504
|
+
}),
|
|
505
|
+
},
|
|
506
|
+
]),
|
|
263
507
|
{
|
|
264
|
-
index:
|
|
265
|
-
componentDatatype: ComponentDatatype.
|
|
266
|
-
componentsPerAttribute:
|
|
267
|
-
vertexBuffer: Buffer.createVertexBuffer({
|
|
268
|
-
typedArray: attributeArrays.positionHigh,
|
|
269
|
-
context,
|
|
270
|
-
usage: BufferUsage.STATIC_DRAW,
|
|
271
|
-
}),
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
index: BufferPolylineAttributeLocations.positionLow,
|
|
275
|
-
componentDatatype: ComponentDatatype.FLOAT,
|
|
276
|
-
componentsPerAttribute: 3,
|
|
277
|
-
vertexBuffer: Buffer.createVertexBuffer({
|
|
278
|
-
typedArray: attributeArrays.positionLow,
|
|
279
|
-
context,
|
|
280
|
-
usage: BufferUsage.STATIC_DRAW,
|
|
281
|
-
}),
|
|
282
|
-
},
|
|
283
|
-
|
|
284
|
-
{
|
|
285
|
-
index: BufferPolylineAttributeLocations.prevPositionHigh,
|
|
286
|
-
componentDatatype: ComponentDatatype.FLOAT,
|
|
287
|
-
componentsPerAttribute: 3,
|
|
288
|
-
vertexBuffer: Buffer.createVertexBuffer({
|
|
289
|
-
typedArray: attributeArrays.prevPositionHigh,
|
|
290
|
-
context,
|
|
291
|
-
usage: BufferUsage.STATIC_DRAW,
|
|
292
|
-
}),
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
index: BufferPolylineAttributeLocations.prevPositionLow,
|
|
296
|
-
componentDatatype: ComponentDatatype.FLOAT,
|
|
297
|
-
componentsPerAttribute: 3,
|
|
298
|
-
vertexBuffer: Buffer.createVertexBuffer({
|
|
299
|
-
typedArray: attributeArrays.prevPositionLow,
|
|
300
|
-
context,
|
|
301
|
-
usage: BufferUsage.STATIC_DRAW,
|
|
302
|
-
}),
|
|
303
|
-
},
|
|
304
|
-
|
|
305
|
-
{
|
|
306
|
-
index: BufferPolylineAttributeLocations.nextPositionHigh,
|
|
307
|
-
componentDatatype: ComponentDatatype.FLOAT,
|
|
308
|
-
componentsPerAttribute: 3,
|
|
508
|
+
index: attributeLocations.pickColor,
|
|
509
|
+
componentDatatype: ComponentDatatype.UNSIGNED_BYTE,
|
|
510
|
+
componentsPerAttribute: 4,
|
|
309
511
|
vertexBuffer: Buffer.createVertexBuffer({
|
|
310
|
-
typedArray: attributeArrays.
|
|
512
|
+
typedArray: attributeArrays.pickColor,
|
|
311
513
|
context,
|
|
312
514
|
usage: BufferUsage.STATIC_DRAW,
|
|
313
515
|
}),
|
|
314
516
|
},
|
|
315
517
|
{
|
|
316
|
-
index:
|
|
518
|
+
index: attributeLocations.showColorWidthAndTexCoord,
|
|
317
519
|
componentDatatype: ComponentDatatype.FLOAT,
|
|
318
|
-
componentsPerAttribute: 3,
|
|
319
|
-
vertexBuffer: Buffer.createVertexBuffer({
|
|
320
|
-
typedArray: attributeArrays.nextPositionLow,
|
|
321
|
-
context,
|
|
322
|
-
usage: BufferUsage.STATIC_DRAW,
|
|
323
|
-
}),
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
index: BufferPolylineAttributeLocations.pickColor,
|
|
327
|
-
componentDatatype: ComponentDatatype.UNSIGNED_BYTE,
|
|
328
520
|
componentsPerAttribute: 4,
|
|
329
521
|
vertexBuffer: Buffer.createVertexBuffer({
|
|
330
|
-
typedArray: attributeArrays.
|
|
522
|
+
typedArray: attributeArrays.showColorWidthAndTexCoord,
|
|
331
523
|
context,
|
|
332
524
|
usage: BufferUsage.STATIC_DRAW,
|
|
333
525
|
}),
|
|
334
526
|
},
|
|
335
527
|
{
|
|
336
|
-
index:
|
|
337
|
-
componentDatatype: ComponentDatatype.
|
|
338
|
-
componentsPerAttribute:
|
|
528
|
+
index: attributeLocations.alpha,
|
|
529
|
+
componentDatatype: ComponentDatatype.UNSIGNED_BYTE,
|
|
530
|
+
componentsPerAttribute: 1,
|
|
339
531
|
vertexBuffer: Buffer.createVertexBuffer({
|
|
340
|
-
typedArray: attributeArrays.
|
|
532
|
+
typedArray: attributeArrays.alpha,
|
|
341
533
|
context,
|
|
342
534
|
usage: BufferUsage.STATIC_DRAW,
|
|
343
535
|
}),
|
|
@@ -354,11 +546,11 @@ function renderBufferPolylineCollection(collection, frameState, renderContext) {
|
|
|
354
546
|
indexCount,
|
|
355
547
|
);
|
|
356
548
|
|
|
357
|
-
for (const key in
|
|
358
|
-
if (Object.hasOwn(
|
|
549
|
+
for (const key in attributeLocations) {
|
|
550
|
+
if (Object.hasOwn(attributeLocations, key)) {
|
|
359
551
|
const attribute = /** @type {BufferPolylineAttribute} */ (key);
|
|
360
552
|
renderContext.vertexArray.copyAttributeFromRange(
|
|
361
|
-
|
|
553
|
+
attributeLocations[attribute],
|
|
362
554
|
renderContext.attributeArrays[attribute],
|
|
363
555
|
vertexOffset,
|
|
364
556
|
vertexCount,
|
|
@@ -369,7 +561,10 @@ function renderBufferPolylineCollection(collection, frameState, renderContext) {
|
|
|
369
561
|
|
|
370
562
|
if (!defined(renderContext.renderState)) {
|
|
371
563
|
renderContext.renderState = RenderState.fromCache({
|
|
372
|
-
blending:
|
|
564
|
+
blending:
|
|
565
|
+
collection._blendOption === BlendOption.OPAQUE
|
|
566
|
+
? BlendingState.DISABLED
|
|
567
|
+
: BlendingState.ALPHA_BLEND,
|
|
373
568
|
depthTest: { enabled: true },
|
|
374
569
|
});
|
|
375
570
|
}
|
|
@@ -379,11 +574,12 @@ function renderBufferPolylineCollection(collection, frameState, renderContext) {
|
|
|
379
574
|
context,
|
|
380
575
|
vertexShaderSource: new ShaderSource({
|
|
381
576
|
sources: [PolylineCommon, BufferPolylineMaterialVS],
|
|
577
|
+
defines: useFloat64 ? ["USE_FLOAT64"] : [],
|
|
382
578
|
}),
|
|
383
579
|
fragmentShaderSource: new ShaderSource({
|
|
384
580
|
sources: [BufferPolylineMaterialFS],
|
|
385
581
|
}),
|
|
386
|
-
attributeLocations
|
|
582
|
+
attributeLocations,
|
|
387
583
|
});
|
|
388
584
|
}
|
|
389
585
|
|
|
@@ -395,12 +591,15 @@ function renderBufferPolylineCollection(collection, frameState, renderContext) {
|
|
|
395
591
|
renderState: renderContext.renderState,
|
|
396
592
|
shaderProgram: renderContext.shaderProgram,
|
|
397
593
|
primitiveType: PrimitiveType.TRIANGLES,
|
|
398
|
-
pass:
|
|
594
|
+
pass:
|
|
595
|
+
collection._blendOption === BlendOption.OPAQUE
|
|
596
|
+
? Pass.OPAQUE
|
|
597
|
+
: Pass.TRANSLUCENT,
|
|
399
598
|
pickId: collection._allowPicking ? "v_pickColor" : undefined,
|
|
400
599
|
owner: collection,
|
|
401
600
|
count: drawCount,
|
|
402
601
|
modelMatrix: collection.modelMatrix, // shared reference
|
|
403
|
-
boundingVolume: collection.
|
|
602
|
+
boundingVolume: collection.boundingVolume, // shared reference
|
|
404
603
|
debugShowBoundingVolume: collection.debugShowBoundingVolume,
|
|
405
604
|
});
|
|
406
605
|
}
|