@rtzh/engine 0.0.3 → 0.0.5
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/zip-web-worker.js +640 -0
- package/Build/Workers/chunk-23CHWHW6.js +97 -0
- package/Build/Workers/chunk-27JI7F7B.js +101 -0
- package/Build/Workers/chunk-2OWEFNS4.js +97 -0
- package/Build/Workers/chunk-2VN5W6HA.js +352 -0
- package/Build/Workers/chunk-2YAONTGQ.js +476 -0
- package/Build/Workers/chunk-324L25HV.js +352 -0
- package/Build/Workers/chunk-3EZBCDBK.js +439 -0
- package/Build/Workers/chunk-3JPA6GA3.js +837 -0
- package/Build/Workers/chunk-3WRJXCJS.js +497 -0
- package/Build/Workers/chunk-3ZJ6X3BW.js +57 -0
- package/Build/Workers/chunk-42I3QSKJ.js +280 -0
- package/Build/Workers/chunk-4BJHO56J.js +171 -0
- package/Build/Workers/chunk-4GPHI5UY.js +288 -0
- package/Build/Workers/chunk-4NAHNN5G.js +288 -0
- package/Build/Workers/chunk-54AFUJNV.js +414 -0
- package/Build/Workers/chunk-553BNJPP.js +299 -0
- package/Build/Workers/chunk-56MKFDJH.js +778 -0
- package/Build/Workers/chunk-5DPCF65K.js +162 -0
- package/Build/Workers/chunk-5MCUZL44.js +455 -0
- package/Build/Workers/chunk-5T4DXPEL.js +299 -0
- package/Build/Workers/chunk-5UHIRI2A.js +1800 -0
- package/Build/Workers/chunk-664SI23B.js +368 -0
- package/Build/Workers/chunk-6GNLKYQO.js +114 -0
- package/Build/Workers/chunk-6ZF4QOFM.js +2058 -0
- package/Build/Workers/chunk-763Q2YKY.js +1483 -0
- package/Build/Workers/chunk-7R74V5Z3.js +241 -0
- package/Build/Workers/chunk-7X6CLAD2.js +439 -0
- package/Build/Workers/chunk-ADQVXDEJ.js +2719 -0
- package/Build/Workers/chunk-ATC2WXI4.js +1054 -0
- package/Build/Workers/chunk-B5ZUBUPB.js +398 -0
- package/Build/Workers/chunk-BHTWF7UG.js +73 -0
- package/Build/Workers/chunk-BLZILZWF.js +2719 -0
- package/Build/Workers/chunk-CCPKBCZD.js +171 -0
- package/Build/Workers/chunk-CMAG5O53.js +1483 -0
- package/Build/Workers/chunk-D3FNWB3Q.js +138 -0
- package/Build/Workers/chunk-DAYNPAVN.js +58 -0
- package/Build/Workers/chunk-DKJMD2HX.js +2058 -0
- package/Build/Workers/chunk-DVTKM7FF.js +256 -0
- package/Build/Workers/chunk-FTHCZAWE.js +44 -0
- package/Build/Workers/chunk-FTXEOX64.js +1067 -0
- package/Build/Workers/chunk-FUFHIXPT.js +305 -0
- package/Build/Workers/chunk-G2KELS4I.js +138 -0
- package/Build/Workers/chunk-GCZNJHST.js +162 -0
- package/Build/Workers/chunk-GJFIEALZ.js +387 -0
- package/Build/Workers/chunk-HC6DDPFU.js +198 -0
- package/Build/Workers/chunk-HHN2M3ES.js +682 -0
- package/Build/Workers/chunk-HHUKBKWS.js +414 -0
- package/Build/Workers/chunk-HLIXASKN.js +476 -0
- package/Build/Workers/chunk-IEBTKCMB.js +497 -0
- package/Build/Workers/chunk-IYXLSOLF.js +692 -0
- package/Build/Workers/chunk-JJD7S2CV.js +3514 -0
- package/Build/Workers/chunk-K6PDZWHZ.js +1460 -0
- package/Build/Workers/chunk-KWFCDTXS.js +940 -0
- package/Build/Workers/chunk-LENXRROQ.js +398 -0
- package/Build/Workers/chunk-MB2ZJQR3.js +55 -0
- package/Build/Workers/chunk-MCNY7SPD.js +139 -0
- package/Build/Workers/chunk-MHEKNHOF.js +511 -0
- package/Build/Workers/chunk-MRLJERN3.js +114 -0
- package/Build/Workers/chunk-NOJAQPXU.js +102 -0
- package/Build/Workers/chunk-OAFZ26QL.js +837 -0
- package/Build/Workers/chunk-OBQVOEPZ.js +124 -0
- package/Build/Workers/chunk-OC63Z35M.js +280 -0
- package/Build/Workers/chunk-OEAC5XUG.js +73 -0
- package/Build/Workers/chunk-OQK27J4J.js +139 -0
- package/Build/Workers/chunk-OTDNJAYJ.js +55 -0
- package/Build/Workers/chunk-PGYA2CMO.js +642 -0
- package/Build/Workers/chunk-PSDWIJMU.js +219 -0
- package/Build/Workers/chunk-PW3GQAXA.js +3514 -0
- package/Build/Workers/chunk-Q2YRPH7V.js +1067 -0
- package/Build/Workers/chunk-QDNIPHD7.js +368 -0
- package/Build/Workers/chunk-QEGQDFX2.js +1045 -0
- package/Build/Workers/chunk-R5U3MYPS.js +198 -0
- package/Build/Workers/chunk-RJIH4MDC.js +241 -0
- package/Build/Workers/chunk-RO7SDGOD.js +352 -0
- package/Build/Workers/chunk-RTJ6L5O4.js +163 -0
- package/Build/Workers/chunk-SCNCHSTQ.js +642 -0
- package/Build/Workers/chunk-SG56ZOPD.js +788 -0
- package/Build/Workers/chunk-SHQEATE2.js +1045 -0
- package/Build/Workers/chunk-SPL7JK6K.js +1054 -0
- package/Build/Workers/chunk-SYCWSSRX.js +1443 -0
- package/Build/Workers/chunk-TEZGNCXH.js +8366 -0
- package/Build/Workers/chunk-TIQZUI5N.js +44 -0
- package/Build/Workers/chunk-TKJHRY4V.js +511 -0
- package/Build/Workers/chunk-TLXEQ5QY.js +778 -0
- package/Build/Workers/chunk-UIMHSWDJ.js +455 -0
- package/Build/Workers/chunk-UO3AWZR3.js +352 -0
- package/Build/Workers/chunk-UTXXZ7XH.js +940 -0
- package/Build/Workers/chunk-V2TRFTCU.js +1317 -0
- package/Build/Workers/chunk-V4I3IKAK.js +1460 -0
- package/Build/Workers/chunk-W2EK42GB.js +75 -0
- package/Build/Workers/chunk-W2OMUTYA.js +1800 -0
- package/Build/Workers/chunk-WHOEQFL4.js +682 -0
- package/Build/Workers/chunk-XHNWVOIJ.js +219 -0
- package/Build/Workers/chunk-XNKQLSHI.js +629 -0
- package/Build/Workers/chunk-XOXF37BU.js +1317 -0
- package/Build/Workers/chunk-YC6PFDXQ.js +8366 -0
- package/Build/Workers/chunk-YFJB3US4.js +102 -0
- package/Build/Workers/chunk-YMXATXRN.js +57 -0
- package/Build/Workers/chunk-YVRD2PO5.js +124 -0
- package/Build/Workers/chunk-Z24A5EMJ.js +387 -0
- package/Build/Workers/chunk-Z4IW5XUY.js +788 -0
- package/Build/Workers/chunk-ZFHCP7RN.js +692 -0
- package/Build/Workers/chunk-ZHHEFNHL.js +37 -0
- package/Build/Workers/chunk-ZI5GDNEV.js +305 -0
- package/Build/Workers/chunk-ZYTMDBCR.js +1443 -0
- package/Build/Workers/combineGeometry.js +66 -0
- package/Build/Workers/createBoxGeometry.js +58 -0
- package/Build/Workers/createBoxOutlineGeometry.js +231 -0
- package/Build/Workers/createCircleGeometry.js +201 -0
- package/Build/Workers/createCircleOutlineGeometry.js +147 -0
- package/Build/Workers/createCoplanarPolygonGeometry.js +505 -0
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +225 -0
- package/Build/Workers/createCorridorGeometry.js +1258 -0
- package/Build/Workers/createCorridorOutlineGeometry.js +563 -0
- package/Build/Workers/createCylinderGeometry.js +60 -0
- package/Build/Workers/createCylinderOutlineGeometry.js +231 -0
- package/Build/Workers/createEllipseGeometry.js +72 -0
- package/Build/Workers/createEllipseOutlineGeometry.js +65 -0
- package/Build/Workers/createEllipsoidGeometry.js +59 -0
- package/Build/Workers/createEllipsoidOutlineGeometry.js +61 -0
- package/Build/Workers/createFrustumGeometry.js +58 -0
- package/Build/Workers/createFrustumOutlineGeometry.js +234 -0
- package/Build/Workers/createGeometry.js +173 -0
- package/Build/Workers/createGroundPolylineGeometry.js +1602 -0
- package/Build/Workers/createPlaneGeometry.js +223 -0
- package/Build/Workers/createPlaneOutlineGeometry.js +124 -0
- package/Build/Workers/createPolygonGeometry.js +1404 -0
- package/Build/Workers/createPolygonOutlineGeometry.js +532 -0
- package/Build/Workers/createPolylineGeometry.js +491 -0
- package/Build/Workers/createPolylineVolumeGeometry.js +374 -0
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +272 -0
- package/Build/Workers/createRectangleGeometry.js +1264 -0
- package/Build/Workers/createRectangleOutlineGeometry.js +476 -0
- package/Build/Workers/createSimplePolylineGeometry.js +397 -0
- package/Build/Workers/createSphereGeometry.js +116 -0
- package/Build/Workers/createSphereOutlineGeometry.js +116 -0
- package/Build/Workers/createTaskProcessorWorker.js +32 -0
- package/Build/Workers/createVectorTileClampedPolylines.js +492 -0
- package/Build/Workers/createVectorTileGeometries.js +387 -0
- package/Build/Workers/createVectorTilePoints.js +114 -0
- package/Build/Workers/createVectorTilePolygons.js +386 -0
- package/Build/Workers/createVectorTilePolylines.js +262 -0
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +91 -0
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +565 -0
- package/Build/Workers/createVerticesFromHeightmap.js +2254 -0
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +499 -0
- package/Build/Workers/createWallGeometry.js +487 -0
- package/Build/Workers/createWallOutlineGeometry.js +335 -0
- package/Build/Workers/decodeDraco.js +369 -0
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +2680 -0
- package/Build/Workers/decodeI3S.js +1339 -0
- package/Build/Workers/gaussianSplatSorter.js +62 -0
- package/Build/Workers/gaussianSplatTextureGenerator.js +68 -0
- package/Build/Workers/incrementallyBuildTerrainPicker.js +121 -0
- package/Build/Workers/transcodeKTX2.js +3463 -0
- package/Build/Workers/transferTypedArrayTest.js +41 -0
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +820 -0
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +95 -0
- package/Source/Scene/Cesium3DTileset.js +173 -0
- package/Source/Scene/GltfLoader.js +2 -2
- package/Source/Scene/Model/BarycentricWireframePipelineStage.js +176 -0
- package/Source/Scene/Model/I3dmLoader.js +2 -2
- package/Source/Scene/Model/Model.js +174 -2
- package/Source/Scene/Model/Model3DTileContent.js +18 -1
- package/Source/Scene/Model/ModelRuntimePrimitive.js +12 -1
- package/Source/Scene/Model/WireframePipelineStage.js +6 -2
- package/Source/Shaders/Model/ModelFS.glsl +12 -0
- package/Source/Shaders/Model/ModelFS.js +12 -0
- package/Source/Shaders/Model/ModelVS.glsl +4 -0
- package/Source/Shaders/Model/ModelVS.js +4 -0
- package/index.d.ts +166 -0
- package/index.js +57 -56
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import BoundingSphere from "../../Core/BoundingSphere.js";
|
|
2
2
|
import Cartesian3 from "../../Core/Cartesian3.js";
|
|
3
3
|
import Cartographic from "../../Core/Cartographic.js";
|
|
4
4
|
import Check from "../../Core/Check.js";
|
|
@@ -417,6 +417,9 @@ function Model(options) {
|
|
|
417
417
|
this._enableDebugWireframe = options.enableDebugWireframe ?? false;
|
|
418
418
|
this._enableShowOutline = options.enableShowOutline ?? true;
|
|
419
419
|
this._debugWireframe = options.debugWireframe ?? false;
|
|
420
|
+
this._debugWireframeLineWidth = options.debugWireframeLineWidth ?? 1.0;
|
|
421
|
+
this._debugWireframeMode = options.debugWireframeMode ?? "lines";
|
|
422
|
+
this._debugWireframeOverlay = options.debugWireframeOverlay ?? false;
|
|
420
423
|
|
|
421
424
|
// Warning for improper setup of debug wireframe
|
|
422
425
|
if (
|
|
@@ -1194,7 +1197,8 @@ Object.defineProperties(Model.prototype, {
|
|
|
1194
1197
|
if (
|
|
1195
1198
|
this._debugWireframe === true &&
|
|
1196
1199
|
this._enableDebugWireframe === false &&
|
|
1197
|
-
this.type === ModelType.GLTF
|
|
1200
|
+
this.type === ModelType.GLTF &&
|
|
1201
|
+
this._debugWireframeMode === "lines"
|
|
1198
1202
|
) {
|
|
1199
1203
|
oneTimeWarning(
|
|
1200
1204
|
"model-debug-wireframe-ignored",
|
|
@@ -1204,6 +1208,80 @@ Object.defineProperties(Model.prototype, {
|
|
|
1204
1208
|
},
|
|
1205
1209
|
},
|
|
1206
1210
|
|
|
1211
|
+
/**
|
|
1212
|
+
* This property is for debugging only; it is not optimized for production use.
|
|
1213
|
+
* <p>
|
|
1214
|
+
* The line width to use when rendering the model in wireframe mode.
|
|
1215
|
+
* This only applies when <code>debugWireframeMode</code> is set to "barycentric".
|
|
1216
|
+
* For "lines" mode, the line width is limited by the browser's WebGL implementation.
|
|
1217
|
+
* </p>
|
|
1218
|
+
*
|
|
1219
|
+
* @memberof Model.prototype
|
|
1220
|
+
*
|
|
1221
|
+
* @type {number}
|
|
1222
|
+
* @default 1.0
|
|
1223
|
+
*/
|
|
1224
|
+
debugWireframeLineWidth: {
|
|
1225
|
+
get: function () {
|
|
1226
|
+
return this._debugWireframeLineWidth;
|
|
1227
|
+
},
|
|
1228
|
+
set: function (value) {
|
|
1229
|
+
if (this._debugWireframeLineWidth !== value) {
|
|
1230
|
+
this._debugWireframeLineWidth = value;
|
|
1231
|
+
this.resetDrawCommands();
|
|
1232
|
+
}
|
|
1233
|
+
},
|
|
1234
|
+
},
|
|
1235
|
+
|
|
1236
|
+
/**
|
|
1237
|
+
* This property is for debugging only; it is not optimized for production use.
|
|
1238
|
+
* <p>
|
|
1239
|
+
* The mode to use when rendering the model in wireframe mode.
|
|
1240
|
+
* </p>
|
|
1241
|
+
*
|
|
1242
|
+
* @memberof Model.prototype
|
|
1243
|
+
*
|
|
1244
|
+
* @type {"lines" | "barycentric"}
|
|
1245
|
+
* @default "lines"
|
|
1246
|
+
*/
|
|
1247
|
+
debugWireframeMode: {
|
|
1248
|
+
get: function () {
|
|
1249
|
+
return this._debugWireframeMode;
|
|
1250
|
+
},
|
|
1251
|
+
set: function (value) {
|
|
1252
|
+
if (this._debugWireframeMode !== value) {
|
|
1253
|
+
this._debugWireframeMode = value;
|
|
1254
|
+
this.resetDrawCommands();
|
|
1255
|
+
}
|
|
1256
|
+
},
|
|
1257
|
+
},
|
|
1258
|
+
|
|
1259
|
+
/**
|
|
1260
|
+
* This property is for debugging only; it is not optimized for production use.
|
|
1261
|
+
* <p>
|
|
1262
|
+
* When <code>true</code>, the wireframe color is overlaid on top of the model's
|
|
1263
|
+
* original material. When <code>false</code>, the wireframe color replaces the
|
|
1264
|
+
* model's original material entirely. Only applies when <code>debugWireframeMode</code>
|
|
1265
|
+
* is set to "barycentric".
|
|
1266
|
+
* </p>
|
|
1267
|
+
*
|
|
1268
|
+
* @memberof Model.prototype
|
|
1269
|
+
*
|
|
1270
|
+
* @type {boolean}
|
|
1271
|
+
* @default false
|
|
1272
|
+
*/
|
|
1273
|
+
debugWireframeOverlay: {
|
|
1274
|
+
get: function () {
|
|
1275
|
+
return this._debugWireframeOverlay;
|
|
1276
|
+
},
|
|
1277
|
+
set: function (value) {
|
|
1278
|
+
if (this._debugWireframeOverlay !== value) {
|
|
1279
|
+
this._debugWireframeOverlay = value;
|
|
1280
|
+
this.resetDrawCommands();
|
|
1281
|
+
}
|
|
1282
|
+
},
|
|
1283
|
+
},
|
|
1284
|
+
|
|
1207
1285
|
/**
|
|
1208
1286
|
* Whether or not to render the model.
|
|
1209
1287
|
*
|
|
@@ -1868,6 +1946,100 @@ Model.prototype.resetDrawCommands = function () {
|
|
|
1868
1946
|
this._drawCommandsBuilt = false;
|
|
1869
1947
|
};
|
|
1870
1948
|
|
|
1949
|
+
/**
|
|
1950
|
+
* Displays the model in wireframe mode.
|
|
1951
|
+
* <p>
|
|
1952
|
+
* Only affects this model; other models in the scene remain unchanged.
|
|
1953
|
+
* </p>
|
|
1954
|
+
* <p>
|
|
1955
|
+
* For WebGL1 environments using "lines" mode, <code>enableDebugWireframe</code>
|
|
1956
|
+
* must be set to <code>true</code> when the model is loaded, otherwise this method
|
|
1957
|
+
* will have no effect. The "barycentric" mode works without enableDebugWireframe.
|
|
1958
|
+
* </p>
|
|
1959
|
+
*
|
|
1960
|
+
* @param {object} [options] Optional parameters for wireframe display
|
|
1961
|
+
* @param {Color} [options.color=Color.WHITE] A color to apply to the model while in wireframe mode
|
|
1962
|
+
* @param {ColorBlendMode} [options.colorBlendMode=ColorBlendMode.REPLACE] How the color blends with the model
|
|
1963
|
+
* @param {"lines" | "barycentric"} [options.mode="lines"] The wireframe rendering mode
|
|
1964
|
+
* @param {boolean} [options.overlay=false] If true, wireframe color is overlaid on top of the model's original material (only applies to barycentric mode)
|
|
1965
|
+
* @returns {Model} This model instance, to allow chaining of method calls.
|
|
1966
|
+
*
|
|
1967
|
+
* @see Model#hideWireframe
|
|
1968
|
+
* @see Model#toggleWireframe
|
|
1969
|
+
* @see Model#debugWireframe
|
|
1970
|
+
*/
|
|
1971
|
+
Model.prototype.showWireframe = function ({
|
|
1972
|
+
color = Color.WHITE,
|
|
1973
|
+
colorBlendMode = ColorBlendMode.REPLACE,
|
|
1974
|
+
lineWidth = 1.0,
|
|
1975
|
+
mode = "lines",
|
|
1976
|
+
overlay = false,
|
|
1977
|
+
} = {}) {
|
|
1978
|
+
this.color = Color.clone(color);
|
|
1979
|
+
this.colorBlendMode = colorBlendMode;
|
|
1980
|
+
this.debugWireframeLineWidth = lineWidth;
|
|
1981
|
+
this.debugWireframeMode = mode;
|
|
1982
|
+
this.debugWireframeOverlay = overlay;
|
|
1983
|
+
this._drawCommandsBuilt = false;
|
|
1984
|
+
this.debugWireframe = true;
|
|
1985
|
+
return this;
|
|
1986
|
+
};
|
|
1987
|
+
|
|
1988
|
+
/**
|
|
1989
|
+
* Hides the model's wireframe, restoring it to normal rendering mode.
|
|
1990
|
+
* <p>
|
|
1991
|
+
* Only affects this model; other models in the scene remain unchanged.
|
|
1992
|
+
* </p>
|
|
1993
|
+
*
|
|
1994
|
+
* @returns {Model} This model instance, to allow chaining of method calls.
|
|
1995
|
+
*
|
|
1996
|
+
* @see Model#showWireframe
|
|
1997
|
+
* @see Model#toggleWireframe
|
|
1998
|
+
* @see Model#debugWireframe
|
|
1999
|
+
*/
|
|
2000
|
+
Model.prototype.hideWireframe = function () {
|
|
2001
|
+
this.colorBlendMode = ColorBlendMode.HIGHLIGHT;
|
|
2002
|
+
this.color = undefined;
|
|
2003
|
+
this._drawCommandsBuilt = false;
|
|
2004
|
+
this.debugWireframe = false;
|
|
2005
|
+
return this;
|
|
2006
|
+
};
|
|
2007
|
+
|
|
2008
|
+
/**
|
|
2009
|
+
* Toggles the model's wireframe display state.
|
|
2010
|
+
* <p>
|
|
2011
|
+
* If the model is currently in wireframe mode, it will be switched to normal
|
|
2012
|
+
* mode, and vice versa. Only affects this model; other models in the scene
|
|
2013
|
+
* remain unchanged.
|
|
2014
|
+
* </p>
|
|
2015
|
+
* <p>
|
|
2016
|
+
* For WebGL1 environments using "lines" mode, <code>enableDebugWireframe</code>
|
|
2017
|
+
* must be set to <code>true</code> when the model is loaded, otherwise enabling
|
|
2018
|
+
* wireframe will have no effect. The "barycentric" mode works without enableDebugWireframe.
|
|
2019
|
+
* </p>
|
|
2020
|
+
*
|
|
2021
|
+
* @param {object} [options] Optional parameters for wireframe display (only applied when switching to wireframe mode)
|
|
2022
|
+
* @param {Color} [options.color=Color.WHITE] A color to apply to the model while in wireframe mode
|
|
2023
|
+
* @param {ColorBlendMode} [options.colorBlendMode=ColorBlendMode.REPLACE] How the color blends with the model
|
|
2024
|
+
* @param {"lines" | "barycentric"} [options.mode="lines"] The wireframe rendering mode
|
|
2025
|
+
* @param {boolean} [options.overlay=false] If true, wireframe color is overlaid on top of the model's original material (only applies to barycentric mode)
|
|
2026
|
+
* @returns {boolean} <code>true</code> if the model is now displayed in
|
|
2027
|
+
* wireframe mode, <code>false</code> if it is in normal mode.
|
|
2028
|
+
*
|
|
2029
|
+
* @see Model#showWireframe
|
|
2030
|
+
* @see Model#hideWireframe
|
|
2031
|
+
* @see Model#debugWireframe
|
|
2032
|
+
*/
|
|
2033
|
+
Model.prototype.toggleWireframe = function (options) {
|
|
2034
|
+
options = options || {};
|
|
2035
|
+
if (this._debugWireframe) {
|
|
2036
|
+
this.hideWireframe();
|
|
2037
|
+
} else {
|
|
2038
|
+
this.showWireframe(options);
|
|
2039
|
+
}
|
|
2040
|
+
return this._debugWireframe;
|
|
2041
|
+
};
|
|
2042
|
+
|
|
1871
2043
|
const scratchIBLReferenceFrameMatrix4 = new Matrix4();
|
|
1872
2044
|
const scratchIBLReferenceFrameMatrix3 = new Matrix3();
|
|
1873
2045
|
const scratchClippingPlanesMatrix = new Matrix4();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import Color from "../../Core/Color.js";
|
|
2
2
|
import combine from "../../Core/combine.js";
|
|
3
3
|
import defined from "../../Core/defined.js";
|
|
4
4
|
import destroyObject from "../../Core/destroyObject.js";
|
|
@@ -270,10 +270,24 @@ Model3DTileContent.prototype.update = function (tileset, frameState) {
|
|
|
270
270
|
model.showCreditsOnScreen = tileset.showCreditsOnScreen;
|
|
271
271
|
model.splitDirection = tileset.splitDirection;
|
|
272
272
|
model.debugWireframe = tileset.debugWireframe;
|
|
273
|
+
model.debugWireframeLineWidth = tileset.debugWireframeLineWidth;
|
|
274
|
+
model.debugWireframeMode = tileset.debugWireframeMode;
|
|
275
|
+
model.debugWireframeOverlay = tileset.debugWireframeOverlay;
|
|
273
276
|
model.showOutline = tileset.showOutline;
|
|
274
277
|
model.outlineColor = tileset.outlineColor;
|
|
275
278
|
model.pointCloudShading = tileset.pointCloudShading;
|
|
276
279
|
|
|
280
|
+
// Sync color from tileset style to model for barycentric wireframe shader
|
|
281
|
+
if (tileset.debugWireframe) {
|
|
282
|
+
const tilesetStyle = tileset.style;
|
|
283
|
+
if (defined(tilesetStyle) && defined(tilesetStyle.color)) {
|
|
284
|
+
const evaluatedColor = tilesetStyle.color.evaluateColor(undefined);
|
|
285
|
+
if (defined(evaluatedColor)) {
|
|
286
|
+
model.color = evaluatedColor;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
277
291
|
// Updating clipping planes requires more effort because of ownership checks
|
|
278
292
|
const tilesetClippingPlanes = tileset.clippingPlanes;
|
|
279
293
|
model.referenceMatrix = tileset.clippingPlanesOriginMatrix;
|
|
@@ -538,6 +552,9 @@ function makeModelOptions(tileset, tile, content, additionalOptions) {
|
|
|
538
552
|
splitDirection: tileset.splitDirection,
|
|
539
553
|
enableDebugWireframe: tileset._enableDebugWireframe,
|
|
540
554
|
debugWireframe: tileset.debugWireframe,
|
|
555
|
+
debugWireframeLineWidth: tileset.debugWireframeLineWidth,
|
|
556
|
+
debugWireframeMode: tileset.debugWireframeMode,
|
|
557
|
+
debugWireframeOverlay: tileset.debugWireframeOverlay,
|
|
541
558
|
projectTo2D: tileset._projectTo2D,
|
|
542
559
|
enablePick: tileset._enablePick,
|
|
543
560
|
enableShowOutline: tileset._enableShowOutline,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import Check from "../../Core/Check.js";
|
|
2
2
|
import Frozen from "../../Core/Frozen.js";
|
|
3
3
|
import defined from "../../Core/defined.js";
|
|
4
4
|
import PrimitiveType from "../../Core/PrimitiveType.js";
|
|
@@ -30,6 +30,7 @@ import SelectedFeatureIdPipelineStage from "./SelectedFeatureIdPipelineStage.js"
|
|
|
30
30
|
import SkinningPipelineStage from "./SkinningPipelineStage.js";
|
|
31
31
|
import VerticalExaggerationPipelineStage from "./VerticalExaggerationPipelineStage.js";
|
|
32
32
|
import WireframePipelineStage from "./WireframePipelineStage.js";
|
|
33
|
+
import BarycentricWireframePipelineStage from "./BarycentricWireframePipelineStage.js";
|
|
33
34
|
import oneTimeWarning from "../../Core/oneTimeWarning.js";
|
|
34
35
|
|
|
35
36
|
/**
|
|
@@ -229,11 +230,17 @@ ModelRuntimePrimitive.prototype.configurePipeline = function (frameState) {
|
|
|
229
230
|
const generateWireframeIndices =
|
|
230
231
|
model.debugWireframe &&
|
|
231
232
|
PrimitiveType.isTriangles(primitive.primitiveType) &&
|
|
233
|
+
model.debugWireframeMode === "lines" &&
|
|
232
234
|
// Generating index buffers for wireframes is always possible in WebGL2.
|
|
233
235
|
// However, this will only work in WebGL1 if the model was constructed with
|
|
234
236
|
// enableDebugWireframe set to true.
|
|
235
237
|
(model._enableDebugWireframe || useWebgl2);
|
|
236
238
|
|
|
239
|
+
const generateBarycentricWireframe =
|
|
240
|
+
model.debugWireframe &&
|
|
241
|
+
PrimitiveType.isTriangles(primitive.primitiveType) &&
|
|
242
|
+
model.debugWireframeMode === "barycentric";
|
|
243
|
+
|
|
237
244
|
const pointCloudShading = model.pointCloudShading;
|
|
238
245
|
const hasAttenuation =
|
|
239
246
|
defined(pointCloudShading) && pointCloudShading.attenuation;
|
|
@@ -263,6 +270,10 @@ ModelRuntimePrimitive.prototype.configurePipeline = function (frameState) {
|
|
|
263
270
|
pipelineStages.push(WireframePipelineStage);
|
|
264
271
|
}
|
|
265
272
|
|
|
273
|
+
if (generateBarycentricWireframe) {
|
|
274
|
+
pipelineStages.push(BarycentricWireframePipelineStage);
|
|
275
|
+
}
|
|
276
|
+
|
|
266
277
|
if (hasClassification) {
|
|
267
278
|
pipelineStages.push(ClassificationPipelineStage);
|
|
268
279
|
}
|
|
@@ -36,6 +36,12 @@ WireframePipelineStage.process = function (
|
|
|
36
36
|
primitive,
|
|
37
37
|
frameState,
|
|
38
38
|
) {
|
|
39
|
+
const model = renderResources.model;
|
|
40
|
+
|
|
41
|
+
if (model.debugWireframeMode === "barycentric") {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
39
45
|
// Applying normal mapping to the lines will result in rendering
|
|
40
46
|
// errors on Linux. This define is added to disable normal
|
|
41
47
|
// mapping in the shader.
|
|
@@ -45,8 +51,6 @@ WireframePipelineStage.process = function (
|
|
|
45
51
|
undefined,
|
|
46
52
|
ShaderDestination.FRAGMENT,
|
|
47
53
|
);
|
|
48
|
-
|
|
49
|
-
const model = renderResources.model;
|
|
50
54
|
const wireframeIndexBuffer = createWireframeIndexBuffer(
|
|
51
55
|
primitive,
|
|
52
56
|
renderResources.indices,
|
|
@@ -128,6 +128,18 @@ void main()
|
|
|
128
128
|
// When not picking metadata END
|
|
129
129
|
//========================================================================
|
|
130
130
|
|
|
131
|
+
#ifdef HAS_BARYCENTRIC_WIREFRAME
|
|
132
|
+
vec3 d = fwidth(v_barycentric);
|
|
133
|
+
vec3 a3 = smoothstep(vec3(0.0), d * u_wireframeWidth, v_barycentric);
|
|
134
|
+
float edge = min(min(a3.x, a3.y), a3.z);
|
|
135
|
+
|
|
136
|
+
#ifdef WIREFRAME_OVERLAY
|
|
137
|
+
color.rgb = mix(u_wireframeColor.rgb, color.rgb, edge);
|
|
138
|
+
#else
|
|
139
|
+
color = mix(u_wireframeColor, color, edge);
|
|
140
|
+
#endif
|
|
141
|
+
#endif
|
|
142
|
+
|
|
131
143
|
out_FragColor = color;
|
|
132
144
|
}
|
|
133
145
|
|
|
@@ -128,6 +128,18 @@ void main()\n\
|
|
|
128
128
|
#endif\n\
|
|
129
129
|
// When not picking metadata END\n\
|
|
130
130
|
//========================================================================\n\
|
|
131
|
+
\n\
|
|
132
|
+
#ifdef HAS_BARYCENTRIC_WIREFRAME\n\
|
|
133
|
+
vec3 d = fwidth(v_barycentric);\n\
|
|
134
|
+
vec3 a3 = smoothstep(vec3(0.0), d * u_wireframeWidth, v_barycentric);\n\
|
|
135
|
+
float edge = min(min(a3.x, a3.y), a3.z);\n\
|
|
136
|
+
\n\
|
|
137
|
+
#ifdef WIREFRAME_OVERLAY\n\
|
|
138
|
+
color.rgb = mix(u_wireframeColor.rgb, color.rgb, edge);\n\
|
|
139
|
+
#else\n\
|
|
140
|
+
color = mix(u_wireframeColor, color, edge);\n\
|
|
141
|
+
#endif\n\
|
|
142
|
+
#endif\n\
|
|
131
143
|
\n\
|
|
132
144
|
out_FragColor = color;\n\
|
|
133
145
|
}\n\
|
package/index.d.ts
CHANGED
|
@@ -29492,6 +29492,32 @@ export class Cesium3DTileset {
|
|
|
29492
29492
|
* Function for examining vector lines as they are being streamed.
|
|
29493
29493
|
*/
|
|
29494
29494
|
examineVectorLinesFunction: (...params: any[]) => any;
|
|
29495
|
+
/**
|
|
29496
|
+
* This property is for debugging only; it is not optimized for production use.
|
|
29497
|
+
<p>
|
|
29498
|
+
The line width to use when rendering the tileset in wireframe mode.
|
|
29499
|
+
This only applies when <code>debugWireframeMode</code> is set to "barycentric".
|
|
29500
|
+
For "lines" mode, the line width is limited by the browser's WebGL implementation.
|
|
29501
|
+
</p>
|
|
29502
|
+
*/
|
|
29503
|
+
debugWireframeLineWidth: number;
|
|
29504
|
+
/**
|
|
29505
|
+
* This property is for debugging only; it is not optimized for production use.
|
|
29506
|
+
<p>
|
|
29507
|
+
The mode to use when rendering the tileset in wireframe mode.
|
|
29508
|
+
</p>
|
|
29509
|
+
*/
|
|
29510
|
+
debugWireframeMode: "lines" | "barycentric";
|
|
29511
|
+
/**
|
|
29512
|
+
* This property is for debugging only; it is not optimized for production use.
|
|
29513
|
+
<p>
|
|
29514
|
+
When <code>true</code>, the wireframe color is overlaid on top of the tileset's
|
|
29515
|
+
original material. When <code>false</code>, the wireframe color replaces the
|
|
29516
|
+
tileset's original material entirely. Only applies when <code>debugWireframeMode</code>
|
|
29517
|
+
is set to "barycentric".
|
|
29518
|
+
</p>
|
|
29519
|
+
*/
|
|
29520
|
+
debugWireframeOverlay: boolean;
|
|
29495
29521
|
/**
|
|
29496
29522
|
* Gets the tileset's asset object property, which contains metadata about the tileset.
|
|
29497
29523
|
<p>
|
|
@@ -29906,6 +29932,63 @@ export class Cesium3DTileset {
|
|
|
29906
29932
|
* @returns The height of the cartographic or undefined if it could not be found.
|
|
29907
29933
|
*/
|
|
29908
29934
|
getHeight(cartographic: Cartographic, scene: Scene): number | undefined;
|
|
29935
|
+
/**
|
|
29936
|
+
* Displays the tileset in wireframe mode.
|
|
29937
|
+
<p>
|
|
29938
|
+
Only affects this tileset; other tilesets in the scene remain unchanged.
|
|
29939
|
+
</p>
|
|
29940
|
+
<p>
|
|
29941
|
+
For WebGL1 environments using "lines" mode, <code>enableDebugWireframe</code>
|
|
29942
|
+
must be set to <code>true</code> when the tileset is created, otherwise this method
|
|
29943
|
+
will have no effect. The "barycentric" mode works without enableDebugWireframe.
|
|
29944
|
+
</p>
|
|
29945
|
+
* @param [options] - Optional parameters for wireframe display
|
|
29946
|
+
* @param [options.color = Color.WHITE] - A color to apply to all features
|
|
29947
|
+
* @param [options.colorBlendMode = Cesium3DTileColorBlendMode.REPLACE] - How the color blends with features
|
|
29948
|
+
* @param [options.mode = "lines"] - The wireframe rendering mode
|
|
29949
|
+
* @param [options.overlay = false] - If true, wireframe color is overlaid on top of the tileset's original material (only applies to barycentric mode)
|
|
29950
|
+
* @returns This tileset instance, to allow chaining of method calls.
|
|
29951
|
+
*/
|
|
29952
|
+
showWireframe(options?: {
|
|
29953
|
+
color?: Color;
|
|
29954
|
+
colorBlendMode?: Cesium3DTileColorBlendMode;
|
|
29955
|
+
mode?: "lines" | "barycentric";
|
|
29956
|
+
overlay?: boolean;
|
|
29957
|
+
}): Cesium3DTileset;
|
|
29958
|
+
/**
|
|
29959
|
+
* Hides the tileset's wireframe, restoring it to normal rendering mode.
|
|
29960
|
+
<p>
|
|
29961
|
+
Only affects this tileset; other tilesets in the scene remain unchanged.
|
|
29962
|
+
</p>
|
|
29963
|
+
* @returns This tileset instance, to allow chaining of method calls.
|
|
29964
|
+
*/
|
|
29965
|
+
hideWireframe(): Cesium3DTileset;
|
|
29966
|
+
/**
|
|
29967
|
+
* Toggles the tileset's wireframe display state.
|
|
29968
|
+
<p>
|
|
29969
|
+
If the tileset is currently in wireframe mode, it will be switched to normal
|
|
29970
|
+
mode, and vice versa. Only affects this tileset; other tilesets in the scene
|
|
29971
|
+
remain unchanged.
|
|
29972
|
+
</p>
|
|
29973
|
+
<p>
|
|
29974
|
+
For WebGL1 environments using "lines" mode, <code>enableDebugWireframe</code>
|
|
29975
|
+
must be set to <code>true</code> when the tileset is created, otherwise enabling
|
|
29976
|
+
wireframe will have no effect. The "barycentric" mode works without enableDebugWireframe.
|
|
29977
|
+
</p>
|
|
29978
|
+
* @param [options] - Optional parameters for wireframe display (only applied when switching to wireframe mode)
|
|
29979
|
+
* @param [options.color = Color.WHITE] - A color to apply to all features
|
|
29980
|
+
* @param [options.colorBlendMode = Cesium3DTileColorBlendMode.REPLACE] - How the color blends with features
|
|
29981
|
+
* @param [options.mode = "lines"] - The wireframe rendering mode
|
|
29982
|
+
* @param [options.overlay = false] - If true, wireframe color is overlaid on top of the tileset's original material (only applies to barycentric mode)
|
|
29983
|
+
* @returns <code>true</code> if the tileset is now displayed in
|
|
29984
|
+
wireframe mode, <code>false</code> if it is in normal mode.
|
|
29985
|
+
*/
|
|
29986
|
+
toggleWireframe(options?: {
|
|
29987
|
+
color?: Color;
|
|
29988
|
+
colorBlendMode?: Cesium3DTileColorBlendMode;
|
|
29989
|
+
mode?: "lines" | "barycentric";
|
|
29990
|
+
overlay?: boolean;
|
|
29991
|
+
}): boolean;
|
|
29909
29992
|
}
|
|
29910
29993
|
|
|
29911
29994
|
/**
|
|
@@ -38688,6 +38771,32 @@ export class Model {
|
|
|
38688
38771
|
</p>
|
|
38689
38772
|
*/
|
|
38690
38773
|
debugWireframe: boolean;
|
|
38774
|
+
/**
|
|
38775
|
+
* This property is for debugging only; it is not optimized for production use.
|
|
38776
|
+
<p>
|
|
38777
|
+
The line width to use when rendering the model in wireframe mode.
|
|
38778
|
+
This only applies when <code>debugWireframeMode</code> is set to "barycentric".
|
|
38779
|
+
For "lines" mode, the line width is limited by the browser's WebGL implementation.
|
|
38780
|
+
</p>
|
|
38781
|
+
*/
|
|
38782
|
+
debugWireframeLineWidth: number;
|
|
38783
|
+
/**
|
|
38784
|
+
* This property is for debugging only; it is not optimized for production use.
|
|
38785
|
+
<p>
|
|
38786
|
+
The mode to use when rendering the model in wireframe mode.
|
|
38787
|
+
</p>
|
|
38788
|
+
*/
|
|
38789
|
+
debugWireframeMode: "lines" | "barycentric";
|
|
38790
|
+
/**
|
|
38791
|
+
* This property is for debugging only; it is not optimized for production use.
|
|
38792
|
+
<p>
|
|
38793
|
+
When <code>true</code>, the wireframe color is overlaid on top of the model's
|
|
38794
|
+
original material. When <code>false</code>, the wireframe color replaces the
|
|
38795
|
+
model's original material entirely. Only applies when <code>debugWireframeMode</code>
|
|
38796
|
+
is set to "barycentric".
|
|
38797
|
+
</p>
|
|
38798
|
+
*/
|
|
38799
|
+
debugWireframeOverlay: boolean;
|
|
38691
38800
|
/**
|
|
38692
38801
|
* Whether or not to render the model.
|
|
38693
38802
|
*/
|
|
@@ -38863,6 +38972,63 @@ export class Model {
|
|
|
38863
38972
|
to re-evaluate the style in the next frame the model is visible.
|
|
38864
38973
|
*/
|
|
38865
38974
|
makeStyleDirty(): void;
|
|
38975
|
+
/**
|
|
38976
|
+
* Displays the model in wireframe mode.
|
|
38977
|
+
<p>
|
|
38978
|
+
Only affects this model; other models in the scene remain unchanged.
|
|
38979
|
+
</p>
|
|
38980
|
+
<p>
|
|
38981
|
+
For WebGL1 environments using "lines" mode, <code>enableDebugWireframe</code>
|
|
38982
|
+
must be set to <code>true</code> when the model is loaded, otherwise this method
|
|
38983
|
+
will have no effect. The "barycentric" mode works without enableDebugWireframe.
|
|
38984
|
+
</p>
|
|
38985
|
+
* @param [options] - Optional parameters for wireframe display
|
|
38986
|
+
* @param [options.color = Color.WHITE] - A color to apply to the model while in wireframe mode
|
|
38987
|
+
* @param [options.colorBlendMode = ColorBlendMode.REPLACE] - How the color blends with the model
|
|
38988
|
+
* @param [options.mode = "lines"] - The wireframe rendering mode
|
|
38989
|
+
* @param [options.overlay = false] - If true, wireframe color is overlaid on top of the model's original material (only applies to barycentric mode)
|
|
38990
|
+
* @returns This model instance, to allow chaining of method calls.
|
|
38991
|
+
*/
|
|
38992
|
+
showWireframe(options?: {
|
|
38993
|
+
color?: Color;
|
|
38994
|
+
colorBlendMode?: ColorBlendMode;
|
|
38995
|
+
mode?: "lines" | "barycentric";
|
|
38996
|
+
overlay?: boolean;
|
|
38997
|
+
}): Model;
|
|
38998
|
+
/**
|
|
38999
|
+
* Hides the model's wireframe, restoring it to normal rendering mode.
|
|
39000
|
+
<p>
|
|
39001
|
+
Only affects this model; other models in the scene remain unchanged.
|
|
39002
|
+
</p>
|
|
39003
|
+
* @returns This model instance, to allow chaining of method calls.
|
|
39004
|
+
*/
|
|
39005
|
+
hideWireframe(): Model;
|
|
39006
|
+
/**
|
|
39007
|
+
* Toggles the model's wireframe display state.
|
|
39008
|
+
<p>
|
|
39009
|
+
If the model is currently in wireframe mode, it will be switched to normal
|
|
39010
|
+
mode, and vice versa. Only affects this model; other models in the scene
|
|
39011
|
+
remain unchanged.
|
|
39012
|
+
</p>
|
|
39013
|
+
<p>
|
|
39014
|
+
For WebGL1 environments using "lines" mode, <code>enableDebugWireframe</code>
|
|
39015
|
+
must be set to <code>true</code> when the model is loaded, otherwise enabling
|
|
39016
|
+
wireframe will have no effect. The "barycentric" mode works without enableDebugWireframe.
|
|
39017
|
+
</p>
|
|
39018
|
+
* @param [options] - Optional parameters for wireframe display (only applied when switching to wireframe mode)
|
|
39019
|
+
* @param [options.color = Color.WHITE] - A color to apply to the model while in wireframe mode
|
|
39020
|
+
* @param [options.colorBlendMode = ColorBlendMode.REPLACE] - How the color blends with the model
|
|
39021
|
+
* @param [options.mode = "lines"] - The wireframe rendering mode
|
|
39022
|
+
* @param [options.overlay = false] - If true, wireframe color is overlaid on top of the model's original material (only applies to barycentric mode)
|
|
39023
|
+
* @returns <code>true</code> if the model is now displayed in
|
|
39024
|
+
wireframe mode, <code>false</code> if it is in normal mode.
|
|
39025
|
+
*/
|
|
39026
|
+
toggleWireframe(options?: {
|
|
39027
|
+
color?: Color;
|
|
39028
|
+
colorBlendMode?: ColorBlendMode;
|
|
39029
|
+
mode?: "lines" | "barycentric";
|
|
39030
|
+
overlay?: boolean;
|
|
39031
|
+
}): boolean;
|
|
38866
39032
|
/**
|
|
38867
39033
|
* Called when {@link Viewer} or {@link CesiumWidget} render the scene to
|
|
38868
39034
|
get the draw commands needed to render this primitive.
|