@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
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Cesium - https://github.com/CesiumGS/cesium
|
|
4
|
+
* Version 0.0.5
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2011-2022 Cesium Contributors
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*
|
|
20
|
+
* Columbus View (Pat. Pend.)
|
|
21
|
+
*
|
|
22
|
+
* Portions licensed separately.
|
|
23
|
+
* See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import {
|
|
27
|
+
Cesium3DTilesTerrainGeometryProcessor_default
|
|
28
|
+
} from "./chunk-JJD7S2CV.js";
|
|
29
|
+
import "./chunk-RO7SDGOD.js";
|
|
30
|
+
import "./chunk-Z4IW5XUY.js";
|
|
31
|
+
import {
|
|
32
|
+
createTaskProcessorWorker_default
|
|
33
|
+
} from "./chunk-27JI7F7B.js";
|
|
34
|
+
import "./chunk-6GNLKYQO.js";
|
|
35
|
+
import "./chunk-OAFZ26QL.js";
|
|
36
|
+
import "./chunk-3EZBCDBK.js";
|
|
37
|
+
import "./chunk-4GPHI5UY.js";
|
|
38
|
+
import "./chunk-GCZNJHST.js";
|
|
39
|
+
import "./chunk-XOXF37BU.js";
|
|
40
|
+
import "./chunk-CCPKBCZD.js";
|
|
41
|
+
import "./chunk-OQK27J4J.js";
|
|
42
|
+
import "./chunk-UTXXZ7XH.js";
|
|
43
|
+
import "./chunk-MB2ZJQR3.js";
|
|
44
|
+
import "./chunk-TEZGNCXH.js";
|
|
45
|
+
import "./chunk-DKJMD2HX.js";
|
|
46
|
+
import "./chunk-DVTKM7FF.js";
|
|
47
|
+
import "./chunk-XNKQLSHI.js";
|
|
48
|
+
import "./chunk-DAYNPAVN.js";
|
|
49
|
+
import "./chunk-V4I3IKAK.js";
|
|
50
|
+
import "./chunk-ZYTMDBCR.js";
|
|
51
|
+
import "./chunk-IEBTKCMB.js";
|
|
52
|
+
import "./chunk-RTJ6L5O4.js";
|
|
53
|
+
import "./chunk-W2EK42GB.js";
|
|
54
|
+
|
|
55
|
+
// packages/engine/Source/Workers/upsampleVerticesFromCesium3DTilesTerrain.js
|
|
56
|
+
function upsampleVerticesFromCesium3DTilesTerrain(options, transferableObjects) {
|
|
57
|
+
const mesh = Cesium3DTilesTerrainGeometryProcessor_default.upsampleMesh(options);
|
|
58
|
+
const verticesBuffer = mesh.vertices.buffer;
|
|
59
|
+
const indicesBuffer = mesh.indices.buffer;
|
|
60
|
+
const westIndicesBuffer = mesh.westIndicesSouthToNorth.buffer;
|
|
61
|
+
const southIndicesBuffer = mesh.southIndicesEastToWest.buffer;
|
|
62
|
+
const eastIndicesBuffer = mesh.eastIndicesNorthToSouth.buffer;
|
|
63
|
+
const northIndicesBuffer = mesh.northIndicesWestToEast.buffer;
|
|
64
|
+
transferableObjects.push(
|
|
65
|
+
verticesBuffer,
|
|
66
|
+
indicesBuffer,
|
|
67
|
+
westIndicesBuffer,
|
|
68
|
+
southIndicesBuffer,
|
|
69
|
+
eastIndicesBuffer,
|
|
70
|
+
northIndicesBuffer
|
|
71
|
+
);
|
|
72
|
+
const result = {
|
|
73
|
+
verticesBuffer,
|
|
74
|
+
indicesBuffer,
|
|
75
|
+
vertexCountWithoutSkirts: mesh.vertexCountWithoutSkirts,
|
|
76
|
+
indexCountWithoutSkirts: mesh.indexCountWithoutSkirts,
|
|
77
|
+
encoding: mesh.encoding,
|
|
78
|
+
westIndicesBuffer,
|
|
79
|
+
southIndicesBuffer,
|
|
80
|
+
eastIndicesBuffer,
|
|
81
|
+
northIndicesBuffer,
|
|
82
|
+
minimumHeight: mesh.minimumHeight,
|
|
83
|
+
maximumHeight: mesh.maximumHeight,
|
|
84
|
+
boundingSphere: mesh.boundingSphere3D,
|
|
85
|
+
orientedBoundingBox: mesh.orientedBoundingBox,
|
|
86
|
+
horizonOcclusionPoint: mesh.horizonOcclusionPoint
|
|
87
|
+
};
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
var upsampleVerticesFromCesium3DTilesTerrain_default = createTaskProcessorWorker_default(
|
|
91
|
+
upsampleVerticesFromCesium3DTilesTerrain
|
|
92
|
+
);
|
|
93
|
+
export {
|
|
94
|
+
upsampleVerticesFromCesium3DTilesTerrain_default as default
|
|
95
|
+
};
|
|
@@ -63,6 +63,7 @@ import Cesium3DTilesetSkipTraversal from "./Cesium3DTilesetSkipTraversal.js";
|
|
|
63
63
|
import Ray from "../Core/Ray.js";
|
|
64
64
|
import DynamicEnvironmentMapManager from "./DynamicEnvironmentMapManager.js";
|
|
65
65
|
import ImageryLayerCollection from "./ImageryLayerCollection.js";
|
|
66
|
+
import Cesium3DTileStyle from "./Cesium3DTileStyle.js";
|
|
66
67
|
|
|
67
68
|
/**
|
|
68
69
|
* @typedef {object} Cesium3DTileset.ConstructorOptions
|
|
@@ -949,6 +950,12 @@ function Cesium3DTileset(options) {
|
|
|
949
950
|
*/
|
|
950
951
|
this.debugWireframe = options.debugWireframe ?? false;
|
|
951
952
|
|
|
953
|
+
this._wireframeOriginalStyle = undefined;
|
|
954
|
+
this._wireframeOriginalColorBlendMode = this.colorBlendMode;
|
|
955
|
+
this._debugWireframeLineWidth = options.debugWireframeLineWidth ?? 1.0;
|
|
956
|
+
this._debugWireframeMode = options.debugWireframeMode ?? "lines";
|
|
957
|
+
this._debugWireframeOverlay = options.debugWireframeOverlay ?? false;
|
|
958
|
+
|
|
952
959
|
// Warning for improper setup of debug wireframe
|
|
953
960
|
if (this.debugWireframe === true && this._enableDebugWireframe === false) {
|
|
954
961
|
oneTimeWarning(
|
|
@@ -1092,6 +1099,71 @@ Object.defineProperties(Cesium3DTileset.prototype, {
|
|
|
1092
1099
|
},
|
|
1093
1100
|
},
|
|
1094
1101
|
|
|
1102
|
+
/**
|
|
1103
|
+
* This property is for debugging only; it is not optimized for production use.
|
|
1104
|
+
* <p>
|
|
1105
|
+
* The line width to use when rendering the tileset in wireframe mode.
|
|
1106
|
+
* This only applies when <code>debugWireframeMode</code> is set to "barycentric".
|
|
1107
|
+
* For "lines" mode, the line width is limited by the browser's WebGL implementation.
|
|
1108
|
+
* </p>
|
|
1109
|
+
*
|
|
1110
|
+
* @memberof Cesium3DTileset.prototype
|
|
1111
|
+
*
|
|
1112
|
+
* @type {number}
|
|
1113
|
+
* @default 1.0
|
|
1114
|
+
*/
|
|
1115
|
+
debugWireframeLineWidth: {
|
|
1116
|
+
get: function () {
|
|
1117
|
+
return this._debugWireframeLineWidth;
|
|
1118
|
+
},
|
|
1119
|
+
set: function (value) {
|
|
1120
|
+
this._debugWireframeLineWidth = value;
|
|
1121
|
+
},
|
|
1122
|
+
},
|
|
1123
|
+
|
|
1124
|
+
/**
|
|
1125
|
+
* This property is for debugging only; it is not optimized for production use.
|
|
1126
|
+
* <p>
|
|
1127
|
+
* The mode to use when rendering the tileset in wireframe mode.
|
|
1128
|
+
* </p>
|
|
1129
|
+
*
|
|
1130
|
+
* @memberof Cesium3DTileset.prototype
|
|
1131
|
+
*
|
|
1132
|
+
* @type {"lines" | "barycentric"}
|
|
1133
|
+
* @default "lines"
|
|
1134
|
+
*/
|
|
1135
|
+
debugWireframeMode: {
|
|
1136
|
+
get: function () {
|
|
1137
|
+
return this._debugWireframeMode;
|
|
1138
|
+
},
|
|
1139
|
+
set: function (value) {
|
|
1140
|
+
this._debugWireframeMode = value;
|
|
1141
|
+
},
|
|
1142
|
+
},
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* This property is for debugging only; it is not optimized for production use.
|
|
1146
|
+
* <p>
|
|
1147
|
+
* When <code>true</code>, the wireframe color is overlaid on top of the tileset's
|
|
1148
|
+
* original material. When <code>false</code>, the wireframe color replaces the
|
|
1149
|
+
* tileset's original material entirely. Only applies when <code>debugWireframeMode</code>
|
|
1150
|
+
* is set to "barycentric".
|
|
1151
|
+
* </p>
|
|
1152
|
+
*
|
|
1153
|
+
* @memberof Cesium3DTileset.prototype
|
|
1154
|
+
*
|
|
1155
|
+
* @type {boolean}
|
|
1156
|
+
* @default false
|
|
1157
|
+
*/
|
|
1158
|
+
debugWireframeOverlay: {
|
|
1159
|
+
get: function () {
|
|
1160
|
+
return this._debugWireframeOverlay;
|
|
1161
|
+
},
|
|
1162
|
+
set: function (value) {
|
|
1163
|
+
this._debugWireframeOverlay = value;
|
|
1164
|
+
},
|
|
1165
|
+
},
|
|
1166
|
+
|
|
1095
1167
|
/**
|
|
1096
1168
|
* Gets the tileset's asset object property, which contains metadata about the tileset.
|
|
1097
1169
|
* <p>
|
|
@@ -3929,4 +4001,105 @@ Cesium3DTileset.prototype.isGltfExtensionRequired = function (
|
|
|
3929
4001
|
* @param {number} time The time of interpolation generally in the range <code>[0.0, 1.0]</code>.
|
|
3930
4002
|
* @returns {number} The interpolated value.
|
|
3931
4003
|
*/
|
|
4004
|
+
|
|
4005
|
+
/**
|
|
4006
|
+
* Displays the tileset in wireframe mode.
|
|
4007
|
+
* <p>
|
|
4008
|
+
* Only affects this tileset; other tilesets in the scene remain unchanged.
|
|
4009
|
+
* </p>
|
|
4010
|
+
* <p>
|
|
4011
|
+
* For WebGL1 environments using "lines" mode, <code>enableDebugWireframe</code>
|
|
4012
|
+
* must be set to <code>true</code> when the tileset is created, otherwise this method
|
|
4013
|
+
* will have no effect. The "barycentric" mode works without enableDebugWireframe.
|
|
4014
|
+
* </p>
|
|
4015
|
+
*
|
|
4016
|
+
* @param {object} [options] Optional parameters for wireframe display
|
|
4017
|
+
* @param {Color} [options.color=Color.WHITE] A color to apply to all features
|
|
4018
|
+
* @param {Cesium3DTileColorBlendMode} [options.colorBlendMode=Cesium3DTileColorBlendMode.REPLACE] How the color blends with features
|
|
4019
|
+
* @param {"lines" | "barycentric"} [options.mode="lines"] The wireframe rendering mode
|
|
4020
|
+
* @param {boolean} [options.overlay=false] If true, wireframe color is overlaid on top of the tileset's original material (only applies to barycentric mode)
|
|
4021
|
+
* @returns {Cesium3DTileset} This tileset instance, to allow chaining of method calls.
|
|
4022
|
+
*
|
|
4023
|
+
* @see Cesium3DTileset#hideWireframe
|
|
4024
|
+
* @see Cesium3DTileset#toggleWireframe
|
|
4025
|
+
* @see Cesium3DTileset#debugWireframe
|
|
4026
|
+
*/
|
|
4027
|
+
Cesium3DTileset.prototype.showWireframe = function ({
|
|
4028
|
+
color = Color.WHITE,
|
|
4029
|
+
colorBlendMode = Cesium3DTileColorBlendMode.REPLACE,
|
|
4030
|
+
lineWidth = 1.0,
|
|
4031
|
+
mode = "lines",
|
|
4032
|
+
overlay = false,
|
|
4033
|
+
} = {}) {
|
|
4034
|
+
if (!this.debugWireframe) {
|
|
4035
|
+
this._wireframeOriginalStyle = this.style;
|
|
4036
|
+
this._wireframeOriginalColorBlendMode = this.colorBlendMode;
|
|
4037
|
+
}
|
|
4038
|
+
|
|
4039
|
+
this.colorBlendMode = colorBlendMode;
|
|
4040
|
+
this.style = new Cesium3DTileStyle({
|
|
4041
|
+
color: color.toCssColorString(),
|
|
4042
|
+
});
|
|
4043
|
+
this.debugWireframeLineWidth = lineWidth;
|
|
4044
|
+
this.debugWireframeMode = mode;
|
|
4045
|
+
this.debugWireframeOverlay = overlay;
|
|
4046
|
+
this.debugWireframe = true;
|
|
4047
|
+
|
|
4048
|
+
return this;
|
|
4049
|
+
};
|
|
4050
|
+
|
|
4051
|
+
/**
|
|
4052
|
+
* Hides the tileset's wireframe, restoring it to normal rendering mode.
|
|
4053
|
+
* <p>
|
|
4054
|
+
* Only affects this tileset; other tilesets in the scene remain unchanged.
|
|
4055
|
+
* </p>
|
|
4056
|
+
*
|
|
4057
|
+
* @returns {Cesium3DTileset} This tileset instance, to allow chaining of method calls.
|
|
4058
|
+
*
|
|
4059
|
+
* @see Cesium3DTileset#showWireframe
|
|
4060
|
+
* @see Cesium3DTileset#toggleWireframe
|
|
4061
|
+
* @see Cesium3DTileset#debugWireframe
|
|
4062
|
+
*/
|
|
4063
|
+
Cesium3DTileset.prototype.hideWireframe = function () {
|
|
4064
|
+
this.debugWireframe = false;
|
|
4065
|
+
this.colorBlendMode = this._wireframeOriginalColorBlendMode;
|
|
4066
|
+
this.style = this._wireframeOriginalStyle;
|
|
4067
|
+
|
|
4068
|
+
return this;
|
|
4069
|
+
};
|
|
4070
|
+
|
|
4071
|
+
/**
|
|
4072
|
+
* Toggles the tileset's wireframe display state.
|
|
4073
|
+
* <p>
|
|
4074
|
+
* If the tileset is currently in wireframe mode, it will be switched to normal
|
|
4075
|
+
* mode, and vice versa. Only affects this tileset; other tilesets in the scene
|
|
4076
|
+
* remain unchanged.
|
|
4077
|
+
* </p>
|
|
4078
|
+
* <p>
|
|
4079
|
+
* For WebGL1 environments using "lines" mode, <code>enableDebugWireframe</code>
|
|
4080
|
+
* must be set to <code>true</code> when the tileset is created, otherwise enabling
|
|
4081
|
+
* wireframe will have no effect. The "barycentric" mode works without enableDebugWireframe.
|
|
4082
|
+
* </p>
|
|
4083
|
+
*
|
|
4084
|
+
* @param {object} [options] Optional parameters for wireframe display (only applied when switching to wireframe mode)
|
|
4085
|
+
* @param {Color} [options.color=Color.WHITE] A color to apply to all features
|
|
4086
|
+
* @param {Cesium3DTileColorBlendMode} [options.colorBlendMode=Cesium3DTileColorBlendMode.REPLACE] How the color blends with features
|
|
4087
|
+
* @param {"lines" | "barycentric"} [options.mode="lines"] The wireframe rendering mode
|
|
4088
|
+
* @param {boolean} [options.overlay=false] If true, wireframe color is overlaid on top of the tileset's original material (only applies to barycentric mode)
|
|
4089
|
+
* @returns {boolean} <code>true</code> if the tileset is now displayed in
|
|
4090
|
+
* wireframe mode, <code>false</code> if it is in normal mode.
|
|
4091
|
+
*
|
|
4092
|
+
* @see Cesium3DTileset#showWireframe
|
|
4093
|
+
* @see Cesium3DTileset#hideWireframe
|
|
4094
|
+
* @see Cesium3DTileset#debugWireframe
|
|
4095
|
+
*/
|
|
4096
|
+
Cesium3DTileset.prototype.toggleWireframe = function (options) {
|
|
4097
|
+
if (this.debugWireframe) {
|
|
4098
|
+
this.hideWireframe();
|
|
4099
|
+
} else {
|
|
4100
|
+
this.showWireframe(options);
|
|
4101
|
+
}
|
|
4102
|
+
return this.debugWireframe;
|
|
4103
|
+
};
|
|
4104
|
+
|
|
3932
4105
|
export default Cesium3DTileset;
|
|
@@ -2201,7 +2201,7 @@ function loadPrimitive(loader, gltfPrimitive, hasInstances, frameState) {
|
|
|
2201
2201
|
let fa = featureIdAttrs[fg];
|
|
2202
2202
|
let label = "featureId_" + fa.setIndex;
|
|
2203
2203
|
if (!existingSetIndices[fa.setIndex] && !existingLabels[label]) {
|
|
2204
|
-
let newFeatId = new
|
|
2204
|
+
let newFeatId = new FeatureIdAttribute();
|
|
2205
2205
|
newFeatId.setIndex = fa.setIndex;
|
|
2206
2206
|
newFeatId.positionalLabel = label;
|
|
2207
2207
|
newFeatId.propertyTableId = 0;
|
|
@@ -2219,7 +2219,7 @@ function loadPrimitive(loader, gltfPrimitive, hasInstances, frameState) {
|
|
|
2219
2219
|
for (let fh = 0; fh <= 1; fh++) {
|
|
2220
2220
|
let defLabel = "featureId_" + fh;
|
|
2221
2221
|
if (!existingLabels[defLabel]) {
|
|
2222
|
-
let defFeatId = new
|
|
2222
|
+
let defFeatId = new FeatureIdAttribute();
|
|
2223
2223
|
defFeatId.setIndex = fh;
|
|
2224
2224
|
defFeatId.positionalLabel = defLabel;
|
|
2225
2225
|
defFeatId.propertyTableId = 0;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import Buffer from "../../Renderer/Buffer.js";
|
|
2
|
+
import BufferUsage from "../../Renderer/BufferUsage.js";
|
|
3
|
+
import Color from "../../Core/Color.js";
|
|
4
|
+
import ComponentDatatype from "../../Core/ComponentDatatype.js";
|
|
5
|
+
import defined from "../../Core/defined.js";
|
|
6
|
+
import IndexDatatype from "../../Core/IndexDatatype.js";
|
|
7
|
+
import ModelUtility from "./ModelUtility.js";
|
|
8
|
+
import PrimitiveType from "../../Core/PrimitiveType.js";
|
|
9
|
+
import ShaderDestination from "../../Renderer/ShaderDestination.js";
|
|
10
|
+
import VertexAttributeSemantic from "../VertexAttributeSemantic.js";
|
|
11
|
+
|
|
12
|
+
const BarycentricWireframePipelineStage = {
|
|
13
|
+
name: "BarycentricWireframePipelineStage",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
BarycentricWireframePipelineStage.process = function (
|
|
17
|
+
renderResources,
|
|
18
|
+
primitive,
|
|
19
|
+
frameState,
|
|
20
|
+
) {
|
|
21
|
+
const shaderBuilder = renderResources.shaderBuilder;
|
|
22
|
+
const model = renderResources.model;
|
|
23
|
+
|
|
24
|
+
const barycentricAttributeLocation = shaderBuilder.addAttribute(
|
|
25
|
+
"vec3",
|
|
26
|
+
"a_barycentric",
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
shaderBuilder.addDefine(
|
|
30
|
+
"HAS_BARYCENTRIC_WIREFRAME",
|
|
31
|
+
undefined,
|
|
32
|
+
ShaderDestination.FRAGMENT,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
if (model.debugWireframeOverlay) {
|
|
36
|
+
shaderBuilder.addDefine(
|
|
37
|
+
"WIREFRAME_OVERLAY",
|
|
38
|
+
undefined,
|
|
39
|
+
ShaderDestination.FRAGMENT,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
shaderBuilder.addVarying("vec3", "v_barycentric");
|
|
44
|
+
|
|
45
|
+
shaderBuilder.addUniform(
|
|
46
|
+
"float",
|
|
47
|
+
"u_wireframeWidth",
|
|
48
|
+
ShaderDestination.FRAGMENT,
|
|
49
|
+
);
|
|
50
|
+
shaderBuilder.addUniform(
|
|
51
|
+
"vec4",
|
|
52
|
+
"u_wireframeColor",
|
|
53
|
+
ShaderDestination.FRAGMENT,
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const stageUniforms = renderResources.uniformMap;
|
|
57
|
+
stageUniforms.u_wireframeWidth = function () {
|
|
58
|
+
return model.debugWireframeLineWidth ?? 1.0;
|
|
59
|
+
};
|
|
60
|
+
stageUniforms.u_wireframeColor = function () {
|
|
61
|
+
return defined(model.color) ? model.color : Color.WHITE;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
addBarycentricAttribute(
|
|
65
|
+
renderResources,
|
|
66
|
+
primitive,
|
|
67
|
+
barycentricAttributeLocation,
|
|
68
|
+
frameState,
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
function getOriginalIndices(primitive, indices, frameState) {
|
|
73
|
+
const positionAttribute = ModelUtility.getAttributeBySemantic(
|
|
74
|
+
primitive,
|
|
75
|
+
VertexAttributeSemantic.POSITION,
|
|
76
|
+
);
|
|
77
|
+
const vertexCount = positionAttribute.count;
|
|
78
|
+
const webgl2 = frameState.context.webgl2;
|
|
79
|
+
|
|
80
|
+
let originalIndices;
|
|
81
|
+
if (defined(indices)) {
|
|
82
|
+
const indicesBuffer = indices.buffer;
|
|
83
|
+
const indicesCount = indices.count;
|
|
84
|
+
if (defined(indicesBuffer) && webgl2) {
|
|
85
|
+
const useUint8Array = indicesBuffer.sizeInBytes === indicesCount;
|
|
86
|
+
originalIndices = useUint8Array
|
|
87
|
+
? new Uint8Array(indicesCount)
|
|
88
|
+
: IndexDatatype.createTypedArray(vertexCount, indicesCount);
|
|
89
|
+
|
|
90
|
+
indicesBuffer.getBufferData(originalIndices);
|
|
91
|
+
} else {
|
|
92
|
+
originalIndices = indices.typedArray;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return originalIndices;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function addBarycentricAttribute(
|
|
99
|
+
renderResources,
|
|
100
|
+
primitive,
|
|
101
|
+
attributeLocation,
|
|
102
|
+
frameState,
|
|
103
|
+
) {
|
|
104
|
+
const positionAttribute = ModelUtility.getAttributeBySemantic(
|
|
105
|
+
primitive,
|
|
106
|
+
VertexAttributeSemantic.POSITION,
|
|
107
|
+
);
|
|
108
|
+
const vertexCount = positionAttribute.count;
|
|
109
|
+
const indices = renderResources.indices;
|
|
110
|
+
const originalIndices = getOriginalIndices(primitive, indices, frameState);
|
|
111
|
+
|
|
112
|
+
const barycentricValues = new Float32Array(vertexCount * 3);
|
|
113
|
+
|
|
114
|
+
if (defined(originalIndices)) {
|
|
115
|
+
const indexCount = indices.count;
|
|
116
|
+
const primitiveType = primitive.primitiveType;
|
|
117
|
+
|
|
118
|
+
if (PrimitiveType.isTriangles(primitiveType)) {
|
|
119
|
+
for (let i = 0; i < indexCount; i += 3) {
|
|
120
|
+
const i0 = originalIndices[i];
|
|
121
|
+
const i1 = originalIndices[i + 1];
|
|
122
|
+
const i2 = originalIndices[i + 2];
|
|
123
|
+
|
|
124
|
+
barycentricValues[i0 * 3] = 1.0;
|
|
125
|
+
barycentricValues[i0 * 3 + 1] = 0.0;
|
|
126
|
+
barycentricValues[i0 * 3 + 2] = 0.0;
|
|
127
|
+
|
|
128
|
+
barycentricValues[i1 * 3] = 0.0;
|
|
129
|
+
barycentricValues[i1 * 3 + 1] = 1.0;
|
|
130
|
+
barycentricValues[i1 * 3 + 2] = 0.0;
|
|
131
|
+
|
|
132
|
+
barycentricValues[i2 * 3] = 0.0;
|
|
133
|
+
barycentricValues[i2 * 3 + 1] = 0.0;
|
|
134
|
+
barycentricValues[i2 * 3 + 2] = 1.0;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
} else {
|
|
138
|
+
for (let i = 0; i < vertexCount; i += 3) {
|
|
139
|
+
const baseIndex = i * 3;
|
|
140
|
+
barycentricValues[baseIndex] = 1.0;
|
|
141
|
+
barycentricValues[baseIndex + 1] = 0.0;
|
|
142
|
+
barycentricValues[baseIndex + 2] = 0.0;
|
|
143
|
+
|
|
144
|
+
barycentricValues[baseIndex + 3] = 0.0;
|
|
145
|
+
barycentricValues[baseIndex + 4] = 1.0;
|
|
146
|
+
barycentricValues[baseIndex + 5] = 0.0;
|
|
147
|
+
|
|
148
|
+
barycentricValues[baseIndex + 6] = 0.0;
|
|
149
|
+
barycentricValues[baseIndex + 7] = 0.0;
|
|
150
|
+
barycentricValues[baseIndex + 8] = 1.0;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const barycentricBuffer = Buffer.createVertexBuffer({
|
|
155
|
+
context: frameState.context,
|
|
156
|
+
typedArray: barycentricValues,
|
|
157
|
+
usage: BufferUsage.STATIC_DRAW,
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
const model = renderResources.model;
|
|
161
|
+
model._pipelineResources.push(barycentricBuffer);
|
|
162
|
+
|
|
163
|
+
const barycentricAttribute = {
|
|
164
|
+
index: attributeLocation,
|
|
165
|
+
vertexBuffer: barycentricBuffer,
|
|
166
|
+
componentsPerAttribute: 3,
|
|
167
|
+
componentDatatype: ComponentDatatype.FLOAT,
|
|
168
|
+
offsetInBytes: 0,
|
|
169
|
+
strideInBytes: 0,
|
|
170
|
+
normalize: false,
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
renderResources.attributes.push(barycentricAttribute);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export default BarycentricWireframePipelineStage;
|
|
@@ -623,7 +623,7 @@ function createInstances(loader, components, frameState) {
|
|
|
623
623
|
featureId1Array[i] = defined(fid1) ? fid1 : 0;
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
|
-
let fid1Attr = new
|
|
626
|
+
let fid1Attr = new Attribute();
|
|
627
627
|
fid1Attr.name = "Instance Feature ID 1";
|
|
628
628
|
fid1Attr.setIndex = 1;
|
|
629
629
|
fid1Attr.semantic = InstanceAttributeSemantic.FEATURE_ID;
|
|
@@ -639,7 +639,7 @@ function createInstances(loader, components, frameState) {
|
|
|
639
639
|
buffers.push(fid1Buf);
|
|
640
640
|
fid1Attr.buffer = fid1Buf;
|
|
641
641
|
instances.attributes.push(fid1Attr);
|
|
642
|
-
let fid1FeatAttr = new
|
|
642
|
+
let fid1FeatAttr = new FeatureIdAttribute();
|
|
643
643
|
fid1FeatAttr.propertyTableId = 0;
|
|
644
644
|
fid1FeatAttr.setIndex = 1;
|
|
645
645
|
fid1FeatAttr.positionalLabel = "instanceFeatureId_1";
|