@cesium/engine 1.0.0 → 1.1.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/{AttributeCompression-4589338a.js → AttributeCompression-b646d393.js} +1 -1
- package/Build/Workers/{AxisAlignedBoundingBox-bfb1234f.js → AxisAlignedBoundingBox-a4321399.js} +1 -1
- package/Build/Workers/{BoundingRectangle-7ffc2153.js → BoundingRectangle-80d8801f.js} +1 -1
- package/Build/Workers/{BoxGeometry-93f344a3.js → BoxGeometry-33c10a4f.js} +1 -1
- package/Build/Workers/{Color-0c5aaf47.js → Color-1bf9a6e0.js} +1 -1
- package/Build/Workers/{CoplanarPolygonGeometryLibrary-6597982a.js → CoplanarPolygonGeometryLibrary-5c5b981b.js} +1 -1
- package/Build/Workers/{CorridorGeometryLibrary-2119580e.js → CorridorGeometryLibrary-7cbae7a0.js} +1 -1
- package/Build/Workers/{CylinderGeometry-f9503c6d.js → CylinderGeometry-42740df0.js} +1 -1
- package/Build/Workers/{EllipseGeometry-fedf72d5.js → EllipseGeometry-49a3ac21.js} +1 -1
- package/Build/Workers/{EllipseGeometryLibrary-4ea68687.js → EllipseGeometryLibrary-b891b2f8.js} +1 -1
- package/Build/Workers/{EllipseOutlineGeometry-e2ae6a35.js → EllipseOutlineGeometry-fbd72e07.js} +1 -1
- package/Build/Workers/{EllipsoidGeodesic-16de63ea.js → EllipsoidGeodesic-98c62a56.js} +1 -1
- package/Build/Workers/{EllipsoidGeometry-95c0330e.js → EllipsoidGeometry-a351dba8.js} +1 -1
- package/Build/Workers/{EllipsoidOutlineGeometry-d6d2ceec.js → EllipsoidOutlineGeometry-3e8779bf.js} +1 -1
- package/Build/Workers/{EllipsoidRhumbLine-ae5e65e0.js → EllipsoidRhumbLine-19756602.js} +1 -1
- package/Build/Workers/{EllipsoidTangentPlane-bfc674bf.js → EllipsoidTangentPlane-cfb50678.js} +1 -1
- package/Build/Workers/{EncodedCartesian3-f473ea18.js → EncodedCartesian3-81f70735.js} +1 -1
- package/Build/Workers/{FrustumGeometry-3bf2e4eb.js → FrustumGeometry-c5754412.js} +1 -1
- package/Build/Workers/{GeometryAttribute-df5f473e.js → GeometryAttribute-0bfd05e8.js} +1 -1
- package/Build/Workers/{GeometryInstance-aa75b4cf.js → GeometryInstance-451dc1cd.js} +1 -1
- package/Build/Workers/{GeometryPipeline-f0e46c42.js → GeometryPipeline-0166905d.js} +1 -1
- package/Build/Workers/{IntersectionTests-9de29d51.js → IntersectionTests-a93d3de9.js} +1 -1
- package/Build/Workers/{Matrix2-ce637455.js → Matrix2-13178034.js} +4 -2
- package/Build/Workers/{Matrix3-4f4df527.js → Matrix3-315394f6.js} +2 -1
- package/Build/Workers/{OrientedBoundingBox-d3ff3d4d.js → OrientedBoundingBox-b450cb61.js} +5 -5
- package/Build/Workers/{Plane-b81241c2.js → Plane-900aa728.js} +1 -1
- package/Build/Workers/{PolygonGeometryLibrary-6f4937bb.js → PolygonGeometryLibrary-f918ac26.js} +1 -1
- package/Build/Workers/PolygonPipeline-f59a8f0a.js +1345 -0
- package/Build/Workers/{PolylinePipeline-2e2b015c.js → PolylinePipeline-d8e6bd9b.js} +1 -1
- package/Build/Workers/{PolylineVolumeGeometryLibrary-7ee1d449.js → PolylineVolumeGeometryLibrary-125d2edf.js} +1 -1
- package/Build/Workers/{PrimitivePipeline-a9b7aae0.js → PrimitivePipeline-0d7b5ed4.js} +1 -1
- package/Build/Workers/{RectangleGeometryLibrary-9aa6c8f6.js → RectangleGeometryLibrary-0768db63.js} +1 -1
- package/Build/Workers/{TerrainEncoding-b52dcfc5.js → TerrainEncoding-06470d7f.js} +1 -1
- package/Build/Workers/{Transforms-2f755df8.js → Transforms-26539bce.js} +97 -83
- package/Build/Workers/{WallGeometryLibrary-ab19a93d.js → WallGeometryLibrary-6167b0fc.js} +1 -1
- package/Build/Workers/{WebMercatorProjection-9f25de49.js → WebMercatorProjection-13a90d41.js} +1 -1
- package/Build/Workers/cesiumWorkerBootstrapper.js +25 -1
- package/Build/Workers/combineGeometry.js +1 -1
- package/Build/Workers/createBoxGeometry.js +1 -1
- package/Build/Workers/createBoxOutlineGeometry.js +1 -1
- package/Build/Workers/createCircleGeometry.js +1 -1
- package/Build/Workers/createCircleOutlineGeometry.js +1 -1
- package/Build/Workers/createCoplanarPolygonGeometry.js +1 -1
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +1 -1
- package/Build/Workers/createCorridorGeometry.js +1 -1
- package/Build/Workers/createCorridorOutlineGeometry.js +1 -1
- package/Build/Workers/createCylinderGeometry.js +1 -1
- package/Build/Workers/createCylinderOutlineGeometry.js +1 -1
- package/Build/Workers/createEllipseGeometry.js +1 -1
- package/Build/Workers/createEllipseOutlineGeometry.js +1 -1
- package/Build/Workers/createEllipsoidGeometry.js +1 -1
- package/Build/Workers/createEllipsoidOutlineGeometry.js +1 -1
- package/Build/Workers/createFrustumGeometry.js +1 -1
- package/Build/Workers/createFrustumOutlineGeometry.js +1 -1
- package/Build/Workers/createGeometry.js +1 -1
- package/Build/Workers/createGroundPolylineGeometry.js +1 -1
- package/Build/Workers/createPlaneGeometry.js +1 -1
- package/Build/Workers/createPlaneOutlineGeometry.js +1 -1
- package/Build/Workers/createPolygonGeometry.js +1 -1
- package/Build/Workers/createPolygonOutlineGeometry.js +1 -1
- package/Build/Workers/createPolylineGeometry.js +1 -1
- package/Build/Workers/createPolylineVolumeGeometry.js +1 -1
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +1 -1
- package/Build/Workers/createRectangleGeometry.js +1 -1
- package/Build/Workers/createRectangleOutlineGeometry.js +1 -1
- package/Build/Workers/createSimplePolylineGeometry.js +1 -1
- package/Build/Workers/createSphereGeometry.js +1 -1
- package/Build/Workers/createSphereOutlineGeometry.js +1 -1
- package/Build/Workers/createVectorTileClampedPolylines.js +1 -1
- package/Build/Workers/createVectorTileGeometries.js +1 -1
- package/Build/Workers/createVectorTilePoints.js +1 -1
- package/Build/Workers/createVectorTilePolygons.js +1 -1
- package/Build/Workers/createVectorTilePolylines.js +1 -1
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +1 -1
- package/Build/Workers/createVerticesFromHeightmap.js +7 -3
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +1 -1
- package/Build/Workers/createWallGeometry.js +1 -1
- package/Build/Workers/createWallOutlineGeometry.js +1 -1
- package/Build/Workers/decodeI3S.js +1 -1
- package/Build/Workers/package.js +25 -1
- package/Build/Workers/transferTypedArrayTest.js +25 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +1 -1
- package/Source/Core/EarthOrientationParameters.js +67 -63
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/Matrix2.js +2 -1
- package/Source/Core/Matrix3.js +2 -1
- package/Source/Core/Matrix4.js +1 -0
- package/Source/Core/OrientedBoundingBox.js +4 -4
- package/Source/Core/S2Cell.js +3 -3
- package/Source/Core/Transforms.js +3 -7
- package/Source/DataSources/GpxDataSource.js +4 -6
- package/Source/DataSources/KmlDataSource.js +3 -5
- package/Source/Renderer/Context.js +27 -9
- package/Source/Renderer/Pass.js +3 -2
- package/Source/Scene/Cesium3DTileContentType.js +19 -0
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +482 -0
- package/Source/Scene/Cesium3DTilesetMetadata.js +2 -2
- package/Source/Scene/ContentMetadata.js +2 -2
- package/Source/Scene/DerivedCommand.js +7 -0
- package/Source/Scene/Expression.js +1 -1
- package/Source/Scene/Globe.js +10 -0
- package/Source/Scene/GlobeSurfaceTileProvider.js +7 -0
- package/Source/Scene/GltfImageLoader.js +1 -1
- package/Source/Scene/GltfVertexBufferLoader.js +10 -2
- package/Source/Scene/GroupMetadata.js +2 -2
- package/Source/Scene/ImplicitMetadataView.js +2 -2
- package/Source/Scene/ImplicitSubtreeCache.js +127 -0
- package/Source/Scene/ImplicitSubtreeMetadata.js +2 -2
- package/Source/Scene/ImplicitTileset.js +3 -2
- package/Source/Scene/KeyframeNode.js +47 -0
- package/Source/Scene/Megatexture.js +490 -0
- package/Source/Scene/MetadataClass.js +60 -25
- package/Source/Scene/MetadataClassProperty.js +132 -68
- package/Source/Scene/MetadataComponentType.js +78 -57
- package/Source/Scene/MetadataEnum.js +59 -23
- package/Source/Scene/MetadataEnumValue.js +49 -15
- package/Source/Scene/MetadataSchema.js +53 -24
- package/Source/Scene/MetadataSchemaLoader.js +2 -2
- package/Source/Scene/MetadataTableProperty.js +2 -2
- package/Source/Scene/MetadataType.js +6 -14
- package/Source/Scene/Model/GeoJsonLoader.js +1 -1
- package/Source/Scene/Model/Model.js +2 -3
- package/Source/Scene/Model/buildDrawCommand.js +19 -11
- package/Source/Scene/PointCloud.js +1 -1
- package/Source/Scene/PropertyAttribute.js +2 -2
- package/Source/Scene/PropertyAttributeProperty.js +2 -2
- package/Source/Scene/PropertyTable.js +2 -2
- package/Source/Scene/PropertyTexture.js +2 -2
- package/Source/Scene/PropertyTextureProperty.js +2 -2
- package/Source/Scene/ResourceCache.js +9 -1
- package/Source/Scene/ResourceCacheKey.js +9 -1
- package/Source/Scene/Scene.js +17 -0
- package/Source/Scene/SpatialNode.js +375 -0
- package/Source/Scene/StructuralMetadata.js +2 -2
- package/Source/Scene/TileMetadata.js +2 -2
- package/Source/Scene/TilesetMetadata.js +2 -2
- package/Source/Scene/VoxelBoxShape.js +527 -0
- package/Source/Scene/VoxelContent.js +169 -0
- package/Source/Scene/VoxelCylinderShape.js +937 -0
- package/Source/Scene/VoxelEllipsoidShape.js +937 -0
- package/Source/Scene/VoxelPrimitive.js +1919 -0
- package/Source/Scene/VoxelProvider.js +255 -0
- package/Source/Scene/VoxelRenderResources.js +224 -0
- package/Source/Scene/VoxelShape.js +152 -0
- package/Source/Scene/VoxelShapeType.js +105 -0
- package/Source/Scene/VoxelTraversal.js +1144 -0
- package/Source/Scene/buildVoxelDrawCommands.js +116 -0
- package/Source/Scene/parseBatchTable.js +18 -2
- package/Source/Scene/preprocess3DTileContent.js +8 -0
- package/Source/Scene/processVoxelProperties.js +455 -0
- package/Source/Shaders/BillboardCollectionVS.glsl +1 -1
- package/Source/Shaders/BillboardCollectionVS.js +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passVoxels.js +11 -0
- package/Source/Shaders/Builtin/CzmBuiltins.js +17 -15
- package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.glsl +55 -43
- package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js +55 -43
- package/Source/Shaders/GlobeFS.glsl +2 -1
- package/Source/Shaders/GlobeFS.js +2 -1
- package/Source/Shaders/PointPrimitiveCollectionVS.glsl +5 -2
- package/Source/Shaders/PointPrimitiveCollectionVS.js +5 -2
- package/Source/Shaders/Voxels/IntersectBox.glsl +79 -0
- package/Source/Shaders/Voxels/IntersectBox.js +81 -0
- package/Source/Shaders/Voxels/IntersectClippingPlanes.glsl +70 -0
- package/Source/Shaders/Voxels/IntersectClippingPlanes.js +72 -0
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +273 -0
- package/Source/Shaders/Voxels/IntersectCylinder.js +275 -0
- package/Source/Shaders/Voxels/IntersectDepth.glsl +23 -0
- package/Source/Shaders/Voxels/IntersectDepth.js +25 -0
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +337 -0
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +339 -0
- package/Source/Shaders/Voxels/Intersection.glsl +54 -0
- package/Source/Shaders/Voxels/Intersection.js +56 -0
- package/Source/Shaders/Voxels/IntersectionUtils.glsl +151 -0
- package/Source/Shaders/Voxels/IntersectionUtils.js +153 -0
- package/Source/Shaders/Voxels/Megatexture.glsl +136 -0
- package/Source/Shaders/Voxels/Megatexture.js +138 -0
- package/Source/Shaders/Voxels/Octree.glsl +221 -0
- package/Source/Shaders/Voxels/Octree.js +223 -0
- package/Source/Shaders/Voxels/VoxelFS.glsl +150 -0
- package/Source/Shaders/Voxels/VoxelFS.js +152 -0
- package/Source/Shaders/Voxels/VoxelVS.glsl +11 -0
- package/Source/Shaders/Voxels/VoxelVS.js +13 -0
- package/Source/Shaders/Voxels/convertUvToBox.glsl +16 -0
- package/Source/Shaders/Voxels/convertUvToBox.js +18 -0
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +79 -0
- package/Source/Shaders/Voxels/convertUvToCylinder.js +81 -0
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +133 -0
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +135 -0
- package/Source/ThirdParty/Workers/z-worker-pako.js +0 -0
- package/index.d.ts +3124 -2287
- package/index.js +1117 -1085
- package/package.json +3 -4
- package/Build/Workers/PolygonPipeline-774a8aaf.js +0 -1341
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
import Cartesian3 from "../Core/Cartesian3.js";
|
|
2
|
+
import Check from "../Core/Check.js";
|
|
3
|
+
import defaultValue from "../Core/defaultValue.js";
|
|
4
|
+
import defined from "../Core/defined.js";
|
|
5
|
+
import DeveloperError from "../Core/DeveloperError.js";
|
|
6
|
+
import Ellipsoid from "../Core/Ellipsoid.js";
|
|
7
|
+
import Matrix4 from "../Core/Matrix4.js";
|
|
8
|
+
import OrientedBoundingBox from "../Core/OrientedBoundingBox.js";
|
|
9
|
+
import Resource from "../Core/Resource.js";
|
|
10
|
+
import RuntimeError from "../Core/RuntimeError.js";
|
|
11
|
+
import Cesium3DTilesetMetadata from "./Cesium3DTilesetMetadata.js";
|
|
12
|
+
import hasExtension from "./hasExtension.js";
|
|
13
|
+
import ImplicitSubtree from "./ImplicitSubtree.js";
|
|
14
|
+
import ImplicitSubtreeCache from "./ImplicitSubtreeCache.js";
|
|
15
|
+
import ImplicitTileCoordinates from "./ImplicitTileCoordinates.js";
|
|
16
|
+
import ImplicitTileset from "./ImplicitTileset.js";
|
|
17
|
+
import MetadataType from "./MetadataType.js";
|
|
18
|
+
import preprocess3DTileContent from "./preprocess3DTileContent.js";
|
|
19
|
+
import ResourceCache from "./ResourceCache.js";
|
|
20
|
+
import VoxelBoxShape from "./VoxelBoxShape.js";
|
|
21
|
+
import VoxelContent from "./VoxelContent.js";
|
|
22
|
+
import VoxelCylinderShape from "./VoxelCylinderShape.js";
|
|
23
|
+
import VoxelShapeType from "./VoxelShapeType.js";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A {@link VoxelProvider} that fetches voxel data from a 3D Tiles tileset.
|
|
27
|
+
* <p>
|
|
28
|
+
* Implements the {@link VoxelProvider} interface.
|
|
29
|
+
* </p>
|
|
30
|
+
*
|
|
31
|
+
* @alias Cesium3DTilesVoxelProvider
|
|
32
|
+
* @constructor
|
|
33
|
+
* @augments VoxelProvider
|
|
34
|
+
*
|
|
35
|
+
* @param {Object} options Object with the following properties:
|
|
36
|
+
* @param {Resource|String|Promise<Resource>|Promise<String>} options.url The URL to a tileset JSON file.
|
|
37
|
+
*
|
|
38
|
+
* @see VoxelProvider
|
|
39
|
+
* @see VoxelPrimitive
|
|
40
|
+
* @see VoxelShapeType
|
|
41
|
+
*
|
|
42
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
43
|
+
*/
|
|
44
|
+
function Cesium3DTilesVoxelProvider(options) {
|
|
45
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
46
|
+
//>>includeStart('debug', pragmas.debug)
|
|
47
|
+
Check.defined("options.url", options.url);
|
|
48
|
+
//>>includeEnd('debug');
|
|
49
|
+
|
|
50
|
+
/** @inheritdoc */
|
|
51
|
+
this.ready = false;
|
|
52
|
+
|
|
53
|
+
/** @inheritdoc */
|
|
54
|
+
this.shapeTransform = undefined;
|
|
55
|
+
|
|
56
|
+
/** @inheritdoc */
|
|
57
|
+
this.globalTransform = undefined;
|
|
58
|
+
|
|
59
|
+
/** @inheritdoc */
|
|
60
|
+
this.shape = undefined;
|
|
61
|
+
|
|
62
|
+
/** @inheritdoc */
|
|
63
|
+
this.minBounds = undefined;
|
|
64
|
+
|
|
65
|
+
/** @inheritdoc */
|
|
66
|
+
this.maxBounds = undefined;
|
|
67
|
+
|
|
68
|
+
/** @inheritdoc */
|
|
69
|
+
this.dimensions = undefined;
|
|
70
|
+
|
|
71
|
+
/** @inheritdoc */
|
|
72
|
+
this.paddingBefore = undefined;
|
|
73
|
+
|
|
74
|
+
/** @inheritdoc */
|
|
75
|
+
this.paddingAfter = undefined;
|
|
76
|
+
|
|
77
|
+
/** @inheritdoc */
|
|
78
|
+
this.names = undefined;
|
|
79
|
+
|
|
80
|
+
/** @inheritdoc */
|
|
81
|
+
this.types = undefined;
|
|
82
|
+
|
|
83
|
+
/** @inheritdoc */
|
|
84
|
+
this.componentTypes = undefined;
|
|
85
|
+
|
|
86
|
+
/** @inheritdoc */
|
|
87
|
+
this.minimumValues = undefined;
|
|
88
|
+
|
|
89
|
+
/** @inheritdoc */
|
|
90
|
+
this.maximumValues = undefined;
|
|
91
|
+
|
|
92
|
+
/** @inheritdoc */
|
|
93
|
+
this.maximumTileCount = undefined;
|
|
94
|
+
|
|
95
|
+
this._implicitTileset = undefined;
|
|
96
|
+
this._subtreeCache = new ImplicitSubtreeCache();
|
|
97
|
+
|
|
98
|
+
const that = this;
|
|
99
|
+
let tilesetJson;
|
|
100
|
+
|
|
101
|
+
this._readyPromise = Promise.resolve(options.url).then(function (url) {
|
|
102
|
+
const resource = Resource.createIfNeeded(url);
|
|
103
|
+
return resource
|
|
104
|
+
.fetchJson()
|
|
105
|
+
.then(function (tileset) {
|
|
106
|
+
tilesetJson = tileset;
|
|
107
|
+
validate(tilesetJson);
|
|
108
|
+
return getMetadataSchemaLoader(tilesetJson, resource).promise;
|
|
109
|
+
})
|
|
110
|
+
.then(function (schemaLoader) {
|
|
111
|
+
const root = tilesetJson.root;
|
|
112
|
+
const voxel = root.content.extensions["3DTILES_content_voxels"];
|
|
113
|
+
const className = voxel.class;
|
|
114
|
+
|
|
115
|
+
const metadataJson = hasExtension(tilesetJson, "3DTILES_metadata")
|
|
116
|
+
? tilesetJson.extensions["3DTILES_metadata"]
|
|
117
|
+
: tilesetJson;
|
|
118
|
+
|
|
119
|
+
const metadataSchema = schemaLoader.schema;
|
|
120
|
+
const metadata = new Cesium3DTilesetMetadata({
|
|
121
|
+
metadataJson: metadataJson,
|
|
122
|
+
schema: metadataSchema,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
addAttributeInfo(that, metadata, className);
|
|
126
|
+
|
|
127
|
+
const implicitTileset = new ImplicitTileset(
|
|
128
|
+
resource,
|
|
129
|
+
root,
|
|
130
|
+
metadataSchema
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const {
|
|
134
|
+
shape,
|
|
135
|
+
minBounds,
|
|
136
|
+
maxBounds,
|
|
137
|
+
shapeTransform,
|
|
138
|
+
globalTransform,
|
|
139
|
+
} = getShape(root);
|
|
140
|
+
|
|
141
|
+
that.shape = shape;
|
|
142
|
+
that.minBounds = minBounds;
|
|
143
|
+
that.maxBounds = maxBounds;
|
|
144
|
+
that.dimensions = Cartesian3.unpack(voxel.dimensions);
|
|
145
|
+
that.shapeTransform = shapeTransform;
|
|
146
|
+
that.globalTransform = globalTransform;
|
|
147
|
+
|
|
148
|
+
let paddingBefore;
|
|
149
|
+
let paddingAfter;
|
|
150
|
+
|
|
151
|
+
if (defined(voxel.padding)) {
|
|
152
|
+
paddingBefore = Cartesian3.unpack(voxel.padding.before);
|
|
153
|
+
paddingAfter = Cartesian3.unpack(voxel.padding.after);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
that.paddingBefore = paddingBefore;
|
|
157
|
+
that.paddingAfter = paddingAfter;
|
|
158
|
+
|
|
159
|
+
that._implicitTileset = implicitTileset;
|
|
160
|
+
|
|
161
|
+
ResourceCache.unload(schemaLoader);
|
|
162
|
+
|
|
163
|
+
that.ready = true;
|
|
164
|
+
return that;
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
Object.defineProperties(Cesium3DTilesVoxelProvider.prototype, {
|
|
170
|
+
/** @inheritdoc */
|
|
171
|
+
readyPromise: {
|
|
172
|
+
get: function () {
|
|
173
|
+
return this._readyPromise;
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
function validate(tileset) {
|
|
179
|
+
const root = tileset.root;
|
|
180
|
+
|
|
181
|
+
if (!defined(root.content)) {
|
|
182
|
+
throw new RuntimeError("Root must have content");
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (!hasExtension(root.content, "3DTILES_content_voxels")) {
|
|
186
|
+
throw new RuntimeError(
|
|
187
|
+
"Root tile content must have 3DTILES_content_voxels extension"
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (
|
|
192
|
+
!hasExtension(root, "3DTILES_implicit_tiling") &&
|
|
193
|
+
!defined(root.implicitTiling)
|
|
194
|
+
) {
|
|
195
|
+
throw new RuntimeError("Root tile must have implicit tiling");
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (
|
|
199
|
+
!defined(tileset.schema) &&
|
|
200
|
+
!defined(tileset.schemaUri) &&
|
|
201
|
+
!hasExtension(tileset, "3DTILES_metadata")
|
|
202
|
+
) {
|
|
203
|
+
throw new RuntimeError("Tileset must have a metadata schema");
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function getShape(tile) {
|
|
208
|
+
const boundingVolume = tile.boundingVolume;
|
|
209
|
+
|
|
210
|
+
let tileTransform;
|
|
211
|
+
if (defined(tile.transform)) {
|
|
212
|
+
tileTransform = Matrix4.unpack(tile.transform);
|
|
213
|
+
} else {
|
|
214
|
+
tileTransform = Matrix4.clone(Matrix4.IDENTITY);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (defined(boundingVolume.box)) {
|
|
218
|
+
return getBoxShape(boundingVolume.box, tileTransform);
|
|
219
|
+
} else if (defined(boundingVolume.region)) {
|
|
220
|
+
return getEllipsoidShape(boundingVolume.region);
|
|
221
|
+
} else if (hasExtension(boundingVolume, "3DTILES_bounding_volume_cylinder")) {
|
|
222
|
+
return getCylinderShape(
|
|
223
|
+
boundingVolume.extensions["3DTILES_bounding_volume_cylinder"].cylinder,
|
|
224
|
+
tileTransform
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
throw new RuntimeError(
|
|
229
|
+
"Only box, region and 3DTILES_bounding_volume_cylinder are supported in Cesium3DTilesVoxelProvider"
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function getEllipsoidShape(region) {
|
|
234
|
+
const west = region[0];
|
|
235
|
+
const south = region[1];
|
|
236
|
+
const east = region[2];
|
|
237
|
+
const north = region[3];
|
|
238
|
+
const minHeight = region[4];
|
|
239
|
+
const maxHeight = region[5];
|
|
240
|
+
|
|
241
|
+
const shapeTransform = Matrix4.fromScale(Ellipsoid.WGS84.radii);
|
|
242
|
+
|
|
243
|
+
const minBoundsX = west;
|
|
244
|
+
const maxBoundsX = east;
|
|
245
|
+
const minBoundsY = south;
|
|
246
|
+
const maxBoundsY = north;
|
|
247
|
+
const minBoundsZ = minHeight;
|
|
248
|
+
const maxBoundsZ = maxHeight;
|
|
249
|
+
|
|
250
|
+
const minBounds = new Cartesian3(minBoundsX, minBoundsY, minBoundsZ);
|
|
251
|
+
const maxBounds = new Cartesian3(maxBoundsX, maxBoundsY, maxBoundsZ);
|
|
252
|
+
|
|
253
|
+
return {
|
|
254
|
+
shape: VoxelShapeType.ELLIPSOID,
|
|
255
|
+
minBounds: minBounds,
|
|
256
|
+
maxBounds: maxBounds,
|
|
257
|
+
shapeTransform: shapeTransform,
|
|
258
|
+
globalTransform: Matrix4.clone(Matrix4.IDENTITY),
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function getBoxShape(box, tileTransform) {
|
|
263
|
+
const obb = OrientedBoundingBox.unpack(box);
|
|
264
|
+
const shapeTransform = Matrix4.fromRotationTranslation(
|
|
265
|
+
obb.halfAxes,
|
|
266
|
+
obb.center
|
|
267
|
+
);
|
|
268
|
+
|
|
269
|
+
return {
|
|
270
|
+
shape: VoxelShapeType.BOX,
|
|
271
|
+
minBounds: Cartesian3.clone(VoxelBoxShape.DefaultMinBounds),
|
|
272
|
+
maxBounds: Cartesian3.clone(VoxelBoxShape.DefaultMaxBounds),
|
|
273
|
+
shapeTransform: shapeTransform,
|
|
274
|
+
globalTransform: tileTransform,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function getCylinderShape(cylinder, tileTransform) {
|
|
279
|
+
const obb = OrientedBoundingBox.unpack(cylinder);
|
|
280
|
+
const shapeTransform = Matrix4.fromRotationTranslation(
|
|
281
|
+
obb.halfAxes,
|
|
282
|
+
obb.center
|
|
283
|
+
);
|
|
284
|
+
|
|
285
|
+
return {
|
|
286
|
+
shape: VoxelShapeType.CYLINDER,
|
|
287
|
+
minBounds: Cartesian3.clone(VoxelCylinderShape.DefaultMinBounds),
|
|
288
|
+
maxBounds: Cartesian3.clone(VoxelCylinderShape.DefaultMaxBounds),
|
|
289
|
+
shapeTransform: shapeTransform,
|
|
290
|
+
globalTransform: tileTransform,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function getMetadataSchemaLoader(tilesetJson, resource) {
|
|
295
|
+
const { schemaUri, schema } = tilesetJson;
|
|
296
|
+
if (!defined(schemaUri)) {
|
|
297
|
+
return ResourceCache.loadSchema({ schema });
|
|
298
|
+
}
|
|
299
|
+
return ResourceCache.loadSchema({
|
|
300
|
+
resource: resource.getDerivedResource({
|
|
301
|
+
url: schemaUri,
|
|
302
|
+
}),
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function addAttributeInfo(provider, metadata, className) {
|
|
307
|
+
const { schema, statistics } = metadata;
|
|
308
|
+
const classStatistics = statistics?.classes[className];
|
|
309
|
+
const properties = schema.classes[className].properties;
|
|
310
|
+
|
|
311
|
+
const propertyInfo = Object.entries(properties).map(([id, property]) => {
|
|
312
|
+
const { type, componentType } = property;
|
|
313
|
+
const min = classStatistics?.properties[id].min;
|
|
314
|
+
const max = classStatistics?.properties[id].max;
|
|
315
|
+
const componentCount = MetadataType.getComponentCount(type);
|
|
316
|
+
const minValue = copyArray(min, componentCount);
|
|
317
|
+
const maxValue = copyArray(max, componentCount);
|
|
318
|
+
|
|
319
|
+
return { id, type, componentType, minValue, maxValue };
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
provider.names = propertyInfo.map((info) => info.id);
|
|
323
|
+
provider.types = propertyInfo.map((info) => info.type);
|
|
324
|
+
provider.componentTypes = propertyInfo.map((info) => info.componentType);
|
|
325
|
+
|
|
326
|
+
const minimumValues = propertyInfo.map((info) => info.minValue);
|
|
327
|
+
const maximumValues = propertyInfo.map((info) => info.maxValue);
|
|
328
|
+
const hasMinimumValues = minimumValues.some(defined);
|
|
329
|
+
|
|
330
|
+
provider.minimumValues = hasMinimumValues ? minimumValues : undefined;
|
|
331
|
+
provider.maximumValues = hasMinimumValues ? maximumValues : undefined;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function copyArray(values, length) {
|
|
335
|
+
// Copy input values into a new array of a specified length.
|
|
336
|
+
// If the input is not an array, its value will be copied into the first element
|
|
337
|
+
// of the returned array. If the input is an array shorter than the returned
|
|
338
|
+
// array, the extra elements in the returned array will be undefined. If the
|
|
339
|
+
// input is undefined, the return will be undefined.
|
|
340
|
+
if (!defined(values)) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
const valuesArray = Array.isArray(values) ? values : [values];
|
|
344
|
+
return Array.from({ length }, (v, i) => valuesArray[i]);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function getVoxelPromise(implicitTileset, tileCoordinates) {
|
|
348
|
+
const voxelRelative = implicitTileset.contentUriTemplates[0].getDerivedResource(
|
|
349
|
+
{
|
|
350
|
+
templateValues: tileCoordinates.getTemplateValues(),
|
|
351
|
+
}
|
|
352
|
+
);
|
|
353
|
+
const voxelResource = implicitTileset.baseResource.getDerivedResource({
|
|
354
|
+
url: voxelRelative.url,
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
return voxelResource.fetchArrayBuffer().then(function (arrayBuffer) {
|
|
358
|
+
const preprocessed = preprocess3DTileContent(arrayBuffer);
|
|
359
|
+
|
|
360
|
+
const voxelContent = new VoxelContent(
|
|
361
|
+
voxelResource,
|
|
362
|
+
preprocessed.jsonPayload,
|
|
363
|
+
preprocessed.binaryPayload,
|
|
364
|
+
implicitTileset.metadataSchema
|
|
365
|
+
);
|
|
366
|
+
|
|
367
|
+
return voxelContent.readyPromise;
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function getSubtreePromise(provider, subtreeCoord) {
|
|
372
|
+
const implicitTileset = provider._implicitTileset;
|
|
373
|
+
const subtreeCache = provider._subtreeCache;
|
|
374
|
+
|
|
375
|
+
// First load the subtree to check if the tile is available.
|
|
376
|
+
// If the subtree has been requested previously it might still be in the cache
|
|
377
|
+
const subtree = subtreeCache.find(subtreeCoord);
|
|
378
|
+
if (defined(subtree)) {
|
|
379
|
+
return subtree.readyPromise;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const subtreeRelative = implicitTileset.subtreeUriTemplate.getDerivedResource(
|
|
383
|
+
{
|
|
384
|
+
templateValues: subtreeCoord.getTemplateValues(),
|
|
385
|
+
}
|
|
386
|
+
);
|
|
387
|
+
const subtreeResource = implicitTileset.baseResource.getDerivedResource({
|
|
388
|
+
url: subtreeRelative.url,
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
return subtreeResource.fetchArrayBuffer().then(function (arrayBuffer) {
|
|
392
|
+
// Check one more time if the subtree is in the cache.
|
|
393
|
+
// This could happen if there are two in-flight tile requests from the same
|
|
394
|
+
// subtree and one finishes before the other.
|
|
395
|
+
let subtree = subtreeCache.find(subtreeCoord);
|
|
396
|
+
if (defined(subtree)) {
|
|
397
|
+
return subtree.readyPromise;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
const preprocessed = preprocess3DTileContent(arrayBuffer);
|
|
401
|
+
subtree = new ImplicitSubtree(
|
|
402
|
+
subtreeResource,
|
|
403
|
+
preprocessed.jsonPayload,
|
|
404
|
+
preprocessed.binaryPayload,
|
|
405
|
+
implicitTileset,
|
|
406
|
+
subtreeCoord
|
|
407
|
+
);
|
|
408
|
+
subtreeCache.addSubtree(subtree);
|
|
409
|
+
return subtree.readyPromise;
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/** @inheritdoc */
|
|
414
|
+
Cesium3DTilesVoxelProvider.prototype.requestData = function (options) {
|
|
415
|
+
//>>includeStart('debug', pragmas.debug);
|
|
416
|
+
if (!this.ready) {
|
|
417
|
+
throw new DeveloperError(
|
|
418
|
+
"The provider is not ready. Use Cesium3DTilesVoxelProvider.readyPromise or wait for Cesium3DTilesVoxelProvider.ready to be true."
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
//>>includeEnd('debug');
|
|
422
|
+
|
|
423
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
424
|
+
const tileLevel = defaultValue(options.tileLevel, 0);
|
|
425
|
+
const tileX = defaultValue(options.tileX, 0);
|
|
426
|
+
const tileY = defaultValue(options.tileY, 0);
|
|
427
|
+
const tileZ = defaultValue(options.tileZ, 0);
|
|
428
|
+
const keyframe = defaultValue(options.keyframe, 0);
|
|
429
|
+
|
|
430
|
+
// 3D Tiles currently doesn't support time-dynamic data.
|
|
431
|
+
if (keyframe !== 0) {
|
|
432
|
+
return undefined;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// 1. Load the subtree that the tile belongs to (possibly from the subtree cache)
|
|
436
|
+
// 2. Load the voxel content if available
|
|
437
|
+
|
|
438
|
+
const implicitTileset = this._implicitTileset;
|
|
439
|
+
const names = this.names;
|
|
440
|
+
|
|
441
|
+
// Can't use a scratch variable here because the object is used inside the promise chain.
|
|
442
|
+
const tileCoordinates = new ImplicitTileCoordinates({
|
|
443
|
+
subdivisionScheme: implicitTileset.subdivisionScheme,
|
|
444
|
+
subtreeLevels: implicitTileset.subtreeLevels,
|
|
445
|
+
level: tileLevel,
|
|
446
|
+
x: tileX,
|
|
447
|
+
y: tileY,
|
|
448
|
+
z: tileZ,
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
// Find the coordinates of the parent subtree containing tileCoordinates
|
|
452
|
+
// If tileCoordinates is a subtree child, use that subtree
|
|
453
|
+
// If tileCoordinates is a subtree root, use its parent subtree
|
|
454
|
+
const isSubtreeRoot =
|
|
455
|
+
tileCoordinates.isSubtreeRoot() && tileCoordinates.level > 0;
|
|
456
|
+
|
|
457
|
+
const subtreeCoord = isSubtreeRoot
|
|
458
|
+
? tileCoordinates.getParentSubtreeCoordinates()
|
|
459
|
+
: tileCoordinates.getSubtreeCoordinates();
|
|
460
|
+
|
|
461
|
+
const that = this;
|
|
462
|
+
|
|
463
|
+
return getSubtreePromise(that, subtreeCoord)
|
|
464
|
+
.then(function (subtree) {
|
|
465
|
+
const available = isSubtreeRoot
|
|
466
|
+
? subtree.childSubtreeIsAvailableAtCoordinates(tileCoordinates)
|
|
467
|
+
: subtree.tileIsAvailableAtCoordinates(tileCoordinates);
|
|
468
|
+
|
|
469
|
+
if (!available) {
|
|
470
|
+
return Promise.reject("Tile is not available");
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
return getVoxelPromise(implicitTileset, tileCoordinates);
|
|
474
|
+
})
|
|
475
|
+
.then(function (voxelContent) {
|
|
476
|
+
return names.map(function (name) {
|
|
477
|
+
return voxelContent.metadataTable.getPropertyTypedArray(name);
|
|
478
|
+
});
|
|
479
|
+
});
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
export default Cesium3DTilesVoxelProvider;
|
|
@@ -168,7 +168,7 @@ Object.defineProperties(Cesium3DTilesetMetadata.prototype, {
|
|
|
168
168
|
},
|
|
169
169
|
|
|
170
170
|
/**
|
|
171
|
-
*
|
|
171
|
+
* Extra user-defined properties.
|
|
172
172
|
*
|
|
173
173
|
* @memberof Cesium3DTilesetMetadata.prototype
|
|
174
174
|
* @type {*}
|
|
@@ -182,7 +182,7 @@ Object.defineProperties(Cesium3DTilesetMetadata.prototype, {
|
|
|
182
182
|
},
|
|
183
183
|
|
|
184
184
|
/**
|
|
185
|
-
*
|
|
185
|
+
* An object containing extensions.
|
|
186
186
|
*
|
|
187
187
|
* @memberof Cesium3DTilesetMetadata.prototype
|
|
188
188
|
* @type {Object}
|
|
@@ -50,7 +50,7 @@ Object.defineProperties(ContentMetadata.prototype, {
|
|
|
50
50
|
},
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* Extra user-defined properties.
|
|
54
54
|
*
|
|
55
55
|
* @memberof ContentMetadata.prototype
|
|
56
56
|
* @type {Object}
|
|
@@ -64,7 +64,7 @@ Object.defineProperties(ContentMetadata.prototype, {
|
|
|
64
64
|
},
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
67
|
+
* An object containing extensions.
|
|
68
68
|
*
|
|
69
69
|
* @memberof ContentMetadata.prototype
|
|
70
70
|
* @type {Object}
|
|
@@ -148,6 +148,13 @@ const vertexlogDepthRegex = /\s+czm_vertexLogDepth\(/;
|
|
|
148
148
|
const extensionRegex = /\s*#extension\s+GL_EXT_frag_depth\s*:\s*enable/;
|
|
149
149
|
|
|
150
150
|
function getLogDepthShaderProgram(context, shaderProgram) {
|
|
151
|
+
const disableLogDepthWrite =
|
|
152
|
+
shaderProgram.fragmentShaderSource.defines.indexOf("LOG_DEPTH_READ_ONLY") >=
|
|
153
|
+
0;
|
|
154
|
+
if (disableLogDepthWrite) {
|
|
155
|
+
return shaderProgram;
|
|
156
|
+
}
|
|
157
|
+
|
|
151
158
|
let shader = context.shaderCache.getDerivedShaderProgram(
|
|
152
159
|
shaderProgram,
|
|
153
160
|
"logDepth"
|
|
@@ -659,7 +659,7 @@ function parseCall(expression, ast) {
|
|
|
659
659
|
const object = ast.callee.object;
|
|
660
660
|
if (call === "test" || call === "exec") {
|
|
661
661
|
// Make sure this is called on a valid type
|
|
662
|
-
if (object.callee.name !== "regExp") {
|
|
662
|
+
if (!defined(object.callee) || object.callee.name !== "regExp") {
|
|
663
663
|
throw new RuntimeError(`${call} is not a function.`);
|
|
664
664
|
}
|
|
665
665
|
if (argsLength === 0) {
|
package/Source/Scene/Globe.js
CHANGED
|
@@ -379,6 +379,15 @@ function Globe(ellipsoid) {
|
|
|
379
379
|
|
|
380
380
|
this._oceanNormalMap = undefined;
|
|
381
381
|
this._zoomedOutOceanSpecularIntensity = undefined;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Determines the darkness of the vertex shadow.
|
|
385
|
+
* This only takes effect when <code>enableLighting</code> is <code>true</code>.
|
|
386
|
+
*
|
|
387
|
+
* @type {Number}
|
|
388
|
+
* @default 0.3
|
|
389
|
+
*/
|
|
390
|
+
this.vertexShadowDarkness = 0.3;
|
|
382
391
|
}
|
|
383
392
|
|
|
384
393
|
Object.defineProperties(Globe.prototype, {
|
|
@@ -1046,6 +1055,7 @@ Globe.prototype.beginFrame = function (frameState) {
|
|
|
1046
1055
|
tileProvider.fillHighlightColor = this.fillHighlightColor;
|
|
1047
1056
|
tileProvider.showSkirts = this.showSkirts;
|
|
1048
1057
|
tileProvider.backFaceCulling = this.backFaceCulling;
|
|
1058
|
+
tileProvider.vertexShadowDarkness = this.vertexShadowDarkness;
|
|
1049
1059
|
tileProvider.undergroundColor = this._undergroundColor;
|
|
1050
1060
|
tileProvider.undergroundColorAlphaByDistance = this._undergroundColorAlphaByDistance;
|
|
1051
1061
|
tileProvider.lambertDiffuseMultiplier = this.lambertDiffuseMultiplier;
|
|
@@ -89,6 +89,7 @@ function GlobeSurfaceTileProvider(options) {
|
|
|
89
89
|
this.dynamicAtmosphereLightingFromSun = false;
|
|
90
90
|
this.showGroundAtmosphere = false;
|
|
91
91
|
this.shadows = ShadowMode.RECEIVE_ONLY;
|
|
92
|
+
this.vertexShadowDarkness = 0.3;
|
|
92
93
|
|
|
93
94
|
/**
|
|
94
95
|
* The color to use to highlight terrain fill tiles. If undefined, fill tiles are not
|
|
@@ -1785,6 +1786,9 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) {
|
|
|
1785
1786
|
u_lambertDiffuseMultiplier: function () {
|
|
1786
1787
|
return this.properties.lambertDiffuseMultiplier;
|
|
1787
1788
|
},
|
|
1789
|
+
u_vertexShadowDarkness: function () {
|
|
1790
|
+
return this.properties.vertexShadowDarkness;
|
|
1791
|
+
},
|
|
1788
1792
|
|
|
1789
1793
|
// make a separate object so that changes to the properties are seen on
|
|
1790
1794
|
// derived commands that combine another uniform map with this one.
|
|
@@ -1846,6 +1850,7 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) {
|
|
|
1846
1850
|
undergroundColor: Color.clone(Color.TRANSPARENT),
|
|
1847
1851
|
undergroundColorAlphaByDistance: new Cartesian4(),
|
|
1848
1852
|
lambertDiffuseMultiplier: 0.0,
|
|
1853
|
+
vertexShadowDarkness: 0.0,
|
|
1849
1854
|
},
|
|
1850
1855
|
};
|
|
1851
1856
|
|
|
@@ -2112,6 +2117,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2112
2117
|
undergroundColorAlphaByDistance.farValue > 0.0);
|
|
2113
2118
|
|
|
2114
2119
|
const lambertDiffuseMultiplier = tileProvider.lambertDiffuseMultiplier;
|
|
2120
|
+
const vertexShadowDarkness = tileProvider.vertexShadowDarkness;
|
|
2115
2121
|
|
|
2116
2122
|
const showReflectiveOcean =
|
|
2117
2123
|
tileProvider.hasWaterMask && defined(waterMaskTexture);
|
|
@@ -2416,6 +2422,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2416
2422
|
Color.clone(undergroundColor, uniformMapProperties.undergroundColor);
|
|
2417
2423
|
|
|
2418
2424
|
uniformMapProperties.lambertDiffuseMultiplier = lambertDiffuseMultiplier;
|
|
2425
|
+
uniformMapProperties.vertexShadowDarkness = vertexShadowDarkness;
|
|
2419
2426
|
|
|
2420
2427
|
const highlightFillTile =
|
|
2421
2428
|
!defined(surfaceTile.vertexArray) &&
|
|
@@ -293,7 +293,7 @@ function loadImageFromBufferTypedArray(typedArray) {
|
|
|
293
293
|
const ktx2Regex = /(^data:image\/ktx2)|(\.ktx2$)/i;
|
|
294
294
|
|
|
295
295
|
function loadImageFromUri(resource) {
|
|
296
|
-
const uri = resource.
|
|
296
|
+
const uri = resource.getUrlComponent(false, true);
|
|
297
297
|
if (ktx2Regex.test(uri)) {
|
|
298
298
|
// Resolves to a CompressedTextureBuffer
|
|
299
299
|
return loadKTX2(resource);
|
|
@@ -67,7 +67,7 @@ function GltfVertexBufferLoader(options) {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
const hasBufferViewId = defined(bufferViewId);
|
|
70
|
-
const hasDraco =
|
|
70
|
+
const hasDraco = hasDracoCompression(draco, attributeSemantic);
|
|
71
71
|
const hasAttributeSemantic = defined(attributeSemantic);
|
|
72
72
|
const hasAccessorId = defined(accessorId);
|
|
73
73
|
|
|
@@ -196,6 +196,14 @@ Object.defineProperties(GltfVertexBufferLoader.prototype, {
|
|
|
196
196
|
},
|
|
197
197
|
});
|
|
198
198
|
|
|
199
|
+
function hasDracoCompression(draco, semantic) {
|
|
200
|
+
return (
|
|
201
|
+
defined(draco) &&
|
|
202
|
+
defined(draco.attributes) &&
|
|
203
|
+
defined(draco.attributes[semantic])
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
|
|
199
207
|
/**
|
|
200
208
|
* Loads the resource.
|
|
201
209
|
* @returns {Promise.<GltfVertexBufferLoader>} A promise which resolves to the loader when the resource loading is completed.
|
|
@@ -204,7 +212,7 @@ Object.defineProperties(GltfVertexBufferLoader.prototype, {
|
|
|
204
212
|
GltfVertexBufferLoader.prototype.load = function () {
|
|
205
213
|
let promise;
|
|
206
214
|
|
|
207
|
-
if (
|
|
215
|
+
if (hasDracoCompression(this._draco, this._attributeSemantic)) {
|
|
208
216
|
promise = loadFromDraco(this);
|
|
209
217
|
} else {
|
|
210
218
|
promise = loadFromBufferView(this);
|
|
@@ -69,7 +69,7 @@ Object.defineProperties(GroupMetadata.prototype, {
|
|
|
69
69
|
},
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* Extra user-defined properties.
|
|
73
73
|
*
|
|
74
74
|
* @memberof GroupMetadata.prototype
|
|
75
75
|
* @type {*}
|
|
@@ -83,7 +83,7 @@ Object.defineProperties(GroupMetadata.prototype, {
|
|
|
83
83
|
},
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
*
|
|
86
|
+
* An object containing extensions.
|
|
87
87
|
*
|
|
88
88
|
* @memberof GroupMetadata.prototype
|
|
89
89
|
* @type {Object}
|
|
@@ -56,7 +56,7 @@ Object.defineProperties(ImplicitMetadataView.prototype, {
|
|
|
56
56
|
},
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* Extra user-defined properties.
|
|
60
60
|
*
|
|
61
61
|
* @memberof ImplicitMetadataView.prototype
|
|
62
62
|
* @type {Object}
|
|
@@ -69,7 +69,7 @@ Object.defineProperties(ImplicitMetadataView.prototype, {
|
|
|
69
69
|
},
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* An object containing extensions.
|
|
73
73
|
*
|
|
74
74
|
* @memberof ImplicitMetadataView.prototype
|
|
75
75
|
* @type {Object}
|