@rtzh/engine 0.0.4 → 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.
Files changed (180) hide show
  1. package/Build/Workers/{chunk-HAY6YE7M.js → chunk-23CHWHW6.js} +4 -4
  2. package/Build/Workers/{chunk-TSAJNE4K.js → chunk-27JI7F7B.js} +2 -2
  3. package/Build/Workers/{chunk-OVPPHDU7.js → chunk-2OWEFNS4.js} +4 -4
  4. package/Build/Workers/{chunk-YBVMSCW4.js → chunk-2VN5W6HA.js} +5 -5
  5. package/Build/Workers/{chunk-OOB2KZC6.js → chunk-2YAONTGQ.js} +7 -7
  6. package/Build/Workers/{chunk-JH27ZGLN.js → chunk-324L25HV.js} +6 -6
  7. package/Build/Workers/{chunk-6LZBBEA7.js → chunk-3EZBCDBK.js} +9 -9
  8. package/Build/Workers/{chunk-25BA4527.js → chunk-3JPA6GA3.js} +12 -12
  9. package/Build/Workers/{chunk-6XJO625E.js → chunk-3WRJXCJS.js} +5 -5
  10. package/Build/Workers/{chunk-SBFTVHRW.js → chunk-3ZJ6X3BW.js} +5 -5
  11. package/Build/Workers/{chunk-B2VFNYD7.js → chunk-42I3QSKJ.js} +1 -1
  12. package/Build/Workers/{chunk-BXBGWQ3Z.js → chunk-4BJHO56J.js} +6 -6
  13. package/Build/Workers/{chunk-WAS3IHIQ.js → chunk-4GPHI5UY.js} +10 -10
  14. package/Build/Workers/{chunk-3M5CRHSG.js → chunk-4NAHNN5G.js} +10 -10
  15. package/Build/Workers/{chunk-Q2DXNFYW.js → chunk-54AFUJNV.js} +11 -11
  16. package/Build/Workers/{chunk-XOVHLPKW.js → chunk-553BNJPP.js} +8 -8
  17. package/Build/Workers/{chunk-GDIBU55R.js → chunk-56MKFDJH.js} +12 -12
  18. package/Build/Workers/{chunk-K4IMD7KH.js → chunk-5DPCF65K.js} +5 -5
  19. package/Build/Workers/{chunk-5QTPACZQ.js → chunk-5MCUZL44.js} +6 -6
  20. package/Build/Workers/{chunk-2BLQ3B4Q.js → chunk-5T4DXPEL.js} +8 -8
  21. package/Build/Workers/{chunk-56XTN5NJ.js → chunk-5UHIRI2A.js} +2 -2
  22. package/Build/Workers/{chunk-5WAG5YKS.js → chunk-664SI23B.js} +12 -12
  23. package/Build/Workers/{chunk-KVDSJXRK.js → chunk-6GNLKYQO.js} +6 -6
  24. package/Build/Workers/{chunk-POY6ZE32.js → chunk-6ZF4QOFM.js} +6 -6
  25. package/Build/Workers/{chunk-ACH67MPW.js → chunk-763Q2YKY.js} +14 -14
  26. package/Build/Workers/{chunk-IELTSYPZ.js → chunk-7R74V5Z3.js} +8 -8
  27. package/Build/Workers/{chunk-PHB5MRHM.js → chunk-7X6CLAD2.js} +9 -9
  28. package/Build/Workers/{chunk-PV5B2YNB.js → chunk-ADQVXDEJ.js} +16 -16
  29. package/Build/Workers/{chunk-7B23DD46.js → chunk-ATC2WXI4.js} +17 -17
  30. package/Build/Workers/{chunk-KVE5EAPO.js → chunk-B5ZUBUPB.js} +14 -14
  31. package/Build/Workers/{chunk-TWF4XRZ6.js → chunk-BHTWF7UG.js} +2 -2
  32. package/Build/Workers/{chunk-UUJXSLQ2.js → chunk-BLZILZWF.js} +16 -16
  33. package/Build/Workers/{chunk-J4MIJCN5.js → chunk-CCPKBCZD.js} +6 -6
  34. package/Build/Workers/{chunk-4HXPSZRC.js → chunk-CMAG5O53.js} +14 -14
  35. package/Build/Workers/{chunk-FJREGHFG.js → chunk-D3FNWB3Q.js} +4 -4
  36. package/Build/Workers/{chunk-HI6X33GO.js → chunk-DAYNPAVN.js} +2 -2
  37. package/Build/Workers/{chunk-EISI2CR2.js → chunk-DKJMD2HX.js} +6 -6
  38. package/Build/Workers/{chunk-AL22JVIA.js → chunk-DVTKM7FF.js} +4 -4
  39. package/Build/Workers/{chunk-ZV42SJKS.js → chunk-FTHCZAWE.js} +2 -2
  40. package/Build/Workers/{chunk-DP76S3IQ.js → chunk-FTXEOX64.js} +17 -17
  41. package/Build/Workers/{chunk-R73BHGGI.js → chunk-FUFHIXPT.js} +4 -4
  42. package/Build/Workers/{chunk-I76SRIKN.js → chunk-G2KELS4I.js} +4 -4
  43. package/Build/Workers/{chunk-KXB3AARU.js → chunk-GCZNJHST.js} +5 -5
  44. package/Build/Workers/{chunk-2CAIFJD5.js → chunk-GJFIEALZ.js} +13 -13
  45. package/Build/Workers/{chunk-NOH3R3YY.js → chunk-HC6DDPFU.js} +7 -7
  46. package/Build/Workers/{chunk-ELXGXAYS.js → chunk-HHN2M3ES.js} +10 -10
  47. package/Build/Workers/{chunk-WLREXLZ7.js → chunk-HHUKBKWS.js} +11 -11
  48. package/Build/Workers/{chunk-TO7TWUET.js → chunk-HLIXASKN.js} +7 -7
  49. package/Build/Workers/{chunk-WMGESUDW.js → chunk-IEBTKCMB.js} +3 -3
  50. package/Build/Workers/{chunk-KFMCOG26.js → chunk-IYXLSOLF.js} +10 -10
  51. package/Build/Workers/{chunk-4Z26IS65.js → chunk-JJD7S2CV.js} +18 -18
  52. package/Build/Workers/{chunk-YPGJSFOO.js → chunk-K6PDZWHZ.js} +5 -5
  53. package/Build/Workers/{chunk-OAOREOSO.js → chunk-KWFCDTXS.js} +9 -9
  54. package/Build/Workers/{chunk-JURLMTV2.js → chunk-LENXRROQ.js} +14 -14
  55. package/Build/Workers/{chunk-5BIQOSBV.js → chunk-MB2ZJQR3.js} +1 -1
  56. package/Build/Workers/{chunk-KBAGFNQ4.js → chunk-MCNY7SPD.js} +5 -5
  57. package/Build/Workers/{chunk-KUAWPGSB.js → chunk-MHEKNHOF.js} +13 -13
  58. package/Build/Workers/{chunk-SOR7PD4V.js → chunk-MRLJERN3.js} +6 -6
  59. package/Build/Workers/{chunk-MLFVICFZ.js → chunk-NOJAQPXU.js} +4 -4
  60. package/Build/Workers/{chunk-VIYQ56Z7.js → chunk-OAFZ26QL.js} +12 -12
  61. package/Build/Workers/{chunk-245NZYCR.js → chunk-OBQVOEPZ.js} +5 -5
  62. package/Build/Workers/{chunk-5CSRWY7L.js → chunk-OC63Z35M.js} +2 -2
  63. package/Build/Workers/{chunk-E2CARZA7.js → chunk-OEAC5XUG.js} +2 -2
  64. package/Build/Workers/{chunk-55IROWAX.js → chunk-OQK27J4J.js} +5 -5
  65. package/Build/Workers/{chunk-LN4NMLYY.js → chunk-OTDNJAYJ.js} +1 -1
  66. package/Build/Workers/{chunk-LPM2FVDN.js → chunk-PGYA2CMO.js} +6 -6
  67. package/Build/Workers/{chunk-EDIUN7V3.js → chunk-PSDWIJMU.js} +7 -7
  68. package/Build/Workers/{chunk-6QVMKRJ4.js → chunk-PW3GQAXA.js} +22 -22
  69. package/Build/Workers/{chunk-DSBEWMOQ.js → chunk-Q2YRPH7V.js} +17 -17
  70. package/Build/Workers/{chunk-KKYQRQ57.js → chunk-QDNIPHD7.js} +12 -12
  71. package/Build/Workers/{chunk-3K2PK2OU.js → chunk-QEGQDFX2.js} +10 -10
  72. package/Build/Workers/{chunk-PLLZB3R4.js → chunk-R5U3MYPS.js} +7 -7
  73. package/Build/Workers/{chunk-IDVURFRN.js → chunk-RJIH4MDC.js} +8 -8
  74. package/Build/Workers/{chunk-7NCJH26L.js → chunk-RO7SDGOD.js} +5 -5
  75. package/Build/Workers/{chunk-KH2OWUUA.js → chunk-RTJ6L5O4.js} +2 -2
  76. package/Build/Workers/{chunk-JFO3ELF3.js → chunk-SCNCHSTQ.js} +6 -6
  77. package/Build/Workers/{chunk-OFJRMGNX.js → chunk-SG56ZOPD.js} +11 -11
  78. package/Build/Workers/{chunk-WO5ZNC7S.js → chunk-SHQEATE2.js} +11 -11
  79. package/Build/Workers/{chunk-D7TGILR3.js → chunk-SPL7JK6K.js} +17 -17
  80. package/Build/Workers/{chunk-VR2L2Y4Z.js → chunk-SYCWSSRX.js} +4 -4
  81. package/Build/Workers/{chunk-HAWJ7FMN.js → chunk-TEZGNCXH.js} +8 -8
  82. package/Build/Workers/{chunk-BOV6T7FO.js → chunk-TIQZUI5N.js} +2 -2
  83. package/Build/Workers/{chunk-S3AE3MZZ.js → chunk-TKJHRY4V.js} +13 -13
  84. package/Build/Workers/{chunk-KHKSE4WQ.js → chunk-TLXEQ5QY.js} +12 -12
  85. package/Build/Workers/{chunk-FVYRV2T6.js → chunk-UIMHSWDJ.js} +6 -6
  86. package/Build/Workers/{chunk-AIW5F22O.js → chunk-UO3AWZR3.js} +6 -6
  87. package/Build/Workers/{chunk-UOD5YNH3.js → chunk-UTXXZ7XH.js} +9 -9
  88. package/Build/Workers/{chunk-HU5P7PMU.js → chunk-V2TRFTCU.js} +7 -7
  89. package/Build/Workers/{chunk-F5LAPCFC.js → chunk-V4I3IKAK.js} +5 -5
  90. package/Build/Workers/{chunk-AVSQILVI.js → chunk-W2EK42GB.js} +1 -1
  91. package/Build/Workers/{chunk-DBKYAGM6.js → chunk-W2OMUTYA.js} +4 -4
  92. package/Build/Workers/{chunk-U364CIW4.js → chunk-WHOEQFL4.js} +10 -10
  93. package/Build/Workers/{chunk-64W2RXA4.js → chunk-XHNWVOIJ.js} +7 -7
  94. package/Build/Workers/{chunk-5VZISKJF.js → chunk-XNKQLSHI.js} +1 -1
  95. package/Build/Workers/{chunk-66YGZWBI.js → chunk-XOXF37BU.js} +7 -7
  96. package/Build/Workers/{chunk-KQIZ7AFF.js → chunk-YC6PFDXQ.js} +16 -16
  97. package/Build/Workers/{chunk-75UGCVME.js → chunk-YFJB3US4.js} +4 -4
  98. package/Build/Workers/{chunk-TDI7UQBO.js → chunk-YMXATXRN.js} +5 -5
  99. package/Build/Workers/{chunk-MQ62ZE2U.js → chunk-YVRD2PO5.js} +5 -5
  100. package/Build/Workers/{chunk-UTWLMOPM.js → chunk-Z24A5EMJ.js} +13 -13
  101. package/Build/Workers/{chunk-P7M4VYFT.js → chunk-Z4IW5XUY.js} +11 -11
  102. package/Build/Workers/{chunk-XJKMLTSH.js → chunk-ZFHCP7RN.js} +10 -10
  103. package/Build/Workers/{chunk-J3FBVUY4.js → chunk-ZHHEFNHL.js} +1 -1
  104. package/Build/Workers/{chunk-BJ6WXQOW.js → chunk-ZI5GDNEV.js} +4 -4
  105. package/Build/Workers/{chunk-QWV2DM66.js → chunk-ZYTMDBCR.js} +4 -4
  106. package/Build/Workers/combineGeometry.js +24 -24
  107. package/Build/Workers/createBoxGeometry.js +18 -18
  108. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  109. package/Build/Workers/createCircleGeometry.js +26 -26
  110. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  111. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  112. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  113. package/Build/Workers/createCorridorGeometry.js +29 -29
  114. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  115. package/Build/Workers/createCylinderGeometry.js +20 -20
  116. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  117. package/Build/Workers/createEllipseGeometry.js +26 -26
  118. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  119. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  120. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  121. package/Build/Workers/createFrustumGeometry.js +18 -18
  122. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  123. package/Build/Workers/createGeometry.js +24 -24
  124. package/Build/Workers/createGroundPolylineGeometry.js +22 -22
  125. package/Build/Workers/createPlaneGeometry.js +16 -16
  126. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  127. package/Build/Workers/createPolygonGeometry.js +32 -32
  128. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  129. package/Build/Workers/createPolylineGeometry.js +25 -25
  130. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  131. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  132. package/Build/Workers/createRectangleGeometry.js +27 -27
  133. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  134. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  135. package/Build/Workers/createSphereGeometry.js +19 -19
  136. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  137. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  138. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  139. package/Build/Workers/createVectorTileGeometries.js +24 -24
  140. package/Build/Workers/createVectorTilePoints.js +13 -13
  141. package/Build/Workers/createVectorTilePolygons.js +22 -22
  142. package/Build/Workers/createVectorTilePolylines.js +14 -14
  143. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
  144. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  145. package/Build/Workers/createVerticesFromHeightmap.js +22 -22
  146. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
  147. package/Build/Workers/createWallGeometry.js +24 -24
  148. package/Build/Workers/createWallOutlineGeometry.js +23 -23
  149. package/Build/Workers/decodeDraco.js +10 -10
  150. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  151. package/Build/Workers/decodeI3S.js +10 -10
  152. package/Build/Workers/gaussianSplatSorter.js +4 -4
  153. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  154. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  155. package/Build/Workers/transcodeKTX2.js +6 -6
  156. package/Build/Workers/transferTypedArrayTest.js +1 -1
  157. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  158. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
  159. package/Source/Scene/Cesium3DTileset.js +173 -0
  160. package/Source/Scene/Model/BarycentricWireframePipelineStage.js +176 -0
  161. package/Source/Scene/Model/Model.js +174 -2
  162. package/Source/Scene/Model/Model3DTileContent.js +18 -1
  163. package/Source/Scene/Model/ModelRuntimePrimitive.js +12 -1
  164. package/Source/Scene/Model/WireframePipelineStage.js +6 -2
  165. package/Source/Shaders/Model/ModelFS.glsl +12 -0
  166. package/Source/Shaders/Model/ModelFS.js +12 -0
  167. package/Source/Shaders/Model/ModelVS.glsl +4 -0
  168. package/Source/Shaders/Model/ModelVS.js +4 -0
  169. package/index.d.ts +166 -0
  170. package/index.js +66 -65
  171. package/package.json +1 -1
  172. package/Build/Workers/chunk-2APW7KRS.js +0 -101
  173. package/Build/Workers/chunk-6H33B6OL.js +0 -37
  174. package/Build/Workers/chunk-BN4WA7LX.js +0 -75
  175. package/Build/Workers/chunk-DEIMB3B5.js +0 -629
  176. package/Build/Workers/chunk-EKMWNF4U.js +0 -55
  177. package/Build/Workers/chunk-HGIGANIQ.js +0 -163
  178. package/Build/Workers/chunk-UYT2PBMV.js +0 -58
  179. package/Build/Workers/chunk-X65Y2JSA.js +0 -55
  180. package/Build/Workers/chunk-Z356SW7E.js +0 -256
@@ -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;
@@ -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;
@@ -1,4 +1,4 @@
1
- import BoundingSphere from "../../Core/BoundingSphere.js";
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
- import Color from "../../Core/Color.js";
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
- import Check from "../../Core/Check.js";
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,