@cesium/engine 7.0.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/Workers/{chunk-MY3VNFGQ.js → chunk-23UFSGND.js} +7 -7
- package/Build/Workers/{chunk-IQBYFRVW.js → chunk-2A75IWRS.js} +7 -7
- package/Build/Workers/{chunk-VRGFV2UO.js → chunk-2FRVPMCS.js} +10 -10
- package/Build/Workers/{chunk-46UD5ABS.js → chunk-2FWRMUTY.js} +4 -4
- package/Build/Workers/{chunk-DTAIXKTO.js → chunk-2UPKWTMJ.js} +6 -6
- package/Build/Workers/{chunk-6VJVYK2V.js → chunk-34FXV7D7.js} +2 -2
- package/Build/Workers/{chunk-ODW7WYM4.js → chunk-3VAZEH7M.js} +2 -2
- package/Build/Workers/{chunk-U2VCRRQW.js → chunk-4DO5W5XZ.js} +6 -6
- package/Build/Workers/{chunk-VK3EJHWI.js → chunk-4H7PY4U5.js} +2 -2
- package/Build/Workers/{chunk-RV7ZYPFT.js → chunk-5QULIR53.js} +4 -4
- package/Build/Workers/{chunk-JY5YEZFA.js → chunk-7TC63SJW.js} +8 -8
- package/Build/Workers/{chunk-JJ4VBOQ3.js → chunk-7ZFGPDJA.js} +4 -4
- package/Build/Workers/{chunk-FP6GYBFX.js → chunk-A5DWLWCY.js} +10 -10
- package/Build/Workers/{chunk-5M3U6ZMA.js → chunk-BBWDMCVU.js} +1 -1
- package/Build/Workers/{chunk-WZU2YLWG.js → chunk-BG4UCVXN.js} +3 -3
- package/Build/Workers/{chunk-5WQ523AW.js → chunk-BIKA3NRA.js} +5 -5
- package/Build/Workers/{chunk-PTQQUQC3.js → chunk-BROJAZRZ.js} +13 -13
- package/Build/Workers/{chunk-YUCVWAY6.js → chunk-DDUQAJ4P.js} +7 -7
- package/Build/Workers/{chunk-2HJWSU7B.js → chunk-EERJKOAF.js} +4 -4
- package/Build/Workers/{chunk-LZGHD6NY.js → chunk-EG6PTBY2.js} +15 -15
- package/Build/Workers/{chunk-IX2JCCNM.js → chunk-EHWHNOEX.js} +1 -1
- package/Build/Workers/{chunk-NKPBIX7F.js → chunk-F3YA3Y2Z.js} +1 -1
- package/Build/Workers/{chunk-L2ZN645J.js → chunk-F4HFJMGM.js} +6 -6
- package/Build/Workers/{chunk-F6SE42BK.js → chunk-FJKNFAKQ.js} +15 -472
- package/Build/Workers/{chunk-PNBGBETF.js → chunk-FNIRWHJB.js} +10 -10
- package/Build/Workers/{chunk-RAEV7K66.js → chunk-FZRIVR7Y.js} +5 -5
- package/Build/Workers/{chunk-AIPU2VSX.js → chunk-G43QFN4Q.js} +6 -6
- package/Build/Workers/{chunk-ZUA2UUNV.js → chunk-GATZHF3K.js} +2 -2
- package/Build/Workers/{chunk-ZK5JOS3D.js → chunk-GRC2ZTAF.js} +14 -14
- package/Build/Workers/{chunk-5YLJ77FF.js → chunk-HU6N6EXB.js} +10 -10
- package/Build/Workers/{chunk-4EBHOMFX.js → chunk-I46ZRR5W.js} +17 -17
- package/Build/Workers/{chunk-LZ7JIV3K.js → chunk-JURN7NPV.js} +17 -17
- package/Build/Workers/{chunk-JCNXK6EL.js → chunk-KKCR2YOP.js} +11 -11
- package/Build/Workers/{chunk-S6SKF6DT.js → chunk-LPR3YNP2.js} +5 -5
- package/Build/Workers/{chunk-UDO6BFSF.js → chunk-M7ERACJJ.js} +13 -13
- package/Build/Workers/{chunk-BZP4T2JJ.js → chunk-MDWEGWPA.js} +10 -10
- package/Build/Workers/{chunk-72SANQJV.js → chunk-OGXZVPPM.js} +9 -5
- package/Build/Workers/{chunk-AR5DNBJ4.js → chunk-PGSJK77E.js} +6 -6
- package/Build/Workers/{chunk-GEJTYLCO.js → chunk-PPH7OFP3.js} +5 -5
- package/Build/Workers/{chunk-OVLG3FRS.js → chunk-SH5USDPI.js} +6 -6
- package/Build/Workers/{chunk-6HZQPRUS.js → chunk-SOWMRMWA.js} +1 -1
- package/Build/Workers/{chunk-JXDC723O.js → chunk-STW2DGFI.js} +2 -2
- package/Build/Workers/{chunk-5HDYHG3F.js → chunk-T3XIFPYR.js} +13 -13
- package/Build/Workers/chunk-TTUZP4BO.js +501 -0
- package/Build/Workers/{chunk-7XEAYGZK.js → chunk-UEXTBDBE.js} +10 -10
- package/Build/Workers/{chunk-GV56Q4LU.js → chunk-VOXYEYJT.js} +11 -11
- package/Build/Workers/{chunk-NY3K4IM3.js → chunk-X4356LRH.js} +12 -12
- package/Build/Workers/{chunk-S4MAZ3SS.js → chunk-XGI5BXZY.js} +2 -2
- package/Build/Workers/{chunk-UAEW6HKG.js → chunk-Y2ME2IJV.js} +13 -13
- package/Build/Workers/{chunk-XWXM2O2R.js → chunk-Y5UQJLYE.js} +6 -6
- package/Build/Workers/{chunk-QZAD5O7I.js → chunk-YJEBABKH.js} +7 -7
- package/Build/Workers/{chunk-UGK3FCDY.js → chunk-YWTJ2B4B.js} +1 -1
- package/Build/Workers/{chunk-R5X4OQT4.js → chunk-Z3TIFFGF.js} +7 -7
- package/Build/Workers/{chunk-WBQCVXR3.js → chunk-ZT7KWISZ.js} +4 -4
- package/Build/Workers/combineGeometry.js +24 -23
- package/Build/Workers/createBoxGeometry.js +18 -17
- package/Build/Workers/createBoxOutlineGeometry.js +16 -15
- package/Build/Workers/createCircleGeometry.js +26 -25
- package/Build/Workers/createCircleOutlineGeometry.js +19 -18
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -32
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -30
- package/Build/Workers/createCorridorGeometry.js +29 -28
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -27
- package/Build/Workers/createCylinderGeometry.js +20 -19
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -17
- package/Build/Workers/createEllipseGeometry.js +26 -25
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -18
- package/Build/Workers/createEllipsoidGeometry.js +19 -18
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -17
- package/Build/Workers/createFrustumGeometry.js +18 -17
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -17
- package/Build/Workers/createGeometry.js +54 -33
- package/Build/Workers/createGroundPolylineGeometry.js +22 -21
- package/Build/Workers/createPlaneGeometry.js +16 -15
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -14
- package/Build/Workers/createPolygonGeometry.js +32 -31
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -29
- package/Build/Workers/createPolylineGeometry.js +25 -24
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -30
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -26
- package/Build/Workers/createRectangleGeometry.js +27 -26
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -19
- package/Build/Workers/createSimplePolylineGeometry.js +23 -22
- package/Build/Workers/createSphereGeometry.js +19 -18
- package/Build/Workers/createSphereOutlineGeometry.js +18 -17
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -23
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +22 -21
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -21
- package/Build/Workers/createVerticesFromHeightmap.js +22 -21
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -18
- package/Build/Workers/createWallGeometry.js +24 -23
- package/Build/Workers/createWallOutlineGeometry.js +23 -22
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +601 -92
- package/Build/Workers/transcodeKTX2.js +7 -7
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -21
- package/Source/Core/Ellipsoid.js +6 -0
- package/Source/Core/IntersectionTests.js +6 -3
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/PixelFormat.js +5 -0
- package/Source/Core/Transforms.js +3 -0
- package/Source/Core/srgbToLinear.js +32 -0
- package/Source/DataSources/CzmlDataSource.js +51 -23
- package/Source/DataSources/DataSourceDisplay.js +27 -0
- package/Source/DataSources/Entity.js +20 -2
- package/Source/DataSources/GeometryUpdaterSet.js +114 -0
- package/Source/DataSources/GeometryVisualizer.js +19 -83
- package/Source/Renderer/Context.js +10 -0
- package/Source/Renderer/ContextLimits.js +2 -0
- package/Source/Renderer/demodernizeShader.js +4 -1
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Axis.js +12 -7
- package/Source/Scene/Camera.js +46 -4
- package/Source/Scene/Cesium3DTileset.js +44 -6
- package/Source/Scene/Cesium3DTilesetBaseTraversal.js +2 -4
- package/Source/Scene/FrameState.js +5 -0
- package/Source/Scene/GlobeTranslucencyState.js +1 -1
- package/Source/Scene/GltfPipeline/updateVersion.js +69 -68
- package/Source/Scene/I3SDataProvider.js +270 -53
- package/Source/Scene/I3SDecoder.js +8 -1
- package/Source/Scene/I3SFeature.js +2 -5
- package/Source/Scene/I3SField.js +136 -31
- package/Source/Scene/I3SGeometry.js +70 -2
- package/Source/Scene/I3SLayer.js +55 -10
- package/Source/Scene/I3SNode.js +175 -18
- package/Source/Scene/I3SStatistics.js +94 -0
- package/Source/Scene/I3SSublayer.js +176 -0
- package/Source/Scene/I3SSymbology.js +337 -0
- package/Source/Scene/KeyframeNode.js +1 -1
- package/Source/Scene/Model/pickModel.js +25 -7
- package/Source/Scene/PickFramebuffer.js +37 -2
- package/Source/Scene/Picking.js +113 -39
- package/Source/Scene/Primitive.js +6 -2
- package/Source/Scene/Scene.js +126 -42
- package/Source/Scene/ScreenSpaceCameraController.js +21 -7
- package/Source/Scene/SensorVolumePortionToDisplay.js +69 -0
- package/Source/Scene/SpatialNode.js +12 -19
- package/Source/Scene/StructuralMetadata.js +1 -1
- package/Source/Scene/VoxelBoxShape.js +76 -0
- package/Source/Scene/VoxelCell.js +273 -0
- package/Source/Scene/VoxelCylinderShape.js +114 -43
- package/Source/Scene/VoxelEllipsoidShape.js +158 -116
- package/Source/Scene/VoxelPrimitive.js +3 -1
- package/Source/Scene/VoxelRenderResources.js +3 -0
- package/Source/Scene/VoxelShape.js +13 -0
- package/Source/Scene/VoxelTraversal.js +76 -54
- package/Source/Scene/buildVoxelDrawCommands.js +23 -0
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -0
- package/Source/Scene/processVoxelProperties.js +2 -0
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +14 -111
- package/Source/Shaders/Voxels/IntersectCylinder.js +14 -111
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +32 -113
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +32 -113
- package/Source/Shaders/Voxels/IntersectLongitude.glsl +102 -0
- package/Source/Shaders/Voxels/IntersectLongitude.js +104 -0
- package/Source/Shaders/Voxels/VoxelFS.glsl +39 -1
- package/Source/Shaders/Voxels/VoxelFS.js +39 -1
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +19 -37
- package/Source/Shaders/Voxels/convertUvToCylinder.js +19 -37
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +24 -44
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +24 -44
- package/Source/Workers/createGeometry.js +40 -11
- package/Source/Workers/decodeI3S.js +720 -94
- package/index.d.ts +296 -11
- package/index.js +102 -94
- package/package.json +1 -1
|
@@ -4,105 +4,23 @@ import Check from "../Core/Check.js";
|
|
|
4
4
|
import defaultValue from "../Core/defaultValue.js";
|
|
5
5
|
import defined from "../Core/defined.js";
|
|
6
6
|
import destroyObject from "../Core/destroyObject.js";
|
|
7
|
-
import Event from "../Core/Event.js";
|
|
8
|
-
import EventHelper from "../Core/EventHelper.js";
|
|
9
7
|
import ClassificationType from "../Scene/ClassificationType.js";
|
|
10
8
|
import MaterialAppearance from "../Scene/MaterialAppearance.js";
|
|
11
9
|
import PerInstanceColorAppearance from "../Scene/PerInstanceColorAppearance.js";
|
|
12
10
|
import ShadowMode from "../Scene/ShadowMode.js";
|
|
13
11
|
import BoundingSphereState from "./BoundingSphereState.js";
|
|
14
|
-
import BoxGeometryUpdater from "./BoxGeometryUpdater.js";
|
|
15
12
|
import ColorMaterialProperty from "./ColorMaterialProperty.js";
|
|
16
|
-
import CorridorGeometryUpdater from "./CorridorGeometryUpdater.js";
|
|
17
|
-
import CylinderGeometryUpdater from "./CylinderGeometryUpdater.js";
|
|
18
13
|
import DynamicGeometryBatch from "./DynamicGeometryBatch.js";
|
|
19
|
-
import EllipseGeometryUpdater from "./EllipseGeometryUpdater.js";
|
|
20
|
-
import EllipsoidGeometryUpdater from "./EllipsoidGeometryUpdater.js";
|
|
21
14
|
import Entity from "./Entity.js";
|
|
22
|
-
import
|
|
23
|
-
import PolygonGeometryUpdater from "./PolygonGeometryUpdater.js";
|
|
24
|
-
import PolylineVolumeGeometryUpdater from "./PolylineVolumeGeometryUpdater.js";
|
|
25
|
-
import RectangleGeometryUpdater from "./RectangleGeometryUpdater.js";
|
|
15
|
+
import GeometryUpdaterSet from "./GeometryUpdaterSet.js";
|
|
26
16
|
import StaticGeometryColorBatch from "./StaticGeometryColorBatch.js";
|
|
27
17
|
import StaticGeometryPerMaterialBatch from "./StaticGeometryPerMaterialBatch.js";
|
|
28
18
|
import StaticGroundGeometryColorBatch from "./StaticGroundGeometryColorBatch.js";
|
|
29
19
|
import StaticGroundGeometryPerMaterialBatch from "./StaticGroundGeometryPerMaterialBatch.js";
|
|
30
20
|
import StaticOutlineGeometryBatch from "./StaticOutlineGeometryBatch.js";
|
|
31
|
-
import WallGeometryUpdater from "./WallGeometryUpdater.js";
|
|
32
21
|
|
|
33
22
|
const emptyArray = [];
|
|
34
23
|
|
|
35
|
-
const geometryUpdaters = [
|
|
36
|
-
BoxGeometryUpdater,
|
|
37
|
-
CylinderGeometryUpdater,
|
|
38
|
-
CorridorGeometryUpdater,
|
|
39
|
-
EllipseGeometryUpdater,
|
|
40
|
-
EllipsoidGeometryUpdater,
|
|
41
|
-
PlaneGeometryUpdater,
|
|
42
|
-
PolygonGeometryUpdater,
|
|
43
|
-
PolylineVolumeGeometryUpdater,
|
|
44
|
-
RectangleGeometryUpdater,
|
|
45
|
-
WallGeometryUpdater,
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
function GeometryUpdaterSet(entity, scene) {
|
|
49
|
-
this.entity = entity;
|
|
50
|
-
this.scene = scene;
|
|
51
|
-
const updaters = new Array(geometryUpdaters.length);
|
|
52
|
-
const geometryChanged = new Event();
|
|
53
|
-
function raiseEvent(geometry) {
|
|
54
|
-
geometryChanged.raiseEvent(geometry);
|
|
55
|
-
}
|
|
56
|
-
const eventHelper = new EventHelper();
|
|
57
|
-
for (let i = 0; i < updaters.length; i++) {
|
|
58
|
-
const updater = new geometryUpdaters[i](entity, scene);
|
|
59
|
-
eventHelper.add(updater.geometryChanged, raiseEvent);
|
|
60
|
-
updaters[i] = updater;
|
|
61
|
-
}
|
|
62
|
-
this.updaters = updaters;
|
|
63
|
-
this.geometryChanged = geometryChanged;
|
|
64
|
-
this.eventHelper = eventHelper;
|
|
65
|
-
|
|
66
|
-
this._removeEntitySubscription = entity.definitionChanged.addEventListener(
|
|
67
|
-
GeometryUpdaterSet.prototype._onEntityPropertyChanged,
|
|
68
|
-
this
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
GeometryUpdaterSet.prototype._onEntityPropertyChanged = function (
|
|
73
|
-
entity,
|
|
74
|
-
propertyName,
|
|
75
|
-
newValue,
|
|
76
|
-
oldValue
|
|
77
|
-
) {
|
|
78
|
-
const updaters = this.updaters;
|
|
79
|
-
for (let i = 0; i < updaters.length; i++) {
|
|
80
|
-
updaters[i]._onEntityPropertyChanged(
|
|
81
|
-
entity,
|
|
82
|
-
propertyName,
|
|
83
|
-
newValue,
|
|
84
|
-
oldValue
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
GeometryUpdaterSet.prototype.forEach = function (callback) {
|
|
90
|
-
const updaters = this.updaters;
|
|
91
|
-
for (let i = 0; i < updaters.length; i++) {
|
|
92
|
-
callback(updaters[i]);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
GeometryUpdaterSet.prototype.destroy = function () {
|
|
97
|
-
this.eventHelper.removeAll();
|
|
98
|
-
const updaters = this.updaters;
|
|
99
|
-
for (let i = 0; i < updaters.length; i++) {
|
|
100
|
-
updaters[i].destroy();
|
|
101
|
-
}
|
|
102
|
-
this._removeEntitySubscription();
|
|
103
|
-
destroyObject(this);
|
|
104
|
-
};
|
|
105
|
-
|
|
106
24
|
/**
|
|
107
25
|
* A general purpose visualizer for geometry represented by {@link Primitive} instances.
|
|
108
26
|
* @alias GeometryVisualizer
|
|
@@ -293,6 +211,24 @@ function GeometryVisualizer(
|
|
|
293
211
|
);
|
|
294
212
|
}
|
|
295
213
|
|
|
214
|
+
/**
|
|
215
|
+
* Add the provided updater to the default list of updaters if not already included
|
|
216
|
+
* @private
|
|
217
|
+
* @param {GeometryUpdater} updater
|
|
218
|
+
*/
|
|
219
|
+
GeometryVisualizer.registerUpdater = function (updater) {
|
|
220
|
+
GeometryUpdaterSet.registerUpdater(updater);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Remove the provided updater from the default list of updaters if included
|
|
225
|
+
* @private
|
|
226
|
+
* @param {GeometryUpdater} updater
|
|
227
|
+
*/
|
|
228
|
+
GeometryVisualizer.unregisterUpdater = function (updater) {
|
|
229
|
+
GeometryUpdaterSet.unregisterUpdater(updater);
|
|
230
|
+
};
|
|
231
|
+
|
|
296
232
|
/**
|
|
297
233
|
* Updates all of the primitives created by this visualizer to match their
|
|
298
234
|
* Entity counterpart at the given time.
|
|
@@ -1432,6 +1432,16 @@ Context.prototype.endFrame = function () {
|
|
|
1432
1432
|
}
|
|
1433
1433
|
};
|
|
1434
1434
|
|
|
1435
|
+
/**
|
|
1436
|
+
* @private
|
|
1437
|
+
* @param {object} readState An object with the following properties:
|
|
1438
|
+
* @param {number} [readState.x=0] The x offset of the rectangle to read from.
|
|
1439
|
+
* @param {number} [readState.y=0] The y offset of the rectangle to read from.
|
|
1440
|
+
* @param {number} [readState.width=gl.drawingBufferWidth] The width of the rectangle to read from.
|
|
1441
|
+
* @param {number} [readState.height=gl.drawingBufferHeight] The height of the rectangle to read from.
|
|
1442
|
+
* @param {Framebuffer} [readState.framebuffer] The framebuffer to read from. If undefined, the read will be from the default framebuffer.
|
|
1443
|
+
* @returns {Uint8Array|Uint16Array|Float32Array|Uint32Array} The pixels in the specified rectangle.
|
|
1444
|
+
*/
|
|
1435
1445
|
Context.prototype.readPixels = function (readState) {
|
|
1436
1446
|
const gl = this._gl;
|
|
1437
1447
|
|
|
@@ -26,7 +26,10 @@ function demodernizeShader(input, isFragmentShader) {
|
|
|
26
26
|
|
|
27
27
|
if (isFragmentShader) {
|
|
28
28
|
// Replace the in with varying.
|
|
29
|
-
output = output.replaceAll(
|
|
29
|
+
output = output.replaceAll(
|
|
30
|
+
/\n\s*(in)\s+(vec\d|mat\d|float)/g,
|
|
31
|
+
`\nvarying $2`
|
|
32
|
+
);
|
|
30
33
|
|
|
31
34
|
if (/out_FragData_(\d+)/.test(output)) {
|
|
32
35
|
output = `#extension GL_EXT_draw_buffers : enable\n${output}`;
|
|
@@ -4,7 +4,7 @@ import Resource from "../Core/Resource.js";
|
|
|
4
4
|
|
|
5
5
|
let defaultTokenCredit;
|
|
6
6
|
const defaultAccessToken =
|
|
7
|
-
"
|
|
7
|
+
"AAPKc6e43bbc520149f79229d173c04883558jat1YV8r6Xjl50ulCDeLTkHzW0vzUC-9m6ASQvGmPbo4-xY_kAzsJxJZm-j_Unr";
|
|
8
8
|
/**
|
|
9
9
|
* Default options for accessing the ArcGIS image tile service.
|
|
10
10
|
*
|
package/Source/Scene/Axis.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import Check from "../Core/Check.js";
|
|
2
|
-
import CesiumMath from "../Core/Math.js";
|
|
3
2
|
import Matrix3 from "../Core/Matrix3.js";
|
|
4
3
|
import Matrix4 from "../Core/Matrix4.js";
|
|
5
4
|
|
|
@@ -41,7 +40,8 @@ const Axis = {
|
|
|
41
40
|
* @constant
|
|
42
41
|
*/
|
|
43
42
|
Axis.Y_UP_TO_Z_UP = Matrix4.fromRotationTranslation(
|
|
44
|
-
|
|
43
|
+
// Rotation about PI/2 around the X-axis
|
|
44
|
+
Matrix3.fromArray([1, 0, 0, 0, 0, 1, 0, -1, 0])
|
|
45
45
|
);
|
|
46
46
|
|
|
47
47
|
/**
|
|
@@ -51,7 +51,8 @@ Axis.Y_UP_TO_Z_UP = Matrix4.fromRotationTranslation(
|
|
|
51
51
|
* @constant
|
|
52
52
|
*/
|
|
53
53
|
Axis.Z_UP_TO_Y_UP = Matrix4.fromRotationTranslation(
|
|
54
|
-
|
|
54
|
+
// Rotation about -PI/2 around the X-axis
|
|
55
|
+
Matrix3.fromArray([1, 0, 0, 0, 0, -1, 0, 1, 0])
|
|
55
56
|
);
|
|
56
57
|
|
|
57
58
|
/**
|
|
@@ -61,7 +62,8 @@ Axis.Z_UP_TO_Y_UP = Matrix4.fromRotationTranslation(
|
|
|
61
62
|
* @constant
|
|
62
63
|
*/
|
|
63
64
|
Axis.X_UP_TO_Z_UP = Matrix4.fromRotationTranslation(
|
|
64
|
-
|
|
65
|
+
// Rotation about -PI/2 around the Y-axis
|
|
66
|
+
Matrix3.fromArray([0, 0, 1, 0, 1, 0, -1, 0, 0])
|
|
65
67
|
);
|
|
66
68
|
|
|
67
69
|
/**
|
|
@@ -71,7 +73,8 @@ Axis.X_UP_TO_Z_UP = Matrix4.fromRotationTranslation(
|
|
|
71
73
|
* @constant
|
|
72
74
|
*/
|
|
73
75
|
Axis.Z_UP_TO_X_UP = Matrix4.fromRotationTranslation(
|
|
74
|
-
|
|
76
|
+
// Rotation about PI/2 around the Y-axis
|
|
77
|
+
Matrix3.fromArray([0, 0, -1, 0, 1, 0, 1, 0, 0])
|
|
75
78
|
);
|
|
76
79
|
|
|
77
80
|
/**
|
|
@@ -81,7 +84,8 @@ Axis.Z_UP_TO_X_UP = Matrix4.fromRotationTranslation(
|
|
|
81
84
|
* @constant
|
|
82
85
|
*/
|
|
83
86
|
Axis.X_UP_TO_Y_UP = Matrix4.fromRotationTranslation(
|
|
84
|
-
|
|
87
|
+
// Rotation about PI/2 around the Z-axis
|
|
88
|
+
Matrix3.fromArray([0, 1, 0, -1, 0, 0, 0, 0, 1])
|
|
85
89
|
);
|
|
86
90
|
|
|
87
91
|
/**
|
|
@@ -91,7 +95,8 @@ Axis.X_UP_TO_Y_UP = Matrix4.fromRotationTranslation(
|
|
|
91
95
|
* @constant
|
|
92
96
|
*/
|
|
93
97
|
Axis.Y_UP_TO_X_UP = Matrix4.fromRotationTranslation(
|
|
94
|
-
|
|
98
|
+
// Rotation about -PI/2 around the Z-axis
|
|
99
|
+
Matrix3.fromArray([0, -1, 0, 1, 0, 0, 0, 0, 1])
|
|
95
100
|
);
|
|
96
101
|
|
|
97
102
|
/**
|
package/Source/Scene/Camera.js
CHANGED
|
@@ -217,6 +217,7 @@ function Camera(scene) {
|
|
|
217
217
|
this._changedDirection = undefined;
|
|
218
218
|
this._changedFrustum = undefined;
|
|
219
219
|
this._changedHeading = undefined;
|
|
220
|
+
this._changedRoll = undefined;
|
|
220
221
|
|
|
221
222
|
/**
|
|
222
223
|
* The amount the camera has to change before the <code>changed</code> event is raised. The value is a percentage in the [0, 1] range.
|
|
@@ -380,25 +381,55 @@ Camera.prototype._updateCameraChanged = function () {
|
|
|
380
381
|
|
|
381
382
|
const percentageChanged = camera.percentageChanged;
|
|
382
383
|
|
|
384
|
+
// check heading
|
|
383
385
|
const currentHeading = camera.heading;
|
|
384
386
|
|
|
385
387
|
if (!defined(camera._changedHeading)) {
|
|
386
388
|
camera._changedHeading = currentHeading;
|
|
387
389
|
}
|
|
388
390
|
|
|
389
|
-
let
|
|
391
|
+
let headingDelta =
|
|
390
392
|
Math.abs(camera._changedHeading - currentHeading) % CesiumMath.TWO_PI;
|
|
391
|
-
|
|
393
|
+
headingDelta =
|
|
394
|
+
headingDelta > CesiumMath.PI
|
|
395
|
+
? CesiumMath.TWO_PI - headingDelta
|
|
396
|
+
: headingDelta;
|
|
392
397
|
|
|
393
398
|
// Since delta is computed as the shortest distance between two angles
|
|
394
399
|
// the percentage is relative to the half circle.
|
|
395
|
-
const headingChangedPercentage =
|
|
400
|
+
const headingChangedPercentage = headingDelta / Math.PI;
|
|
396
401
|
|
|
397
402
|
if (headingChangedPercentage > percentageChanged) {
|
|
398
|
-
camera._changed.raiseEvent(headingChangedPercentage);
|
|
399
403
|
camera._changedHeading = currentHeading;
|
|
400
404
|
}
|
|
401
405
|
|
|
406
|
+
// check roll
|
|
407
|
+
const currentRoll = camera.roll;
|
|
408
|
+
|
|
409
|
+
if (!defined(camera._changedRoll)) {
|
|
410
|
+
camera._changedRoll = currentRoll;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
let rollDelta =
|
|
414
|
+
Math.abs(camera._changedRoll - currentRoll) % CesiumMath.TWO_PI;
|
|
415
|
+
rollDelta =
|
|
416
|
+
rollDelta > CesiumMath.PI ? CesiumMath.TWO_PI - rollDelta : rollDelta;
|
|
417
|
+
|
|
418
|
+
// Since delta is computed as the shortest distance between two angles
|
|
419
|
+
// the percentage is relative to the half circle.
|
|
420
|
+
const rollChangedPercentage = rollDelta / Math.PI;
|
|
421
|
+
|
|
422
|
+
if (rollChangedPercentage > percentageChanged) {
|
|
423
|
+
camera._changedRoll = currentRoll;
|
|
424
|
+
}
|
|
425
|
+
if (
|
|
426
|
+
rollChangedPercentage > percentageChanged ||
|
|
427
|
+
headingChangedPercentage > percentageChanged
|
|
428
|
+
) {
|
|
429
|
+
camera._changed.raiseEvent(
|
|
430
|
+
Math.max(rollChangedPercentage, headingChangedPercentage)
|
|
431
|
+
);
|
|
432
|
+
}
|
|
402
433
|
if (camera._mode === SceneMode.SCENE2D) {
|
|
403
434
|
if (!defined(camera._changedFrustum)) {
|
|
404
435
|
camera._changedPosition = Cartesian3.clone(
|
|
@@ -1233,6 +1264,11 @@ const scratchSetViewMatrix3 = new Matrix3();
|
|
|
1233
1264
|
const scratchSetViewCartographic = new Cartographic();
|
|
1234
1265
|
|
|
1235
1266
|
function setView3D(camera, position, hpr) {
|
|
1267
|
+
//>>includeStart('debug', pragmas.debug);
|
|
1268
|
+
if (isNaN(position.x) || isNaN(position.y) || isNaN(position.z)) {
|
|
1269
|
+
throw new DeveloperError("position has a NaN component");
|
|
1270
|
+
}
|
|
1271
|
+
//>>includeEnd('debug');
|
|
1236
1272
|
const currentTransform = Matrix4.clone(
|
|
1237
1273
|
camera.transform,
|
|
1238
1274
|
scratchSetViewTransform1
|
|
@@ -1473,6 +1509,12 @@ Camera.prototype.setView = function (options) {
|
|
|
1473
1509
|
destination,
|
|
1474
1510
|
scratchSetViewCartesian
|
|
1475
1511
|
);
|
|
1512
|
+
//>>includeStart('debug', pragmas.debug);
|
|
1513
|
+
// destination.z may be null in 2D, but .x and .y should be numeric
|
|
1514
|
+
if (isNaN(destination.x) || isNaN(destination.y)) {
|
|
1515
|
+
throw new DeveloperError(`destination has a NaN component`);
|
|
1516
|
+
}
|
|
1517
|
+
//>>includeEnd('debug');
|
|
1476
1518
|
convert = false;
|
|
1477
1519
|
}
|
|
1478
1520
|
|
|
@@ -112,7 +112,8 @@ import Ray from "../Core/Ray.js";
|
|
|
112
112
|
* @property {string|number} [instanceFeatureIdLabel="instanceFeatureId_0"] Label of the instance feature ID set used for picking and styling. If instanceFeatureIdLabel is set to an integer N, it is converted to the string "instanceFeatureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority.
|
|
113
113
|
* @property {boolean} [showCreditsOnScreen=false] Whether to display the credits of this tileset on screen.
|
|
114
114
|
* @property {SplitDirection} [splitDirection=SplitDirection.NONE] The {@link SplitDirection} split to apply to this tileset.
|
|
115
|
-
* @property {boolean} [
|
|
115
|
+
* @property {boolean} [enableCollision=false] When <code>true</code>, enables collisions for camera or CPU picking. While this is <code>true</code> the camera will be prevented from going below the tileset surface if {@link ScreenSpaceCameraController#enableCollisionDetection} is true.
|
|
116
|
+
* @property {boolean} [disableCollision=true] Whether to turn off collisions for camera collisions or picking. While this is <code>true</code> the camera will be allowed to go in or below the tileset surface if {@link ScreenSpaceCameraController#enableCollisionDetection} is true. Deprecated.
|
|
116
117
|
* @property {boolean} [projectTo2D=false] Whether to accurately project the tileset to 2D. If this is true, the tileset will be projected accurately to 2D, but it will use more memory to do so. If this is false, the tileset will use less memory and will still render in 2D / CV mode, but its projected positions may be inaccurate. This cannot be set after the tileset has been created.
|
|
117
118
|
* @property {boolean} [enablePick=false] Whether to allow collision and CPU picking with <code>pick</code> when using WebGL 1. If using WebGL 2 or above, this option will be ignored. If using WebGL 1 and this is true, the <code>pick</code> operation will work correctly, but it will use more memory to do so. If running with WebGL 1 and this is false, the model will use less memory, but <code>pick</code> will always return <code>undefined</code>. This cannot be set after the tileset has loaded.
|
|
118
119
|
* @property {string} [debugHeatmapTilePropertyName] The tile variable to colorize as a heatmap. All rendered tiles will be colorized relative to each other's specified variable value.
|
|
@@ -155,11 +156,11 @@ import Ray from "../Core/Ray.js";
|
|
|
155
156
|
* }
|
|
156
157
|
*
|
|
157
158
|
* @example
|
|
158
|
-
* //
|
|
159
|
+
* // Turn on camera collisions with the tileset.
|
|
159
160
|
* try {
|
|
160
161
|
* const tileset = await Cesium.Cesium3DTileset.fromUrl(
|
|
161
162
|
* "http://localhost:8002/tilesets/Seattle/tileset.json",
|
|
162
|
-
* {
|
|
163
|
+
* { enableCollision: true }
|
|
163
164
|
* );
|
|
164
165
|
* scene.primitives.add(tileset);
|
|
165
166
|
* } catch (error) {
|
|
@@ -864,12 +865,21 @@ function Cesium3DTileset(options) {
|
|
|
864
865
|
);
|
|
865
866
|
|
|
866
867
|
/**
|
|
867
|
-
*
|
|
868
|
+
* If <code>true</code>, allows collisions for camera collisions or picking. While this is <code>true</code> the camera will be prevented from going in or below the tileset surface if {@link ScreenSpaceCameraController#enableCollisionDetection} is true. This can have performance implecations if the tileset contains tile with a larger number of vertices.
|
|
868
869
|
*
|
|
869
870
|
* @type {boolean}
|
|
870
871
|
* @default false
|
|
871
872
|
*/
|
|
872
|
-
this.
|
|
873
|
+
this.enableCollision = defaultValue(options.enableCollision, false);
|
|
874
|
+
|
|
875
|
+
if (defined(options.disableCollision)) {
|
|
876
|
+
deprecationWarning(
|
|
877
|
+
"Cesium3DTileset options.disableCollision",
|
|
878
|
+
"Cesium3DTileset options.disableCollision has been deprecated in CesiumJS 1.115. It will be removed in CesiumJS 1.116. Use options.enableCollision instead."
|
|
879
|
+
);
|
|
880
|
+
|
|
881
|
+
this.enableCollision = !options.disableCollision;
|
|
882
|
+
}
|
|
873
883
|
|
|
874
884
|
this._projectTo2D = defaultValue(options.projectTo2D, false);
|
|
875
885
|
this._enablePick = defaultValue(options.enablePick, false);
|
|
@@ -1073,6 +1083,34 @@ Object.defineProperties(Cesium3DTileset.prototype, {
|
|
|
1073
1083
|
},
|
|
1074
1084
|
},
|
|
1075
1085
|
|
|
1086
|
+
/**
|
|
1087
|
+
* Whether to turn off collisions for camera collisions or picking. While this is <code>true</code> the camera will be allowed to go in or below the tileset surface if {@link ScreenSpaceCameraController#enableCollisionDetection} is true.
|
|
1088
|
+
* @memberof Cesium3DTileset.prototype
|
|
1089
|
+
*
|
|
1090
|
+
* @type {boolean}
|
|
1091
|
+
* @default true
|
|
1092
|
+
*
|
|
1093
|
+
* @deprecated
|
|
1094
|
+
*/
|
|
1095
|
+
disableCollision: {
|
|
1096
|
+
get: function () {
|
|
1097
|
+
deprecationWarning(
|
|
1098
|
+
"Cesium3DTileset.disableCollision",
|
|
1099
|
+
"Cesium3DTileset.disableCollision has been deprecated in CesiumJS 1.115. It will be removed in CesiumJS 1.116. Use Cesium3DTileset.enableCollision instead."
|
|
1100
|
+
);
|
|
1101
|
+
|
|
1102
|
+
return !this.enableCollision;
|
|
1103
|
+
},
|
|
1104
|
+
set: function (value) {
|
|
1105
|
+
deprecationWarning(
|
|
1106
|
+
"Cesium3DTileset.disableCollision",
|
|
1107
|
+
"Cesium3DTileset.disableCollision has been deprecated in CesiumJS 1.115. It will be removed in CesiumJS 1.116. Use Cesium3DTileset.enableCollision instead."
|
|
1108
|
+
);
|
|
1109
|
+
|
|
1110
|
+
this.enableCollision = !value;
|
|
1111
|
+
},
|
|
1112
|
+
},
|
|
1113
|
+
|
|
1076
1114
|
/**
|
|
1077
1115
|
* Gets the tileset's asset object property, which contains metadata about the tileset.
|
|
1078
1116
|
* <p>
|
|
@@ -2643,7 +2681,7 @@ function processUpdateHeight(tileset, tile, frameState) {
|
|
|
2643
2681
|
const boundingSphere = tile.boundingSphere;
|
|
2644
2682
|
|
|
2645
2683
|
for (const callbackData of heightCallbackData) {
|
|
2646
|
-
// No need to
|
|
2684
|
+
// No need to update if the tile was already visible last frame
|
|
2647
2685
|
if (callbackData.invoked || tile._wasSelectedLastFrame) {
|
|
2648
2686
|
continue;
|
|
2649
2687
|
}
|
|
@@ -271,12 +271,10 @@ function executeEmptyTraversal(root, frameState) {
|
|
|
271
271
|
|
|
272
272
|
// Only traverse if the tile is empty - traversal stops at descendants with content
|
|
273
273
|
const traverse = !tile.hasRenderableContent && canTraverse(tile);
|
|
274
|
-
const emptyLeaf = !tile.hasRenderableContent && tile.children.length === 0;
|
|
275
274
|
|
|
276
275
|
// Traversal stops but the tile does not have content yet
|
|
277
276
|
// There will be holes if the parent tries to refine to its children, so don't refine
|
|
278
|
-
|
|
279
|
-
if (!traverse && !tile.contentAvailable && !emptyLeaf) {
|
|
277
|
+
if (!traverse && !tile.contentAvailable) {
|
|
280
278
|
allDescendantsLoaded = false;
|
|
281
279
|
}
|
|
282
280
|
|
|
@@ -295,7 +293,7 @@ function executeEmptyTraversal(root, frameState) {
|
|
|
295
293
|
}
|
|
296
294
|
}
|
|
297
295
|
|
|
298
|
-
return allDescendantsLoaded;
|
|
296
|
+
return root.hasEmptyContent || allDescendantsLoaded;
|
|
299
297
|
}
|
|
300
298
|
|
|
301
299
|
export default Cesium3DTilesetBaseTraversal;
|
|
@@ -182,6 +182,7 @@ function FrameState(context, creditDisplay, jobScheduler) {
|
|
|
182
182
|
* @type {object}
|
|
183
183
|
* @property {boolean} render <code>true</code> if the primitive should update for a render pass, <code>false</code> otherwise.
|
|
184
184
|
* @property {boolean} pick <code>true</code> if the primitive should update for a picking pass, <code>false</code> otherwise.
|
|
185
|
+
* @property {boolean} pickVoxel <code>true</code> if the primitive should update for a voxel picking pass, <code>false</code> otherwise.
|
|
185
186
|
* @property {boolean} depth <code>true</code> if the primitive should update for a depth only pass, <code>false</code> otherwise.
|
|
186
187
|
* @property {boolean} postProcess <code>true</code> if the primitive should update for a per-feature post-process pass, <code>false</code> otherwise.
|
|
187
188
|
* @property {boolean} offscreen <code>true</code> if the primitive should update for an offscreen pass, <code>false</code> otherwise.
|
|
@@ -199,6 +200,10 @@ function FrameState(context, creditDisplay, jobScheduler) {
|
|
|
199
200
|
* @default false
|
|
200
201
|
*/
|
|
201
202
|
pick: false,
|
|
203
|
+
/**
|
|
204
|
+
* @default false
|
|
205
|
+
*/
|
|
206
|
+
pickVoxel: false,
|
|
202
207
|
/**
|
|
203
208
|
* @default false
|
|
204
209
|
*/
|
|
@@ -930,7 +930,7 @@ GlobeTranslucencyState.prototype.pushDerivedCommands = function (
|
|
|
930
930
|
isBlendCommand,
|
|
931
931
|
frameState
|
|
932
932
|
) {
|
|
933
|
-
const picking = frameState.passes.pick;
|
|
933
|
+
const picking = frameState.passes.pick || frameState.passes.pickVoxel;
|
|
934
934
|
if (picking && isBlendCommand) {
|
|
935
935
|
// No need to push blend commands in the pick pass
|
|
936
936
|
return;
|
|
@@ -1079,6 +1079,26 @@ function convertTechniquesToPbr(gltf, options) {
|
|
|
1079
1079
|
removeExtension(gltf, "KHR_blend");
|
|
1080
1080
|
}
|
|
1081
1081
|
|
|
1082
|
+
function assignAsBaseColor(material, baseColor) {
|
|
1083
|
+
if (defined(baseColor)) {
|
|
1084
|
+
if (isVec4(baseColor)) {
|
|
1085
|
+
material.pbrMetallicRoughness.baseColorFactor = srgbToLinear(baseColor);
|
|
1086
|
+
} else if (isTexture(baseColor)) {
|
|
1087
|
+
material.pbrMetallicRoughness.baseColorTexture = baseColor;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
function assignAsEmissive(material, emissive) {
|
|
1093
|
+
if (defined(emissive)) {
|
|
1094
|
+
if (isVec4(emissive)) {
|
|
1095
|
+
material.emissiveFactor = emissive.slice(0, 3);
|
|
1096
|
+
} else if (isTexture(emissive)) {
|
|
1097
|
+
material.emissiveTexture = emissive;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1082
1102
|
function convertMaterialsCommonToPbr(gltf) {
|
|
1083
1103
|
// Future work: convert KHR_materials_common lights to KHR_lights_punctual
|
|
1084
1104
|
ForEach.material(gltf, function (material) {
|
|
@@ -1086,80 +1106,61 @@ function convertMaterialsCommonToPbr(gltf) {
|
|
|
1086
1106
|
material.extensions,
|
|
1087
1107
|
defaultValue.EMPTY_OBJECT
|
|
1088
1108
|
).KHR_materials_common;
|
|
1109
|
+
if (!defined(materialsCommon)) {
|
|
1110
|
+
// Nothing to do
|
|
1111
|
+
return;
|
|
1112
|
+
}
|
|
1089
1113
|
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1114
|
+
const values = defaultValue(materialsCommon.values, {});
|
|
1115
|
+
const ambient = values.ambient;
|
|
1116
|
+
const diffuse = values.diffuse;
|
|
1117
|
+
const emission = values.emission;
|
|
1118
|
+
const transparency = values.transparency;
|
|
1119
|
+
|
|
1120
|
+
// These actually exist on the extension object, not the values object despite what's shown in the spec
|
|
1121
|
+
const doubleSided = materialsCommon.doubleSided;
|
|
1122
|
+
const transparent = materialsCommon.transparent;
|
|
1123
|
+
|
|
1124
|
+
// Ignore specular and shininess for now because the conversion to PBR
|
|
1125
|
+
// isn't straightforward and depends on the technique
|
|
1126
|
+
initializePbrMaterial(material);
|
|
1127
|
+
|
|
1128
|
+
const technique = materialsCommon.technique;
|
|
1129
|
+
if (technique === "CONSTANT") {
|
|
1130
|
+
// Add the KHR_materials_unlit extension
|
|
1131
|
+
addExtensionsUsed(gltf, "KHR_materials_unlit");
|
|
1132
|
+
material.extensions = defined(material.extensions)
|
|
1133
|
+
? material.extensions
|
|
1103
1134
|
: {};
|
|
1135
|
+
material.extensions["KHR_materials_unlit"] = {};
|
|
1104
1136
|
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
if (defined(ambient)) {
|
|
1119
|
-
if (isVec4(ambient)) {
|
|
1120
|
-
material.emissiveFactor = ambient.slice(0, 3);
|
|
1121
|
-
} else if (isTexture(ambient)) {
|
|
1122
|
-
material.emissiveTexture = ambient;
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
if (defined(diffuse)) {
|
|
1127
|
-
if (isVec4(diffuse)) {
|
|
1128
|
-
material.pbrMetallicRoughness.baseColorFactor = srgbToLinear(diffuse);
|
|
1129
|
-
} else if (isTexture(diffuse)) {
|
|
1130
|
-
material.pbrMetallicRoughness.baseColorTexture = diffuse;
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
if (defined(doubleSided)) {
|
|
1135
|
-
material.doubleSided = doubleSided;
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1138
|
-
if (defined(emission)) {
|
|
1139
|
-
if (isVec4(emission)) {
|
|
1140
|
-
material.emissiveFactor = emission.slice(0, 3);
|
|
1141
|
-
} else if (isTexture(emission)) {
|
|
1142
|
-
material.emissiveTexture = emission;
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
if (defined(transparency)) {
|
|
1147
|
-
if (defined(material.pbrMetallicRoughness.baseColorFactor)) {
|
|
1148
|
-
material.pbrMetallicRoughness.baseColorFactor[3] *= transparency;
|
|
1149
|
-
} else {
|
|
1150
|
-
material.pbrMetallicRoughness.baseColorFactor = [
|
|
1151
|
-
1,
|
|
1152
|
-
1,
|
|
1153
|
-
1,
|
|
1154
|
-
transparency,
|
|
1155
|
-
];
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1137
|
+
// The CONSTANT technique does not support 'diffuse', so
|
|
1138
|
+
// assign either the 'emission' or the 'ambient' as the
|
|
1139
|
+
// base color
|
|
1140
|
+
assignAsBaseColor(material, emission);
|
|
1141
|
+
assignAsBaseColor(material, ambient);
|
|
1142
|
+
} else {
|
|
1143
|
+
// Assign the 'diffuse' as the base color, and
|
|
1144
|
+
// the 'ambient' or 'emissive' as the emissive
|
|
1145
|
+
// part if they are present.
|
|
1146
|
+
assignAsBaseColor(material, diffuse);
|
|
1147
|
+
assignAsEmissive(material, ambient);
|
|
1148
|
+
assignAsEmissive(material, emission);
|
|
1149
|
+
}
|
|
1158
1150
|
|
|
1159
|
-
|
|
1160
|
-
|
|
1151
|
+
if (defined(doubleSided)) {
|
|
1152
|
+
material.doubleSided = doubleSided;
|
|
1153
|
+
}
|
|
1154
|
+
if (defined(transparency)) {
|
|
1155
|
+
if (defined(material.pbrMetallicRoughness.baseColorFactor)) {
|
|
1156
|
+
material.pbrMetallicRoughness.baseColorFactor[3] *= transparency;
|
|
1157
|
+
} else {
|
|
1158
|
+
material.pbrMetallicRoughness.baseColorFactor = [1, 1, 1, transparency];
|
|
1161
1159
|
}
|
|
1162
1160
|
}
|
|
1161
|
+
if (defined(transparent)) {
|
|
1162
|
+
material.alphaMode = transparent ? "BLEND" : "OPAQUE";
|
|
1163
|
+
}
|
|
1163
1164
|
});
|
|
1164
1165
|
|
|
1165
1166
|
removeExtension(gltf, "KHR_materials_common");
|