@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,255 @@
|
|
|
1
|
+
import DeveloperError from "../Core/DeveloperError.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Provides voxel data. Intended to be used with {@link VoxelPrimitive}.
|
|
5
|
+
* This type describes an interface and is not intended to be instantiated directly.
|
|
6
|
+
*
|
|
7
|
+
* @alias VoxelProvider
|
|
8
|
+
* @constructor
|
|
9
|
+
*
|
|
10
|
+
* @see Cesium3DTilesVoxelProvider
|
|
11
|
+
* @see VoxelPrimitive
|
|
12
|
+
* @see VoxelShapeType
|
|
13
|
+
*
|
|
14
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
15
|
+
*/
|
|
16
|
+
function VoxelProvider() {
|
|
17
|
+
DeveloperError.throwInstantiationError();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
Object.defineProperties(VoxelProvider.prototype, {
|
|
21
|
+
/**
|
|
22
|
+
* Gets a value indicating whether or not the provider is ready for use.
|
|
23
|
+
*
|
|
24
|
+
* @memberof VoxelProvider.prototype
|
|
25
|
+
* @type {Boolean}
|
|
26
|
+
* @readonly
|
|
27
|
+
*/
|
|
28
|
+
ready: {
|
|
29
|
+
get: DeveloperError.throwInstantiationError,
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Gets the promise that will be resolved when the provider is ready for use.
|
|
34
|
+
*
|
|
35
|
+
* @memberof VoxelProvider.prototype
|
|
36
|
+
* @type {Promise.<VoxelProvider>}
|
|
37
|
+
* @readonly
|
|
38
|
+
*/
|
|
39
|
+
readyPromise: {
|
|
40
|
+
get: DeveloperError.throwInstantiationError,
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A transform from local space to global space. If undefined, the identity matrix will be used instead.
|
|
45
|
+
*
|
|
46
|
+
* @memberof VoxelProvider.prototype
|
|
47
|
+
* @type {Matrix4|undefined}
|
|
48
|
+
* @readonly
|
|
49
|
+
*/
|
|
50
|
+
globalTransform: {
|
|
51
|
+
get: DeveloperError.throwInstantiationError,
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* A transform from shape space to local space. If undefined, the identity matrix will be used instead.
|
|
56
|
+
*
|
|
57
|
+
* @memberof VoxelProvider.prototype
|
|
58
|
+
* @type {Matrix4|undefined}
|
|
59
|
+
* @readonly
|
|
60
|
+
*/
|
|
61
|
+
shapeTransform: {
|
|
62
|
+
get: DeveloperError.throwInstantiationError,
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Gets the {@link VoxelShapeType}
|
|
67
|
+
* This should not be called before {@link VoxelProvider#ready} returns true.
|
|
68
|
+
*
|
|
69
|
+
* @memberof VoxelProvider.prototype
|
|
70
|
+
* @type {VoxelShapeType}
|
|
71
|
+
* @readonly
|
|
72
|
+
*/
|
|
73
|
+
shape: {
|
|
74
|
+
get: DeveloperError.throwInstantiationError,
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Gets the minimum bounds.
|
|
79
|
+
* If undefined, the shape's default minimum bounds will be used instead.
|
|
80
|
+
* This should not be called before {@link VoxelProvider#ready} returns true.
|
|
81
|
+
*
|
|
82
|
+
* @memberof VoxelProvider.prototype
|
|
83
|
+
* @type {Cartesian3|undefined}
|
|
84
|
+
* @readonly
|
|
85
|
+
*/
|
|
86
|
+
minBounds: {
|
|
87
|
+
get: DeveloperError.throwInstantiationError,
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Gets the maximum bounds.
|
|
92
|
+
* If undefined, the shape's default maximum bounds will be used instead.
|
|
93
|
+
* This should not be called before {@link VoxelProvider#ready} returns true.
|
|
94
|
+
*
|
|
95
|
+
* @memberof VoxelProvider.prototype
|
|
96
|
+
* @type {Cartesian3|undefined}
|
|
97
|
+
* @readonly
|
|
98
|
+
*/
|
|
99
|
+
maxBounds: {
|
|
100
|
+
get: DeveloperError.throwInstantiationError,
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Gets the number of voxels per dimension of a tile. This is the same for all tiles in the dataset.
|
|
105
|
+
* This should not be called before {@link VoxelProvider#ready} returns true.
|
|
106
|
+
*
|
|
107
|
+
* @memberof VoxelProvider.prototype
|
|
108
|
+
* @type {Cartesian3}
|
|
109
|
+
* @readonly
|
|
110
|
+
*/
|
|
111
|
+
dimensions: {
|
|
112
|
+
get: DeveloperError.throwInstantiationError,
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Gets the number of padding voxels before the tile. This improves rendering quality when sampling the edge of a tile, but it increases memory usage.
|
|
117
|
+
* This should not be called before {@link VoxelProvider#ready} returns true.
|
|
118
|
+
*
|
|
119
|
+
* @memberof VoxelProvider.prototype
|
|
120
|
+
* @type {Cartesian3|undefined}
|
|
121
|
+
* @readonly
|
|
122
|
+
*/
|
|
123
|
+
paddingBefore: {
|
|
124
|
+
get: DeveloperError.throwInstantiationError,
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Gets the number of padding voxels after the tile. This improves rendering quality when sampling the edge of a tile, but it increases memory usage.
|
|
129
|
+
* This should not be called before {@link VoxelProvider#ready} returns true.
|
|
130
|
+
*
|
|
131
|
+
* @memberof VoxelProvider.prototype
|
|
132
|
+
* @type {Cartesian3|undefined}
|
|
133
|
+
* @readonly
|
|
134
|
+
*/
|
|
135
|
+
paddingAfter: {
|
|
136
|
+
get: DeveloperError.throwInstantiationError,
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Gets the metadata names.
|
|
141
|
+
* This should not be called before {@link VoxelProvider#ready} returns true.
|
|
142
|
+
*
|
|
143
|
+
* @memberof VoxelProvider.prototype
|
|
144
|
+
* @type {String[]}
|
|
145
|
+
* @readonly
|
|
146
|
+
*/
|
|
147
|
+
names: {
|
|
148
|
+
get: DeveloperError.throwInstantiationError,
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Gets the metadata types.
|
|
153
|
+
* This should not be called before {@link VoxelProvider#ready} returns true.
|
|
154
|
+
*
|
|
155
|
+
* @memberof VoxelProvider.prototype
|
|
156
|
+
* @type {MetadataType[]}
|
|
157
|
+
* @readonly
|
|
158
|
+
*/
|
|
159
|
+
types: {
|
|
160
|
+
get: DeveloperError.throwInstantiationError,
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Gets the metadata component types.
|
|
165
|
+
* This should not be called before {@link VoxelProvider#ready} returns true.
|
|
166
|
+
*
|
|
167
|
+
* @memberof VoxelProvider.prototype
|
|
168
|
+
* @type {MetadataComponentType[]}
|
|
169
|
+
* @readonly
|
|
170
|
+
*/
|
|
171
|
+
componentTypes: {
|
|
172
|
+
get: DeveloperError.throwInstantiationError,
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Gets the metadata minimum values.
|
|
177
|
+
* This should not be called before {@link VoxelProvider#ready} returns true.
|
|
178
|
+
*
|
|
179
|
+
* @memberof VoxelProvider.prototype
|
|
180
|
+
* @type {Number[][]|undefined}
|
|
181
|
+
* @readonly
|
|
182
|
+
*/
|
|
183
|
+
minimumValues: {
|
|
184
|
+
get: DeveloperError.throwInstantiationError,
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Gets the metadata maximum values.
|
|
189
|
+
* This should not be called before {@link VoxelProvider#ready} returns true.
|
|
190
|
+
*
|
|
191
|
+
* @memberof VoxelProvider.prototype
|
|
192
|
+
* @type {Number[][]|undefined}
|
|
193
|
+
* @readonly
|
|
194
|
+
*/
|
|
195
|
+
maximumValues: {
|
|
196
|
+
get: DeveloperError.throwInstantiationError,
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* The maximum number of tiles that exist for this provider. This value is used as a hint to the voxel renderer to allocate an appropriate amount of GPU memory. If this value is not known it can be undefined.
|
|
201
|
+
* This should not be called before {@link VoxelProvider#ready} returns true.
|
|
202
|
+
*
|
|
203
|
+
* @memberof VoxelProvider.prototype
|
|
204
|
+
* @type {Number|undefined}
|
|
205
|
+
* @readonly
|
|
206
|
+
*/
|
|
207
|
+
maximumTileCount: {
|
|
208
|
+
get: DeveloperError.throwInstantiationError,
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Gets the number of keyframes in the dataset.
|
|
213
|
+
* This should not be called before {@link VoxelProvider#ready} returns true.
|
|
214
|
+
*
|
|
215
|
+
* @memberof VoxelProvider.prototype
|
|
216
|
+
* @type {Number}
|
|
217
|
+
* @readonly
|
|
218
|
+
* @private
|
|
219
|
+
*/
|
|
220
|
+
keyframeCount: {
|
|
221
|
+
get: DeveloperError.throwInstantiationError,
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Gets the {@link TimeIntervalCollection} for the dataset, or undefined if it doesn't have timestamps.
|
|
226
|
+
* This should not be called before {@link VoxelProvider#ready} returns true.
|
|
227
|
+
*
|
|
228
|
+
* @memberof VoxelProvider.prototype
|
|
229
|
+
* @type {TimeIntervalCollection}
|
|
230
|
+
* @readonly
|
|
231
|
+
* @private
|
|
232
|
+
*/
|
|
233
|
+
timeIntervalCollection: {
|
|
234
|
+
get: DeveloperError.throwInstantiationError,
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Requests the data for a given tile. The data is a flattened 3D array ordered by X, then Y, then Z.
|
|
240
|
+
* This function should not be called before {@link VoxelProvider#ready} returns true.
|
|
241
|
+
* @function
|
|
242
|
+
*
|
|
243
|
+
* @param {Object} [options] Object with the following properties:
|
|
244
|
+
* @param {Number} [options.tileLevel=0] The tile's level.
|
|
245
|
+
* @param {Number} [options.tileX=0] The tile's X coordinate.
|
|
246
|
+
* @param {Number} [options.tileY=0] The tile's Y coordinate.
|
|
247
|
+
* @param {Number} [options.tileZ=0] The tile's Z coordinate.
|
|
248
|
+
* @privateparam {Number} [options.keyframe=0] The requested keyframe.
|
|
249
|
+
* @returns {Promise<Array[]>|undefined} A promise to an array of typed arrays containing the requested voxel data or undefined if there was a problem loading the data.
|
|
250
|
+
*
|
|
251
|
+
* @exception {DeveloperError} The provider must be ready.
|
|
252
|
+
*/
|
|
253
|
+
VoxelProvider.prototype.requestData = DeveloperError.throwInstantiationError;
|
|
254
|
+
|
|
255
|
+
export default VoxelProvider;
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import Cartesian3 from "../Core/Cartesian3.js";
|
|
2
|
+
import combine from "../Core/combine.js";
|
|
3
|
+
import defined from "../Core/defined.js";
|
|
4
|
+
import ShaderBuilder from "../Renderer/ShaderBuilder.js";
|
|
5
|
+
import ShaderDestination from "../Renderer/ShaderDestination.js";
|
|
6
|
+
import VoxelFS from "../Shaders/Voxels/VoxelFS.js";
|
|
7
|
+
import VoxelVS from "../Shaders/Voxels/VoxelVS.js";
|
|
8
|
+
import IntersectionUtils from "../Shaders/Voxels/IntersectionUtils.js";
|
|
9
|
+
import IntersectDepth from "../Shaders/Voxels/IntersectDepth.js";
|
|
10
|
+
import IntersectClippingPlanes from "../Shaders/Voxels/IntersectClippingPlanes.js";
|
|
11
|
+
import IntersectBox from "../Shaders/Voxels/IntersectBox.js";
|
|
12
|
+
import IntersectCylinder from "../Shaders/Voxels/IntersectCylinder.js";
|
|
13
|
+
import IntersectEllipsoid from "../Shaders/Voxels/IntersectEllipsoid.js";
|
|
14
|
+
import Intersection from "../Shaders/Voxels/Intersection.js";
|
|
15
|
+
import convertUvToBox from "../Shaders/Voxels/convertUvToBox.js";
|
|
16
|
+
import convertUvToCylinder from "../Shaders/Voxels/convertUvToCylinder.js";
|
|
17
|
+
import convertUvToEllipsoid from "../Shaders/Voxels/convertUvToEllipsoid.js";
|
|
18
|
+
import Octree from "../Shaders/Voxels/Octree.js";
|
|
19
|
+
import Megatexture from "../Shaders/Voxels/Megatexture.js";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Set up render resources, including basic shader code, for rendering
|
|
23
|
+
* a Voxel primitive.
|
|
24
|
+
* The shader code generated by this function may be modified in later stages.
|
|
25
|
+
* @constructor
|
|
26
|
+
* @param {VoxelPrimitive} primitive
|
|
27
|
+
*
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
function VoxelRenderResources(primitive) {
|
|
31
|
+
const shaderBuilder = new ShaderBuilder();
|
|
32
|
+
/**
|
|
33
|
+
* An object used to build a shader incrementally. Each pipeline stage
|
|
34
|
+
* may add lines of shader code to this object.
|
|
35
|
+
*
|
|
36
|
+
* @type {ShaderBuilder}
|
|
37
|
+
* @readonly
|
|
38
|
+
*
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
41
|
+
this.shaderBuilder = shaderBuilder;
|
|
42
|
+
|
|
43
|
+
// Custom shader uniforms
|
|
44
|
+
const customShader = primitive._customShader;
|
|
45
|
+
const uniformMap = combine(primitive._uniformMap, customShader.uniformMap);
|
|
46
|
+
primitive._uniformMap = uniformMap;
|
|
47
|
+
|
|
48
|
+
const customShaderUniforms = customShader.uniforms;
|
|
49
|
+
for (const uniformName in customShaderUniforms) {
|
|
50
|
+
if (customShaderUniforms.hasOwnProperty(uniformName)) {
|
|
51
|
+
const uniform = customShaderUniforms[uniformName];
|
|
52
|
+
shaderBuilder.addUniform(
|
|
53
|
+
uniform.type,
|
|
54
|
+
uniformName,
|
|
55
|
+
ShaderDestination.FRAGMENT
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// The reason this uniform is added by shader builder is because some of the
|
|
60
|
+
// dynamically generated shader code reads from it.
|
|
61
|
+
shaderBuilder.addUniform(
|
|
62
|
+
"sampler2D",
|
|
63
|
+
"u_megatextureTextures[METADATA_COUNT]",
|
|
64
|
+
ShaderDestination.FRAGMENT
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* A dictionary mapping uniform name to functions that return the uniform
|
|
69
|
+
* values.
|
|
70
|
+
*
|
|
71
|
+
* @type {Object.<String, Function>}
|
|
72
|
+
*/
|
|
73
|
+
this.uniformMap = uniformMap;
|
|
74
|
+
|
|
75
|
+
const clippingPlanes = primitive._clippingPlanes;
|
|
76
|
+
const clippingPlanesLength =
|
|
77
|
+
defined(clippingPlanes) && clippingPlanes.enabled
|
|
78
|
+
? clippingPlanes.length
|
|
79
|
+
: 0;
|
|
80
|
+
|
|
81
|
+
this.clippingPlanes = clippingPlanes;
|
|
82
|
+
this.clippingPlanesLength = clippingPlanesLength;
|
|
83
|
+
|
|
84
|
+
// Build shader
|
|
85
|
+
shaderBuilder.addVertexLines([VoxelVS]);
|
|
86
|
+
|
|
87
|
+
shaderBuilder.addFragmentLines([
|
|
88
|
+
customShader.fragmentShaderText,
|
|
89
|
+
"#line 0",
|
|
90
|
+
IntersectionUtils,
|
|
91
|
+
]);
|
|
92
|
+
|
|
93
|
+
if (clippingPlanesLength > 0) {
|
|
94
|
+
shaderBuilder.addDefine(
|
|
95
|
+
"CLIPPING_PLANES",
|
|
96
|
+
undefined,
|
|
97
|
+
ShaderDestination.FRAGMENT
|
|
98
|
+
);
|
|
99
|
+
shaderBuilder.addDefine(
|
|
100
|
+
"CLIPPING_PLANES_COUNT",
|
|
101
|
+
clippingPlanesLength,
|
|
102
|
+
ShaderDestination.FRAGMENT
|
|
103
|
+
);
|
|
104
|
+
if (clippingPlanes.unionClippingRegions) {
|
|
105
|
+
shaderBuilder.addDefine(
|
|
106
|
+
"CLIPPING_PLANES_UNION",
|
|
107
|
+
undefined,
|
|
108
|
+
ShaderDestination.FRAGMENT
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
shaderBuilder.addFragmentLines([IntersectClippingPlanes]);
|
|
112
|
+
}
|
|
113
|
+
if (primitive._depthTest) {
|
|
114
|
+
shaderBuilder.addDefine(
|
|
115
|
+
"DEPTH_TEST",
|
|
116
|
+
undefined,
|
|
117
|
+
ShaderDestination.FRAGMENT
|
|
118
|
+
);
|
|
119
|
+
shaderBuilder.addFragmentLines([IntersectDepth]);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const shapeType = primitive._provider.shape;
|
|
123
|
+
if (shapeType === "BOX") {
|
|
124
|
+
shaderBuilder.addFragmentLines([
|
|
125
|
+
IntersectBox,
|
|
126
|
+
Intersection,
|
|
127
|
+
convertUvToBox,
|
|
128
|
+
]);
|
|
129
|
+
} else if (shapeType === "CYLINDER") {
|
|
130
|
+
shaderBuilder.addFragmentLines([
|
|
131
|
+
IntersectCylinder,
|
|
132
|
+
Intersection,
|
|
133
|
+
convertUvToCylinder,
|
|
134
|
+
]);
|
|
135
|
+
} else if (shapeType === "ELLIPSOID") {
|
|
136
|
+
shaderBuilder.addFragmentLines([
|
|
137
|
+
IntersectEllipsoid,
|
|
138
|
+
Intersection,
|
|
139
|
+
convertUvToEllipsoid,
|
|
140
|
+
]);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
shaderBuilder.addFragmentLines([Octree, Megatexture, VoxelFS]);
|
|
144
|
+
|
|
145
|
+
const shape = primitive._shape;
|
|
146
|
+
const shapeDefines = shape.shaderDefines;
|
|
147
|
+
for (const key in shapeDefines) {
|
|
148
|
+
if (shapeDefines.hasOwnProperty(key)) {
|
|
149
|
+
let value = shapeDefines[key];
|
|
150
|
+
// if value is undefined, don't define it
|
|
151
|
+
// if value is true, define it to nothing
|
|
152
|
+
if (defined(value)) {
|
|
153
|
+
value = value === true ? undefined : value;
|
|
154
|
+
shaderBuilder.addDefine(key, value, ShaderDestination.FRAGMENT);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Count how many intersections the shader will do.
|
|
160
|
+
let intersectionCount = shape.shaderMaximumIntersectionsLength;
|
|
161
|
+
if (clippingPlanesLength > 0) {
|
|
162
|
+
shaderBuilder.addDefine(
|
|
163
|
+
"CLIPPING_PLANES_INTERSECTION_INDEX",
|
|
164
|
+
intersectionCount,
|
|
165
|
+
ShaderDestination.FRAGMENT
|
|
166
|
+
);
|
|
167
|
+
if (clippingPlanesLength === 1) {
|
|
168
|
+
intersectionCount += 1;
|
|
169
|
+
} else if (clippingPlanes.unionClippingRegions) {
|
|
170
|
+
intersectionCount += 2;
|
|
171
|
+
} else {
|
|
172
|
+
intersectionCount += 1;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (primitive._depthTest) {
|
|
176
|
+
shaderBuilder.addDefine(
|
|
177
|
+
"DEPTH_INTERSECTION_INDEX",
|
|
178
|
+
intersectionCount,
|
|
179
|
+
ShaderDestination.FRAGMENT
|
|
180
|
+
);
|
|
181
|
+
intersectionCount += 1;
|
|
182
|
+
}
|
|
183
|
+
shaderBuilder.addDefine(
|
|
184
|
+
"INTERSECTION_COUNT",
|
|
185
|
+
intersectionCount,
|
|
186
|
+
ShaderDestination.FRAGMENT
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
// Additional fragment shader defines
|
|
190
|
+
if (
|
|
191
|
+
!Cartesian3.equals(primitive.paddingBefore, Cartesian3.ZERO) ||
|
|
192
|
+
!Cartesian3.equals(primitive.paddingAfter, Cartesian3.ZERO)
|
|
193
|
+
) {
|
|
194
|
+
shaderBuilder.addDefine("PADDING", undefined, ShaderDestination.FRAGMENT);
|
|
195
|
+
}
|
|
196
|
+
// Allow reading from log depth texture, but don't write log depth anywhere.
|
|
197
|
+
// Note: This needs to be set even if depthTest is off because it affects the
|
|
198
|
+
// derived command system.
|
|
199
|
+
if (primitive._useLogDepth) {
|
|
200
|
+
shaderBuilder.addDefine(
|
|
201
|
+
"LOG_DEPTH_READ_ONLY",
|
|
202
|
+
undefined,
|
|
203
|
+
ShaderDestination.FRAGMENT
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
if (primitive._jitter) {
|
|
207
|
+
shaderBuilder.addDefine("JITTER", undefined, ShaderDestination.FRAGMENT);
|
|
208
|
+
}
|
|
209
|
+
if (primitive._nearestSampling) {
|
|
210
|
+
shaderBuilder.addDefine(
|
|
211
|
+
"NEAREST_SAMPLING",
|
|
212
|
+
undefined,
|
|
213
|
+
ShaderDestination.FRAGMENT
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
const traversal = primitive._traversal;
|
|
217
|
+
shaderBuilder.addDefine(
|
|
218
|
+
"SAMPLE_COUNT",
|
|
219
|
+
`${traversal._sampleCount}`,
|
|
220
|
+
ShaderDestination.FRAGMENT
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export default VoxelRenderResources;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import DeveloperError from "../Core/DeveloperError.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Controls per-shape behavior for culling and rendering voxel grids.
|
|
5
|
+
* This type describes an interface and is not intended to be instantiated directly.
|
|
6
|
+
*
|
|
7
|
+
* @alias VoxelShape
|
|
8
|
+
* @constructor
|
|
9
|
+
*
|
|
10
|
+
* @see VoxelBoxShape
|
|
11
|
+
* @see VoxelEllipsoidShape
|
|
12
|
+
* @see VoxelCylinderShape
|
|
13
|
+
* @see VoxelShapeType
|
|
14
|
+
*
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
function VoxelShape() {
|
|
18
|
+
DeveloperError.throwInstantiationError();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
Object.defineProperties(VoxelShape.prototype, {
|
|
22
|
+
/**
|
|
23
|
+
* An oriented bounding box containing the bounded shape.
|
|
24
|
+
* The update function must be called before accessing this value.
|
|
25
|
+
*
|
|
26
|
+
* @memberof VoxelShape.prototype
|
|
27
|
+
* @type {OrientedBoundingBox}
|
|
28
|
+
* @readonly
|
|
29
|
+
*/
|
|
30
|
+
orientedBoundingBox: {
|
|
31
|
+
get: DeveloperError.throwInstantiationError,
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A bounding sphere containing the bounded shape.
|
|
36
|
+
* The update function must be called before accessing this value.
|
|
37
|
+
*
|
|
38
|
+
* @memberof VoxelShape.prototype
|
|
39
|
+
* @type {BoundingSphere}
|
|
40
|
+
* @readonly
|
|
41
|
+
*/
|
|
42
|
+
boundingSphere: {
|
|
43
|
+
get: DeveloperError.throwInstantiationError,
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A transformation matrix containing the bounded shape.
|
|
48
|
+
* The update function must be called before accessing this value.
|
|
49
|
+
*
|
|
50
|
+
* @memberof VoxelShape.prototype
|
|
51
|
+
* @type {Matrix4}
|
|
52
|
+
* @readonly
|
|
53
|
+
*/
|
|
54
|
+
boundTransform: {
|
|
55
|
+
get: DeveloperError.throwInstantiationError,
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A transformation matrix containing the shape, ignoring the bounds.
|
|
60
|
+
* The update function must be called before accessing this value.
|
|
61
|
+
*
|
|
62
|
+
* @memberof VoxelShape.prototype
|
|
63
|
+
* @type {Matrix4}
|
|
64
|
+
* @readonly
|
|
65
|
+
*/
|
|
66
|
+
shapeTransform: {
|
|
67
|
+
get: DeveloperError.throwInstantiationError,
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @type {Object.<string, any>}
|
|
72
|
+
* @readonly
|
|
73
|
+
*/
|
|
74
|
+
shaderUniforms: {
|
|
75
|
+
get: DeveloperError.throwInstantiationError,
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @type {Object.<string, any>}
|
|
80
|
+
* @readonly
|
|
81
|
+
*/
|
|
82
|
+
shaderDefines: {
|
|
83
|
+
get: DeveloperError.throwInstantiationError,
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The maximum number of intersections against the shape for any ray direction.
|
|
88
|
+
* @type {Number}
|
|
89
|
+
* @readonly
|
|
90
|
+
*/
|
|
91
|
+
shaderMaximumIntersectionsLength: {
|
|
92
|
+
get: DeveloperError.throwInstantiationError,
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Update the shape's state.
|
|
98
|
+
*
|
|
99
|
+
* @param {Matrix4} modelMatrix The model matrix.
|
|
100
|
+
* @param {Cartesian3} minBounds The minimum bounds.
|
|
101
|
+
* @param {Cartesian3} maxBounds The maximum bounds.
|
|
102
|
+
* @returns {Boolean} Whether the shape is visible.
|
|
103
|
+
*/
|
|
104
|
+
VoxelShape.prototype.update = DeveloperError.throwInstantiationError;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Computes an oriented bounding box for a specified tile.
|
|
108
|
+
* The update function must be called before calling this function.
|
|
109
|
+
*
|
|
110
|
+
* @param {Number} tileLevel The tile's level.
|
|
111
|
+
* @param {Number} tileX The tile's x coordinate.
|
|
112
|
+
* @param {Number} tileY The tile's y coordinate.
|
|
113
|
+
* @param {Number} tileZ The tile's z coordinate.
|
|
114
|
+
* @param {OrientedBoundingBox} result The oriented bounding box that will be set to enclose the specified tile.
|
|
115
|
+
* @returns {OrientedBoundingBox} The oriented bounding box.
|
|
116
|
+
*/
|
|
117
|
+
VoxelShape.prototype.computeOrientedBoundingBoxForTile =
|
|
118
|
+
DeveloperError.throwInstantiationError;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Computes an approximate step size for raymarching the root tile of a voxel grid.
|
|
122
|
+
* The update function must be called before calling this function.
|
|
123
|
+
*
|
|
124
|
+
* @param {Cartesian3} voxelDimensions The voxel grid dimensions for a tile.
|
|
125
|
+
* @returns {Number} The step size.
|
|
126
|
+
*/
|
|
127
|
+
VoxelShape.prototype.computeApproximateStepSize =
|
|
128
|
+
DeveloperError.throwInstantiationError;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Defines the minimum bounds of the shape. The meaning can vary per-shape.
|
|
132
|
+
*
|
|
133
|
+
* @type {Cartesian3}
|
|
134
|
+
* @constant
|
|
135
|
+
* @readonly
|
|
136
|
+
*
|
|
137
|
+
* @private
|
|
138
|
+
*/
|
|
139
|
+
VoxelShape.DefaultMinBounds = DeveloperError.throwInstantiationError;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Defines the maximum bounds of the shape. The meaning can vary per-shape.
|
|
143
|
+
*
|
|
144
|
+
* @type {Cartesian3}
|
|
145
|
+
* @constant
|
|
146
|
+
* @readonly
|
|
147
|
+
*
|
|
148
|
+
* @private
|
|
149
|
+
*/
|
|
150
|
+
VoxelShape.DefaultMaxBounds = DeveloperError.throwInstantiationError;
|
|
151
|
+
|
|
152
|
+
export default VoxelShape;
|