@cesium/engine 17.0.0 → 18.0.1-splats.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 +1 -1
- package/Build/Workers/{chunk-UC7KH56Y.js → chunk-2AXKROJA.js} +5 -5
- package/Build/Workers/{chunk-IKDQX7DY.js → chunk-2J5ZZ7CY.js} +4 -4
- package/Build/Workers/{chunk-4TIR5UPL.js → chunk-2SYY3UBI.js} +1 -1
- package/Build/Workers/{chunk-CC2WKHIW.js → chunk-2WKW3BEB.js} +6 -6
- package/Build/Workers/{chunk-CBFJVM6I.js → chunk-2ZO6BCHN.js} +11 -11
- package/Build/Workers/{chunk-7PHT4JHA.js → chunk-3UKG5X7F.js} +12 -12
- package/Build/Workers/{chunk-PM4Q36WX.js → chunk-4GYIDPXP.js} +9 -9
- package/Build/Workers/{chunk-QUFN3GEO.js → chunk-6EP7ED36.js} +3 -3
- package/Build/Workers/{chunk-QJTIOB2Z.js → chunk-6QOBORNG.js} +6 -6
- package/Build/Workers/{chunk-YE6MDFDA.js → chunk-6WWHK2ER.js} +14 -14
- package/Build/Workers/{chunk-RX65FA7X.js → chunk-6Y6TVYHS.js} +7 -7
- package/Build/Workers/{chunk-P2N5IDWU.js → chunk-744VWE2U.js} +13 -13
- package/Build/Workers/{chunk-LVGYWPEX.js → chunk-7PQ52XCW.js} +4 -4
- package/Build/Workers/{chunk-PS3OKVOQ.js → chunk-A5UFJW2M.js} +12 -12
- package/Build/Workers/{chunk-CAKU6ZPR.js → chunk-AQKVFTWV.js} +8 -8
- package/Build/Workers/{chunk-236N6BJN.js → chunk-BKTEHJFD.js} +2 -2
- package/Build/Workers/{chunk-5PC577K7.js → chunk-CQXYKPAW.js} +16 -16
- package/Build/Workers/{chunk-DRMXU674.js → chunk-DI7PHKC6.js} +5 -5
- package/Build/Workers/{chunk-CQMXZF4A.js → chunk-DKKIQS6F.js} +6 -6
- package/Build/Workers/{chunk-J2HTPGC7.js → chunk-DTVWE5YL.js} +2 -2
- package/Build/Workers/{chunk-SSLK4U3V.js → chunk-ERPS2WZC.js} +4 -4
- package/Build/Workers/chunk-EYMZ5FSQ.js +280 -0
- package/Build/Workers/{chunk-LPGOAMYH.js → chunk-F43TQW5B.js} +2 -2
- package/Build/Workers/{chunk-5RPUEFSA.js → chunk-FOMRN6II.js} +6 -6
- package/Build/Workers/{chunk-2BJXFXD7.js → chunk-FOTXJYKS.js} +4 -4
- package/Build/Workers/{chunk-VXAKU6EV.js → chunk-G2Y7EA4W.js} +5 -5
- package/Build/Workers/{chunk-KE45DUDH.js → chunk-GY4E4ZP6.js} +10 -10
- package/Build/Workers/{chunk-NZSBSY5K.js → chunk-HDG3VHYL.js} +2 -2
- package/Build/Workers/{chunk-WP3IJYLC.js → chunk-HOEUXPBL.js} +9 -9
- package/Build/Workers/{chunk-5YEFZMMM.js → chunk-IWDYVJ56.js} +12 -12
- package/Build/Workers/{chunk-SQKTLDSD.js → chunk-JA4KPQJL.js} +12 -12
- package/Build/Workers/{chunk-MAIKDIBS.js → chunk-JZZQEZMA.js} +6 -6
- package/Build/Workers/{chunk-77MDEA47.js → chunk-KPLU3WDY.js} +5 -5
- package/Build/Workers/{chunk-E7SMO47Q.js → chunk-LHM6V4D6.js} +5 -5
- package/Build/Workers/{chunk-HBNWBMAM.js → chunk-LMTGCD6P.js} +1 -1
- package/Build/Workers/{chunk-XYGBWBD5.js → chunk-LWZOYSSF.js} +1 -1
- package/Build/Workers/{chunk-OBHLT34A.js → chunk-M6U7SV4T.js} +7 -7
- package/Build/Workers/{chunk-MS5NWDHH.js → chunk-O25M56DO.js} +2 -2
- package/Build/Workers/{chunk-UX5JWAC7.js → chunk-OE2WXO2Z.js} +10 -10
- package/Build/Workers/{chunk-C5DCX2YQ.js → chunk-PFD462OE.js} +6 -6
- package/Build/Workers/{chunk-37PA7GZW.js → chunk-PPI33PXH.js} +7 -7
- package/Build/Workers/{chunk-4BGKMM7J.js → chunk-PRQQHLUB.js} +1 -1
- package/Build/Workers/{chunk-IFIS4CVK.js → chunk-RTUZ7MJB.js} +2 -2
- package/Build/Workers/{chunk-G6JUXZUO.js → chunk-S6QBTP5U.js} +4 -4
- package/Build/Workers/{chunk-UFV3YUIN.js → chunk-SMFCIGM3.js} +5 -5
- package/Build/Workers/{chunk-P57PR3WM.js → chunk-TC3LEKFJ.js} +5 -5
- package/Build/Workers/{chunk-7IIMO7ZZ.js → chunk-UTLYCPFY.js} +16 -16
- package/Build/Workers/{chunk-HGEGZ67N.js → chunk-V7LEBY53.js} +6 -6
- package/Build/Workers/{chunk-GO3RZX2R.js → chunk-VE3UKRDB.js} +9 -9
- package/Build/Workers/{chunk-ZTBZMRQT.js → chunk-W3FBD4FE.js} +8 -8
- package/Build/Workers/{chunk-K5JTWJPE.js → chunk-YRR6CJGG.js} +4 -4
- package/Build/Workers/{chunk-UZ6KXWCA.js → chunk-ZVTKMLU6.js} +4 -4
- package/Build/Workers/combineGeometry.js +21 -21
- package/Build/Workers/createBoxGeometry.js +15 -15
- package/Build/Workers/createBoxOutlineGeometry.js +13 -13
- package/Build/Workers/createCircleGeometry.js +23 -23
- package/Build/Workers/createCircleOutlineGeometry.js +16 -16
- package/Build/Workers/createCoplanarPolygonGeometry.js +30 -30
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +28 -28
- package/Build/Workers/createCorridorGeometry.js +26 -26
- package/Build/Workers/createCorridorOutlineGeometry.js +25 -25
- package/Build/Workers/createCylinderGeometry.js +17 -17
- package/Build/Workers/createCylinderOutlineGeometry.js +15 -15
- package/Build/Workers/createEllipseGeometry.js +23 -23
- package/Build/Workers/createEllipseOutlineGeometry.js +16 -16
- package/Build/Workers/createEllipsoidGeometry.js +16 -16
- package/Build/Workers/createEllipsoidOutlineGeometry.js +15 -15
- package/Build/Workers/createFrustumGeometry.js +15 -15
- package/Build/Workers/createFrustumOutlineGeometry.js +15 -15
- package/Build/Workers/createGeometry.js +23 -21
- package/Build/Workers/createGroundPolylineGeometry.js +19 -19
- package/Build/Workers/createPlaneGeometry.js +13 -13
- package/Build/Workers/createPlaneOutlineGeometry.js +12 -12
- package/Build/Workers/createPolygonGeometry.js +29 -29
- package/Build/Workers/createPolygonOutlineGeometry.js +27 -27
- package/Build/Workers/createPolylineGeometry.js +22 -22
- package/Build/Workers/createPolylineVolumeGeometry.js +28 -28
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +24 -24
- package/Build/Workers/createRectangleGeometry.js +24 -24
- package/Build/Workers/createRectangleOutlineGeometry.js +17 -17
- package/Build/Workers/createSimplePolylineGeometry.js +20 -20
- package/Build/Workers/createSphereGeometry.js +16 -16
- package/Build/Workers/createSphereOutlineGeometry.js +15 -15
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +12 -12
- package/Build/Workers/createVectorTileGeometries.js +21 -21
- package/Build/Workers/createVectorTilePoints.js +11 -11
- package/Build/Workers/createVectorTilePolygons.js +19 -19
- package/Build/Workers/createVectorTilePolylines.js +12 -12
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +19 -19
- package/Build/Workers/createVerticesFromHeightmap.js +19 -19
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +16 -16
- package/Build/Workers/createWallGeometry.js +21 -21
- package/Build/Workers/createWallOutlineGeometry.js +20 -20
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +9 -9
- package/Build/Workers/gaussianSplatSorter.js +62 -0
- package/Build/Workers/gaussianSplatTextureGenerator.js +68 -0
- package/Build/Workers/transcodeKTX2.js +78 -7
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +19 -19
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/PixelFormat.js +98 -0
- package/Source/Renderer/Context.js +2 -0
- package/Source/Renderer/Pass.js +3 -2
- package/Source/Renderer/Texture.js +1 -0
- package/Source/Renderer/Texture3D.js +568 -0
- package/Source/Renderer/VertexArray.js +33 -8
- package/Source/Renderer/createUniform.js +3 -0
- package/Source/Renderer/createUniformArray.js +1 -0
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Cesium3DTileContentFactory.js +23 -0
- package/Source/Scene/Cesium3DTileset.js +197 -2
- package/Source/Scene/GaussianSplat3DTileContent.js +504 -0
- package/Source/Scene/GaussianSplatPrimitive.js +932 -0
- package/Source/Scene/GaussianSplatRenderResources.js +81 -0
- package/Source/Scene/GaussianSplatSorter.js +73 -0
- package/Source/Scene/GaussianSplatTextureGenerator.js +64 -0
- package/Source/Scene/GlobeSurfaceShaderSet.js +4 -5
- package/Source/Scene/GltfLoader.js +82 -4
- package/Source/Scene/GltfSpzLoader.js +222 -0
- package/Source/Scene/GltfVertexBufferLoader.js +98 -3
- package/Source/Scene/ImageryLayer.js +19 -4
- package/Source/Scene/ImageryLayerCollection.js +3 -2
- package/Source/Scene/Model/CartesianRectangle.js +108 -0
- package/Source/Scene/Model/ImageryConfiguration.js +25 -0
- package/Source/Scene/Model/ImageryCoverage.js +488 -0
- package/Source/Scene/Model/ImageryFlags.js +31 -0
- package/Source/Scene/Model/ImageryInput.js +60 -0
- package/Source/Scene/Model/ImageryPipelineStage.js +1040 -0
- package/Source/Scene/Model/MappedPositions.js +84 -0
- package/Source/Scene/Model/Model.js +38 -0
- package/Source/Scene/Model/ModelImagery.js +403 -0
- package/Source/Scene/Model/ModelImageryMapping.js +489 -0
- package/Source/Scene/Model/ModelPrimitiveImagery.js +972 -0
- package/Source/Scene/Model/ModelReader.js +810 -0
- package/Source/Scene/Model/ModelRenderResources.js +13 -0
- package/Source/Scene/Model/ModelRuntimePrimitive.js +20 -0
- package/Source/Scene/Model/ModelSceneGraph.js +133 -27
- package/Source/Scene/Model/ModelUtility.js +2 -0
- package/Source/Scene/Model/NodeRenderResources.js +10 -0
- package/Source/Scene/ModelComponents.js +10 -0
- package/Source/Scene/PrimitiveLoadPlan.js +59 -0
- package/Source/Scene/ResourceCache.js +60 -3
- package/Source/Scene/ResourceCacheKey.js +39 -1
- package/Source/Scene/Scene.js +32 -1
- package/Source/Scene/VertexAttributeSemantic.js +30 -0
- package/Source/Scene/VoxelPrimitive.js +22 -37
- package/Source/Scene/VoxelRenderResources.js +1 -1
- package/Source/Scene/processVoxelProperties.js +41 -100
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.js +11 -0
- package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
- package/Source/Shaders/Builtin/CzmBuiltins.js +2 -0
- package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.glsl +0 -1
- package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js +0 -1
- package/Source/Shaders/GlobeFS.glsl +22 -0
- package/Source/Shaders/GlobeFS.js +22 -0
- package/Source/Shaders/Model/MaterialStageFS.glsl +4 -0
- package/Source/Shaders/Model/MaterialStageFS.js +4 -0
- package/Source/Shaders/Model/ModelFS.glsl +3 -1
- package/Source/Shaders/Model/ModelFS.js +3 -1
- package/Source/Shaders/Model/ModelVS.glsl +5 -1
- package/Source/Shaders/Model/ModelVS.js +5 -1
- package/Source/Shaders/Model/PointCloudStylingStageVS.glsl +1 -1
- package/Source/Shaders/Model/PointCloudStylingStageVS.js +2 -1
- package/Source/Shaders/PrimitiveGaussianSplatFS.glsl +18 -0
- package/Source/Shaders/PrimitiveGaussianSplatFS.js +20 -0
- package/Source/Shaders/PrimitiveGaussianSplatVS.glsl +108 -0
- package/Source/Shaders/PrimitiveGaussianSplatVS.js +109 -0
- package/Source/Shaders/Voxels/IntersectDepth.glsl +10 -3
- package/Source/Shaders/Voxels/IntersectDepth.js +10 -3
- package/Source/Shaders/Voxels/Intersection.glsl +1 -3
- package/Source/Shaders/Voxels/Intersection.js +1 -3
- package/Source/Shaders/Voxels/IntersectionUtils.glsl +1 -0
- package/Source/Shaders/Voxels/IntersectionUtils.js +1 -0
- package/Source/Shaders/Voxels/VoxelFS.glsl +37 -24
- package/Source/Shaders/Voxels/VoxelFS.js +37 -24
- package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
- package/Source/ThirdParty/wasm_splats_bg.wasm +0 -0
- package/Source/Workers/gaussianSplatSorter.js +34 -0
- package/Source/Workers/gaussianSplatTextureGenerator.js +39 -0
- package/index.d.ts +66 -2
- package/index.js +101 -80
- package/package.json +6 -4
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
import Cartesian3 from "../Core/Cartesian3.js";
|
|
2
|
+
import Check from "../Core/Check.js";
|
|
3
|
+
import createGuid from "../Core/createGuid.js";
|
|
4
|
+
import Frozen from "../Core/Frozen.js";
|
|
5
|
+
import defined from "../Core/defined.js";
|
|
6
|
+
import destroyObject from "../Core/destroyObject.js";
|
|
7
|
+
import DeveloperError from "../Core/DeveloperError.js";
|
|
8
|
+
import PixelFormat from "../Core/PixelFormat.js";
|
|
9
|
+
import ContextLimits from "./ContextLimits.js";
|
|
10
|
+
import MipmapHint from "./MipmapHint.js";
|
|
11
|
+
import PixelDatatype from "./PixelDatatype.js";
|
|
12
|
+
import Sampler from "./Sampler.js";
|
|
13
|
+
import TextureMagnificationFilter from "./TextureMagnificationFilter.js";
|
|
14
|
+
import TextureMinificationFilter from "./TextureMinificationFilter.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {object} Texture3D.ConstructorOptions
|
|
18
|
+
*
|
|
19
|
+
* @property {Context} context
|
|
20
|
+
* @property {object} [source] The source for texel values to be loaded into the texture3D.
|
|
21
|
+
* @property {PixelFormat} [pixelFormat=PixelFormat.RGBA] The format of each pixel, i.e., the number of components it has and what they represent.
|
|
22
|
+
* @property {PixelDatatype} [pixelDatatype=PixelDatatype.UNSIGNED_BYTE] The data type of each pixel.
|
|
23
|
+
* @property {boolean} [flipY=true] If true, the source values will be read as if the y-axis is inverted (y=0 at the top).
|
|
24
|
+
* @property {boolean} [skipColorSpaceConversion=false] If true, color space conversions will be skipped when reading the texel values.
|
|
25
|
+
* @property {Sampler} [sampler] Information about how to sample the texture3D.
|
|
26
|
+
* @property {number} [width] The pixel width of the texture3D. If not supplied, must be available from the source.
|
|
27
|
+
* @property {number} [height] The pixel height of the texture3D. If not supplied, must be available from the source.
|
|
28
|
+
* @property {number} [depth] The pixel depth of the texture3D. If not supplied, must be available from the source.
|
|
29
|
+
* @property {boolean} [preMultiplyAlpha] If true, the alpha channel will be multiplied into the other channels.
|
|
30
|
+
* @property {string} [id] A unique identifier for the texture3D. If this is not given, then a GUID will be created.
|
|
31
|
+
*
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A wrapper for a {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLTexture|WebGLTexture}
|
|
37
|
+
* to abstract away the verbose GL calls associated with setting up a texture3D.
|
|
38
|
+
*
|
|
39
|
+
* @alias Texture3D
|
|
40
|
+
* @constructor
|
|
41
|
+
*
|
|
42
|
+
* @param {Texture3D.ConstructorOptions} options
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
function Texture3D(options) {
|
|
46
|
+
options = options ?? Frozen.EMPTY_OBJECT;
|
|
47
|
+
|
|
48
|
+
//>>includeStart('debug', pragmas.debug);
|
|
49
|
+
Check.defined("options.context", options.context);
|
|
50
|
+
//>>includeEnd('debug');
|
|
51
|
+
|
|
52
|
+
const {
|
|
53
|
+
context,
|
|
54
|
+
source,
|
|
55
|
+
pixelFormat = PixelFormat.RGBA,
|
|
56
|
+
pixelDatatype = PixelDatatype.UNSIGNED_BYTE,
|
|
57
|
+
flipY = true,
|
|
58
|
+
skipColorSpaceConversion = false,
|
|
59
|
+
sampler = new Sampler(),
|
|
60
|
+
} = options;
|
|
61
|
+
|
|
62
|
+
if (!context.webgl2) {
|
|
63
|
+
throw new DeveloperError(
|
|
64
|
+
"WebGL1 does not support texture3D. Please use a WebGL2 context.",
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
let { width, height, depth } = options;
|
|
69
|
+
if (defined(source)) {
|
|
70
|
+
// Make sure we are using the element's intrinsic width and height where available
|
|
71
|
+
if (!defined(width)) {
|
|
72
|
+
width = source.width;
|
|
73
|
+
}
|
|
74
|
+
if (!defined(height)) {
|
|
75
|
+
height = source.height;
|
|
76
|
+
}
|
|
77
|
+
// depth is not used for 2D textures, but is required for 3D textures
|
|
78
|
+
if (!defined(depth)) {
|
|
79
|
+
depth = source.depth;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Use premultiplied alpha for opaque textures should perform better on Chrome:
|
|
84
|
+
// http://media.tojicode.com/webglCamp4/#20
|
|
85
|
+
const preMultiplyAlpha =
|
|
86
|
+
options.preMultiplyAlpha ||
|
|
87
|
+
pixelFormat === PixelFormat.RGB ||
|
|
88
|
+
pixelFormat === PixelFormat.LUMINANCE;
|
|
89
|
+
|
|
90
|
+
const internalFormat = PixelFormat.toInternalFormat(
|
|
91
|
+
pixelFormat,
|
|
92
|
+
pixelDatatype,
|
|
93
|
+
context,
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const isCompressed = PixelFormat.isCompressedFormat(internalFormat);
|
|
97
|
+
|
|
98
|
+
//>>includeStart('debug', pragmas.debug);
|
|
99
|
+
if (!defined(width) || !defined(height) || !defined(depth)) {
|
|
100
|
+
throw new DeveloperError(
|
|
101
|
+
"options requires a source field to create an initialized texture3D or width, height and depth fields to create a blank texture3D.",
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
Check.typeOf.number.greaterThan("width", width, 0);
|
|
106
|
+
|
|
107
|
+
if (width > ContextLimits.maximumTextureSize) {
|
|
108
|
+
throw new DeveloperError(
|
|
109
|
+
`Width must be less than or equal to the maximum texture3D size (${ContextLimits.maximumTextureSize}). Check maximumTextureSize.`,
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
Check.typeOf.number.greaterThan("height", height, 0);
|
|
114
|
+
|
|
115
|
+
if (height > ContextLimits.maximumTextureSize) {
|
|
116
|
+
throw new DeveloperError(
|
|
117
|
+
`Height must be less than or equal to the maximum texture3D size (${ContextLimits.maximumTextureSize}). Check maximumTextureSize.`,
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
Check.typeOf.number.greaterThan("depth", depth, 0);
|
|
122
|
+
|
|
123
|
+
if (depth > ContextLimits.maximumTextureSize) {
|
|
124
|
+
throw new DeveloperError(
|
|
125
|
+
`Depth must be less than or equal to the maximum texture3D size (${ContextLimits.maximumTextureSize}). Check maximumTextureSize.`,
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (!PixelFormat.validate(pixelFormat)) {
|
|
130
|
+
throw new DeveloperError("Invalid options.pixelFormat.");
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (!isCompressed && !PixelDatatype.validate(pixelDatatype)) {
|
|
134
|
+
throw new DeveloperError("Invalid options.pixelDatatype.");
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (
|
|
138
|
+
pixelFormat === PixelFormat.DEPTH_COMPONENT &&
|
|
139
|
+
pixelDatatype !== PixelDatatype.UNSIGNED_SHORT &&
|
|
140
|
+
pixelDatatype !== PixelDatatype.UNSIGNED_INT
|
|
141
|
+
) {
|
|
142
|
+
throw new DeveloperError(
|
|
143
|
+
"When options.pixelFormat is DEPTH_COMPONENT, options.pixelDatatype must be UNSIGNED_SHORT or UNSIGNED_INT.",
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (
|
|
148
|
+
pixelFormat === PixelFormat.DEPTH_STENCIL &&
|
|
149
|
+
pixelDatatype !== PixelDatatype.UNSIGNED_INT_24_8
|
|
150
|
+
) {
|
|
151
|
+
throw new DeveloperError(
|
|
152
|
+
"When options.pixelFormat is DEPTH_STENCIL, options.pixelDatatype must be UNSIGNED_INT_24_8.",
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (pixelDatatype === PixelDatatype.FLOAT && !context.floatingPointTexture) {
|
|
157
|
+
throw new DeveloperError(
|
|
158
|
+
"When options.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension. Check context.floatingPointTexture.",
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (
|
|
163
|
+
pixelDatatype === PixelDatatype.HALF_FLOAT &&
|
|
164
|
+
!context.halfFloatingPointTexture
|
|
165
|
+
) {
|
|
166
|
+
throw new DeveloperError(
|
|
167
|
+
"When options.pixelDatatype is HALF_FLOAT, this WebGL implementation must support the OES_texture_half_float extension. Check context.halfFloatingPointTexture.",
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (PixelFormat.isDepthFormat(pixelFormat)) {
|
|
172
|
+
if (defined(source)) {
|
|
173
|
+
throw new DeveloperError(
|
|
174
|
+
"When options.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, source cannot be provided.",
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (!context.depthTexture) {
|
|
179
|
+
throw new DeveloperError(
|
|
180
|
+
"When options.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, this WebGL implementation must support WEBGL_depth_texture. Check context.depthTexture.",
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (isCompressed) {
|
|
186
|
+
throw new DeveloperError(
|
|
187
|
+
"Texture3D does not currently support compressed formats.",
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
//>>includeEnd('debug');
|
|
191
|
+
|
|
192
|
+
const gl = context._gl;
|
|
193
|
+
|
|
194
|
+
const sizeInBytes = PixelFormat.texture3DSizeInBytes(
|
|
195
|
+
pixelFormat,
|
|
196
|
+
pixelDatatype,
|
|
197
|
+
width,
|
|
198
|
+
height,
|
|
199
|
+
depth,
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
this._id = options.id ?? createGuid();
|
|
203
|
+
this._context = context;
|
|
204
|
+
this._textureFilterAnisotropic = context._textureFilterAnisotropic;
|
|
205
|
+
this._textureTarget = gl.TEXTURE_3D;
|
|
206
|
+
this._texture = gl.createTexture();
|
|
207
|
+
this._internalFormat = internalFormat;
|
|
208
|
+
this._pixelFormat = pixelFormat;
|
|
209
|
+
this._pixelDatatype = pixelDatatype;
|
|
210
|
+
this._width = width;
|
|
211
|
+
this._height = height;
|
|
212
|
+
this._depth = depth;
|
|
213
|
+
this._dimensions = new Cartesian3(width, height, depth);
|
|
214
|
+
this._hasMipmap = false;
|
|
215
|
+
this._sizeInBytes = sizeInBytes;
|
|
216
|
+
this._preMultiplyAlpha = preMultiplyAlpha;
|
|
217
|
+
this._flipY = flipY;
|
|
218
|
+
this._initialized = false;
|
|
219
|
+
this._sampler = undefined;
|
|
220
|
+
|
|
221
|
+
this._sampler = sampler;
|
|
222
|
+
setupSampler(this, sampler);
|
|
223
|
+
|
|
224
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
225
|
+
gl.bindTexture(this._textureTarget, this._texture);
|
|
226
|
+
|
|
227
|
+
if (defined(source)) {
|
|
228
|
+
if (skipColorSpaceConversion) {
|
|
229
|
+
gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);
|
|
230
|
+
} else {
|
|
231
|
+
gl.pixelStorei(
|
|
232
|
+
gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,
|
|
233
|
+
gl.BROWSER_DEFAULT_WEBGL,
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
if (!defined(source.arrayBufferView)) {
|
|
237
|
+
throw new DeveloperError(
|
|
238
|
+
"For Texture3D, options.source.arrayBufferView must be defined",
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
loadBufferSource(this, source);
|
|
243
|
+
|
|
244
|
+
this._initialized = true;
|
|
245
|
+
} else {
|
|
246
|
+
loadNull(this);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
gl.bindTexture(this._textureTarget, null);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Load texel data from a buffer into a texture3D.
|
|
254
|
+
*
|
|
255
|
+
* @param {Texture3D} texture3D The texture3D to which texel values will be loaded.
|
|
256
|
+
* @param {object} source The source for texel values to be loaded into the texture3D.
|
|
257
|
+
*
|
|
258
|
+
* @private
|
|
259
|
+
*/
|
|
260
|
+
function loadBufferSource(texture3D, source) {
|
|
261
|
+
const context = texture3D._context;
|
|
262
|
+
const gl = context._gl;
|
|
263
|
+
const textureTarget = texture3D._textureTarget;
|
|
264
|
+
const internalFormat = texture3D._internalFormat;
|
|
265
|
+
|
|
266
|
+
const { width, height, depth, pixelFormat, pixelDatatype, flipY } = texture3D;
|
|
267
|
+
|
|
268
|
+
const unpackAlignment = PixelFormat.alignmentInBytes(
|
|
269
|
+
pixelFormat,
|
|
270
|
+
pixelDatatype,
|
|
271
|
+
width,
|
|
272
|
+
);
|
|
273
|
+
gl.pixelStorei(gl.UNPACK_ALIGNMENT, unpackAlignment);
|
|
274
|
+
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
|
|
275
|
+
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
|
276
|
+
|
|
277
|
+
const { arrayBufferView } = source;
|
|
278
|
+
if (flipY) {
|
|
279
|
+
console.warn("texture3D.flipY is not supported.");
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
let levels = 1;
|
|
283
|
+
if (source.mipLevels && source.mipLevels.length) {
|
|
284
|
+
levels = source.mipLevels.length + 1;
|
|
285
|
+
}
|
|
286
|
+
gl.texStorage3D(textureTarget, levels, internalFormat, width, height, depth);
|
|
287
|
+
|
|
288
|
+
gl.texSubImage3D(
|
|
289
|
+
textureTarget,
|
|
290
|
+
0,
|
|
291
|
+
0,
|
|
292
|
+
0,
|
|
293
|
+
0,
|
|
294
|
+
width,
|
|
295
|
+
height,
|
|
296
|
+
depth,
|
|
297
|
+
pixelFormat,
|
|
298
|
+
PixelDatatype.toWebGLConstant(pixelDatatype, context),
|
|
299
|
+
arrayBufferView,
|
|
300
|
+
);
|
|
301
|
+
|
|
302
|
+
if (levels > 1) {
|
|
303
|
+
let mipWidth = width;
|
|
304
|
+
let mipHeight = height;
|
|
305
|
+
let mipDepth = depth;
|
|
306
|
+
for (let i = 0; i < source.mipLevels.length; ++i) {
|
|
307
|
+
mipWidth = nextMipSize(mipWidth);
|
|
308
|
+
mipHeight = nextMipSize(mipHeight);
|
|
309
|
+
mipDepth = nextMipSize(mipDepth);
|
|
310
|
+
gl.texSubImage3D(
|
|
311
|
+
textureTarget,
|
|
312
|
+
i + 1,
|
|
313
|
+
0,
|
|
314
|
+
0,
|
|
315
|
+
0,
|
|
316
|
+
mipWidth,
|
|
317
|
+
mipHeight,
|
|
318
|
+
mipDepth,
|
|
319
|
+
pixelFormat,
|
|
320
|
+
PixelDatatype.toWebGLConstant(pixelDatatype, context),
|
|
321
|
+
source.mipLevels[i],
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Compute a dimension of the image for the next mip level.
|
|
329
|
+
*
|
|
330
|
+
* @param {number} currentSize The size of the current mip level.
|
|
331
|
+
* @returns {number} The size of the next mip level.
|
|
332
|
+
*
|
|
333
|
+
* @private
|
|
334
|
+
*/
|
|
335
|
+
function nextMipSize(currentSize) {
|
|
336
|
+
const nextSize = Math.floor(currentSize / 2) | 0;
|
|
337
|
+
return Math.max(nextSize, 1);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Allocate a texture3D in GPU memory, without providing any image data.
|
|
342
|
+
*
|
|
343
|
+
* @param {Texture3D} texture3D The texture3D to be initialized with null values.
|
|
344
|
+
*
|
|
345
|
+
* @private
|
|
346
|
+
*/
|
|
347
|
+
function loadNull(texture3D) {
|
|
348
|
+
const context = texture3D._context;
|
|
349
|
+
|
|
350
|
+
context._gl.texImage3D(
|
|
351
|
+
texture3D._textureTarget,
|
|
352
|
+
0,
|
|
353
|
+
texture3D._internalFormat,
|
|
354
|
+
texture3D._width,
|
|
355
|
+
texture3D._height,
|
|
356
|
+
texture3D._depth,
|
|
357
|
+
0,
|
|
358
|
+
texture3D._pixelFormat,
|
|
359
|
+
PixelDatatype.toWebGLConstant(texture3D._pixelDatatype, context),
|
|
360
|
+
null,
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* This function is identical to using the Texture3D constructor except that it can be
|
|
366
|
+
* replaced with a mock/spy in tests.
|
|
367
|
+
* @private
|
|
368
|
+
*/
|
|
369
|
+
Texture3D.create = function (options) {
|
|
370
|
+
return new Texture3D(options);
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
Object.defineProperties(Texture3D.prototype, {
|
|
374
|
+
/**
|
|
375
|
+
* A unique id for the texture3D
|
|
376
|
+
* @memberof Texture3D.prototype
|
|
377
|
+
* @type {string}
|
|
378
|
+
* @readonly
|
|
379
|
+
* @private
|
|
380
|
+
*/
|
|
381
|
+
id: {
|
|
382
|
+
get: function () {
|
|
383
|
+
return this._id;
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
/**
|
|
387
|
+
* The sampler to use when sampling this texture3D.
|
|
388
|
+
* Create a sampler by calling {@link Sampler}. If this
|
|
389
|
+
* parameter is not specified, a default sampler is used. The default sampler clamps texture3D
|
|
390
|
+
* coordinates in both directions, uses linear filtering for both magnification and minification,
|
|
391
|
+
* and uses a maximum anisotropy of 1.0.
|
|
392
|
+
* @memberof Texture3D.prototype
|
|
393
|
+
* @type {Sampler}
|
|
394
|
+
* @private
|
|
395
|
+
*/
|
|
396
|
+
sampler: {
|
|
397
|
+
get: function () {
|
|
398
|
+
return this._sampler;
|
|
399
|
+
},
|
|
400
|
+
set: function (sampler) {
|
|
401
|
+
setupSampler(this, sampler);
|
|
402
|
+
this._sampler = sampler;
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
pixelFormat: {
|
|
406
|
+
get: function () {
|
|
407
|
+
return this._pixelFormat;
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
pixelDatatype: {
|
|
411
|
+
get: function () {
|
|
412
|
+
return this._pixelDatatype;
|
|
413
|
+
},
|
|
414
|
+
},
|
|
415
|
+
dimensions: {
|
|
416
|
+
get: function () {
|
|
417
|
+
return this._dimensions;
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
preMultiplyAlpha: {
|
|
421
|
+
get: function () {
|
|
422
|
+
return this._preMultiplyAlpha;
|
|
423
|
+
},
|
|
424
|
+
},
|
|
425
|
+
flipY: {
|
|
426
|
+
get: function () {
|
|
427
|
+
return this._flipY;
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
width: {
|
|
431
|
+
get: function () {
|
|
432
|
+
return this._width;
|
|
433
|
+
},
|
|
434
|
+
},
|
|
435
|
+
height: {
|
|
436
|
+
get: function () {
|
|
437
|
+
return this._height;
|
|
438
|
+
},
|
|
439
|
+
},
|
|
440
|
+
depth: {
|
|
441
|
+
get: function () {
|
|
442
|
+
return this._depth;
|
|
443
|
+
},
|
|
444
|
+
},
|
|
445
|
+
sizeInBytes: {
|
|
446
|
+
get: function () {
|
|
447
|
+
if (this._hasMipmap) {
|
|
448
|
+
return Math.floor((this._sizeInBytes * 8) / 7);
|
|
449
|
+
}
|
|
450
|
+
return this._sizeInBytes;
|
|
451
|
+
},
|
|
452
|
+
},
|
|
453
|
+
_target: {
|
|
454
|
+
get: function () {
|
|
455
|
+
return this._textureTarget;
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Set up a sampler for use with a texture3D
|
|
462
|
+
* @param {Texture3D} texture3D The texture3D to be sampled by this sampler
|
|
463
|
+
* @param {Sampler} sampler Information about how to sample the texture3D
|
|
464
|
+
* @private
|
|
465
|
+
*/
|
|
466
|
+
function setupSampler(texture3D, sampler) {
|
|
467
|
+
let { minificationFilter, magnificationFilter } = sampler;
|
|
468
|
+
|
|
469
|
+
const mipmap = [
|
|
470
|
+
TextureMinificationFilter.NEAREST_MIPMAP_NEAREST,
|
|
471
|
+
TextureMinificationFilter.NEAREST_MIPMAP_LINEAR,
|
|
472
|
+
TextureMinificationFilter.LINEAR_MIPMAP_NEAREST,
|
|
473
|
+
TextureMinificationFilter.LINEAR_MIPMAP_LINEAR,
|
|
474
|
+
].includes(minificationFilter);
|
|
475
|
+
|
|
476
|
+
const context = texture3D._context;
|
|
477
|
+
const pixelFormat = texture3D._pixelFormat;
|
|
478
|
+
const pixelDatatype = texture3D._pixelDatatype;
|
|
479
|
+
|
|
480
|
+
// float textures only support nearest filtering unless the linear extensions are supported
|
|
481
|
+
if (
|
|
482
|
+
(pixelDatatype === PixelDatatype.FLOAT && !context.textureFloatLinear) ||
|
|
483
|
+
(pixelDatatype === PixelDatatype.HALF_FLOAT &&
|
|
484
|
+
!context.textureHalfFloatLinear)
|
|
485
|
+
) {
|
|
486
|
+
// override the sampler's settings
|
|
487
|
+
minificationFilter = mipmap
|
|
488
|
+
? TextureMinificationFilter.NEAREST_MIPMAP_NEAREST
|
|
489
|
+
: TextureMinificationFilter.NEAREST;
|
|
490
|
+
magnificationFilter = TextureMagnificationFilter.NEAREST;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// WebGL 2 depth texture3D only support nearest filtering. See section 3.8.13 OpenGL ES 3 spec
|
|
494
|
+
if (PixelFormat.isDepthFormat(pixelFormat)) {
|
|
495
|
+
minificationFilter = TextureMinificationFilter.NEAREST;
|
|
496
|
+
magnificationFilter = TextureMagnificationFilter.NEAREST;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
const gl = context._gl;
|
|
500
|
+
const target = texture3D._textureTarget;
|
|
501
|
+
|
|
502
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
503
|
+
gl.bindTexture(target, texture3D._texture);
|
|
504
|
+
gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, minificationFilter);
|
|
505
|
+
gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, magnificationFilter);
|
|
506
|
+
gl.texParameteri(target, gl.TEXTURE_WRAP_S, sampler.wrapS);
|
|
507
|
+
gl.texParameteri(target, gl.TEXTURE_WRAP_T, sampler.wrapT);
|
|
508
|
+
if (defined(texture3D._textureFilterAnisotropic)) {
|
|
509
|
+
gl.texParameteri(
|
|
510
|
+
target,
|
|
511
|
+
texture3D._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,
|
|
512
|
+
sampler.maximumAnisotropy,
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
gl.bindTexture(target, null);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* @param {MipmapHint} [hint=MipmapHint.DONT_CARE] optional.
|
|
520
|
+
* @private
|
|
521
|
+
* @exception {DeveloperError} Cannot call generateMipmap when the texture3D pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.
|
|
522
|
+
* @exception {DeveloperError} Cannot call generateMipmap when the texture3D pixel format is a compressed format.
|
|
523
|
+
* @exception {DeveloperError} hint is invalid.
|
|
524
|
+
* @exception {DeveloperError} This texture3D's width must be a power of two to call generateMipmap() in a WebGL1 context.
|
|
525
|
+
* @exception {DeveloperError} This texture3D's height must be a power of two to call generateMipmap() in a WebGL1 context.
|
|
526
|
+
* @exception {DeveloperError} This texture3D was destroyed, i.e., destroy() was called.
|
|
527
|
+
*/
|
|
528
|
+
Texture3D.prototype.generateMipmap = function (hint) {
|
|
529
|
+
hint = hint ?? MipmapHint.DONT_CARE;
|
|
530
|
+
|
|
531
|
+
//>>includeStart('debug', pragmas.debug);
|
|
532
|
+
if (PixelFormat.isDepthFormat(this._pixelFormat)) {
|
|
533
|
+
throw new DeveloperError(
|
|
534
|
+
"Cannot call generateMipmap when the texture3D pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.",
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
if (PixelFormat.isCompressedFormat(this._pixelFormat)) {
|
|
538
|
+
throw new DeveloperError(
|
|
539
|
+
"Cannot call generateMipmap with a compressed pixel format.",
|
|
540
|
+
);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
if (!MipmapHint.validate(hint)) {
|
|
544
|
+
throw new DeveloperError("hint is invalid.");
|
|
545
|
+
}
|
|
546
|
+
//>>includeEnd('debug');
|
|
547
|
+
|
|
548
|
+
this._hasMipmap = true;
|
|
549
|
+
|
|
550
|
+
const gl = this._context._gl;
|
|
551
|
+
const target = this._textureTarget;
|
|
552
|
+
|
|
553
|
+
gl.hint(gl.GENERATE_MIPMAP_HINT, hint);
|
|
554
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
555
|
+
gl.bindTexture(target, this._texture);
|
|
556
|
+
gl.generateMipmap(target);
|
|
557
|
+
gl.bindTexture(target, null);
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
Texture3D.prototype.isDestroyed = function () {
|
|
561
|
+
return false;
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
Texture3D.prototype.destroy = function () {
|
|
565
|
+
this._context._gl.deleteTexture(this._texture);
|
|
566
|
+
return destroyObject(this);
|
|
567
|
+
};
|
|
568
|
+
export default Texture3D;
|
|
@@ -11,6 +11,7 @@ import RuntimeError from "../Core/RuntimeError.js";
|
|
|
11
11
|
import Buffer from "./Buffer.js";
|
|
12
12
|
import BufferUsage from "./BufferUsage.js";
|
|
13
13
|
import ContextLimits from "./ContextLimits.js";
|
|
14
|
+
import AttributeType from "../Scene/AttributeType.js";
|
|
14
15
|
|
|
15
16
|
function addAttribute(attributes, attribute, index, context) {
|
|
16
17
|
const hasVertexBuffer = defined(attribute.vertexBuffer);
|
|
@@ -639,6 +640,7 @@ VertexArray.fromGeometry = function (options) {
|
|
|
639
640
|
componentDatatype = ComponentDatatype.FLOAT;
|
|
640
641
|
}
|
|
641
642
|
|
|
643
|
+
let attrProps = {};
|
|
642
644
|
vertexBuffer = undefined;
|
|
643
645
|
if (defined(attribute.values)) {
|
|
644
646
|
vertexBuffer = Buffer.createVertexBuffer({
|
|
@@ -649,16 +651,39 @@ VertexArray.fromGeometry = function (options) {
|
|
|
649
651
|
),
|
|
650
652
|
usage: bufferUsage,
|
|
651
653
|
});
|
|
654
|
+
|
|
655
|
+
attrProps = {
|
|
656
|
+
index: attributeLocations[name],
|
|
657
|
+
vertexBuffer: vertexBuffer,
|
|
658
|
+
value: attribute.value,
|
|
659
|
+
componentDatatype: componentDatatype,
|
|
660
|
+
componentsPerAttribute: attribute.componentsPerAttribute,
|
|
661
|
+
normalize: attribute.normalize,
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
//if we already have a typedArray lets use it
|
|
666
|
+
if (defined(attribute.typedArray)) {
|
|
667
|
+
vertexBuffer = Buffer.createVertexBuffer({
|
|
668
|
+
context: context,
|
|
669
|
+
typedArray: attribute.typedArray,
|
|
670
|
+
usage: bufferUsage,
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
attrProps = {
|
|
674
|
+
index: attributeLocations[name],
|
|
675
|
+
vertexBuffer: vertexBuffer,
|
|
676
|
+
value: undefined,
|
|
677
|
+
componentDatatype: componentDatatype,
|
|
678
|
+
componentsPerAttribute: AttributeType.getNumberOfComponents(
|
|
679
|
+
attribute.type,
|
|
680
|
+
),
|
|
681
|
+
normalize: attribute.normalized,
|
|
682
|
+
instanceDivisor: attribute.instanceDivisor,
|
|
683
|
+
};
|
|
652
684
|
}
|
|
653
685
|
|
|
654
|
-
vaAttributes.push(
|
|
655
|
-
index: attributeLocations[name],
|
|
656
|
-
vertexBuffer: vertexBuffer,
|
|
657
|
-
value: attribute.value,
|
|
658
|
-
componentDatatype: componentDatatype,
|
|
659
|
-
componentsPerAttribute: attribute.componentsPerAttribute,
|
|
660
|
-
normalize: attribute.normalize,
|
|
661
|
-
});
|
|
686
|
+
vaAttributes.push(attrProps);
|
|
662
687
|
}
|
|
663
688
|
}
|
|
664
689
|
}
|
|
@@ -24,8 +24,11 @@ function createUniform(gl, activeUniform, uniformName, location) {
|
|
|
24
24
|
case gl.FLOAT_VEC4:
|
|
25
25
|
return new UniformFloatVec4(gl, activeUniform, uniformName, location);
|
|
26
26
|
case gl.SAMPLER_2D:
|
|
27
|
+
case gl.SAMPLER_3D:
|
|
27
28
|
case gl.SAMPLER_CUBE:
|
|
28
29
|
return new UniformSampler(gl, activeUniform, uniformName, location);
|
|
30
|
+
case gl.UNSIGNED_INT_SAMPLER_2D:
|
|
31
|
+
return new UniformSampler(gl, activeUniform, uniformName, location);
|
|
29
32
|
case gl.INT:
|
|
30
33
|
case gl.BOOL:
|
|
31
34
|
return new UniformInt(gl, activeUniform, uniformName, location);
|
|
@@ -4,7 +4,7 @@ import Resource from "../Core/Resource.js";
|
|
|
4
4
|
|
|
5
5
|
let defaultTokenCredit;
|
|
6
6
|
const defaultAccessToken =
|
|
7
|
-
"
|
|
7
|
+
"AAPTxy8BH1VEsoebNVZXo8HurEOF051kAEKlhkOhBEc9BmTP0IZoWRBEdmOPutLUJ2JcHWgott0sjyyyJ6-Nu6O_MLmmkiswXG4qzrOMMu0N8VU2LUbsVXxF7KR041TgbHlgZPBYpt4LZXFH4jpS6NIBFm_JqZPzxLgFhbAYSs4yh_vDo1I7Qxr9dPzWiIPm5KHQ99Hs2uH4JH4356FxozccoIsuX2H4LyTBRUZ36FqFikI.AT1_FcZPNruQ";
|
|
8
8
|
/**
|
|
9
9
|
* Default options for accessing the ArcGIS image tile service.
|
|
10
10
|
*
|
|
@@ -4,6 +4,7 @@ import Implicit3DTileContent from "./Implicit3DTileContent.js";
|
|
|
4
4
|
import Model3DTileContent from "./Model/Model3DTileContent.js";
|
|
5
5
|
import Tileset3DTileContent from "./Tileset3DTileContent.js";
|
|
6
6
|
import Vector3DTileContent from "./Vector3DTileContent.js";
|
|
7
|
+
import GaussianSplat3DTileContent from "./GaussianSplat3DTileContent.js";
|
|
7
8
|
import RuntimeError from "../Core/RuntimeError.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -92,9 +93,31 @@ const Cesium3DTileContentFactory = {
|
|
|
92
93
|
const dataView = new DataView(arrayBuffer, byteOffset);
|
|
93
94
|
const byteLength = dataView.getUint32(8, true);
|
|
94
95
|
const glb = new Uint8Array(arrayBuffer, byteOffset, byteLength);
|
|
96
|
+
let hasGaussianSplatExtension = false;
|
|
97
|
+
if (tileset.isGltfExtensionRequired instanceof Function) {
|
|
98
|
+
hasGaussianSplatExtension = tileset.isGltfExtensionRequired(
|
|
99
|
+
"KHR_spz_gaussian_splats_compression",
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
if (hasGaussianSplatExtension) {
|
|
103
|
+
return GaussianSplat3DTileContent.fromGltf(tileset, tile, resource, glb);
|
|
104
|
+
}
|
|
105
|
+
|
|
95
106
|
return Model3DTileContent.fromGltf(tileset, tile, resource, glb);
|
|
96
107
|
},
|
|
97
108
|
gltf: function (tileset, tile, resource, json) {
|
|
109
|
+
const forceGaussianSplats =
|
|
110
|
+
tileset.debugTreatTilesetAsGaussianSplats ?? false;
|
|
111
|
+
let hasGaussianSplatExtension = false;
|
|
112
|
+
if (tileset.isGltfExtensionRequired instanceof Function) {
|
|
113
|
+
hasGaussianSplatExtension = tileset.isGltfExtensionRequired(
|
|
114
|
+
"KHR_spz_gaussian_splats_compression",
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
if (forceGaussianSplats || hasGaussianSplatExtension) {
|
|
118
|
+
return GaussianSplat3DTileContent.fromGltf(tileset, tile, resource, json);
|
|
119
|
+
}
|
|
120
|
+
|
|
98
121
|
return Model3DTileContent.fromGltf(tileset, tile, resource, json);
|
|
99
122
|
},
|
|
100
123
|
geoJson: function (tileset, tile, resource, json) {
|