@cesium/engine 9.0.0 → 9.2.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/pako_deflate.min.js +108 -210
- package/Build/ThirdParty/Workers/pako_inflate.min.js +466 -568
- package/Build/ThirdParty/Workers/z-worker-pako.js +56 -105
- package/Build/Workers/{chunk-VR5RBW52.js → chunk-26NE4LRW.js} +7 -7
- package/Build/Workers/{chunk-P2YAAMT2.js → chunk-26XJDV3D.js} +15 -15
- package/Build/Workers/{chunk-L4BW3RUA.js → chunk-2TRB253J.js} +7 -7
- package/Build/Workers/{chunk-NP2GYYE5.js → chunk-3PV5HQ2R.js} +6 -6
- package/Build/Workers/{chunk-BCU2LH5T.js → chunk-3VDHTBY5.js} +10 -10
- package/Build/Workers/{chunk-WHUSTDIB.js → chunk-4RG6WOXH.js} +10 -10
- package/Build/Workers/{chunk-P4XKB3QZ.js → chunk-5OK5JFDP.js} +5 -5
- package/Build/Workers/{chunk-2ZBL3MVO.js → chunk-7HLZRYGD.js} +10 -12
- package/Build/Workers/chunk-7PFZ4Z7C.js +961 -0
- package/Build/Workers/{chunk-24YTYWNB.js → chunk-A5CSB5ZE.js} +11 -13
- package/Build/Workers/{chunk-RMOEYCZW.js → chunk-AROLUUGS.js} +2 -2
- package/Build/Workers/{chunk-3NCVAGDA.js → chunk-BBBTT36L.js} +14 -14
- package/Build/Workers/{chunk-QKBGRKKG.js → chunk-BNT2SNWU.js} +4 -4
- package/Build/Workers/{chunk-LQJ5FFFR.js → chunk-CFBGPZU6.js} +11 -13
- package/Build/Workers/{chunk-C6OI26DR.js → chunk-CVCVMOQA.js} +1 -1
- package/Build/Workers/{chunk-SS4ESNE3.js → chunk-DIVFF6DK.js} +2 -2
- package/Build/Workers/{chunk-PXB7T27O.js → chunk-EJZVBTX4.js} +6 -6
- package/Build/Workers/{chunk-TZORKRNK.js → chunk-EODIOQ35.js} +1 -1
- package/Build/Workers/{chunk-QCQUZGXI.js → chunk-ETC45PHH.js} +5 -6
- package/Build/Workers/{chunk-E6WXPSJS.js → chunk-G7IAO7CW.js} +7 -7
- package/Build/Workers/{chunk-X2F6BEPY.js → chunk-GOQEANLM.js} +16 -16
- package/Build/Workers/{chunk-7COR472O.js → chunk-GUFV24F4.js} +7197 -5096
- package/Build/Workers/{chunk-5TIV3L26.js → chunk-GX2BWBN2.js} +13 -13
- package/Build/Workers/{chunk-ADOVHYWO.js → chunk-GX5LMUGZ.js} +469 -6
- package/Build/Workers/{chunk-2632RVPI.js → chunk-I6CW7ZE5.js} +7 -7
- package/Build/Workers/{chunk-YDVSBWEO.js → chunk-IF2OX6R4.js} +3 -5
- package/Build/Workers/{chunk-RSJXEO2A.js → chunk-IXYFH7DV.js} +95 -155
- package/Build/Workers/{chunk-ZNVSKMQ2.js → chunk-K5F23SZO.js} +6 -6
- package/Build/Workers/{chunk-MWV7IZK4.js → chunk-KTZK2UDR.js} +7 -7
- package/Build/Workers/{chunk-HBQPB6IH.js → chunk-LZFFO4KB.js} +12 -12
- package/Build/Workers/{chunk-GFA4SMXV.js → chunk-OYP23VAL.js} +11 -11
- package/Build/Workers/{chunk-ZYPTP7GS.js → chunk-PHT53MCH.js} +11 -11
- package/Build/Workers/{chunk-TJBU6GML.js → chunk-PUQR43HZ.js} +6 -6
- package/Build/Workers/{chunk-CO35JNNE.js → chunk-QZIWFSRM.js} +4 -4
- package/Build/Workers/{chunk-C3XBUYBO.js → chunk-RDR4KVPA.js} +17 -17
- package/Build/Workers/{chunk-YV4H2Y7M.js → chunk-RRUO4QEK.js} +4 -4
- package/Build/Workers/{chunk-LAQP3SCC.js → chunk-RTIT7UDN.js} +2 -2
- package/Build/Workers/{chunk-Z7FQLK6N.js → chunk-SC3TBKST.js} +4 -4
- package/Build/Workers/{chunk-GXUXEOE2.js → chunk-TDIGL45B.js} +1 -1
- package/Build/Workers/{chunk-EOXYZ34O.js → chunk-TP4FFUAH.js} +2 -2
- package/Build/Workers/{chunk-N4KXMWQU.js → chunk-U2LSTOMA.js} +2 -2
- package/Build/Workers/{chunk-6WF3KIF5.js → chunk-U6MTSO6A.js} +47 -84
- package/Build/Workers/{chunk-I37B3MZ2.js → chunk-UICVDDCQ.js} +1 -1
- package/Build/Workers/{chunk-DPUSFA7S.js → chunk-UKJCFXVV.js} +6 -6
- package/Build/Workers/{chunk-EPKE7GE3.js → chunk-UYKG3UFK.js} +5 -5
- package/Build/Workers/{chunk-RV7ZOSS6.js → chunk-W4OS542B.js} +13 -13
- package/Build/Workers/{chunk-DGDUKCJJ.js → chunk-WHDEZSAL.js} +6 -6
- package/Build/Workers/{chunk-NZWNZA6S.js → chunk-WOYQB5HM.js} +5 -5
- package/Build/Workers/{chunk-M2AYBTNH.js → chunk-WP3LCUOE.js} +13 -13
- package/Build/Workers/{chunk-73FKKY52.js → chunk-YGNQJ4YI.js} +5 -5
- package/Build/Workers/{chunk-SE4PXOEA.js → chunk-YGTWKLFY.js} +19 -19
- package/Build/Workers/{chunk-5R6VWLMH.js → chunk-ZHJDE6JN.js} +6 -6
- package/Build/Workers/combineGeometry.js +22 -24
- package/Build/Workers/createBoxGeometry.js +16 -18
- package/Build/Workers/createBoxOutlineGeometry.js +14 -16
- package/Build/Workers/createCircleGeometry.js +24 -26
- package/Build/Workers/createCircleOutlineGeometry.js +17 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -34
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -31
- package/Build/Workers/createCorridorGeometry.js +27 -29
- package/Build/Workers/createCorridorOutlineGeometry.js +26 -28
- package/Build/Workers/createCylinderGeometry.js +18 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +16 -18
- package/Build/Workers/createEllipseGeometry.js +24 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +17 -19
- package/Build/Workers/createEllipsoidGeometry.js +17 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -18
- package/Build/Workers/createFrustumGeometry.js +16 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -19
- package/Build/Workers/createGeometry.js +22 -24
- package/Build/Workers/createGroundPolylineGeometry.js +23 -25
- package/Build/Workers/createPlaneGeometry.js +14 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +13 -15
- package/Build/Workers/createPolygonGeometry.js +32 -34
- package/Build/Workers/createPolygonOutlineGeometry.js +28 -30
- package/Build/Workers/createPolylineGeometry.js +23 -25
- package/Build/Workers/createPolylineVolumeGeometry.js +29 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -27
- package/Build/Workers/createRectangleGeometry.js +27 -29
- package/Build/Workers/createRectangleOutlineGeometry.js +18 -20
- package/Build/Workers/createSimplePolylineGeometry.js +21 -23
- package/Build/Workers/createSphereGeometry.js +17 -19
- package/Build/Workers/createSphereOutlineGeometry.js +16 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -16
- package/Build/Workers/createVectorTileGeometries.js +22 -24
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +20 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -16
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +23 -25
- package/Build/Workers/createVerticesFromHeightmap.js +23 -25
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -22
- package/Build/Workers/createWallGeometry.js +22 -24
- package/Build/Workers/createWallOutlineGeometry.js +21 -23
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +12 -19
- package/Build/Workers/decodeI3S.js +10 -11
- package/Build/Workers/transcodeKTX2.js +44 -80
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -22
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/Math.js +0 -5
- package/Source/Core/PixelFormat.js +1 -0
- package/Source/Core/Rectangle.js +89 -0
- package/Source/Core/TaskProcessor.js +19 -3
- package/Source/Core/sampleTerrain.js +3 -3
- package/Source/DataSources/DataSourceDisplay.js +5 -0
- package/Source/Renderer/ShaderBuilder.js +6 -3
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +7 -5
- package/Source/Scene/Cesium3DTile.js +65 -0
- package/Source/Scene/Cesium3DTileset.js +48 -1
- package/Source/Scene/ClippingPolygon.js +212 -0
- package/Source/Scene/ClippingPolygonCollection.js +968 -0
- package/Source/Scene/Globe.js +14 -0
- package/Source/Scene/GlobeSurfaceShaderSet.js +81 -15
- package/Source/Scene/GlobeSurfaceTileProvider.js +81 -1
- package/Source/Scene/GltfLoader.js +458 -435
- package/Source/Scene/GltfLoaderUtil.js +3 -12
- package/Source/Scene/GltfPipeline/forEachTextureInMaterial.js +23 -7
- package/Source/Scene/GltfStructuralMetadataLoader.js +11 -9
- package/Source/Scene/Label.js +1 -1
- package/Source/Scene/Model/AlphaPipelineStage.js +1 -1
- package/Source/Scene/Model/GeometryPipelineStage.js +15 -43
- package/Source/Scene/Model/ImageBasedLightingPipelineStage.js +7 -0
- package/Source/Scene/Model/LightingPipelineStage.js +2 -4
- package/Source/Scene/Model/MaterialPipelineStage.js +346 -29
- package/Source/Scene/Model/Model.js +91 -3
- package/Source/Scene/Model/Model3DTileContent.js +21 -0
- package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +92 -0
- package/Source/Scene/Model/ModelSceneGraph.js +5 -0
- package/Source/Scene/Model/ModelUtility.js +3 -0
- package/Source/Scene/Model/VerticalExaggerationPipelineStage.js +4 -6
- package/Source/Scene/ModelComponents.js +169 -1
- package/Source/Scene/PickDepth.js +23 -15
- package/Source/Scene/ResourceCache.js +41 -50
- package/Source/Scene/ResourceCacheKey.js +41 -53
- package/Source/Scene/Terrain.js +2 -2
- package/Source/Shaders/Builtin/CzmBuiltins.js +6 -8
- package/Source/Shaders/Builtin/Functions/clipPolygons.glsl +37 -0
- package/Source/Shaders/Builtin/Functions/clipPolygons.js +39 -0
- package/Source/Shaders/Builtin/Functions/maximumComponent.glsl +21 -0
- package/Source/Shaders/Builtin/Functions/maximumComponent.js +23 -0
- package/Source/Shaders/Builtin/Functions/pbrLighting.glsl +108 -44
- package/Source/Shaders/Builtin/Functions/pbrLighting.js +108 -44
- package/Source/Shaders/Builtin/Functions/unpackClippingExtents.glsl +14 -0
- package/Source/Shaders/Builtin/Functions/unpackClippingExtents.js +15 -0
- package/Source/Shaders/Builtin/Structs/modelMaterial.glsl +14 -0
- package/Source/Shaders/Builtin/Structs/modelMaterial.js +14 -0
- package/Source/Shaders/GlobeFS.glsl +13 -1
- package/Source/Shaders/GlobeFS.js +13 -1
- package/Source/Shaders/GlobeVS.glsl +32 -0
- package/Source/Shaders/GlobeVS.js +32 -0
- package/Source/Shaders/Model/GeometryStageVS.glsl +1 -1
- package/Source/Shaders/Model/GeometryStageVS.js +1 -1
- package/Source/Shaders/Model/ImageBasedLightingStageFS.glsl +211 -133
- package/Source/Shaders/Model/ImageBasedLightingStageFS.js +212 -133
- package/Source/Shaders/Model/LightingStageFS.glsl +113 -48
- package/Source/Shaders/Model/LightingStageFS.js +113 -48
- package/Source/Shaders/Model/MaterialStageFS.glsl +399 -137
- package/Source/Shaders/Model/MaterialStageFS.js +399 -137
- package/Source/Shaders/Model/ModelClippingPolygonsStageFS.glsl +6 -0
- package/Source/Shaders/Model/ModelClippingPolygonsStageFS.js +8 -0
- package/Source/Shaders/Model/ModelClippingPolygonsStageVS.glsl +27 -0
- package/Source/Shaders/Model/ModelClippingPolygonsStageVS.js +29 -0
- package/Source/Shaders/Model/ModelFS.glsl +6 -0
- package/Source/Shaders/Model/ModelFS.js +7 -1
- package/Source/Shaders/Model/ModelVS.glsl +4 -0
- package/Source/Shaders/Model/ModelVS.js +4 -0
- package/Source/Shaders/PolygonSignedDistanceFS.glsl +100 -0
- package/Source/Shaders/PolygonSignedDistanceFS.js +101 -0
- package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
- package/index.d.ts +230 -4
- package/index.js +234 -229
- package/package.json +1 -1
- package/Build/Workers/chunk-2KACWKS4.js +0 -501
- package/Build/Workers/chunk-2XPLH3JY.js +0 -2977
- package/Build/Workers/chunk-X6XOMPWL.js +0 -73
- package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.glsl +0 -16
- package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.js +0 -18
- package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.glsl +0 -37
- package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.js +0 -39
- package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.glsl +0 -30
- package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.js +0 -32
- package/Source/Shaders/Builtin/Structs/pbrParameters.glsl +0 -16
- package/Source/Shaders/Builtin/Structs/pbrParameters.js +0 -18
|
@@ -255,6 +255,27 @@ Model3DTileContent.prototype.update = function (tileset, frameState) {
|
|
|
255
255
|
model._clippingPlanesState = 0;
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
+
// Updating clipping polygons requires more effort because of ownership checks
|
|
259
|
+
const tilesetClippingPolygons = tileset.clippingPolygons;
|
|
260
|
+
if (defined(tilesetClippingPolygons) && tile.clippingPolygonsDirty) {
|
|
261
|
+
// Dereference the clipping polygons from the model if they are irrelevant.
|
|
262
|
+
model._clippingPolygons =
|
|
263
|
+
tilesetClippingPolygons.enabled && tile._isClippedByPolygon
|
|
264
|
+
? tilesetClippingPolygons
|
|
265
|
+
: undefined;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// If the model references a different ClippingPolygonCollection from the tileset,
|
|
269
|
+
// update the model to use the new ClippingPolygonCollection.
|
|
270
|
+
if (
|
|
271
|
+
defined(tilesetClippingPolygons) &&
|
|
272
|
+
defined(model._clippingPolygons) &&
|
|
273
|
+
model._clippingPolygons !== tilesetClippingPolygons
|
|
274
|
+
) {
|
|
275
|
+
model._clippingPolygons = tilesetClippingPolygons;
|
|
276
|
+
model._clippingPolygonsState = 0;
|
|
277
|
+
}
|
|
278
|
+
|
|
258
279
|
model.update(frameState);
|
|
259
280
|
|
|
260
281
|
if (!this._ready && model.ready) {
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import combine from "../../Core/combine.js";
|
|
2
|
+
import ModelClippingPolygonsStageVS from "../../Shaders/Model/ModelClippingPolygonsStageVS.js";
|
|
3
|
+
import ModelClippingPolygonsStageFS from "../../Shaders/Model/ModelClippingPolygonsStageFS.js";
|
|
4
|
+
import ShaderDestination from "../../Renderer/ShaderDestination.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The model clipping planes stage is responsible for applying clipping planes to the model.
|
|
8
|
+
*
|
|
9
|
+
* @namespace ModelClippingPolygonsPipelineStage
|
|
10
|
+
*
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
13
|
+
const ModelClippingPolygonsPipelineStage = {
|
|
14
|
+
name: "ModelClippingPolygonsPipelineStage", // Helps with debugging
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Process a model for polygon clipping. This modifies the following parts of the render resources:
|
|
19
|
+
*
|
|
20
|
+
* <ul>
|
|
21
|
+
* <li>adds a define to both the vertex and fragment shaders to indicate that the model has clipping polygons</li>
|
|
22
|
+
* <li>adds the defines to both the vertex and fragment shaders for parameters related to clipping polygons, such as the number of polygons</li>
|
|
23
|
+
* <li>adds a function to the vertex shader to determine lookup uvs</li>
|
|
24
|
+
* <li>adds a function to the fragment shader to discard clipped regions</li>
|
|
25
|
+
* <li>adds the uniforms to the vertex and fragment shaders for the clipping extents texture and clipping distance respectively</li>
|
|
26
|
+
* <li>adds a varying for lookup uvs in the clipping texture</li>
|
|
27
|
+
*</ul>
|
|
28
|
+
*
|
|
29
|
+
* @param {ModelRenderResources} renderResources The render resources for this model.
|
|
30
|
+
* @param {Model} model The model.
|
|
31
|
+
* @param {FrameState} frameState The frameState.
|
|
32
|
+
*
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
35
|
+
ModelClippingPolygonsPipelineStage.process = function (
|
|
36
|
+
renderResources,
|
|
37
|
+
model,
|
|
38
|
+
frameState
|
|
39
|
+
) {
|
|
40
|
+
const clippingPolygons = model.clippingPolygons;
|
|
41
|
+
const shaderBuilder = renderResources.shaderBuilder;
|
|
42
|
+
|
|
43
|
+
shaderBuilder.addDefine(
|
|
44
|
+
"ENABLE_CLIPPING_POLYGONS",
|
|
45
|
+
undefined,
|
|
46
|
+
ShaderDestination.BOTH
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
if (clippingPolygons.inverse) {
|
|
50
|
+
shaderBuilder.addDefine(
|
|
51
|
+
"CLIPPING_INVERSE",
|
|
52
|
+
undefined,
|
|
53
|
+
ShaderDestination.FRAGMENT
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
shaderBuilder.addDefine(
|
|
58
|
+
"CLIPPING_POLYGON_REGIONS_LENGTH",
|
|
59
|
+
clippingPolygons.extentsCount,
|
|
60
|
+
ShaderDestination.BOTH
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
shaderBuilder.addUniform(
|
|
64
|
+
"sampler2D",
|
|
65
|
+
"model_clippingDistance",
|
|
66
|
+
ShaderDestination.FRAGMENT
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
shaderBuilder.addUniform(
|
|
70
|
+
"sampler2D",
|
|
71
|
+
"model_clippingExtents",
|
|
72
|
+
ShaderDestination.VERTEX
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
shaderBuilder.addVarying("vec2", "v_clippingPosition");
|
|
76
|
+
shaderBuilder.addVarying("int", "v_regionIndex", "flat");
|
|
77
|
+
shaderBuilder.addVertexLines(ModelClippingPolygonsStageVS);
|
|
78
|
+
shaderBuilder.addFragmentLines(ModelClippingPolygonsStageFS);
|
|
79
|
+
|
|
80
|
+
const uniformMap = {
|
|
81
|
+
model_clippingDistance: function () {
|
|
82
|
+
return clippingPolygons.clippingTexture;
|
|
83
|
+
},
|
|
84
|
+
model_clippingExtents: function () {
|
|
85
|
+
return clippingPolygons.extentsTexture;
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
renderResources.uniformMap = combine(uniformMap, renderResources.uniformMap);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export default ModelClippingPolygonsPipelineStage;
|
|
@@ -14,6 +14,7 @@ import ImageBasedLightingPipelineStage from "./ImageBasedLightingPipelineStage.j
|
|
|
14
14
|
import ModelArticulation from "./ModelArticulation.js";
|
|
15
15
|
import ModelColorPipelineStage from "./ModelColorPipelineStage.js";
|
|
16
16
|
import ModelClippingPlanesPipelineStage from "./ModelClippingPlanesPipelineStage.js";
|
|
17
|
+
import ModelClippingPolygonsPipelineStage from "./ModelClippingPolygonsPipelineStage.js";
|
|
17
18
|
import ModelNode from "./ModelNode.js";
|
|
18
19
|
import ModelRuntimeNode from "./ModelRuntimeNode.js";
|
|
19
20
|
import ModelRuntimePrimitive from "./ModelRuntimePrimitive.js";
|
|
@@ -626,6 +627,10 @@ ModelSceneGraph.prototype.configurePipeline = function (frameState) {
|
|
|
626
627
|
modelPipelineStages.push(ModelClippingPlanesPipelineStage);
|
|
627
628
|
}
|
|
628
629
|
|
|
630
|
+
if (model.isClippingPolygonsEnabled()) {
|
|
631
|
+
modelPipelineStages.push(ModelClippingPolygonsPipelineStage);
|
|
632
|
+
}
|
|
633
|
+
|
|
629
634
|
if (model.hasSilhouette(frameState)) {
|
|
630
635
|
modelPipelineStages.push(ModelSilhouettePipelineStage);
|
|
631
636
|
}
|
|
@@ -357,6 +357,9 @@ ModelUtility.supportedExtensions = {
|
|
|
357
357
|
KHR_techniques_webgl: true,
|
|
358
358
|
KHR_materials_common: true,
|
|
359
359
|
KHR_materials_pbrSpecularGlossiness: true,
|
|
360
|
+
KHR_materials_specular: true,
|
|
361
|
+
KHR_materials_anisotropy: true,
|
|
362
|
+
KHR_materials_clearcoat: true,
|
|
360
363
|
KHR_materials_unlit: true,
|
|
361
364
|
KHR_mesh_quantization: true,
|
|
362
365
|
KHR_texture_basisu: true,
|
|
@@ -3,11 +3,9 @@ import ShaderDestination from "../../Renderer/ShaderDestination.js";
|
|
|
3
3
|
import VerticalExaggerationStageVS from "../../Shaders/Model/VerticalExaggerationStageVS.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* The
|
|
7
|
-
*
|
|
8
|
-
* {@link
|
|
9
|
-
* properties that depend on the attributes of the primitive. This shader code
|
|
10
|
-
* is automatically generated by this stage.
|
|
6
|
+
* The vertical exaggeration pipeline stage transforms the vertex
|
|
7
|
+
* positions based on the values of {@link Scene#verticalExaggeration} and
|
|
8
|
+
* {@link Scene#verticalExaggerationRelativeHeight}
|
|
11
9
|
*
|
|
12
10
|
* @namespace VerticalExaggerationPipelineStage
|
|
13
11
|
*
|
|
@@ -20,7 +18,7 @@ const VerticalExaggerationPipelineStage = {
|
|
|
20
18
|
const scratchExaggerationUniform = new Cartesian2();
|
|
21
19
|
|
|
22
20
|
/**
|
|
23
|
-
* Add vertical exaggeration
|
|
21
|
+
* Add defines and uniforms for vertical exaggeration calculations in the vertex shader
|
|
24
22
|
*
|
|
25
23
|
* @param {PrimitiveRenderResources} renderResources The render resources for the primitive
|
|
26
24
|
* @param {ModelComponents.Primitive} primitive The primitive to be rendered
|
|
@@ -1337,10 +1337,151 @@ SpecularGlossiness.DEFAULT_SPECULAR_FACTOR = Cartesian3.ONE;
|
|
|
1337
1337
|
*/
|
|
1338
1338
|
SpecularGlossiness.DEFAULT_GLOSSINESS_FACTOR = 1.0;
|
|
1339
1339
|
|
|
1340
|
+
function Specular() {
|
|
1341
|
+
/**
|
|
1342
|
+
* The specular factor.
|
|
1343
|
+
*
|
|
1344
|
+
* @type {number}
|
|
1345
|
+
* @default 1.0
|
|
1346
|
+
* @private
|
|
1347
|
+
*/
|
|
1348
|
+
this.specularFactor = Specular.DEFAULT_SPECULAR_FACTOR;
|
|
1349
|
+
|
|
1350
|
+
/**
|
|
1351
|
+
* The specular texture reader.
|
|
1352
|
+
*
|
|
1353
|
+
* @type {ModelComponents.TextureReader}
|
|
1354
|
+
* @private
|
|
1355
|
+
*/
|
|
1356
|
+
this.specularTexture = undefined;
|
|
1357
|
+
|
|
1358
|
+
/**
|
|
1359
|
+
* The specular color factor.
|
|
1360
|
+
*
|
|
1361
|
+
* @type {Cartesian3}
|
|
1362
|
+
* @default new Cartesian3(1.0, 1.0, 1.0)
|
|
1363
|
+
* @private
|
|
1364
|
+
*/
|
|
1365
|
+
this.specularColorFactor = Cartesian3.clone(
|
|
1366
|
+
Specular.DEFAULT_SPECULAR_COLOR_FACTOR
|
|
1367
|
+
);
|
|
1368
|
+
|
|
1369
|
+
/**
|
|
1370
|
+
* The specular color texture reader.
|
|
1371
|
+
*
|
|
1372
|
+
* @type {ModelComponents.TextureReader}
|
|
1373
|
+
* @private
|
|
1374
|
+
*/
|
|
1375
|
+
this.specularColorTexture = undefined;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
/**
|
|
1379
|
+
* @private
|
|
1380
|
+
*/
|
|
1381
|
+
Specular.DEFAULT_SPECULAR_FACTOR = 1.0;
|
|
1382
|
+
|
|
1383
|
+
/**
|
|
1384
|
+
* @private
|
|
1385
|
+
*/
|
|
1386
|
+
Specular.DEFAULT_SPECULAR_COLOR_FACTOR = Cartesian3.ONE;
|
|
1387
|
+
|
|
1388
|
+
function Anisotropy() {
|
|
1389
|
+
/**
|
|
1390
|
+
* The anisotropy strength.
|
|
1391
|
+
*
|
|
1392
|
+
* @type {number}
|
|
1393
|
+
* @default 0.0
|
|
1394
|
+
* @private
|
|
1395
|
+
*/
|
|
1396
|
+
this.anisotropyStrength = Anisotropy.DEFAULT_ANISOTROPY_STRENGTH;
|
|
1397
|
+
|
|
1398
|
+
/**
|
|
1399
|
+
* The rotation of the anisotropy in tangent, bitangent space,
|
|
1400
|
+
* measured in radians counter-clockwise from the tangent.
|
|
1401
|
+
*
|
|
1402
|
+
* @type {number}
|
|
1403
|
+
* @default 0.0
|
|
1404
|
+
* @private
|
|
1405
|
+
*/
|
|
1406
|
+
this.anisotropyRotation = Anisotropy.DEFAULT_ANISOTROPY_ROTATION;
|
|
1407
|
+
|
|
1408
|
+
/**
|
|
1409
|
+
* The anisotropy texture reader.
|
|
1410
|
+
*
|
|
1411
|
+
* @type {ModelComponents.TextureReader}
|
|
1412
|
+
* @private
|
|
1413
|
+
*/
|
|
1414
|
+
this.anisotropyTexture = undefined;
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
/**
|
|
1418
|
+
* @private
|
|
1419
|
+
*/
|
|
1420
|
+
Anisotropy.DEFAULT_ANISOTROPY_STRENGTH = 0.0;
|
|
1421
|
+
|
|
1422
|
+
/**
|
|
1423
|
+
* @private
|
|
1424
|
+
*/
|
|
1425
|
+
Anisotropy.DEFAULT_ANISOTROPY_ROTATION = 0.0;
|
|
1426
|
+
|
|
1427
|
+
function Clearcoat() {
|
|
1428
|
+
/**
|
|
1429
|
+
* The clearcoat layer intensity.
|
|
1430
|
+
*
|
|
1431
|
+
* @type {number}
|
|
1432
|
+
* @default 0.0
|
|
1433
|
+
* @private
|
|
1434
|
+
*/
|
|
1435
|
+
this.clearcoatFactor = Clearcoat.DEFAULT_CLEARCOAT_FACTOR;
|
|
1436
|
+
|
|
1437
|
+
/**
|
|
1438
|
+
* The clearcoat layer intensity texture reader.
|
|
1439
|
+
*
|
|
1440
|
+
* @type {ModelComponents.TextureReader}
|
|
1441
|
+
* @private
|
|
1442
|
+
*/
|
|
1443
|
+
this.clearcoatTexture = undefined;
|
|
1444
|
+
|
|
1445
|
+
/**
|
|
1446
|
+
* The clearcoat layer roughness.
|
|
1447
|
+
*
|
|
1448
|
+
* @type {number}
|
|
1449
|
+
* @default 0.0
|
|
1450
|
+
* @private
|
|
1451
|
+
*/
|
|
1452
|
+
this.clearcoatRoughnessFactor = Clearcoat.DEFAULT_CLEARCOAT_ROUGHNESS_FACTOR;
|
|
1453
|
+
|
|
1454
|
+
/**
|
|
1455
|
+
* The clearcoat layer roughness texture.
|
|
1456
|
+
*
|
|
1457
|
+
* @type {ModelComponents.TextureReader}
|
|
1458
|
+
* @private
|
|
1459
|
+
*/
|
|
1460
|
+
this.clearcoatRoughnessTexture = undefined;
|
|
1461
|
+
|
|
1462
|
+
/**
|
|
1463
|
+
* The clearcoat normal map texture.
|
|
1464
|
+
*
|
|
1465
|
+
* @type {ModelComponents.TextureReader}
|
|
1466
|
+
* @private
|
|
1467
|
+
*/
|
|
1468
|
+
this.clearcoatNormalTexture = undefined;
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
/**
|
|
1472
|
+
* @private
|
|
1473
|
+
*/
|
|
1474
|
+
Clearcoat.DEFAULT_CLEARCOAT_FACTOR = 0.0;
|
|
1475
|
+
|
|
1476
|
+
/**
|
|
1477
|
+
* @private
|
|
1478
|
+
*/
|
|
1479
|
+
Clearcoat.DEFAULT_CLEARCOAT_ROUGHNESS_FACTOR = 0.0;
|
|
1480
|
+
|
|
1340
1481
|
/**
|
|
1341
1482
|
* The material appearance of a primitive.
|
|
1342
1483
|
*
|
|
1343
|
-
* @alias
|
|
1484
|
+
* @alias ModelComponents.Material
|
|
1344
1485
|
* @constructor
|
|
1345
1486
|
*
|
|
1346
1487
|
* @private
|
|
@@ -1362,6 +1503,30 @@ function Material() {
|
|
|
1362
1503
|
*/
|
|
1363
1504
|
this.specularGlossiness = undefined;
|
|
1364
1505
|
|
|
1506
|
+
/**
|
|
1507
|
+
* Material properties for the PBR specular shading model.
|
|
1508
|
+
*
|
|
1509
|
+
* @type {ModelComponents.Specular}
|
|
1510
|
+
* @private
|
|
1511
|
+
*/
|
|
1512
|
+
this.specular = undefined;
|
|
1513
|
+
|
|
1514
|
+
/**
|
|
1515
|
+
* Material properties for the PBR anisotropy shading model.
|
|
1516
|
+
*
|
|
1517
|
+
* @type {ModelComponents.Anisotropy}
|
|
1518
|
+
* @private
|
|
1519
|
+
*/
|
|
1520
|
+
this.anisotropy = undefined;
|
|
1521
|
+
|
|
1522
|
+
/**
|
|
1523
|
+
* Material properties for the PBR clearcoat shading model.
|
|
1524
|
+
*
|
|
1525
|
+
* @type {ModelComponents.Clearcoat}
|
|
1526
|
+
* @private
|
|
1527
|
+
*/
|
|
1528
|
+
this.clearcoat = undefined;
|
|
1529
|
+
|
|
1365
1530
|
/**
|
|
1366
1531
|
* The emissive texture reader.
|
|
1367
1532
|
*
|
|
@@ -1461,6 +1626,9 @@ ModelComponents.Components = Components;
|
|
|
1461
1626
|
ModelComponents.TextureReader = TextureReader;
|
|
1462
1627
|
ModelComponents.MetallicRoughness = MetallicRoughness;
|
|
1463
1628
|
ModelComponents.SpecularGlossiness = SpecularGlossiness;
|
|
1629
|
+
ModelComponents.Specular = Specular;
|
|
1630
|
+
ModelComponents.Anisotropy = Anisotropy;
|
|
1631
|
+
ModelComponents.Clearcoat = Clearcoat;
|
|
1464
1632
|
ModelComponents.Material = Material;
|
|
1465
1633
|
|
|
1466
1634
|
export default ModelComponents;
|
|
@@ -30,22 +30,30 @@ function updateFramebuffers(pickDepth, context, depthTexture) {
|
|
|
30
30
|
|
|
31
31
|
function updateCopyCommands(pickDepth, context, depthTexture) {
|
|
32
32
|
if (!defined(pickDepth._copyDepthCommand)) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
pickDepth._copyDepthCommand = context.createViewportQuadCommand(
|
|
34
|
+
`uniform highp sampler2D colorTexture;
|
|
35
|
+
|
|
36
|
+
in vec2 v_textureCoordinates;
|
|
37
|
+
|
|
38
|
+
void main()
|
|
39
|
+
{
|
|
40
|
+
vec4 globeDepthPacked = texture(czm_globeDepthTexture, v_textureCoordinates);
|
|
41
|
+
float globeDepth = czm_unpackDepth(globeDepthPacked);
|
|
42
|
+
float depth = texture(colorTexture, v_textureCoordinates).r;
|
|
43
|
+
out_FragColor = czm_branchFreeTernary(globeDepth <= 0.0 || globeDepth >= 1.0 || depth < globeDepth && depth > 0.0 && depth < 1.0,
|
|
44
|
+
czm_packDepth(depth), globeDepthPacked);
|
|
45
|
+
}
|
|
46
|
+
`,
|
|
47
|
+
{
|
|
48
|
+
renderState: RenderState.fromCache(),
|
|
49
|
+
uniformMap: {
|
|
50
|
+
colorTexture: function () {
|
|
51
|
+
return pickDepth._textureToCopy;
|
|
52
|
+
},
|
|
45
53
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
owner: pickDepth,
|
|
55
|
+
}
|
|
56
|
+
);
|
|
49
57
|
}
|
|
50
58
|
|
|
51
59
|
pickDepth._textureToCopy = depthTexture;
|
|
@@ -146,8 +146,7 @@ ResourceCache.unload = function (resourceLoader) {
|
|
|
146
146
|
*/
|
|
147
147
|
ResourceCache.getSchemaLoader = function (options) {
|
|
148
148
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
149
|
-
const schema = options
|
|
150
|
-
const resource = options.resource;
|
|
149
|
+
const { schema, resource } = options;
|
|
151
150
|
|
|
152
151
|
//>>includeStart('debug', pragmas.debug);
|
|
153
152
|
if (defined(schema) === defined(resource)) {
|
|
@@ -189,9 +188,7 @@ ResourceCache.getSchemaLoader = function (options) {
|
|
|
189
188
|
*/
|
|
190
189
|
ResourceCache.getEmbeddedBufferLoader = function (options) {
|
|
191
190
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
192
|
-
const parentResource = options
|
|
193
|
-
const bufferId = options.bufferId;
|
|
194
|
-
const typedArray = options.typedArray;
|
|
191
|
+
const { parentResource, bufferId, typedArray } = options;
|
|
195
192
|
|
|
196
193
|
//>>includeStart('debug', pragmas.debug);
|
|
197
194
|
Check.typeOf.object("options.parentResource", parentResource);
|
|
@@ -231,7 +228,7 @@ ResourceCache.getEmbeddedBufferLoader = function (options) {
|
|
|
231
228
|
*/
|
|
232
229
|
ResourceCache.getExternalBufferLoader = function (options) {
|
|
233
230
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
234
|
-
const resource = options
|
|
231
|
+
const { resource } = options;
|
|
235
232
|
|
|
236
233
|
//>>includeStart('debug', pragmas.debug);
|
|
237
234
|
Check.typeOf.object("options.resource", resource);
|
|
@@ -268,10 +265,7 @@ ResourceCache.getExternalBufferLoader = function (options) {
|
|
|
268
265
|
*/
|
|
269
266
|
ResourceCache.getGltfJsonLoader = function (options) {
|
|
270
267
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
271
|
-
const gltfResource = options
|
|
272
|
-
const baseResource = options.baseResource;
|
|
273
|
-
const typedArray = options.typedArray;
|
|
274
|
-
const gltfJson = options.gltfJson;
|
|
268
|
+
const { gltfResource, baseResource, typedArray, gltfJson } = options;
|
|
275
269
|
|
|
276
270
|
//>>includeStart('debug', pragmas.debug);
|
|
277
271
|
Check.typeOf.object("options.gltfResource", gltfResource);
|
|
@@ -313,10 +307,7 @@ ResourceCache.getGltfJsonLoader = function (options) {
|
|
|
313
307
|
*/
|
|
314
308
|
ResourceCache.getBufferViewLoader = function (options) {
|
|
315
309
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
316
|
-
const gltf = options
|
|
317
|
-
const bufferViewId = options.bufferViewId;
|
|
318
|
-
const gltfResource = options.gltfResource;
|
|
319
|
-
const baseResource = options.baseResource;
|
|
310
|
+
const { gltf, bufferViewId, gltfResource, baseResource } = options;
|
|
320
311
|
|
|
321
312
|
//>>includeStart('debug', pragmas.debug);
|
|
322
313
|
Check.typeOf.object("options.gltf", gltf);
|
|
@@ -363,10 +354,7 @@ ResourceCache.getBufferViewLoader = function (options) {
|
|
|
363
354
|
*/
|
|
364
355
|
ResourceCache.getDracoLoader = function (options) {
|
|
365
356
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
366
|
-
const gltf = options
|
|
367
|
-
const draco = options.draco;
|
|
368
|
-
const gltfResource = options.gltfResource;
|
|
369
|
-
const baseResource = options.baseResource;
|
|
357
|
+
const { gltf, draco, gltfResource, baseResource } = options;
|
|
370
358
|
|
|
371
359
|
//>>includeStart('debug', pragmas.debug);
|
|
372
360
|
Check.typeOf.object("options.gltf", gltf);
|
|
@@ -424,18 +412,20 @@ ResourceCache.getDracoLoader = function (options) {
|
|
|
424
412
|
*/
|
|
425
413
|
ResourceCache.getVertexBufferLoader = function (options) {
|
|
426
414
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
427
|
-
const
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
415
|
+
const {
|
|
416
|
+
gltf,
|
|
417
|
+
gltfResource,
|
|
418
|
+
baseResource,
|
|
419
|
+
frameState,
|
|
420
|
+
bufferViewId,
|
|
421
|
+
draco,
|
|
422
|
+
attributeSemantic,
|
|
423
|
+
accessorId,
|
|
424
|
+
asynchronous = true,
|
|
425
|
+
dequantize = false,
|
|
426
|
+
loadBuffer = false,
|
|
427
|
+
loadTypedArray = false,
|
|
428
|
+
} = options;
|
|
439
429
|
|
|
440
430
|
//>>includeStart('debug', pragmas.debug);
|
|
441
431
|
Check.typeOf.object("options.gltf", gltf);
|
|
@@ -541,15 +531,17 @@ function hasDracoCompression(draco, semantic) {
|
|
|
541
531
|
*/
|
|
542
532
|
ResourceCache.getIndexBufferLoader = function (options) {
|
|
543
533
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
534
|
+
const {
|
|
535
|
+
gltf,
|
|
536
|
+
accessorId,
|
|
537
|
+
gltfResource,
|
|
538
|
+
baseResource,
|
|
539
|
+
frameState,
|
|
540
|
+
draco,
|
|
541
|
+
asynchronous = true,
|
|
542
|
+
loadBuffer = false,
|
|
543
|
+
loadTypedArray = false,
|
|
544
|
+
} = options;
|
|
553
545
|
|
|
554
546
|
//>>includeStart('debug', pragmas.debug);
|
|
555
547
|
Check.typeOf.object("options.gltf", gltf);
|
|
@@ -610,10 +602,7 @@ ResourceCache.getIndexBufferLoader = function (options) {
|
|
|
610
602
|
*/
|
|
611
603
|
ResourceCache.getImageLoader = function (options) {
|
|
612
604
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
613
|
-
const gltf = options
|
|
614
|
-
const imageId = options.imageId;
|
|
615
|
-
const gltfResource = options.gltfResource;
|
|
616
|
-
const baseResource = options.baseResource;
|
|
605
|
+
const { gltf, imageId, gltfResource, baseResource } = options;
|
|
617
606
|
|
|
618
607
|
//>>includeStart('debug', pragmas.debug);
|
|
619
608
|
Check.typeOf.object("options.gltf", gltf);
|
|
@@ -663,13 +652,15 @@ ResourceCache.getImageLoader = function (options) {
|
|
|
663
652
|
*/
|
|
664
653
|
ResourceCache.getTextureLoader = function (options) {
|
|
665
654
|
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
666
|
-
const
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
655
|
+
const {
|
|
656
|
+
gltf,
|
|
657
|
+
textureInfo,
|
|
658
|
+
gltfResource,
|
|
659
|
+
baseResource,
|
|
660
|
+
supportedImageFormats,
|
|
661
|
+
frameState,
|
|
662
|
+
asynchronous = true,
|
|
663
|
+
} = options;
|
|
673
664
|
|
|
674
665
|
//>>includeStart('debug', pragmas.debug);
|
|
675
666
|
Check.typeOf.object("options.gltf", gltf);
|