@cesium/engine 20.0.2-ion.0 → 21.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/ThirdParty/Workers/zip-web-worker.js +637 -0
- package/Build/Workers/{chunk-WZKTQZUW.js → chunk-2T4WAVWX.js} +6 -6
- package/Build/Workers/{chunk-6LULWCX3.js → chunk-3G5XEUPY.js} +1 -1
- package/Build/Workers/{chunk-OIMV4OE5.js → chunk-3MSNTCHW.js} +9 -9
- package/Build/Workers/{chunk-VZNF2GT7.js → chunk-3OPG2FGI.js} +4 -4
- package/Build/Workers/{chunk-MTBXKKSQ.js → chunk-3PUG3T2H.js} +12 -12
- package/Build/Workers/{chunk-XWRUYDF6.js → chunk-4PH27XAL.js} +2 -2
- package/Build/Workers/{chunk-P2V7PVDH.js → chunk-4VJYMLR6.js} +8 -8
- package/Build/Workers/{chunk-MFXTB5I4.js → chunk-5B3PGBQW.js} +11 -11
- package/Build/Workers/{chunk-USK6ZAY2.js → chunk-5GHCWGC4.js} +1 -1
- package/Build/Workers/{chunk-AHFTST3Q.js → chunk-5PEQUMCB.js} +12 -12
- package/Build/Workers/{chunk-23B3EYUM.js → chunk-64WSG7AT.js} +4 -4
- package/Build/Workers/{chunk-CEA3L7M7.js → chunk-6J6WGCWP.js} +4 -4
- package/Build/Workers/{chunk-VSMKMGX4.js → chunk-75B34CC6.js} +5 -5
- package/Build/Workers/{chunk-IS5FETN7.js → chunk-7PLX65MV.js} +5 -5
- package/Build/Workers/{chunk-FNUSHLOY.js → chunk-AR2FUSG6.js} +1 -1
- package/Build/Workers/{chunk-VLGVUVJY.js → chunk-ARYRHDEB.js} +6 -6
- package/Build/Workers/{chunk-FHLPYFIW.js → chunk-B7INTBBB.js} +13 -13
- package/Build/Workers/{chunk-BHAATGZA.js → chunk-BDPSQXLX.js} +5 -5
- package/Build/Workers/{chunk-QZGZIAK2.js → chunk-BU4CGMHO.js} +6 -6
- package/Build/Workers/{chunk-YNPZU55A.js → chunk-BUBVUXDO.js} +6 -6
- package/Build/Workers/{chunk-LS63ERFB.js → chunk-CF72FAKC.js} +4 -4
- package/Build/Workers/{chunk-D4XRQNUO.js → chunk-DJ4ROETJ.js} +5 -5
- package/Build/Workers/{chunk-ABTG74AR.js → chunk-E5XCZVIY.js} +1 -1
- package/Build/Workers/{chunk-AFKNTEMH.js → chunk-EAYW4CFP.js} +16 -16
- package/Build/Workers/{chunk-YXTWHLJA.js → chunk-EHFMZFVC.js} +4 -4
- package/Build/Workers/{chunk-H7HFDM3G.js → chunk-FFCKCQPK.js} +5 -5
- package/Build/Workers/{chunk-V6ZGOX4I.js → chunk-GKCZ2G36.js} +7 -7
- package/Build/Workers/{chunk-VODCZKV2.js → chunk-HJ7IZBEI.js} +4 -4
- package/Build/Workers/{chunk-66MGJQFZ.js → chunk-JJZWDROM.js} +2 -2
- package/Build/Workers/{chunk-F4PS6RFF.js → chunk-JUOEBO4F.js} +10 -10
- package/Build/Workers/{chunk-WORBFT5H.js → chunk-K4IDXMIZ.js} +9 -9
- package/Build/Workers/{chunk-Q3OWKSC5.js → chunk-LL6HN3W4.js} +10 -10
- package/Build/Workers/{chunk-YUHWFX5H.js → chunk-LNTUIO55.js} +2 -2
- package/Build/Workers/{chunk-VA7LWA5Q.js → chunk-LWOCFJEH.js} +9 -9
- package/Build/Workers/{chunk-5DF5RVIO.js → chunk-MMUISYW4.js} +16 -16
- package/Build/Workers/{chunk-K6THSIDU.js → chunk-MXYW4BQ3.js} +2 -2
- package/Build/Workers/{chunk-X55ZOYMS.js → chunk-N6DVKXZD.js} +12 -12
- package/Build/Workers/{chunk-NKKNQMEH.js → chunk-NP46ZIBY.js} +3 -3
- package/Build/Workers/{chunk-QID3DXQA.js → chunk-OW6F6CPZ.js} +7 -7
- package/Build/Workers/{chunk-CYC7JX3P.js → chunk-P6OAOFBU.js} +8 -8
- package/Build/Workers/{chunk-FYYP46TF.js → chunk-PXDMWXO5.js} +2 -2
- package/Build/Workers/{chunk-TZDR2BAP.js → chunk-QS7623NH.js} +6 -6
- package/Build/Workers/{chunk-D5X2LOJ2.js → chunk-ROH45IXJ.js} +7 -7
- package/Build/Workers/{chunk-UR36KLNW.js → chunk-S2P6LCIB.js} +4 -4
- package/Build/Workers/{chunk-Z2W7ZIGV.js → chunk-S4NZVXU6.js} +2 -2
- package/Build/Workers/{chunk-YSDOO7AG.js → chunk-SGGO5WVA.js} +5 -5
- package/Build/Workers/{chunk-H5IQLAJP.js → chunk-TG7N7TPY.js} +47 -50
- package/Build/Workers/{chunk-XIDMFHR4.js → chunk-TUZQG4RW.js} +14 -14
- package/Build/Workers/{chunk-JVG6T2WE.js → chunk-UHVE7V65.js} +12 -12
- package/Build/Workers/{chunk-FAQ2XNFV.js → chunk-UY2HVPDL.js} +5 -5
- package/Build/Workers/{chunk-CUU3WGXJ.js → chunk-YNLPRFUQ.js} +6 -6
- package/Build/Workers/{chunk-X6GXYB3M.js → chunk-ZYOHBCCE.js} +1 -1
- package/Build/Workers/combineGeometry.js +21 -21
- package/Build/Workers/createBoxGeometry.js +15 -15
- package/Build/Workers/createBoxOutlineGeometry.js +13 -13
- package/Build/Workers/createCircleGeometry.js +23 -23
- package/Build/Workers/createCircleOutlineGeometry.js +16 -16
- package/Build/Workers/createCoplanarPolygonGeometry.js +30 -30
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +28 -28
- package/Build/Workers/createCorridorGeometry.js +26 -26
- package/Build/Workers/createCorridorOutlineGeometry.js +25 -25
- package/Build/Workers/createCylinderGeometry.js +17 -17
- package/Build/Workers/createCylinderOutlineGeometry.js +15 -15
- package/Build/Workers/createEllipseGeometry.js +23 -23
- package/Build/Workers/createEllipseOutlineGeometry.js +16 -16
- package/Build/Workers/createEllipsoidGeometry.js +16 -16
- package/Build/Workers/createEllipsoidOutlineGeometry.js +15 -15
- package/Build/Workers/createFrustumGeometry.js +15 -15
- package/Build/Workers/createFrustumOutlineGeometry.js +15 -15
- package/Build/Workers/createGeometry.js +21 -21
- package/Build/Workers/createGroundPolylineGeometry.js +19 -19
- package/Build/Workers/createPlaneGeometry.js +13 -13
- package/Build/Workers/createPlaneOutlineGeometry.js +12 -12
- package/Build/Workers/createPolygonGeometry.js +29 -29
- package/Build/Workers/createPolygonOutlineGeometry.js +27 -27
- package/Build/Workers/createPolylineGeometry.js +22 -22
- package/Build/Workers/createPolylineVolumeGeometry.js +28 -28
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +24 -24
- package/Build/Workers/createRectangleGeometry.js +24 -24
- package/Build/Workers/createRectangleOutlineGeometry.js +17 -17
- package/Build/Workers/createSimplePolylineGeometry.js +20 -20
- package/Build/Workers/createSphereGeometry.js +16 -16
- package/Build/Workers/createSphereOutlineGeometry.js +15 -15
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +12 -12
- package/Build/Workers/createVectorTileGeometries.js +21 -21
- package/Build/Workers/createVectorTilePoints.js +11 -11
- package/Build/Workers/createVectorTilePolygons.js +19 -19
- package/Build/Workers/createVectorTilePolylines.js +12 -12
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +19 -19
- package/Build/Workers/createVerticesFromHeightmap.js +19 -19
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +16 -16
- package/Build/Workers/createWallGeometry.js +21 -21
- package/Build/Workers/createWallOutlineGeometry.js +20 -20
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +9 -9
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +19 -19
- package/Source/Core/Event.js +41 -49
- package/Source/Core/GoogleMaps.js +2 -2
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonResource.js +30 -4
- package/Source/Core/Resource.js +5 -1
- package/Source/DataSources/KmlDataSource.js +62 -63
- package/Source/DataSources/exportKml.js +27 -30
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Azure2DImageryProvider.js +308 -0
- package/Source/Scene/Billboard.js +4 -0
- package/Source/Scene/BillboardCollection.js +9 -2
- package/Source/Scene/ClippingPlaneCollection.js +3 -3
- package/Source/Scene/ClippingPolygon.js +91 -2
- package/Source/Scene/CreditDisplay.js +1 -1
- package/Source/Scene/GaussianSplat3DTileContent.js +54 -9
- package/Source/Scene/GaussianSplatPrimitive.js +49 -50
- package/Source/Scene/Google2DImageryProvider.js +614 -0
- package/Source/Scene/IonImageryProvider.js +22 -1
- package/Source/Scene/LabelCollection.js +1 -0
- package/Source/Scene/Material.js +248 -80
- package/Source/Scene/Primitive.js +6 -0
- package/Source/Scene/PrimitiveState.js +123 -0
- package/Source/Scene/Scene.js +2 -2
- package/Source/Scene/VoxelBoundsCollection.js +494 -0
- package/Source/Scene/VoxelBoxShape.js +236 -101
- package/Source/Scene/VoxelCylinderShape.js +315 -204
- package/Source/Scene/VoxelEllipsoidShape.js +402 -119
- package/Source/Scene/VoxelPrimitive.js +119 -84
- package/Source/Scene/VoxelRenderResources.js +17 -10
- package/Source/Scene/VoxelShape.js +21 -6
- package/Source/Scene/buildVoxelDrawCommands.js +61 -20
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -1
- package/Source/Scene/getClippingFunction.js +79 -88
- package/Source/Shaders/BillboardCollectionVS.glsl +2 -0
- package/Source/Shaders/BillboardCollectionVS.js +2 -0
- package/Source/Shaders/Voxels/IntersectBox.glsl +20 -33
- package/Source/Shaders/Voxels/IntersectBox.js +20 -33
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +28 -32
- package/Source/Shaders/Voxels/IntersectCylinder.js +28 -32
- package/Source/Shaders/Voxels/IntersectDepth.glsl +1 -4
- package/Source/Shaders/Voxels/IntersectDepth.js +1 -4
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +12 -20
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +12 -20
- package/Source/Shaders/Voxels/IntersectLongitude.glsl +21 -9
- package/Source/Shaders/Voxels/IntersectLongitude.js +21 -9
- package/Source/Shaders/Voxels/{IntersectClippingPlanes.glsl → IntersectPlane.glsl} +5 -3
- package/Source/Shaders/Voxels/{IntersectClippingPlanes.js → IntersectPlane.js} +5 -3
- package/Source/Shaders/Voxels/Intersection.glsl +3 -3
- package/Source/Shaders/Voxels/Intersection.js +3 -3
- package/Source/Shaders/Voxels/Octree.glsl +46 -51
- package/Source/Shaders/Voxels/Octree.js +46 -51
- package/Source/Shaders/Voxels/VoxelFS.glsl +50 -48
- package/Source/Shaders/Voxels/VoxelFS.js +50 -48
- package/Source/Shaders/Voxels/VoxelUtils.glsl +0 -19
- package/Source/Shaders/Voxels/VoxelUtils.js +0 -19
- package/Source/Shaders/Voxels/convertLocalToBoxUv.glsl +30 -0
- package/Source/Shaders/Voxels/convertLocalToBoxUv.js +32 -0
- package/Source/Shaders/Voxels/convertLocalToCylinderUv.glsl +97 -0
- package/Source/Shaders/Voxels/convertLocalToCylinderUv.js +99 -0
- package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.glsl +193 -0
- package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.js +195 -0
- package/Source/ThirdParty/Workers/zip-web-worker.js +1 -0
- package/Source/ThirdParty/zip-module.wasm +0 -0
- package/index.d.ts +317 -14
- package/index.js +141 -139
- package/package.json +2 -2
- package/Build/ThirdParty/Workers/pako_deflate.min.js +0 -503
- package/Build/ThirdParty/Workers/pako_inflate.min.js +0 -698
- package/Build/ThirdParty/Workers/z-worker-pako.js +0 -601
- package/Source/Core/defaultValue.js +0 -48
- package/Source/Shaders/Voxels/convertUvToBox.glsl +0 -45
- package/Source/Shaders/Voxels/convertUvToBox.js +0 -46
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +0 -99
- package/Source/Shaders/Voxels/convertUvToCylinder.js +0 -101
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +0 -139
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +0 -141
- package/Source/ThirdParty/Workers/pako_deflate.min.js +0 -2
- package/Source/ThirdParty/Workers/pako_inflate.min.js +0 -2
- package/Source/ThirdParty/Workers/z-worker-pako.js +0 -1
|
@@ -130,6 +130,14 @@ function VoxelPrimitive(options) {
|
|
|
130
130
|
*/
|
|
131
131
|
this._paddingAfter = new Cartesian3();
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
* This member is not known until the provider is ready.
|
|
135
|
+
*
|
|
136
|
+
* @type {number}
|
|
137
|
+
* @private
|
|
138
|
+
*/
|
|
139
|
+
this._availableLevels = 1;
|
|
140
|
+
|
|
133
141
|
/**
|
|
134
142
|
* This member is not known until the provider is ready.
|
|
135
143
|
*
|
|
@@ -332,24 +340,24 @@ function VoxelPrimitive(options) {
|
|
|
332
340
|
this._clock = options.clock;
|
|
333
341
|
|
|
334
342
|
// Transforms and other values that are computed when the shape changes
|
|
335
|
-
|
|
336
343
|
/**
|
|
337
344
|
* @type {Matrix4}
|
|
338
345
|
* @private
|
|
339
346
|
*/
|
|
340
|
-
this.
|
|
347
|
+
this._transformPositionLocalToWorld = new Matrix4();
|
|
341
348
|
|
|
342
349
|
/**
|
|
343
|
-
* @type {
|
|
350
|
+
* @type {Matrix4}
|
|
344
351
|
* @private
|
|
345
352
|
*/
|
|
346
|
-
this.
|
|
353
|
+
this._transformPositionWorldToLocal = new Matrix4();
|
|
347
354
|
|
|
348
355
|
/**
|
|
356
|
+
* Transforms a plane in Hessian normal form from local space to view space.
|
|
349
357
|
* @type {Matrix4}
|
|
350
358
|
* @private
|
|
351
359
|
*/
|
|
352
|
-
this.
|
|
360
|
+
this._transformPlaneLocalToView = new Matrix4();
|
|
353
361
|
|
|
354
362
|
/**
|
|
355
363
|
* @type {Matrix3}
|
|
@@ -440,14 +448,16 @@ function VoxelPrimitive(options) {
|
|
|
440
448
|
inputDimensions: new Cartesian3(),
|
|
441
449
|
paddingBefore: new Cartesian3(),
|
|
442
450
|
paddingAfter: new Cartesian3(),
|
|
443
|
-
|
|
444
|
-
transformPositionUvToView: new Matrix4(),
|
|
451
|
+
transformPositionViewToLocal: new Matrix4(),
|
|
445
452
|
transformDirectionViewToLocal: new Matrix3(),
|
|
446
|
-
|
|
447
|
-
|
|
453
|
+
cameraPositionLocal: new Cartesian3(),
|
|
454
|
+
cameraDirectionLocal: new Cartesian3(),
|
|
455
|
+
cameraTileCoordinates: new Cartesian4(),
|
|
456
|
+
cameraTileUv: new Cartesian3(),
|
|
448
457
|
ndcSpaceAxisAlignedBoundingBox: new Cartesian4(),
|
|
449
458
|
clippingPlanesTexture: undefined,
|
|
450
459
|
clippingPlanesMatrix: new Matrix4(),
|
|
460
|
+
renderBoundPlanesTexture: undefined,
|
|
451
461
|
stepSize: 0,
|
|
452
462
|
pickColor: new Color(),
|
|
453
463
|
};
|
|
@@ -631,11 +641,7 @@ function initialize(primitive, provider) {
|
|
|
631
641
|
// Create the shape object, and update it so it is valid for VoxelTraversal
|
|
632
642
|
const ShapeConstructor = VoxelShapeType.getShapeConstructor(shapeType);
|
|
633
643
|
primitive._shape = new ShapeConstructor();
|
|
634
|
-
primitive._shapeVisible = updateShapeAndTransforms(
|
|
635
|
-
primitive,
|
|
636
|
-
primitive._shape,
|
|
637
|
-
provider,
|
|
638
|
-
);
|
|
644
|
+
primitive._shapeVisible = updateShapeAndTransforms(primitive);
|
|
639
645
|
}
|
|
640
646
|
|
|
641
647
|
Object.defineProperties(VoxelPrimitive.prototype, {
|
|
@@ -1137,20 +1143,10 @@ Object.defineProperties(VoxelPrimitive.prototype, {
|
|
|
1137
1143
|
|
|
1138
1144
|
const scratchIntersect = new Cartesian4();
|
|
1139
1145
|
const scratchNdcAabb = new Cartesian4();
|
|
1140
|
-
const scratchTransformPositionWorldToLocal = new Matrix4();
|
|
1141
1146
|
const scratchTransformPositionLocalToWorld = new Matrix4();
|
|
1142
1147
|
const scratchTransformPositionLocalToProjection = new Matrix4();
|
|
1143
|
-
|
|
1144
|
-
const
|
|
1145
|
-
Matrix3.fromUniformScale(0.5, new Matrix3()),
|
|
1146
|
-
new Cartesian3(0.5, 0.5, 0.5),
|
|
1147
|
-
new Matrix4(),
|
|
1148
|
-
);
|
|
1149
|
-
const transformPositionUvToLocal = Matrix4.fromRotationTranslation(
|
|
1150
|
-
Matrix3.fromUniformScale(2.0, new Matrix3()),
|
|
1151
|
-
new Cartesian3(-1.0, -1.0, -1.0),
|
|
1152
|
-
new Matrix4(),
|
|
1153
|
-
);
|
|
1148
|
+
const scratchCameraPositionShapeUv = new Cartesian3();
|
|
1149
|
+
const scratchCameraTileCoordinates = new Cartesian4();
|
|
1154
1150
|
|
|
1155
1151
|
/**
|
|
1156
1152
|
* Updates the voxel primitive.
|
|
@@ -1160,6 +1156,7 @@ const transformPositionUvToLocal = Matrix4.fromRotationTranslation(
|
|
|
1160
1156
|
*/
|
|
1161
1157
|
VoxelPrimitive.prototype.update = function (frameState) {
|
|
1162
1158
|
const provider = this._provider;
|
|
1159
|
+
const uniforms = this._uniforms;
|
|
1163
1160
|
|
|
1164
1161
|
// Update the custom shader in case it has texture uniforms.
|
|
1165
1162
|
this._customShader.update(frameState);
|
|
@@ -1185,10 +1182,9 @@ VoxelPrimitive.prototype.update = function (frameState) {
|
|
|
1185
1182
|
// frame because the member variables can be modified externally via the
|
|
1186
1183
|
// getters.
|
|
1187
1184
|
const shapeDirty = checkTransformAndBounds(this, provider);
|
|
1188
|
-
const shape = this._shape;
|
|
1189
1185
|
if (shapeDirty) {
|
|
1190
|
-
this._shapeVisible = updateShapeAndTransforms(this
|
|
1191
|
-
if (checkShapeDefines(this
|
|
1186
|
+
this._shapeVisible = updateShapeAndTransforms(this);
|
|
1187
|
+
if (checkShapeDefines(this)) {
|
|
1192
1188
|
this._shaderDirty = true;
|
|
1193
1189
|
}
|
|
1194
1190
|
}
|
|
@@ -1196,6 +1192,8 @@ VoxelPrimitive.prototype.update = function (frameState) {
|
|
|
1196
1192
|
return;
|
|
1197
1193
|
}
|
|
1198
1194
|
|
|
1195
|
+
this._shape.updateViewTransforms(frameState);
|
|
1196
|
+
|
|
1199
1197
|
// Update the traversal and prepare for rendering.
|
|
1200
1198
|
const keyframeLocation = getKeyframeLocation(
|
|
1201
1199
|
provider.timeIntervalCollection,
|
|
@@ -1243,7 +1241,6 @@ VoxelPrimitive.prototype.update = function (frameState) {
|
|
|
1243
1241
|
}
|
|
1244
1242
|
|
|
1245
1243
|
const leafNodeTexture = traversal.leafNodeTexture;
|
|
1246
|
-
const uniforms = this._uniforms;
|
|
1247
1244
|
if (defined(leafNodeTexture)) {
|
|
1248
1245
|
uniforms.octreeLeafNodeTexture = traversal.leafNodeTexture;
|
|
1249
1246
|
uniforms.octreeLeafNodeTexelSizeUv = Cartesian2.clone(
|
|
@@ -1262,7 +1259,7 @@ VoxelPrimitive.prototype.update = function (frameState) {
|
|
|
1262
1259
|
// Calculate the NDC-space AABB to "scissor" the fullscreen quad
|
|
1263
1260
|
const transformPositionWorldToProjection =
|
|
1264
1261
|
context.uniformState.viewProjection;
|
|
1265
|
-
const orientedBoundingBox =
|
|
1262
|
+
const { orientedBoundingBox } = this._shape;
|
|
1266
1263
|
const ndcAabb = orientedBoundingBoxToNdcAabb(
|
|
1267
1264
|
orientedBoundingBox,
|
|
1268
1265
|
transformPositionWorldToProjection,
|
|
@@ -1286,17 +1283,17 @@ VoxelPrimitive.prototype.update = function (frameState) {
|
|
|
1286
1283
|
uniforms.ndcSpaceAxisAlignedBoundingBox,
|
|
1287
1284
|
);
|
|
1288
1285
|
const transformPositionViewToWorld = context.uniformState.inverseView;
|
|
1289
|
-
|
|
1290
|
-
this.
|
|
1286
|
+
const transformPositionViewToLocal = Matrix4.multiplyTransformation(
|
|
1287
|
+
this._transformPositionWorldToLocal,
|
|
1291
1288
|
transformPositionViewToWorld,
|
|
1292
|
-
uniforms.
|
|
1289
|
+
uniforms.transformPositionViewToLocal,
|
|
1293
1290
|
);
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
this.
|
|
1298
|
-
uniforms.transformPositionUvToView,
|
|
1291
|
+
|
|
1292
|
+
this._transformPlaneLocalToView = Matrix4.transpose(
|
|
1293
|
+
transformPositionViewToLocal,
|
|
1294
|
+
this._transformPlaneLocalToView,
|
|
1299
1295
|
);
|
|
1296
|
+
|
|
1300
1297
|
const transformDirectionViewToWorld =
|
|
1301
1298
|
context.uniformState.inverseViewRotation;
|
|
1302
1299
|
uniforms.transformDirectionViewToLocal = Matrix3.multiply(
|
|
@@ -1304,32 +1301,85 @@ VoxelPrimitive.prototype.update = function (frameState) {
|
|
|
1304
1301
|
transformDirectionViewToWorld,
|
|
1305
1302
|
uniforms.transformDirectionViewToLocal,
|
|
1306
1303
|
);
|
|
1307
|
-
uniforms.
|
|
1308
|
-
this.
|
|
1304
|
+
uniforms.cameraPositionLocal = Matrix4.multiplyByPoint(
|
|
1305
|
+
this._transformPositionWorldToLocal,
|
|
1309
1306
|
frameState.camera.positionWC,
|
|
1310
|
-
uniforms.
|
|
1307
|
+
uniforms.cameraPositionLocal,
|
|
1311
1308
|
);
|
|
1312
|
-
uniforms.
|
|
1313
|
-
this.
|
|
1309
|
+
uniforms.cameraDirectionLocal = Matrix3.multiplyByVector(
|
|
1310
|
+
this._transformDirectionWorldToLocal,
|
|
1314
1311
|
frameState.camera.directionWC,
|
|
1315
|
-
uniforms.
|
|
1312
|
+
uniforms.cameraDirectionLocal,
|
|
1313
|
+
);
|
|
1314
|
+
const cameraTileCoordinates = getTileCoordinates(
|
|
1315
|
+
this,
|
|
1316
|
+
uniforms.cameraPositionLocal,
|
|
1317
|
+
scratchCameraTileCoordinates,
|
|
1318
|
+
);
|
|
1319
|
+
uniforms.cameraTileCoordinates = Cartesian4.fromElements(
|
|
1320
|
+
Math.floor(cameraTileCoordinates.x),
|
|
1321
|
+
Math.floor(cameraTileCoordinates.y),
|
|
1322
|
+
Math.floor(cameraTileCoordinates.z),
|
|
1323
|
+
cameraTileCoordinates.w,
|
|
1324
|
+
uniforms.cameraTileCoordinates,
|
|
1316
1325
|
);
|
|
1317
|
-
uniforms.
|
|
1318
|
-
|
|
1319
|
-
|
|
1326
|
+
uniforms.cameraTileUv = Cartesian3.fromElements(
|
|
1327
|
+
cameraTileCoordinates.x - Math.floor(cameraTileCoordinates.x),
|
|
1328
|
+
cameraTileCoordinates.y - Math.floor(cameraTileCoordinates.y),
|
|
1329
|
+
cameraTileCoordinates.z - Math.floor(cameraTileCoordinates.z),
|
|
1330
|
+
uniforms.cameraTileUv,
|
|
1320
1331
|
);
|
|
1321
1332
|
uniforms.stepSize = this._stepSizeMultiplier;
|
|
1322
1333
|
|
|
1334
|
+
updateRenderBoundPlanes(this, frameState);
|
|
1335
|
+
|
|
1323
1336
|
// Render the primitive
|
|
1324
1337
|
const command = frameState.passes.pick
|
|
1325
1338
|
? this._drawCommandPick
|
|
1326
1339
|
: frameState.passes.pickVoxel
|
|
1327
1340
|
? this._drawCommandPickVoxel
|
|
1328
1341
|
: this._drawCommand;
|
|
1329
|
-
command.boundingVolume =
|
|
1342
|
+
command.boundingVolume = this._shape.boundingSphere;
|
|
1330
1343
|
frameState.commandList.push(command);
|
|
1331
1344
|
};
|
|
1332
1345
|
|
|
1346
|
+
function updateRenderBoundPlanes(primitive, frameState) {
|
|
1347
|
+
const uniforms = primitive._uniforms;
|
|
1348
|
+
const { renderBoundPlanes } = primitive._shape;
|
|
1349
|
+
if (!defined(renderBoundPlanes)) {
|
|
1350
|
+
return;
|
|
1351
|
+
}
|
|
1352
|
+
renderBoundPlanes.update(frameState, primitive._transformPlaneLocalToView);
|
|
1353
|
+
uniforms.renderBoundPlanesTexture = renderBoundPlanes.texture;
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
/**
|
|
1357
|
+
* Converts a position in local space to tile coordinates.
|
|
1358
|
+
*
|
|
1359
|
+
* @param {VoxelPrimitive} primitive The primitive to get the tile coordinates for.
|
|
1360
|
+
* @param {Cartesian3} positionLocal The position in local space to convert to tile coordinates.
|
|
1361
|
+
* @param {Cartesian4} result The result object to store the tile coordinates.
|
|
1362
|
+
* @returns {Cartesian4} The tile coordinates of the supplied position.
|
|
1363
|
+
* @private
|
|
1364
|
+
*/
|
|
1365
|
+
function getTileCoordinates(primitive, positionLocal, result) {
|
|
1366
|
+
const shapeUv = primitive._shape.convertLocalToShapeUvSpace(
|
|
1367
|
+
positionLocal,
|
|
1368
|
+
scratchCameraPositionShapeUv,
|
|
1369
|
+
);
|
|
1370
|
+
|
|
1371
|
+
const availableLevels = primitive._availableLevels;
|
|
1372
|
+
const numTiles = 2 ** (availableLevels - 1);
|
|
1373
|
+
|
|
1374
|
+
return Cartesian4.fromElements(
|
|
1375
|
+
shapeUv.x * numTiles,
|
|
1376
|
+
shapeUv.y * numTiles,
|
|
1377
|
+
shapeUv.z * numTiles,
|
|
1378
|
+
availableLevels - 1,
|
|
1379
|
+
result,
|
|
1380
|
+
);
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1333
1383
|
const scratchExaggerationScale = new Cartesian3();
|
|
1334
1384
|
const scratchExaggerationCenter = new Cartesian3();
|
|
1335
1385
|
const scratchCartographicCenter = new Cartographic();
|
|
@@ -1337,7 +1387,6 @@ const scratchExaggerationTranslation = new Cartesian3();
|
|
|
1337
1387
|
|
|
1338
1388
|
/**
|
|
1339
1389
|
* Update the exaggerated bounds of a primitive to account for vertical exaggeration
|
|
1340
|
-
* Currently only applies to Ellipsoid shape type
|
|
1341
1390
|
* @param {VoxelPrimitive} primitive
|
|
1342
1391
|
* @param {FrameState} frameState
|
|
1343
1392
|
* @private
|
|
@@ -1513,6 +1562,7 @@ function initFromProvider(primitive, provider, context) {
|
|
|
1513
1562
|
primitive._inputDimensions,
|
|
1514
1563
|
uniforms.inputDimensions,
|
|
1515
1564
|
);
|
|
1565
|
+
primitive._availableLevels = provider.availableLevels ?? 1;
|
|
1516
1566
|
|
|
1517
1567
|
// Create the VoxelTraversal, and set related uniforms
|
|
1518
1568
|
const keyframeCount = provider.keyframeCount ?? 1;
|
|
@@ -1586,12 +1636,11 @@ function updateBound(primitive, newBoundKey, oldBoundKey) {
|
|
|
1586
1636
|
/**
|
|
1587
1637
|
* Update the shape and related transforms
|
|
1588
1638
|
* @param {VoxelPrimitive} primitive
|
|
1589
|
-
* @param {VoxelShape} shape
|
|
1590
|
-
* @param {VoxelProvider} provider
|
|
1591
1639
|
* @returns {boolean} True if the shape is visible
|
|
1592
1640
|
* @private
|
|
1593
1641
|
*/
|
|
1594
|
-
function updateShapeAndTransforms(primitive
|
|
1642
|
+
function updateShapeAndTransforms(primitive) {
|
|
1643
|
+
const shape = primitive._shape;
|
|
1595
1644
|
const visible = shape.update(
|
|
1596
1645
|
primitive._compoundModelMatrix,
|
|
1597
1646
|
primitive._exaggeratedMinBounds,
|
|
@@ -1603,29 +1652,16 @@ function updateShapeAndTransforms(primitive, shape, provider) {
|
|
|
1603
1652
|
return false;
|
|
1604
1653
|
}
|
|
1605
1654
|
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
scratchTransformPositionWorldToLocal,
|
|
1610
|
-
);
|
|
1611
|
-
|
|
1612
|
-
// Set member variables when the shape is dirty
|
|
1613
|
-
primitive._transformPositionWorldToUv = Matrix4.multiplyTransformation(
|
|
1614
|
-
transformPositionLocalToUv,
|
|
1615
|
-
transformPositionWorldToLocal,
|
|
1616
|
-
primitive._transformPositionWorldToUv,
|
|
1655
|
+
primitive._transformPositionLocalToWorld = Matrix4.clone(
|
|
1656
|
+
shape.shapeTransform,
|
|
1657
|
+
primitive._transformPositionLocalToWorld,
|
|
1617
1658
|
);
|
|
1618
|
-
primitive.
|
|
1619
|
-
primitive.
|
|
1620
|
-
primitive.
|
|
1621
|
-
);
|
|
1622
|
-
primitive._transformPositionUvToWorld = Matrix4.multiplyTransformation(
|
|
1623
|
-
transformPositionLocalToWorld,
|
|
1624
|
-
transformPositionUvToLocal,
|
|
1625
|
-
primitive._transformPositionUvToWorld,
|
|
1659
|
+
primitive._transformPositionWorldToLocal = Matrix4.inverse(
|
|
1660
|
+
primitive._transformPositionLocalToWorld,
|
|
1661
|
+
primitive._transformPositionWorldToLocal,
|
|
1626
1662
|
);
|
|
1627
1663
|
primitive._transformDirectionWorldToLocal = Matrix4.getMatrix3(
|
|
1628
|
-
|
|
1664
|
+
primitive._transformPositionWorldToLocal,
|
|
1629
1665
|
primitive._transformDirectionWorldToLocal,
|
|
1630
1666
|
);
|
|
1631
1667
|
|
|
@@ -1679,17 +1715,16 @@ function setTraversalUniforms(traversal, uniforms) {
|
|
|
1679
1715
|
/**
|
|
1680
1716
|
* Track changes in shape-related shader defines
|
|
1681
1717
|
* @param {VoxelPrimitive} primitive
|
|
1682
|
-
* @param {VoxelShape} shape
|
|
1683
1718
|
* @returns {boolean} True if any of the shape defines changed, requiring a shader rebuild
|
|
1684
1719
|
* @private
|
|
1685
1720
|
*/
|
|
1686
|
-
function checkShapeDefines(primitive
|
|
1687
|
-
const
|
|
1688
|
-
const shapeDefinesChanged = Object.keys(
|
|
1689
|
-
(key) =>
|
|
1721
|
+
function checkShapeDefines(primitive) {
|
|
1722
|
+
const { shaderDefines } = primitive._shape;
|
|
1723
|
+
const shapeDefinesChanged = Object.keys(shaderDefines).some(
|
|
1724
|
+
(key) => shaderDefines[key] !== primitive._shapeDefinesOld[key],
|
|
1690
1725
|
);
|
|
1691
1726
|
if (shapeDefinesChanged) {
|
|
1692
|
-
primitive._shapeDefinesOld = clone(
|
|
1727
|
+
primitive._shapeDefinesOld = clone(shaderDefines, true);
|
|
1693
1728
|
}
|
|
1694
1729
|
return shapeDefinesChanged;
|
|
1695
1730
|
}
|
|
@@ -1761,12 +1796,12 @@ function updateClippingPlanes(primitive, frameState) {
|
|
|
1761
1796
|
const uniforms = primitive._uniforms;
|
|
1762
1797
|
uniforms.clippingPlanesTexture = clippingPlanes.texture;
|
|
1763
1798
|
|
|
1764
|
-
// Compute the clipping plane's transformation to
|
|
1799
|
+
// Compute the clipping plane's transformation to local space and then take the inverse
|
|
1765
1800
|
// transpose to properly transform the hessian normal form of the plane.
|
|
1766
1801
|
|
|
1767
|
-
// transpose(inverse(
|
|
1768
|
-
// transpose(inverse(clippingPlaneLocalToWorld) * inverse(
|
|
1769
|
-
// transpose(inverse(clippingPlaneLocalToWorld) *
|
|
1802
|
+
// transpose(inverse(worldToLocal * clippingPlaneLocalToWorld))
|
|
1803
|
+
// transpose(inverse(clippingPlaneLocalToWorld) * inverse(worldToLocal))
|
|
1804
|
+
// transpose(inverse(clippingPlaneLocalToWorld) * localToWorld)
|
|
1770
1805
|
|
|
1771
1806
|
uniforms.clippingPlanesMatrix = Matrix4.transpose(
|
|
1772
1807
|
Matrix4.multiplyTransformation(
|
|
@@ -1774,7 +1809,7 @@ function updateClippingPlanes(primitive, frameState) {
|
|
|
1774
1809
|
clippingPlanes.modelMatrix,
|
|
1775
1810
|
uniforms.clippingPlanesMatrix,
|
|
1776
1811
|
),
|
|
1777
|
-
primitive.
|
|
1812
|
+
primitive._transformPositionLocalToWorld,
|
|
1778
1813
|
uniforms.clippingPlanesMatrix,
|
|
1779
1814
|
),
|
|
1780
1815
|
uniforms.clippingPlanesMatrix,
|
|
@@ -8,15 +8,15 @@ import VoxelFS from "../Shaders/Voxels/VoxelFS.js";
|
|
|
8
8
|
import VoxelVS from "../Shaders/Voxels/VoxelVS.js";
|
|
9
9
|
import IntersectionUtils from "../Shaders/Voxels/IntersectionUtils.js";
|
|
10
10
|
import IntersectDepth from "../Shaders/Voxels/IntersectDepth.js";
|
|
11
|
-
import
|
|
11
|
+
import IntersectPlane from "../Shaders/Voxels/IntersectPlane.js";
|
|
12
12
|
import IntersectLongitude from "../Shaders/Voxels/IntersectLongitude.js";
|
|
13
13
|
import IntersectBox from "../Shaders/Voxels/IntersectBox.js";
|
|
14
14
|
import IntersectCylinder from "../Shaders/Voxels/IntersectCylinder.js";
|
|
15
15
|
import IntersectEllipsoid from "../Shaders/Voxels/IntersectEllipsoid.js";
|
|
16
16
|
import Intersection from "../Shaders/Voxels/Intersection.js";
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
17
|
+
import convertLocalToBoxUv from "../Shaders/Voxels/convertLocalToBoxUv.js";
|
|
18
|
+
import convertLocalToCylinderUv from "../Shaders/Voxels/convertLocalToCylinderUv.js";
|
|
19
|
+
import convertLocalToEllipsoidUv from "../Shaders/Voxels/convertLocalToEllipsoidUv.js";
|
|
20
20
|
import Octree from "../Shaders/Voxels/Octree.js";
|
|
21
21
|
import Megatexture from "../Shaders/Voxels/Megatexture.js";
|
|
22
22
|
import VoxelMetadataOrder from "./VoxelMetadataOrder.js";
|
|
@@ -84,6 +84,12 @@ function VoxelRenderResources(primitive) {
|
|
|
84
84
|
this.clippingPlanes = clippingPlanes;
|
|
85
85
|
this.clippingPlanesLength = clippingPlanesLength;
|
|
86
86
|
|
|
87
|
+
const renderBoundPlanes = primitive._shape.renderBoundPlanes;
|
|
88
|
+
const renderBoundPlanesLength = renderBoundPlanes?.length ?? 0;
|
|
89
|
+
|
|
90
|
+
this.renderBoundPlanes = renderBoundPlanes;
|
|
91
|
+
this.renderBoundPlanesLength = renderBoundPlanesLength;
|
|
92
|
+
|
|
87
93
|
// Build shader
|
|
88
94
|
shaderBuilder.addVertexLines([VoxelVS]);
|
|
89
95
|
|
|
@@ -116,8 +122,10 @@ function VoxelRenderResources(primitive) {
|
|
|
116
122
|
"#line 0",
|
|
117
123
|
Octree,
|
|
118
124
|
VoxelUtils,
|
|
119
|
-
IntersectionUtils,
|
|
120
125
|
Megatexture,
|
|
126
|
+
IntersectionUtils,
|
|
127
|
+
IntersectPlane,
|
|
128
|
+
IntersectDepth,
|
|
121
129
|
]);
|
|
122
130
|
|
|
123
131
|
if (clippingPlanesLength > 0) {
|
|
@@ -138,9 +146,8 @@ function VoxelRenderResources(primitive) {
|
|
|
138
146
|
ShaderDestination.FRAGMENT,
|
|
139
147
|
);
|
|
140
148
|
}
|
|
141
|
-
shaderBuilder.addFragmentLines([IntersectClippingPlanes]);
|
|
142
149
|
}
|
|
143
|
-
|
|
150
|
+
|
|
144
151
|
if (primitive._depthTest) {
|
|
145
152
|
shaderBuilder.addDefine(
|
|
146
153
|
"DEPTH_TEST",
|
|
@@ -151,20 +158,20 @@ function VoxelRenderResources(primitive) {
|
|
|
151
158
|
|
|
152
159
|
if (shapeType === "BOX") {
|
|
153
160
|
shaderBuilder.addFragmentLines([
|
|
154
|
-
|
|
161
|
+
convertLocalToBoxUv,
|
|
155
162
|
IntersectBox,
|
|
156
163
|
Intersection,
|
|
157
164
|
]);
|
|
158
165
|
} else if (shapeType === "CYLINDER") {
|
|
159
166
|
shaderBuilder.addFragmentLines([
|
|
160
|
-
|
|
167
|
+
convertLocalToCylinderUv,
|
|
161
168
|
IntersectLongitude,
|
|
162
169
|
IntersectCylinder,
|
|
163
170
|
Intersection,
|
|
164
171
|
]);
|
|
165
172
|
} else if (shapeType === "ELLIPSOID") {
|
|
166
173
|
shaderBuilder.addFragmentLines([
|
|
167
|
-
|
|
174
|
+
convertLocalToEllipsoidUv,
|
|
168
175
|
IntersectLongitude,
|
|
169
176
|
IntersectEllipsoid,
|
|
170
177
|
Intersection,
|
|
@@ -21,7 +21,6 @@ function VoxelShape() {
|
|
|
21
21
|
Object.defineProperties(VoxelShape.prototype, {
|
|
22
22
|
/**
|
|
23
23
|
* An oriented bounding box containing the bounded shape.
|
|
24
|
-
* The update function must be called before accessing this value.
|
|
25
24
|
*
|
|
26
25
|
* @memberof VoxelShape.prototype
|
|
27
26
|
* @type {OrientedBoundingBox}
|
|
@@ -34,7 +33,6 @@ Object.defineProperties(VoxelShape.prototype, {
|
|
|
34
33
|
|
|
35
34
|
/**
|
|
36
35
|
* A bounding sphere containing the bounded shape.
|
|
37
|
-
* The update function must be called before accessing this value.
|
|
38
36
|
*
|
|
39
37
|
* @memberof VoxelShape.prototype
|
|
40
38
|
* @type {BoundingSphere}
|
|
@@ -47,7 +45,6 @@ Object.defineProperties(VoxelShape.prototype, {
|
|
|
47
45
|
|
|
48
46
|
/**
|
|
49
47
|
* A transformation matrix containing the bounded shape.
|
|
50
|
-
* The update function must be called before accessing this value.
|
|
51
48
|
*
|
|
52
49
|
* @memberof VoxelShape.prototype
|
|
53
50
|
* @type {Matrix4}
|
|
@@ -60,7 +57,6 @@ Object.defineProperties(VoxelShape.prototype, {
|
|
|
60
57
|
|
|
61
58
|
/**
|
|
62
59
|
* A transformation matrix containing the shape, ignoring the bounds.
|
|
63
|
-
* The update function must be called before accessing this value.
|
|
64
60
|
*
|
|
65
61
|
* @memberof VoxelShape.prototype
|
|
66
62
|
* @type {Matrix4}
|
|
@@ -72,6 +68,7 @@ Object.defineProperties(VoxelShape.prototype, {
|
|
|
72
68
|
},
|
|
73
69
|
|
|
74
70
|
/**
|
|
71
|
+
* @memberof VoxelShape.prototype
|
|
75
72
|
* @type {Object<string, any>}
|
|
76
73
|
* @readonly
|
|
77
74
|
* @private
|
|
@@ -81,6 +78,7 @@ Object.defineProperties(VoxelShape.prototype, {
|
|
|
81
78
|
},
|
|
82
79
|
|
|
83
80
|
/**
|
|
81
|
+
* @memberof VoxelShape.prototype
|
|
84
82
|
* @type {Object<string, any>}
|
|
85
83
|
* @readonly
|
|
86
84
|
* @private
|
|
@@ -91,6 +89,7 @@ Object.defineProperties(VoxelShape.prototype, {
|
|
|
91
89
|
|
|
92
90
|
/**
|
|
93
91
|
* The maximum number of intersections against the shape for any ray direction.
|
|
92
|
+
* @memberof VoxelShape.prototype
|
|
94
93
|
* @type {number}
|
|
95
94
|
* @readonly
|
|
96
95
|
* @private
|
|
@@ -110,9 +109,26 @@ Object.defineProperties(VoxelShape.prototype, {
|
|
|
110
109
|
*/
|
|
111
110
|
VoxelShape.prototype.update = DeveloperError.throwInstantiationError;
|
|
112
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Update any view-dependent transforms.
|
|
114
|
+
* @private
|
|
115
|
+
* @param {FrameState} frameState The frame state.
|
|
116
|
+
*/
|
|
117
|
+
VoxelShape.prototype.updateViewTransforms =
|
|
118
|
+
DeveloperError.throwInstantiationError;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Converts a local coordinate to the shape's UV space.
|
|
122
|
+
* @private
|
|
123
|
+
* @param {Cartesian3} positionLocal The local coordinate to convert.
|
|
124
|
+
* @param {Cartesian3} result The Cartesian3 to store the result in.
|
|
125
|
+
* @returns {Cartesian3} The converted UV coordinate.
|
|
126
|
+
*/
|
|
127
|
+
VoxelShape.prototype.convertLocalToShapeUvSpace =
|
|
128
|
+
DeveloperError.throwInstantiationError;
|
|
129
|
+
|
|
113
130
|
/**
|
|
114
131
|
* Computes an oriented bounding box for a specified tile.
|
|
115
|
-
* The update function must be called before calling this function.
|
|
116
132
|
* @private
|
|
117
133
|
* @param {number} tileLevel The tile's level.
|
|
118
134
|
* @param {number} tileX The tile's x coordinate.
|
|
@@ -126,7 +142,6 @@ VoxelShape.prototype.computeOrientedBoundingBoxForTile =
|
|
|
126
142
|
|
|
127
143
|
/**
|
|
128
144
|
* Computes an oriented bounding box for a specified sample within a specified tile.
|
|
129
|
-
* The update function must be called before calling this function.
|
|
130
145
|
* @private
|
|
131
146
|
* @param {SpatialNode} spatialNode The spatial node containing the sample
|
|
132
147
|
* @param {Cartesian3} tileDimensions The size of the tile in number of samples, before padding
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import defined from "../Core/defined.js";
|
|
2
|
-
import PrimitiveType from "../Core/PrimitiveType.js";
|
|
3
1
|
import BlendingState from "./BlendingState.js";
|
|
2
|
+
import Cartesian2 from "../Core/Cartesian2.js";
|
|
3
|
+
import ClippingPlaneCollection from "./ClippingPlaneCollection.js";
|
|
4
4
|
import CullFace from "./CullFace.js";
|
|
5
|
-
import
|
|
5
|
+
import defined from "../Core/defined.js";
|
|
6
6
|
import DrawCommand from "../Renderer/DrawCommand.js";
|
|
7
7
|
import Pass from "../Renderer/Pass.js";
|
|
8
|
+
import PrimitiveType from "../Core/PrimitiveType.js";
|
|
9
|
+
import processVoxelProperties from "./processVoxelProperties.js";
|
|
8
10
|
import RenderState from "../Renderer/RenderState.js";
|
|
9
11
|
import ShaderDestination from "../Renderer/ShaderDestination.js";
|
|
12
|
+
import VoxelBoundsCollection from "./VoxelBoundsCollection.js";
|
|
10
13
|
import VoxelRenderResources from "./VoxelRenderResources.js";
|
|
11
|
-
|
|
14
|
+
|
|
15
|
+
const textureResolutionScratch = new Cartesian2();
|
|
12
16
|
|
|
13
17
|
/**
|
|
14
18
|
* @function
|
|
@@ -23,27 +27,40 @@ function buildVoxelDrawCommands(primitive, context) {
|
|
|
23
27
|
|
|
24
28
|
processVoxelProperties(renderResources, primitive);
|
|
25
29
|
|
|
26
|
-
const {
|
|
27
|
-
|
|
30
|
+
const {
|
|
31
|
+
shaderBuilder,
|
|
32
|
+
clippingPlanes,
|
|
33
|
+
clippingPlanesLength,
|
|
34
|
+
renderBoundPlanes,
|
|
35
|
+
renderBoundPlanesLength,
|
|
36
|
+
} = renderResources;
|
|
28
37
|
|
|
29
38
|
if (clippingPlanesLength > 0) {
|
|
30
|
-
// Extract the getClippingPlane function from the getClippingFunction string.
|
|
31
|
-
// This is a bit of a hack.
|
|
32
39
|
const functionId = "getClippingPlane";
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const functionSignature = `vec4 ${functionId}(highp sampler2D packedPlanes, int planeNumber)`;
|
|
41
|
+
const textureResolution = ClippingPlaneCollection.getTextureResolution(
|
|
42
|
+
clippingPlanes,
|
|
43
|
+
context,
|
|
44
|
+
textureResolutionScratch,
|
|
45
|
+
);
|
|
46
|
+
const functionBody = getPlaneFunctionBody(textureResolution);
|
|
47
|
+
shaderBuilder.addFunction(
|
|
48
|
+
functionId,
|
|
49
|
+
functionSignature,
|
|
50
|
+
ShaderDestination.FRAGMENT,
|
|
42
51
|
);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
shaderBuilder.addFunctionLines(functionId, [functionBody]);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (renderBoundPlanesLength > 0) {
|
|
56
|
+
const functionId = "getBoundPlane";
|
|
57
|
+
const functionSignature = `vec4 ${functionId}(highp sampler2D packedPlanes, int planeNumber)`;
|
|
58
|
+
const textureResolution = VoxelBoundsCollection.getTextureResolution(
|
|
59
|
+
renderBoundPlanes,
|
|
60
|
+
context,
|
|
61
|
+
textureResolutionScratch,
|
|
46
62
|
);
|
|
63
|
+
const functionBody = getPlaneFunctionBody(textureResolution);
|
|
47
64
|
shaderBuilder.addFunction(
|
|
48
65
|
functionId,
|
|
49
66
|
functionSignature,
|
|
@@ -133,4 +150,28 @@ function buildVoxelDrawCommands(primitive, context) {
|
|
|
133
150
|
primitive._drawCommandPickVoxel = drawCommandPickVoxel;
|
|
134
151
|
}
|
|
135
152
|
|
|
153
|
+
function getPlaneFunctionBody(textureResolution) {
|
|
154
|
+
const width = textureResolution.x;
|
|
155
|
+
const height = textureResolution.y;
|
|
156
|
+
|
|
157
|
+
const pixelWidth = 1.0 / width;
|
|
158
|
+
const pixelHeight = 1.0 / height;
|
|
159
|
+
|
|
160
|
+
let pixelWidthString = `${pixelWidth}`;
|
|
161
|
+
if (pixelWidthString.indexOf(".") === -1) {
|
|
162
|
+
pixelWidthString += ".0";
|
|
163
|
+
}
|
|
164
|
+
let pixelHeightString = `${pixelHeight}`;
|
|
165
|
+
if (pixelHeightString.indexOf(".") === -1) {
|
|
166
|
+
pixelHeightString += ".0";
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return `int pixY = planeNumber / ${width};
|
|
170
|
+
int pixX = planeNumber - (pixY * ${width});
|
|
171
|
+
// Sample from center of pixel
|
|
172
|
+
float u = (float(pixX) + 0.5) * ${pixelWidthString};
|
|
173
|
+
float v = (float(pixY) + 0.5) * ${pixelHeightString};
|
|
174
|
+
return texture(packedPlanes, vec2(u, v));`;
|
|
175
|
+
}
|
|
176
|
+
|
|
136
177
|
export default buildVoxelDrawCommands;
|
|
@@ -88,7 +88,7 @@ async function createGooglePhotorealistic3DTileset(apiOptions, tilesetOptions) {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
const resource = new Resource({
|
|
91
|
-
url: `${GoogleMaps.mapTilesApiEndpoint}3dtiles/root.json`,
|
|
91
|
+
url: `${GoogleMaps.mapTilesApiEndpoint}v1/3dtiles/root.json`,
|
|
92
92
|
queryParameters: {
|
|
93
93
|
key: key,
|
|
94
94
|
},
|