@cesium/engine 6.2.0 → 8.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/z-worker-pako.js +568 -407
- package/Build/Workers/{chunk-RH4N2ONY.js → chunk-23UFSGND.js} +7 -7
- package/Build/Workers/{chunk-HPP4JLNH.js → chunk-2A75IWRS.js} +7 -7
- package/Build/Workers/{chunk-5IRLXUTA.js → chunk-2FRVPMCS.js} +10 -10
- package/Build/Workers/{chunk-ZQRZBHYI.js → chunk-2FWRMUTY.js} +4 -4
- package/Build/Workers/{chunk-Z2SIPUKB.js → chunk-2UPKWTMJ.js} +6 -6
- package/Build/Workers/{chunk-434ZTTFX.js → chunk-34FXV7D7.js} +2 -2
- package/Build/Workers/{chunk-MW3CJYLX.js → chunk-3VAZEH7M.js} +2 -2
- package/Build/Workers/{chunk-HUPNRBWW.js → chunk-4DO5W5XZ.js} +6 -6
- package/Build/Workers/{chunk-PIXK6KHB.js → chunk-4H7PY4U5.js} +2 -2
- package/Build/Workers/{chunk-BP467WX3.js → chunk-5QULIR53.js} +4 -4
- package/Build/Workers/{chunk-R3HUGXBH.js → chunk-7TC63SJW.js} +8 -8
- package/Build/Workers/{chunk-SQVTYRZY.js → chunk-7ZFGPDJA.js} +4 -4
- package/Build/Workers/{chunk-TIXXVKUY.js → chunk-A5DWLWCY.js} +10 -10
- package/Build/Workers/{chunk-CWJQGBWT.js → chunk-BBWDMCVU.js} +1 -1
- package/Build/Workers/{chunk-4KP73B43.js → chunk-BG4UCVXN.js} +3 -3
- package/Build/Workers/{chunk-Y4OJ4B23.js → chunk-BIKA3NRA.js} +5 -5
- package/Build/Workers/{chunk-DR5XZ6K5.js → chunk-BROJAZRZ.js} +13 -13
- package/Build/Workers/{chunk-FWGNCYP6.js → chunk-DDUQAJ4P.js} +7 -7
- package/Build/Workers/{chunk-QRBRVGZC.js → chunk-EERJKOAF.js} +4 -4
- package/Build/Workers/{chunk-52VSIKEA.js → chunk-EG6PTBY2.js} +15 -15
- package/Build/Workers/{chunk-O43GWBSF.js → chunk-EHWHNOEX.js} +1 -1
- package/Build/Workers/{chunk-MN34FIF5.js → chunk-F3YA3Y2Z.js} +1 -1
- package/Build/Workers/{chunk-GF5TNNKP.js → chunk-F4HFJMGM.js} +6 -6
- package/Build/Workers/{chunk-HOT2SNXP.js → chunk-FJKNFAKQ.js} +133 -553
- package/Build/Workers/{chunk-TMPVBFJQ.js → chunk-FNIRWHJB.js} +10 -10
- package/Build/Workers/{chunk-DMCSY5BU.js → chunk-FZRIVR7Y.js} +5 -5
- package/Build/Workers/{chunk-Z4JUBRHP.js → chunk-G43QFN4Q.js} +6 -6
- package/Build/Workers/{chunk-HPH5HSFE.js → chunk-GATZHF3K.js} +2 -2
- package/Build/Workers/{chunk-CSIZ3BGT.js → chunk-GRC2ZTAF.js} +14 -14
- package/Build/Workers/{chunk-NE4JNU6H.js → chunk-HU6N6EXB.js} +10 -10
- package/Build/Workers/{chunk-GVL5I7TC.js → chunk-I46ZRR5W.js} +17 -17
- package/Build/Workers/{chunk-5GDBZTHX.js → chunk-JURN7NPV.js} +17 -17
- package/Build/Workers/{chunk-H5DUXHCV.js → chunk-KKCR2YOP.js} +11 -11
- package/Build/Workers/{chunk-LX6XV4DK.js → chunk-LPR3YNP2.js} +5 -5
- package/Build/Workers/{chunk-HFKSAB5K.js → chunk-M7ERACJJ.js} +13 -13
- package/Build/Workers/{chunk-BUZDZBUH.js → chunk-MDWEGWPA.js} +10 -10
- package/Build/Workers/{chunk-LGJUI2CE.js → chunk-OGXZVPPM.js} +9 -5
- package/Build/Workers/{chunk-PZ2WJWUG.js → chunk-PGSJK77E.js} +6 -6
- package/Build/Workers/{chunk-ARPTYYKS.js → chunk-PPH7OFP3.js} +5 -5
- package/Build/Workers/{chunk-R4OZKBXH.js → chunk-SH5USDPI.js} +6 -6
- package/Build/Workers/{chunk-SV7DDPAC.js → chunk-SOWMRMWA.js} +1 -1
- package/Build/Workers/{chunk-RIDPF7PO.js → chunk-STW2DGFI.js} +2 -2
- package/Build/Workers/{chunk-CDGHUKQ4.js → chunk-T3XIFPYR.js} +13 -13
- package/Build/Workers/chunk-TTUZP4BO.js +501 -0
- package/Build/Workers/{chunk-QTZQZY2C.js → chunk-UEXTBDBE.js} +34 -10
- package/Build/Workers/{chunk-XUTVA4K5.js → chunk-VOXYEYJT.js} +11 -11
- package/Build/Workers/{chunk-AXFRNOVC.js → chunk-X4356LRH.js} +12 -12
- package/Build/Workers/{chunk-5HLGKKG3.js → chunk-XGI5BXZY.js} +2 -2
- package/Build/Workers/{chunk-SNN7WOC2.js → chunk-Y2ME2IJV.js} +13 -13
- package/Build/Workers/{chunk-LGL4P5KL.js → chunk-Y5UQJLYE.js} +6 -6
- package/Build/Workers/{chunk-3PW6ZBN4.js → chunk-YJEBABKH.js} +7 -7
- package/Build/Workers/{chunk-YBKFS53K.js → chunk-YWTJ2B4B.js} +1 -1
- package/Build/Workers/{chunk-5SK36PU4.js → chunk-Z3TIFFGF.js} +7 -7
- package/Build/Workers/{chunk-JGG36SQV.js → chunk-ZT7KWISZ.js} +4 -4
- package/Build/Workers/combineGeometry.js +24 -23
- package/Build/Workers/createBoxGeometry.js +18 -17
- package/Build/Workers/createBoxOutlineGeometry.js +16 -15
- package/Build/Workers/createCircleGeometry.js +26 -25
- package/Build/Workers/createCircleOutlineGeometry.js +19 -18
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -32
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -30
- package/Build/Workers/createCorridorGeometry.js +29 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
- package/Build/Workers/createCylinderGeometry.js +20 -19
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -17
- package/Build/Workers/createEllipseGeometry.js +26 -25
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -18
- package/Build/Workers/createEllipsoidGeometry.js +19 -18
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -17
- package/Build/Workers/createFrustumGeometry.js +18 -17
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -17
- package/Build/Workers/createGeometry.js +54 -33
- package/Build/Workers/createGroundPolylineGeometry.js +22 -21
- package/Build/Workers/createPlaneGeometry.js +16 -15
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -14
- package/Build/Workers/createPolygonGeometry.js +32 -166
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -29
- package/Build/Workers/createPolylineGeometry.js +25 -24
- package/Build/Workers/createPolylineVolumeGeometry.js +32 -33
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -26
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -19
- package/Build/Workers/createSimplePolylineGeometry.js +23 -22
- package/Build/Workers/createSphereGeometry.js +19 -18
- package/Build/Workers/createSphereOutlineGeometry.js +18 -17
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -23
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +22 -21
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -21
- package/Build/Workers/createVerticesFromHeightmap.js +22 -21
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -18
- package/Build/Workers/createWallGeometry.js +24 -23
- package/Build/Workers/createWallOutlineGeometry.js +23 -22
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +601 -92
- package/Build/Workers/transcodeKTX2.js +7 -7
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -21
- package/LICENSE.md +1 -1
- package/Source/Assets/approximateTerrainHeights.json +1 -1
- package/Source/Core/Ellipsoid.js +6 -0
- package/Source/Core/GregorianDate.js +85 -0
- package/Source/Core/HeadingPitchRange.js +2 -2
- package/Source/Core/IntersectionTests.js +6 -3
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/PixelFormat.js +5 -0
- package/Source/Core/PolygonGeometry.js +0 -169
- package/Source/Core/Resource.js +30 -69
- package/Source/Core/Transforms.js +30 -18
- package/Source/Core/createWorldBathymetryAsync.js +45 -0
- package/Source/Core/srgbToLinear.js +32 -0
- package/Source/DataSources/CzmlDataSource.js +51 -23
- package/Source/DataSources/DataSourceDisplay.js +27 -0
- package/Source/DataSources/EllipsoidGeometryUpdater.js +3 -4
- package/Source/DataSources/Entity.js +28 -7
- package/Source/DataSources/EntityCollection.js +1 -2
- package/Source/DataSources/GeometryUpdater.js +1 -2
- package/Source/DataSources/GeometryUpdaterSet.js +114 -0
- package/Source/DataSources/GeometryVisualizer.js +19 -83
- package/Source/DataSources/GroundGeometryUpdater.js +6 -3
- package/Source/DataSources/ModelVisualizer.js +19 -98
- package/Source/DataSources/PolygonGeometryUpdater.js +14 -2
- package/Source/DataSources/PolylineGeometryUpdater.js +9 -8
- package/Source/DataSources/TerrainOffsetProperty.js +15 -23
- package/Source/Renderer/AutomaticUniforms.js +121 -1
- package/Source/Renderer/Context.js +10 -0
- package/Source/Renderer/ContextLimits.js +2 -0
- package/Source/Renderer/UniformState.js +127 -0
- package/Source/Renderer/demodernizeShader.js +4 -1
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Atmosphere.js +127 -0
- package/Source/Scene/Axis.js +12 -7
- package/Source/Scene/Billboard.js +29 -26
- package/Source/Scene/BillboardCollection.js +3 -3
- package/Source/Scene/Camera.js +47 -5
- package/Source/Scene/Cesium3DTile.js +1 -0
- package/Source/Scene/Cesium3DTileContent.js +14 -0
- package/Source/Scene/Cesium3DTileset.js +364 -45
- package/Source/Scene/Cesium3DTilesetBaseTraversal.js +2 -4
- package/Source/Scene/Cesium3DTilesetTraversal.js +4 -0
- package/Source/Scene/Composite3DTileContent.js +42 -0
- package/Source/Scene/DynamicAtmosphereLightingType.js +56 -0
- package/Source/Scene/Empty3DTileContent.js +4 -0
- package/Source/Scene/Fog.js +1 -0
- package/Source/Scene/FrameState.js +14 -1
- package/Source/Scene/Geometry3DTileContent.js +4 -0
- package/Source/Scene/Globe.js +3 -2
- package/Source/Scene/GlobeSurfaceTileProvider.js +3 -1
- package/Source/Scene/GlobeTranslucencyState.js +1 -1
- package/Source/Scene/GltfLoader.js +15 -5
- package/Source/Scene/GltfPipeline/updateVersion.js +69 -68
- package/Source/Scene/HeightReference.js +59 -2
- package/Source/Scene/I3SDataProvider.js +270 -53
- package/Source/Scene/I3SDecoder.js +8 -1
- package/Source/Scene/I3SFeature.js +2 -5
- package/Source/Scene/I3SField.js +136 -31
- package/Source/Scene/I3SGeometry.js +70 -2
- package/Source/Scene/I3SLayer.js +55 -10
- package/Source/Scene/I3SNode.js +175 -18
- package/Source/Scene/I3SStatistics.js +94 -0
- package/Source/Scene/I3SSublayer.js +176 -0
- package/Source/Scene/I3SSymbology.js +337 -0
- package/Source/Scene/Implicit3DTileContent.js +4 -0
- package/Source/Scene/KeyframeNode.js +1 -1
- package/Source/Scene/LabelCollection.js +2 -2
- package/Source/Scene/Model/AtmospherePipelineStage.js +59 -0
- package/Source/Scene/Model/B3dmLoader.js +4 -0
- package/Source/Scene/Model/FeatureIdPipelineStage.js +25 -2
- package/Source/Scene/Model/I3dmLoader.js +4 -0
- package/Source/Scene/Model/InstancingPipelineStage.js +24 -6
- package/Source/Scene/Model/MetadataPipelineStage.js +31 -3
- package/Source/Scene/Model/Model.js +82 -32
- package/Source/Scene/Model/Model3DTileContent.js +31 -0
- package/Source/Scene/Model/ModelAnimationChannel.js +16 -15
- package/Source/Scene/Model/ModelSceneGraph.js +6 -0
- package/Source/Scene/Model/pickModel.js +426 -0
- package/Source/Scene/Multiple3DTileContent.js +42 -0
- package/Source/Scene/PickFramebuffer.js +37 -2
- package/Source/Scene/Picking.js +113 -39
- package/Source/Scene/Primitive.js +6 -2
- package/Source/Scene/QuadtreePrimitive.js +1 -1
- package/Source/Scene/Scene.js +312 -46
- package/Source/Scene/ScreenSpaceCameraController.js +23 -13
- package/Source/Scene/SensorVolumePortionToDisplay.js +69 -0
- package/Source/Scene/SkyAtmosphere.js +5 -6
- package/Source/Scene/SpatialNode.js +12 -19
- package/Source/Scene/StructuralMetadata.js +1 -1
- package/Source/Scene/Terrain.js +49 -0
- package/Source/Scene/TileBoundingS2Cell.js +2 -2
- package/Source/Scene/Tileset3DTileContent.js +4 -0
- package/Source/Scene/Vector3DTileContent.js +4 -0
- package/Source/Scene/VoxelBoxShape.js +76 -0
- package/Source/Scene/VoxelCell.js +273 -0
- package/Source/Scene/VoxelCylinderShape.js +114 -43
- package/Source/Scene/VoxelEllipsoidShape.js +158 -116
- package/Source/Scene/VoxelPrimitive.js +3 -1
- package/Source/Scene/VoxelRenderResources.js +3 -0
- package/Source/Scene/VoxelShape.js +13 -0
- package/Source/Scene/VoxelTraversal.js +76 -54
- package/Source/Scene/buildVoxelDrawCommands.js +23 -0
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -0
- package/Source/Scene/processVoxelProperties.js +2 -0
- package/Source/Shaders/AtmosphereCommon.glsl +3 -11
- package/Source/Shaders/AtmosphereCommon.js +3 -11
- package/Source/Shaders/Builtin/CzmBuiltins.js +12 -0
- package/Source/Shaders/Builtin/Functions/applyHSBShift.glsl +32 -0
- package/Source/Shaders/Builtin/Functions/applyHSBShift.js +34 -0
- package/Source/Shaders/Builtin/Functions/approximateTanh.glsl +10 -0
- package/Source/Shaders/Builtin/Functions/approximateTanh.js +12 -0
- package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.glsl +44 -0
- package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.js +46 -0
- package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.glsl +30 -0
- package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.js +32 -0
- package/Source/Shaders/Builtin/Functions/computeScattering.glsl +150 -0
- package/Source/Shaders/Builtin/Functions/computeScattering.js +152 -0
- package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.glsl +22 -0
- package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.js +24 -0
- package/Source/Shaders/Builtin/Functions/translateRelativeToEye.glsl +5 -0
- package/Source/Shaders/Builtin/Functions/translateRelativeToEye.js +5 -0
- package/Source/Shaders/GlobeFS.glsl +16 -25
- package/Source/Shaders/GlobeFS.js +16 -25
- package/Source/Shaders/GlobeVS.glsl +1 -1
- package/Source/Shaders/GlobeVS.js +1 -1
- package/Source/Shaders/Model/AtmosphereStageFS.glsl +111 -0
- package/Source/Shaders/Model/AtmosphereStageFS.js +113 -0
- package/Source/Shaders/Model/AtmosphereStageVS.glsl +12 -0
- package/Source/Shaders/Model/AtmosphereStageVS.js +14 -0
- package/Source/Shaders/Model/GeometryStageFS.glsl +1 -1
- package/Source/Shaders/Model/GeometryStageFS.js +1 -1
- package/Source/Shaders/Model/GeometryStageVS.glsl +4 -4
- package/Source/Shaders/Model/GeometryStageVS.js +4 -4
- package/Source/Shaders/Model/ModelColorStageFS.glsl +1 -1
- package/Source/Shaders/Model/ModelColorStageFS.js +2 -1
- package/Source/Shaders/Model/ModelFS.glsl +4 -0
- package/Source/Shaders/Model/ModelFS.js +4 -0
- package/Source/Shaders/Model/ModelVS.glsl +9 -4
- package/Source/Shaders/Model/ModelVS.js +9 -4
- package/Source/Shaders/SkyAtmosphereCommon.glsl +3 -13
- package/Source/Shaders/SkyAtmosphereCommon.js +3 -13
- package/Source/Shaders/SkyAtmosphereFS.glsl +5 -10
- package/Source/Shaders/SkyAtmosphereFS.js +5 -10
- package/Source/Shaders/SkyAtmosphereVS.glsl +3 -2
- package/Source/Shaders/SkyAtmosphereVS.js +3 -2
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +14 -111
- package/Source/Shaders/Voxels/IntersectCylinder.js +14 -111
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +32 -113
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +32 -113
- package/Source/Shaders/Voxels/IntersectLongitude.glsl +102 -0
- package/Source/Shaders/Voxels/IntersectLongitude.js +104 -0
- package/Source/Shaders/Voxels/VoxelFS.glsl +39 -1
- package/Source/Shaders/Voxels/VoxelFS.js +39 -1
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +19 -37
- package/Source/Shaders/Voxels/convertUvToCylinder.js +19 -37
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +24 -44
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +24 -44
- package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
- package/Source/ThirdParty/draco_decoder.wasm +0 -0
- package/Source/Workers/createGeometry.js +40 -11
- package/Source/Workers/decodeI3S.js +720 -94
- package/index.d.ts +574 -71
- package/index.js +217 -196
- package/package.json +3 -3
- package/Build/Workers/chunk-ATB2I7OS.js +0 -55
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Cartesian3 from "../Core/Cartesian3.js";
|
|
1
2
|
import defaultValue from "../Core/defaultValue.js";
|
|
2
3
|
import defined from "../Core/defined.js";
|
|
3
4
|
import destroyObject from "../Core/destroyObject.js";
|
|
@@ -347,6 +348,47 @@ Composite3DTileContent.prototype.update = function (tileset, frameState) {
|
|
|
347
348
|
}
|
|
348
349
|
};
|
|
349
350
|
|
|
351
|
+
/**
|
|
352
|
+
* Find an intersection between a ray and the tile content surface that was rendered. The ray must be given in world coordinates.
|
|
353
|
+
*
|
|
354
|
+
* @param {Ray} ray The ray to test for intersection.
|
|
355
|
+
* @param {FrameState} frameState The frame state.
|
|
356
|
+
* @param {Cartesian3|undefined} [result] The intersection or <code>undefined</code> if none was found.
|
|
357
|
+
* @returns {Cartesian3|undefined} The intersection or <code>undefined</code> if none was found.
|
|
358
|
+
*
|
|
359
|
+
* @private
|
|
360
|
+
*/
|
|
361
|
+
Composite3DTileContent.prototype.pick = function (ray, frameState, result) {
|
|
362
|
+
if (!this._ready) {
|
|
363
|
+
return undefined;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
let intersection;
|
|
367
|
+
let minDistance = Number.POSITIVE_INFINITY;
|
|
368
|
+
const contents = this._contents;
|
|
369
|
+
const length = contents.length;
|
|
370
|
+
|
|
371
|
+
for (let i = 0; i < length; ++i) {
|
|
372
|
+
const candidate = contents[i].pick(ray, frameState, result);
|
|
373
|
+
|
|
374
|
+
if (!defined(candidate)) {
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
const distance = Cartesian3.distance(ray.origin, candidate);
|
|
379
|
+
if (distance < minDistance) {
|
|
380
|
+
intersection = candidate;
|
|
381
|
+
minDistance = distance;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
if (!defined(intersection)) {
|
|
386
|
+
return undefined;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
return result;
|
|
390
|
+
};
|
|
391
|
+
|
|
350
392
|
Composite3DTileContent.prototype.isDestroyed = function () {
|
|
351
393
|
return false;
|
|
352
394
|
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atmosphere lighting effects (sky atmosphere, ground atmosphere, fog) can be
|
|
3
|
+
* further modified with dynamic lighting from the sun or other light source
|
|
4
|
+
* that changes over time. This enum determines which light source to use.
|
|
5
|
+
*
|
|
6
|
+
* @enum {number}
|
|
7
|
+
*/
|
|
8
|
+
const DynamicAtmosphereLightingType = {
|
|
9
|
+
/**
|
|
10
|
+
* Do not use dynamic atmosphere lighting. Atmosphere lighting effects will
|
|
11
|
+
* be lit from directly above rather than using the scene's light source.
|
|
12
|
+
*
|
|
13
|
+
* @type {number}
|
|
14
|
+
* @constant
|
|
15
|
+
*/
|
|
16
|
+
NONE: 0,
|
|
17
|
+
/**
|
|
18
|
+
* Use the scene's current light source for dynamic atmosphere lighting.
|
|
19
|
+
*
|
|
20
|
+
* @type {number}
|
|
21
|
+
* @constant
|
|
22
|
+
*/
|
|
23
|
+
SCENE_LIGHT: 1,
|
|
24
|
+
/**
|
|
25
|
+
* Force the dynamic atmosphere lighting to always use the sunlight direction,
|
|
26
|
+
* even if the scene uses a different light source.
|
|
27
|
+
*
|
|
28
|
+
* @type {number}
|
|
29
|
+
* @constant
|
|
30
|
+
*/
|
|
31
|
+
SUNLIGHT: 2,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Get the lighting enum from the older globe flags
|
|
36
|
+
*
|
|
37
|
+
* @param {Globe} globe The globe
|
|
38
|
+
* @return {DynamicAtmosphereLightingType} The corresponding enum value
|
|
39
|
+
*
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
42
|
+
DynamicAtmosphereLightingType.fromGlobeFlags = function (globe) {
|
|
43
|
+
const lightingOn = globe.enableLighting && globe.dynamicAtmosphereLighting;
|
|
44
|
+
if (!lightingOn) {
|
|
45
|
+
return DynamicAtmosphereLightingType.NONE;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Force sunlight
|
|
49
|
+
if (globe.dynamicAtmosphereLightingFromSun) {
|
|
50
|
+
return DynamicAtmosphereLightingType.SUNLIGHT;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return DynamicAtmosphereLightingType.SCENE_LIGHT;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default Object.freeze(DynamicAtmosphereLightingType);
|
|
@@ -150,6 +150,10 @@ Empty3DTileContent.prototype.applyStyle = function (style) {};
|
|
|
150
150
|
|
|
151
151
|
Empty3DTileContent.prototype.update = function (tileset, frameState) {};
|
|
152
152
|
|
|
153
|
+
Empty3DTileContent.prototype.pick = function (ray, frameState, result) {
|
|
154
|
+
return undefined;
|
|
155
|
+
};
|
|
156
|
+
|
|
153
157
|
Empty3DTileContent.prototype.isDestroyed = function () {
|
|
154
158
|
return false;
|
|
155
159
|
};
|
package/Source/Scene/Fog.js
CHANGED
|
@@ -182,6 +182,7 @@ function FrameState(context, creditDisplay, jobScheduler) {
|
|
|
182
182
|
* @type {object}
|
|
183
183
|
* @property {boolean} render <code>true</code> if the primitive should update for a render pass, <code>false</code> otherwise.
|
|
184
184
|
* @property {boolean} pick <code>true</code> if the primitive should update for a picking pass, <code>false</code> otherwise.
|
|
185
|
+
* @property {boolean} pickVoxel <code>true</code> if the primitive should update for a voxel picking pass, <code>false</code> otherwise.
|
|
185
186
|
* @property {boolean} depth <code>true</code> if the primitive should update for a depth only pass, <code>false</code> otherwise.
|
|
186
187
|
* @property {boolean} postProcess <code>true</code> if the primitive should update for a per-feature post-process pass, <code>false</code> otherwise.
|
|
187
188
|
* @property {boolean} offscreen <code>true</code> if the primitive should update for an offscreen pass, <code>false</code> otherwise.
|
|
@@ -199,6 +200,10 @@ function FrameState(context, creditDisplay, jobScheduler) {
|
|
|
199
200
|
* @default false
|
|
200
201
|
*/
|
|
201
202
|
pick: false,
|
|
203
|
+
/**
|
|
204
|
+
* @default false
|
|
205
|
+
*/
|
|
206
|
+
pickVoxel: false,
|
|
202
207
|
/**
|
|
203
208
|
* @default false
|
|
204
209
|
*/
|
|
@@ -254,7 +259,8 @@ function FrameState(context, creditDisplay, jobScheduler) {
|
|
|
254
259
|
/**
|
|
255
260
|
* @typedef FrameState.Fog
|
|
256
261
|
* @type {object}
|
|
257
|
-
* @property {boolean} enabled <code>true</code> if fog is enabled, <code>false</code> otherwise.
|
|
262
|
+
* @property {boolean} enabled <code>true</code> if fog is enabled, <code>false</code> otherwise. This affects both fog culling and rendering.
|
|
263
|
+
* @property {boolean} renderable <code>true</code> if fog should be rendered, <code>false</code> if not. This flag should be checked in combination with fog.enabled.
|
|
258
264
|
* @property {number} density A positive number used to mix the color and fog color based on camera distance.
|
|
259
265
|
* @property {number} sse A scalar used to modify the screen space error of geometry partially in fog.
|
|
260
266
|
* @property {number} minimumBrightness The minimum brightness of terrain with fog applied.
|
|
@@ -269,11 +275,18 @@ function FrameState(context, creditDisplay, jobScheduler) {
|
|
|
269
275
|
* @default false
|
|
270
276
|
*/
|
|
271
277
|
enabled: false,
|
|
278
|
+
renderable: false,
|
|
272
279
|
density: undefined,
|
|
273
280
|
sse: undefined,
|
|
274
281
|
minimumBrightness: undefined,
|
|
275
282
|
};
|
|
276
283
|
|
|
284
|
+
/**
|
|
285
|
+
* The current Atmosphere
|
|
286
|
+
* @type {Atmosphere}
|
|
287
|
+
*/
|
|
288
|
+
this.atmosphere = undefined;
|
|
289
|
+
|
|
277
290
|
/**
|
|
278
291
|
* A scalar used to vertically exaggerate the scene
|
|
279
292
|
* @type {number}
|
|
@@ -525,6 +525,10 @@ Geometry3DTileContent.prototype.update = function (tileset, frameState) {
|
|
|
525
525
|
}
|
|
526
526
|
};
|
|
527
527
|
|
|
528
|
+
Geometry3DTileContent.prototype.pick = function (ray, frameState, result) {
|
|
529
|
+
return undefined;
|
|
530
|
+
};
|
|
531
|
+
|
|
528
532
|
Geometry3DTileContent.prototype.isDestroyed = function () {
|
|
529
533
|
return false;
|
|
530
534
|
};
|
package/Source/Scene/Globe.js
CHANGED
|
@@ -691,8 +691,8 @@ function makeShadersDirty(globe) {
|
|
|
691
691
|
|
|
692
692
|
const requireNormals =
|
|
693
693
|
defined(globe._material) &&
|
|
694
|
-
(globe._material.shaderSource.match(/slope/) ||
|
|
695
|
-
globe._material.shaderSource.match("normalEC"));
|
|
694
|
+
(defined(globe._material.shaderSource.match(/slope/)) ||
|
|
695
|
+
defined(globe._material.shaderSource.match("normalEC")));
|
|
696
696
|
|
|
697
697
|
const fragmentSources = [AtmosphereCommon, GroundAtmosphere];
|
|
698
698
|
if (
|
|
@@ -1106,6 +1106,7 @@ Globe.prototype.beginFrame = function (frameState) {
|
|
|
1106
1106
|
tileProvider.undergroundColor = this._undergroundColor;
|
|
1107
1107
|
tileProvider.undergroundColorAlphaByDistance = this._undergroundColorAlphaByDistance;
|
|
1108
1108
|
tileProvider.lambertDiffuseMultiplier = this.lambertDiffuseMultiplier;
|
|
1109
|
+
|
|
1109
1110
|
surface.beginFrame(frameState);
|
|
1110
1111
|
}
|
|
1111
1112
|
};
|
|
@@ -2502,7 +2502,9 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2502
2502
|
uniformMapProperties.localizedTranslucencyRectangle
|
|
2503
2503
|
);
|
|
2504
2504
|
|
|
2505
|
-
// For performance,
|
|
2505
|
+
// For performance, render fog only when fog is enabled and the effect of
|
|
2506
|
+
// fog would be non-negligible. This prevents the shader from running when
|
|
2507
|
+
// the camera is in space, for example.
|
|
2506
2508
|
const applyFog =
|
|
2507
2509
|
enableFog &&
|
|
2508
2510
|
CesiumMath.fog(tile._distance, frameState.fog.density) >
|
|
@@ -930,7 +930,7 @@ GlobeTranslucencyState.prototype.pushDerivedCommands = function (
|
|
|
930
930
|
isBlendCommand,
|
|
931
931
|
frameState
|
|
932
932
|
) {
|
|
933
|
-
const picking = frameState.passes.pick;
|
|
933
|
+
const picking = frameState.passes.pick || frameState.passes.pickVoxel;
|
|
934
934
|
if (picking && isBlendCommand) {
|
|
935
935
|
// No need to push blend commands in the pick pass
|
|
936
936
|
return;
|
|
@@ -179,6 +179,7 @@ const GltfLoaderState = {
|
|
|
179
179
|
* @param {Axis} [options.forwardAxis=Axis.Z] The forward-axis of the glTF model.
|
|
180
180
|
* @param {boolean} [options.loadAttributesAsTypedArray=false] Load all attributes and indices as typed arrays instead of GPU buffers. If the attributes are interleaved in the glTF they will be de-interleaved in the typed array.
|
|
181
181
|
* @param {boolean} [options.loadAttributesFor2D=false] If <code>true</code>, load the positions buffer and any instanced attribute buffers as typed arrays for accurately projecting models to 2D.
|
|
182
|
+
* @param {boolean} [options.enablePick=false] If <code>true</code>, load the positions buffer, any instanced attribute buffers, and index buffer as typed arrays for CPU-enabled picking in WebGL1.
|
|
182
183
|
* @param {boolean} [options.loadIndicesForWireframe=false] If <code>true</code>, load the index buffer as both a buffer and typed array. The latter is useful for creating wireframe indices in WebGL1.
|
|
183
184
|
* @param {boolean} [options.loadPrimitiveOutline=true] If <code>true</code>, load outlines from the {@link https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/CESIUM_primitive_outline|CESIUM_primitive_outline} extension. This can be set false to avoid post-processing geometry at load time.
|
|
184
185
|
* @param {boolean} [options.loadForClassification=false] If <code>true</code> and if the model has feature IDs, load the feature IDs and indices as typed arrays. This is useful for batching features for classification.
|
|
@@ -203,6 +204,7 @@ function GltfLoader(options) {
|
|
|
203
204
|
false
|
|
204
205
|
);
|
|
205
206
|
const loadAttributesFor2D = defaultValue(options.loadAttributesFor2D, false);
|
|
207
|
+
const enablePick = defaultValue(options.enablePick);
|
|
206
208
|
const loadIndicesForWireframe = defaultValue(
|
|
207
209
|
options.loadIndicesForWireframe,
|
|
208
210
|
false
|
|
@@ -234,6 +236,7 @@ function GltfLoader(options) {
|
|
|
234
236
|
this._forwardAxis = forwardAxis;
|
|
235
237
|
this._loadAttributesAsTypedArray = loadAttributesAsTypedArray;
|
|
236
238
|
this._loadAttributesFor2D = loadAttributesFor2D;
|
|
239
|
+
this._enablePick = enablePick;
|
|
237
240
|
this._loadIndicesForWireframe = loadIndicesForWireframe;
|
|
238
241
|
this._loadPrimitiveOutline = loadPrimitiveOutline;
|
|
239
242
|
this._loadForClassification = loadForClassification;
|
|
@@ -1241,6 +1244,8 @@ function loadVertexAttribute(
|
|
|
1241
1244
|
!hasInstances &&
|
|
1242
1245
|
loader._loadAttributesFor2D &&
|
|
1243
1246
|
!frameState.scene3DOnly;
|
|
1247
|
+
const loadTypedArrayForPicking =
|
|
1248
|
+
isPositionAttribute && loader._enablePick && !frameState.context.webgl2;
|
|
1244
1249
|
|
|
1245
1250
|
const loadTypedArrayForClassification =
|
|
1246
1251
|
loader._loadForClassification && isFeatureIdAttribute;
|
|
@@ -1252,6 +1257,7 @@ function loadVertexAttribute(
|
|
|
1252
1257
|
const outputTypedArray =
|
|
1253
1258
|
outputTypedArrayOnly ||
|
|
1254
1259
|
loadTypedArrayFor2D ||
|
|
1260
|
+
loadTypedArrayForPicking ||
|
|
1255
1261
|
loadTypedArrayForClassification;
|
|
1256
1262
|
|
|
1257
1263
|
// Determine what to load right now:
|
|
@@ -1319,6 +1325,8 @@ function loadInstancedAttribute(
|
|
|
1319
1325
|
loader._loadAttributesAsTypedArray ||
|
|
1320
1326
|
(hasRotation && isTransformAttribute) ||
|
|
1321
1327
|
!frameState.context.instancedArrays;
|
|
1328
|
+
const loadTypedArrayForPicking =
|
|
1329
|
+
loader._enablePick && !frameState.context.webgl2;
|
|
1322
1330
|
|
|
1323
1331
|
const loadBuffer = !loadAsTypedArrayOnly;
|
|
1324
1332
|
|
|
@@ -1328,7 +1336,8 @@ function loadInstancedAttribute(
|
|
|
1328
1336
|
// - the model will be projected to 2D.
|
|
1329
1337
|
const loadFor2D = loader._loadAttributesFor2D && !frameState.scene3DOnly;
|
|
1330
1338
|
const loadTranslationAsTypedArray =
|
|
1331
|
-
isTranslationAttribute &&
|
|
1339
|
+
isTranslationAttribute &&
|
|
1340
|
+
(!hasTranslationMinMax || loadFor2D || loadTypedArrayForPicking);
|
|
1332
1341
|
|
|
1333
1342
|
const loadTypedArray = loadAsTypedArrayOnly || loadTranslationAsTypedArray;
|
|
1334
1343
|
|
|
@@ -1365,9 +1374,10 @@ function loadIndices(
|
|
|
1365
1374
|
indices.count = accessor.count;
|
|
1366
1375
|
|
|
1367
1376
|
const loadAttributesAsTypedArray = loader._loadAttributesAsTypedArray;
|
|
1368
|
-
// Load the index buffer as a typed array to generate wireframes in WebGL1.
|
|
1369
|
-
const
|
|
1370
|
-
loader._loadIndicesForWireframe
|
|
1377
|
+
// Load the index buffer as a typed array to generate wireframes or pick in WebGL1.
|
|
1378
|
+
const loadForCpuOperations =
|
|
1379
|
+
(loader._loadIndicesForWireframe || loader._enablePick) &&
|
|
1380
|
+
!frameState.context.webgl2;
|
|
1371
1381
|
|
|
1372
1382
|
// Load the index buffer as a typed array to batch features together for classification.
|
|
1373
1383
|
const loadForClassification = loader._loadForClassification && hasFeatureIds;
|
|
@@ -1377,7 +1387,7 @@ function loadIndices(
|
|
|
1377
1387
|
const outputTypedArrayOnly = loadAttributesAsTypedArray;
|
|
1378
1388
|
const outputBuffer = !outputTypedArrayOnly;
|
|
1379
1389
|
const outputTypedArray =
|
|
1380
|
-
loadAttributesAsTypedArray ||
|
|
1390
|
+
loadAttributesAsTypedArray || loadForCpuOperations || loadForClassification;
|
|
1381
1391
|
|
|
1382
1392
|
// Determine what to load right now:
|
|
1383
1393
|
//
|
|
@@ -1079,6 +1079,26 @@ function convertTechniquesToPbr(gltf, options) {
|
|
|
1079
1079
|
removeExtension(gltf, "KHR_blend");
|
|
1080
1080
|
}
|
|
1081
1081
|
|
|
1082
|
+
function assignAsBaseColor(material, baseColor) {
|
|
1083
|
+
if (defined(baseColor)) {
|
|
1084
|
+
if (isVec4(baseColor)) {
|
|
1085
|
+
material.pbrMetallicRoughness.baseColorFactor = srgbToLinear(baseColor);
|
|
1086
|
+
} else if (isTexture(baseColor)) {
|
|
1087
|
+
material.pbrMetallicRoughness.baseColorTexture = baseColor;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
function assignAsEmissive(material, emissive) {
|
|
1093
|
+
if (defined(emissive)) {
|
|
1094
|
+
if (isVec4(emissive)) {
|
|
1095
|
+
material.emissiveFactor = emissive.slice(0, 3);
|
|
1096
|
+
} else if (isTexture(emissive)) {
|
|
1097
|
+
material.emissiveTexture = emissive;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1082
1102
|
function convertMaterialsCommonToPbr(gltf) {
|
|
1083
1103
|
// Future work: convert KHR_materials_common lights to KHR_lights_punctual
|
|
1084
1104
|
ForEach.material(gltf, function (material) {
|
|
@@ -1086,80 +1106,61 @@ function convertMaterialsCommonToPbr(gltf) {
|
|
|
1086
1106
|
material.extensions,
|
|
1087
1107
|
defaultValue.EMPTY_OBJECT
|
|
1088
1108
|
).KHR_materials_common;
|
|
1109
|
+
if (!defined(materialsCommon)) {
|
|
1110
|
+
// Nothing to do
|
|
1111
|
+
return;
|
|
1112
|
+
}
|
|
1089
1113
|
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1114
|
+
const values = defaultValue(materialsCommon.values, {});
|
|
1115
|
+
const ambient = values.ambient;
|
|
1116
|
+
const diffuse = values.diffuse;
|
|
1117
|
+
const emission = values.emission;
|
|
1118
|
+
const transparency = values.transparency;
|
|
1119
|
+
|
|
1120
|
+
// These actually exist on the extension object, not the values object despite what's shown in the spec
|
|
1121
|
+
const doubleSided = materialsCommon.doubleSided;
|
|
1122
|
+
const transparent = materialsCommon.transparent;
|
|
1123
|
+
|
|
1124
|
+
// Ignore specular and shininess for now because the conversion to PBR
|
|
1125
|
+
// isn't straightforward and depends on the technique
|
|
1126
|
+
initializePbrMaterial(material);
|
|
1127
|
+
|
|
1128
|
+
const technique = materialsCommon.technique;
|
|
1129
|
+
if (technique === "CONSTANT") {
|
|
1130
|
+
// Add the KHR_materials_unlit extension
|
|
1131
|
+
addExtensionsUsed(gltf, "KHR_materials_unlit");
|
|
1132
|
+
material.extensions = defined(material.extensions)
|
|
1133
|
+
? material.extensions
|
|
1103
1134
|
: {};
|
|
1135
|
+
material.extensions["KHR_materials_unlit"] = {};
|
|
1104
1136
|
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
if (defined(ambient)) {
|
|
1119
|
-
if (isVec4(ambient)) {
|
|
1120
|
-
material.emissiveFactor = ambient.slice(0, 3);
|
|
1121
|
-
} else if (isTexture(ambient)) {
|
|
1122
|
-
material.emissiveTexture = ambient;
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
if (defined(diffuse)) {
|
|
1127
|
-
if (isVec4(diffuse)) {
|
|
1128
|
-
material.pbrMetallicRoughness.baseColorFactor = srgbToLinear(diffuse);
|
|
1129
|
-
} else if (isTexture(diffuse)) {
|
|
1130
|
-
material.pbrMetallicRoughness.baseColorTexture = diffuse;
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
if (defined(doubleSided)) {
|
|
1135
|
-
material.doubleSided = doubleSided;
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1138
|
-
if (defined(emission)) {
|
|
1139
|
-
if (isVec4(emission)) {
|
|
1140
|
-
material.emissiveFactor = emission.slice(0, 3);
|
|
1141
|
-
} else if (isTexture(emission)) {
|
|
1142
|
-
material.emissiveTexture = emission;
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
if (defined(transparency)) {
|
|
1147
|
-
if (defined(material.pbrMetallicRoughness.baseColorFactor)) {
|
|
1148
|
-
material.pbrMetallicRoughness.baseColorFactor[3] *= transparency;
|
|
1149
|
-
} else {
|
|
1150
|
-
material.pbrMetallicRoughness.baseColorFactor = [
|
|
1151
|
-
1,
|
|
1152
|
-
1,
|
|
1153
|
-
1,
|
|
1154
|
-
transparency,
|
|
1155
|
-
];
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1137
|
+
// The CONSTANT technique does not support 'diffuse', so
|
|
1138
|
+
// assign either the 'emission' or the 'ambient' as the
|
|
1139
|
+
// base color
|
|
1140
|
+
assignAsBaseColor(material, emission);
|
|
1141
|
+
assignAsBaseColor(material, ambient);
|
|
1142
|
+
} else {
|
|
1143
|
+
// Assign the 'diffuse' as the base color, and
|
|
1144
|
+
// the 'ambient' or 'emissive' as the emissive
|
|
1145
|
+
// part if they are present.
|
|
1146
|
+
assignAsBaseColor(material, diffuse);
|
|
1147
|
+
assignAsEmissive(material, ambient);
|
|
1148
|
+
assignAsEmissive(material, emission);
|
|
1149
|
+
}
|
|
1158
1150
|
|
|
1159
|
-
|
|
1160
|
-
|
|
1151
|
+
if (defined(doubleSided)) {
|
|
1152
|
+
material.doubleSided = doubleSided;
|
|
1153
|
+
}
|
|
1154
|
+
if (defined(transparency)) {
|
|
1155
|
+
if (defined(material.pbrMetallicRoughness.baseColorFactor)) {
|
|
1156
|
+
material.pbrMetallicRoughness.baseColorFactor[3] *= transparency;
|
|
1157
|
+
} else {
|
|
1158
|
+
material.pbrMetallicRoughness.baseColorFactor = [1, 1, 1, transparency];
|
|
1161
1159
|
}
|
|
1162
1160
|
}
|
|
1161
|
+
if (defined(transparent)) {
|
|
1162
|
+
material.alphaMode = transparent ? "BLEND" : "OPAQUE";
|
|
1163
|
+
}
|
|
1163
1164
|
});
|
|
1164
1165
|
|
|
1165
1166
|
removeExtension(gltf, "KHR_materials_common");
|
|
@@ -12,17 +12,74 @@ const HeightReference = {
|
|
|
12
12
|
NONE: 0,
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* The position is clamped to the terrain.
|
|
15
|
+
* The position is clamped to the terrain and 3D Tiles.
|
|
16
16
|
* @type {number}
|
|
17
17
|
* @constant
|
|
18
18
|
*/
|
|
19
19
|
CLAMP_TO_GROUND: 1,
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* The position height is the height above the terrain.
|
|
22
|
+
* The position height is the height above the terrain and 3D Tiles.
|
|
23
23
|
* @type {number}
|
|
24
24
|
* @constant
|
|
25
25
|
*/
|
|
26
26
|
RELATIVE_TO_GROUND: 2,
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The position is clamped to terain.
|
|
30
|
+
* @type {number}
|
|
31
|
+
* @constant
|
|
32
|
+
*/
|
|
33
|
+
CLAMP_TO_TERRAIN: 3,
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The position height is the height above terrain.
|
|
37
|
+
* @type {number}
|
|
38
|
+
* @constant
|
|
39
|
+
*/
|
|
40
|
+
RELATIVE_TO_TERRAIN: 4,
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The position is clamped to 3D Tiles.
|
|
44
|
+
* @type {number}
|
|
45
|
+
* @constant
|
|
46
|
+
*/
|
|
47
|
+
CLAMP_TO_3D_TILE: 5,
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The position height is the height above 3D Tiles.
|
|
51
|
+
* @type {number}
|
|
52
|
+
* @constant
|
|
53
|
+
*/
|
|
54
|
+
RELATIVE_TO_3D_TILE: 6,
|
|
27
55
|
};
|
|
56
|
+
|
|
28
57
|
export default Object.freeze(HeightReference);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Returns true if the height should be clamped to the surface
|
|
61
|
+
* @param {HeightReference} heightReference
|
|
62
|
+
* @returns true if the height should be clamped to the surface
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
65
|
+
export function isHeightReferenceClamp(heightReference) {
|
|
66
|
+
return (
|
|
67
|
+
heightReference === HeightReference.CLAMP_TO_GROUND ||
|
|
68
|
+
heightReference === HeightReference.CLAMP_TO_3D_TILE ||
|
|
69
|
+
heightReference === HeightReference.CLAMP_TO_TERRAIN
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Returns true if the height should be offset relative to the surface
|
|
75
|
+
* @param {HeightReference} heightReference
|
|
76
|
+
* @returns true if the height should be offset relative to the surface
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
export function isHeightReferenceRelative(heightReference) {
|
|
80
|
+
return (
|
|
81
|
+
heightReference === HeightReference.RELATIVE_TO_GROUND ||
|
|
82
|
+
heightReference === HeightReference.RELATIVE_TO_3D_TILE ||
|
|
83
|
+
heightReference === HeightReference.RELATIVE_TO_TERRAIN
|
|
84
|
+
);
|
|
85
|
+
}
|