three-base 2.0.142 → 2.0.166

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 (231) hide show
  1. package/DirectionalLight.d.ts +6 -6
  2. package/DirectionalLight.js +68 -68
  3. package/EventMap.d.ts +103 -103
  4. package/EventMap.js +17 -17
  5. package/EventMesh.d.ts +18 -18
  6. package/EventMesh.js +59 -59
  7. package/ExtrudeMesh.d.ts +112 -112
  8. package/ExtrudeMesh.js +342 -342
  9. package/FPScontrol.d.ts +531 -511
  10. package/FPScontrol.js +1866 -1799
  11. package/FPScontrol.ts +1922 -1855
  12. package/Fire/Fire.d.ts +28 -28
  13. package/Fire/Fire.js +80 -80
  14. package/Fire/FireGeometry.d.ts +9 -9
  15. package/Fire/FireGeometry.js +40 -40
  16. package/Fire/FireMaterial.d.ts +28 -28
  17. package/Fire/FireMaterial.js +32 -32
  18. package/Fire/index.d.ts +2 -2
  19. package/Fire/index.js +2 -2
  20. package/GLTFDracoLoader.d.ts +71 -71
  21. package/GLTFDracoLoader.js +266 -266
  22. package/GLTFDracoLoader.ts +1 -1
  23. package/Grass/Grass.d.ts +8 -8
  24. package/Grass/Grass.js +38 -38
  25. package/Grass/index.d.ts +2 -2
  26. package/Grass/index.js +2 -2
  27. package/Ground1/Ground1.d.ts +10 -10
  28. package/Ground1/Ground1.js +71 -71
  29. package/Ground1/index.d.ts +1 -1
  30. package/Ground1/index.js +1 -1
  31. package/MeshBase.d.ts +36 -36
  32. package/MeshBase.js +251 -247
  33. package/MeshBase.ts +6 -2
  34. package/Mirror.d.ts +25 -25
  35. package/Mirror.js +143 -143
  36. package/MktMesh/MktMesh.d.ts +301 -291
  37. package/MktMesh/MktMesh.js +1064 -1045
  38. package/MktMesh/MktMesh.ts +32 -11
  39. package/MktMesh/assetUrl.d.ts +59 -35
  40. package/MktMesh/assetUrl.js +165 -69
  41. package/MktMesh/assetUrl.ts +164 -69
  42. package/MktMesh/mktMappingShader.d.ts +12 -12
  43. package/MktMesh/mktMappingShader.js +138 -138
  44. package/MktMesh/mktMappingShader.ts +139 -139
  45. package/MktMesh/mktShader.d.ts +263 -263
  46. package/MktMesh/mktShader.js +1236 -1236
  47. package/MktMesh/mktShader.ts +1344 -1344
  48. package/MktMesh/panoBitmapTexture.d.ts +25 -25
  49. package/MktMesh/panoBitmapTexture.js +52 -52
  50. package/MktMesh/panoBitmapTexture.ts +54 -54
  51. package/MktMesh/panoSlotBind.d.ts +29 -29
  52. package/MktMesh/panoSlotBind.js +106 -106
  53. package/MktMesh/panoSlotBind.ts +153 -153
  54. package/MktMesh/panoSlotRoster.d.ts +22 -22
  55. package/MktMesh/panoSlotRoster.js +169 -169
  56. package/MktMesh/panoSlotRoster.ts +168 -168
  57. package/MktMesh/panoTileStitcher.d.ts +119 -119
  58. package/MktMesh/panoTileStitcher.js +529 -529
  59. package/MktMesh/panoTileStitcher.ts +616 -616
  60. package/MktMesh/types.d.ts +75 -75
  61. package/MktMesh/types.js +1 -1
  62. package/MktMesh/wallCapTessellate.d.ts +33 -33
  63. package/MktMesh/wallCapTessellate.js +97 -97
  64. package/MktMesh/wallCapTessellate.ts +68 -68
  65. package/PipeMesh/PathGeometry.d.ts +44 -44
  66. package/PipeMesh/PathGeometry.js +307 -307
  67. package/PipeMesh/PathPoint.d.ts +17 -17
  68. package/PipeMesh/PathPoint.js +31 -31
  69. package/PipeMesh/PathPointList.d.ts +31 -31
  70. package/PipeMesh/PathPointList.js +209 -209
  71. package/PipeMesh/PathTubeGeometry.d.ts +25 -25
  72. package/PipeMesh/PathTubeGeometry.js +130 -130
  73. package/PipeMesh/PipeMesh.d.ts +25 -25
  74. package/PipeMesh/PipeMesh.js +63 -63
  75. package/PipeMesh/index.d.ts +1 -1
  76. package/PipeMesh/index.js +1 -1
  77. package/PlaneModal1/PlaneModal1.d.ts +34 -34
  78. package/PlaneModal1/PlaneModal1.js +109 -109
  79. package/PlaneModal1/index.d.ts +1 -1
  80. package/PlaneModal1/index.js +1 -1
  81. package/PlaneText.d.ts +27 -27
  82. package/PlaneText.js +35 -35
  83. package/PlaneWithHtml.d.ts +13 -13
  84. package/PlaneWithHtml.js +66 -64
  85. package/PlaneWithHtml.ts +3 -1
  86. package/PointLight/PointLight.d.ts +13 -13
  87. package/PointLight/PointLight.js +64 -64
  88. package/PointLight/index.d.ts +1 -1
  89. package/PointLight/index.js +1 -1
  90. package/Sky/Sky.d.ts +9 -9
  91. package/Sky/Sky.js +22 -22
  92. package/Sky/index.d.ts +1 -1
  93. package/Sky/index.js +1 -1
  94. package/SpotLight.d.ts +6 -6
  95. package/SpotLight.js +72 -72
  96. package/SpriteModal1/SpriteModal1.d.ts +33 -33
  97. package/SpriteModal1/SpriteModal1.js +116 -116
  98. package/SpriteModal1/index.d.ts +1 -1
  99. package/SpriteModal1/index.js +1 -1
  100. package/SpriteText.d.ts +46 -46
  101. package/SpriteText.js +176 -176
  102. package/SpriteText2.d.ts +48 -48
  103. package/SpriteText2.js +223 -223
  104. package/SpriteText3.d.ts +86 -86
  105. package/SpriteText3.js +517 -517
  106. package/SpriteText3.ts +599 -599
  107. package/SpriteWithHtml.d.ts +9 -9
  108. package/SpriteWithHtml.js +46 -44
  109. package/SpriteWithHtml.ts +3 -1
  110. package/Text3D/Text3D.d.ts +20 -20
  111. package/Text3D/Text3D.js +58 -58
  112. package/Text3D/fontController.d.ts +60 -60
  113. package/Text3D/fontController.js +166 -166
  114. package/Text3D/index.d.ts +1 -1
  115. package/Text3D/index.js +1 -1
  116. package/ThreeBase.d.ts +248 -248
  117. package/ThreeBase.js +1202 -1202
  118. package/ThreeBase.ts +1314 -1314
  119. package/ThreeMouse.d.ts +53 -54
  120. package/ThreeMouse.js +453 -453
  121. package/Transition.d.ts +45 -45
  122. package/Transition.js +209 -209
  123. package/Water/Water.d.ts +5 -5
  124. package/Water/Water.js +44 -44
  125. package/Water/index.d.ts +2 -2
  126. package/Water/index.js +2 -2
  127. package/WaterFlow/FloatingDuck.d.ts +88 -88
  128. package/WaterFlow/FloatingDuck.js +307 -307
  129. package/WaterFlow/FloatingDuck.ts +445 -445
  130. package/WaterFlow/GPUFluidSimulation.d.ts +56 -56
  131. package/WaterFlow/GPUFluidSimulation.js +781 -781
  132. package/WaterFlow/GPUFluidSimulation.ts +827 -827
  133. package/WaterFlow/ReservoirSystem.d.ts +106 -106
  134. package/WaterFlow/ReservoirSystem.js +611 -611
  135. package/WaterFlow/ReservoirSystem.ts +754 -754
  136. package/WaterFlow/SPHField.d.ts +35 -35
  137. package/WaterFlow/SPHField.js +203 -203
  138. package/WaterFlow/SPHField.ts +228 -228
  139. package/WaterFlow/ScreenSpaceFluidPass.d.ts +69 -69
  140. package/WaterFlow/ScreenSpaceFluidPass.js +728 -728
  141. package/WaterFlow/ScreenSpaceFluidPass.ts +789 -789
  142. package/WaterFlow/ShallowWaterSurface.d.ts +45 -45
  143. package/WaterFlow/ShallowWaterSurface.js +438 -438
  144. package/WaterFlow/ShallowWaterSurface.ts +510 -510
  145. package/WaterFlow/WaterFlow.d.ts +87 -87
  146. package/WaterFlow/WaterFlow.js +171 -171
  147. package/WaterFlow/WaterFlow.ts +219 -219
  148. package/WaterFlow/types.d.ts +161 -161
  149. package/WaterFlow/types.js +1 -1
  150. package/WaterFlow/types.ts +189 -189
  151. package/WaterFlow/waterFlowPass.d.ts +3 -3
  152. package/WaterFlow/waterFlowPass.js +20 -20
  153. package/WaterFlow/waterFlowPass.ts +40 -40
  154. package/collisionOBB.d.ts +42 -42
  155. package/collisionOBB.js +112 -112
  156. package/collisionOBB.ts +108 -108
  157. package/declare.d.ts +25 -25
  158. package/index.d.ts +1 -1
  159. package/index.js +1 -1
  160. package/instanced/InstancedBatch.d.ts +57 -57
  161. package/instanced/InstancedBatch.js +348 -348
  162. package/instanced/InstancedBatch.ts +406 -406
  163. package/instanced/InstancedChild.d.ts +174 -174
  164. package/instanced/InstancedChild.js +264 -264
  165. package/instanced/InstancedChild.ts +327 -327
  166. package/instanced/InstancedGroup.d.ts +43 -43
  167. package/instanced/InstancedGroup.js +126 -126
  168. package/instanced/InstancedGroup.ts +137 -137
  169. package/instanced/InstancedMeshBase.d.ts +38 -38
  170. package/instanced/InstancedMeshBase.js +282 -282
  171. package/instanced/InstancedTemplate.d.ts +46 -46
  172. package/instanced/InstancedTemplate.js +125 -125
  173. package/keyControls.d.ts +29 -30
  174. package/keyControls.js +101 -101
  175. package/lensflare/LensFlare.d.ts +39 -39
  176. package/lensflare/LensFlare.js +284 -284
  177. package/package.json +6 -1
  178. package/pass/bloom_pass.d.ts +2 -2
  179. package/pass/bloom_pass.js +174 -174
  180. package/pass/cover_pass.d.ts +2 -2
  181. package/pass/cover_pass.js +108 -108
  182. package/pass/debugDepthState.d.ts +20 -20
  183. package/pass/debugDepthState.js +9 -9
  184. package/pass/debugDepthState.ts +22 -22
  185. package/pass/depthTestBias.d.ts +12 -12
  186. package/pass/depthTestBias.js +12 -12
  187. package/pass/depthTestBias.ts +12 -12
  188. package/pass/effectUserData.d.ts +27 -27
  189. package/pass/effectUserData.js +1 -1
  190. package/pass/effectUserData.ts +46 -46
  191. package/pass/frosted_glass_pass.d.ts +2 -2
  192. package/pass/frosted_glass_pass.js +150 -150
  193. package/pass/fsQuad.d.ts +9 -9
  194. package/pass/fsQuad.js +28 -28
  195. package/pass/glow_pass.d.ts +2 -2
  196. package/pass/glow_pass.js +350 -350
  197. package/pass/screen_bloom_pass.d.ts +11 -11
  198. package/pass/screen_bloom_pass.js +136 -136
  199. package/pass/ssao_pass.d.ts +88 -88
  200. package/pass/ssao_pass.js +799 -799
  201. package/pass/ssao_pass.ts +918 -918
  202. package/pass/stroke_pass.d.ts +2 -2
  203. package/pass/stroke_pass.js +267 -267
  204. package/shaders/FXAAShaderMaterial.d.ts +3 -3
  205. package/shaders/FXAAShaderMaterial.js +20 -20
  206. package/shaders/baseDepthVisShader.d.ts +11 -11
  207. package/shaders/baseDepthVisShader.js +36 -36
  208. package/shaders/baseDepthVisShader.ts +36 -36
  209. package/shaders/baseTextureToRenderShader.d.ts +2 -2
  210. package/shaders/baseTextureToRenderShader.js +19 -19
  211. package/shaders/copyShader.d.ts +3 -3
  212. package/shaders/copyShader.js +13 -13
  213. package/shaders/debugDepthCompareShader.d.ts +14 -14
  214. package/shaders/debugDepthCompareShader.js +49 -49
  215. package/shaders/debugDepthCompareShader.ts +50 -50
  216. package/shaders/debugDepthJudgeShader.d.ts +18 -18
  217. package/shaders/debugDepthJudgeShader.js +52 -52
  218. package/shaders/debugDepthJudgeShader.ts +54 -54
  219. package/shaders/debugExcludedShader.d.ts +13 -13
  220. package/shaders/debugExcludedShader.js +46 -46
  221. package/shaders/debugExcludedShader.ts +48 -48
  222. package/spriteTextBg.d.ts +1 -1
  223. package/spriteTextBg.js +20 -20
  224. package/spriteTextBg.ts +20 -20
  225. package/threeLoader.d.ts +35 -35
  226. package/threeLoader.js +518 -518
  227. package/threeUtils.d.ts +71 -53
  228. package/threeUtils.js +363 -329
  229. package/threeUtils.ts +35 -0
  230. package/types.d.ts +2 -2
  231. package/types.js +6 -6
@@ -1,15 +1,15 @@
1
- /*
2
- * @Author: xiaosihan
3
- * @Date: 2024-01-20 05:10:37
4
- * @Last Modified by: xiaosihan
5
- * @Last Modified time: 2024-01-20 05:10:57
6
- */
7
- import { NoBlending, ShaderChunk, ShaderMaterial, Vector2 } from "three";
8
- const FXAAShaderMaterial = new ShaderMaterial({
9
- uniforms: {
10
- tDiffuse: { value: null },
11
- resolution: { value: new Vector2(1 / 1024, 1 / 1024) }
12
- },
1
+ /*
2
+ * @Author: xiaosihan
3
+ * @Date: 2024-01-20 05:10:37
4
+ * @Last Modified by: xiaosihan
5
+ * @Last Modified time: 2024-01-20 05:10:57
6
+ */
7
+ import { NoBlending, ShaderChunk, ShaderMaterial, Vector2 } from "three";
8
+ const FXAAShaderMaterial = new ShaderMaterial({
9
+ uniforms: {
10
+ tDiffuse: { value: null },
11
+ resolution: { value: new Vector2(1 / 1024, 1 / 1024) }
12
+ },
13
13
  vertexShader: `
14
14
  ${ShaderChunk.common}
15
15
  ${ShaderChunk.logdepthbuf_pars_vertex}
@@ -19,7 +19,7 @@ const FXAAShaderMaterial = new ShaderMaterial({
19
19
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
20
20
  ${ShaderChunk.logdepthbuf_vertex}
21
21
  }
22
- `,
22
+ `,
23
23
  fragmentShader: `
24
24
  ${ShaderChunk.logdepthbuf_pars_fragment}
25
25
  precision highp float;
@@ -192,10 +192,10 @@ const FXAAShaderMaterial = new ShaderMaterial({
192
192
  );
193
193
  ${ShaderChunk.logdepthbuf_fragment}
194
194
  }
195
- `,
196
- blending: NoBlending,
197
- depthTest: false,
198
- depthWrite: false,
199
- transparent: true
200
- });
201
- export default FXAAShaderMaterial;
195
+ `,
196
+ blending: NoBlending,
197
+ depthTest: false,
198
+ depthWrite: false,
199
+ transparent: true
200
+ });
201
+ export default FXAAShaderMaterial;
@@ -1,11 +1,11 @@
1
- import { ShaderMaterial } from "three";
2
- /**
3
- * 调试用:把 baseDepthTexture(可见深度图)直接以灰度输出到屏幕。
4
- * 对数深度:近=0(黑) 远=1(白)。
5
- * - 全屏纯白 → 深度图为空(全 clear 1.0),说明 renderAoDepthPass 没把深度写进 baseDepthTexture;
6
- * 此时所有依赖深度遮挡的后处理(stroke/glow/cover/frosted)都会"一律显示在前"。
7
- * - 有灰阶/明暗 → 深度图正常,问题在比对侧(selectDepth / depthTestShader)。
8
- * 触发:在控制台执行 `window.__BASE_DEPTH_VIS = true` 后画面即切到该视图。
9
- */
10
- declare const baseDepthVisShader: ShaderMaterial;
11
- export default baseDepthVisShader;
1
+ import { ShaderMaterial } from "three";
2
+ /**
3
+ * 调试用:把 baseDepthTexture(可见深度图)直接以灰度输出到屏幕。
4
+ * 对数深度:近=0(黑) 远=1(白)。
5
+ * - 全屏纯白 → 深度图为空(全 clear 1.0),说明 renderAoDepthPass 没把深度写进 baseDepthTexture;
6
+ * 此时所有依赖深度遮挡的后处理(stroke/glow/cover/frosted)都会"一律显示在前"。
7
+ * - 有灰阶/明暗 → 深度图正常,问题在比对侧(selectDepth / depthTestShader)。
8
+ * 触发:在控制台执行 `window.__BASE_DEPTH_VIS = true` 后画面即切到该视图。
9
+ */
10
+ declare const baseDepthVisShader: ShaderMaterial;
11
+ export default baseDepthVisShader;
@@ -1,36 +1,36 @@
1
- import { ShaderChunk, ShaderMaterial } from "three";
2
- /**
3
- * 调试用:把 baseDepthTexture(可见深度图)直接以灰度输出到屏幕。
4
- * 对数深度:近=0(黑) 远=1(白)。
5
- * - 全屏纯白 → 深度图为空(全 clear 1.0),说明 renderAoDepthPass 没把深度写进 baseDepthTexture;
6
- * 此时所有依赖深度遮挡的后处理(stroke/glow/cover/frosted)都会"一律显示在前"。
7
- * - 有灰阶/明暗 → 深度图正常,问题在比对侧(selectDepth / depthTestShader)。
8
- * 触发:在控制台执行 `window.__BASE_DEPTH_VIS = true` 后画面即切到该视图。
9
- */
10
- const baseDepthVisShader = new ShaderMaterial({
11
- uniforms: {
12
- tDepth: { value: null },
13
- },
14
- vertexShader: `
15
- ${ShaderChunk.common}
16
- ${ShaderChunk.logdepthbuf_pars_vertex}
17
- varying vec2 vUv;
18
- void main() {
19
- vUv = uv;
20
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
21
- ${ShaderChunk.logdepthbuf_vertex}
22
- }
23
- `,
24
- fragmentShader: `
25
- uniform sampler2D tDepth;
26
- varying vec2 vUv;
27
- void main() {
28
- float d = texture2D(tDepth, vUv).r;
29
- gl_FragColor = vec4(d, d, d, 1.0);
30
- }
31
- `,
32
- depthTest: false,
33
- depthWrite: false,
34
- transparent: true,
35
- });
36
- export default baseDepthVisShader;
1
+ import { ShaderChunk, ShaderMaterial } from "three";
2
+ /**
3
+ * 调试用:把 baseDepthTexture(可见深度图)直接以灰度输出到屏幕。
4
+ * 对数深度:近=0(黑) 远=1(白)。
5
+ * - 全屏纯白 → 深度图为空(全 clear 1.0),说明 renderAoDepthPass 没把深度写进 baseDepthTexture;
6
+ * 此时所有依赖深度遮挡的后处理(stroke/glow/cover/frosted)都会"一律显示在前"。
7
+ * - 有灰阶/明暗 → 深度图正常,问题在比对侧(selectDepth / depthTestShader)。
8
+ * 触发:在控制台执行 `window.__BASE_DEPTH_VIS = true` 后画面即切到该视图。
9
+ */
10
+ const baseDepthVisShader = new ShaderMaterial({
11
+ uniforms: {
12
+ tDepth: { value: null },
13
+ },
14
+ vertexShader: `
15
+ ${ShaderChunk.common}
16
+ ${ShaderChunk.logdepthbuf_pars_vertex}
17
+ varying vec2 vUv;
18
+ void main() {
19
+ vUv = uv;
20
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
21
+ ${ShaderChunk.logdepthbuf_vertex}
22
+ }
23
+ `,
24
+ fragmentShader: `
25
+ uniform sampler2D tDepth;
26
+ varying vec2 vUv;
27
+ void main() {
28
+ float d = texture2D(tDepth, vUv).r;
29
+ gl_FragColor = vec4(d, d, d, 1.0);
30
+ }
31
+ `,
32
+ depthTest: false,
33
+ depthWrite: false,
34
+ transparent: true,
35
+ });
36
+ export default baseDepthVisShader;
@@ -1,36 +1,36 @@
1
- import { ShaderChunk, ShaderMaterial } from "three";
2
- /**
3
- * 调试用:把 baseDepthTexture(可见深度图)直接以灰度输出到屏幕。
4
- * 对数深度:近=0(黑) 远=1(白)。
5
- * - 全屏纯白 → 深度图为空(全 clear 1.0),说明 renderAoDepthPass 没把深度写进 baseDepthTexture;
6
- * 此时所有依赖深度遮挡的后处理(stroke/glow/cover/frosted)都会"一律显示在前"。
7
- * - 有灰阶/明暗 → 深度图正常,问题在比对侧(selectDepth / depthTestShader)。
8
- * 触发:在控制台执行 `window.__BASE_DEPTH_VIS = true` 后画面即切到该视图。
9
- */
10
- const baseDepthVisShader = new ShaderMaterial({
11
- uniforms: {
12
- tDepth: { value: null as unknown as import("three").Texture },
13
- },
14
- vertexShader: `
15
- ${ShaderChunk.common}
16
- ${ShaderChunk.logdepthbuf_pars_vertex}
17
- varying vec2 vUv;
18
- void main() {
19
- vUv = uv;
20
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
21
- ${ShaderChunk.logdepthbuf_vertex}
22
- }
23
- `,
24
- fragmentShader: `
25
- uniform sampler2D tDepth;
26
- varying vec2 vUv;
27
- void main() {
28
- float d = texture2D(tDepth, vUv).r;
29
- gl_FragColor = vec4(d, d, d, 1.0);
30
- }
31
- `,
32
- depthTest: false,
33
- depthWrite: false,
34
- transparent: true,
35
- });
36
- export default baseDepthVisShader;
1
+ import { ShaderChunk, ShaderMaterial } from "three";
2
+ /**
3
+ * 调试用:把 baseDepthTexture(可见深度图)直接以灰度输出到屏幕。
4
+ * 对数深度:近=0(黑) 远=1(白)。
5
+ * - 全屏纯白 → 深度图为空(全 clear 1.0),说明 renderAoDepthPass 没把深度写进 baseDepthTexture;
6
+ * 此时所有依赖深度遮挡的后处理(stroke/glow/cover/frosted)都会"一律显示在前"。
7
+ * - 有灰阶/明暗 → 深度图正常,问题在比对侧(selectDepth / depthTestShader)。
8
+ * 触发:在控制台执行 `window.__BASE_DEPTH_VIS = true` 后画面即切到该视图。
9
+ */
10
+ const baseDepthVisShader = new ShaderMaterial({
11
+ uniforms: {
12
+ tDepth: { value: null as unknown as import("three").Texture },
13
+ },
14
+ vertexShader: `
15
+ ${ShaderChunk.common}
16
+ ${ShaderChunk.logdepthbuf_pars_vertex}
17
+ varying vec2 vUv;
18
+ void main() {
19
+ vUv = uv;
20
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
21
+ ${ShaderChunk.logdepthbuf_vertex}
22
+ }
23
+ `,
24
+ fragmentShader: `
25
+ uniform sampler2D tDepth;
26
+ varying vec2 vUv;
27
+ void main() {
28
+ float d = texture2D(tDepth, vUv).r;
29
+ gl_FragColor = vec4(d, d, d, 1.0);
30
+ }
31
+ `,
32
+ depthTest: false,
33
+ depthWrite: false,
34
+ transparent: true,
35
+ });
36
+ export default baseDepthVisShader;
@@ -1,2 +1,2 @@
1
- import { ShaderMaterial } from "three";
2
- export declare const baseTextureToRenderShader: ShaderMaterial;
1
+ import { ShaderMaterial } from "three";
2
+ export declare const baseTextureToRenderShader: ShaderMaterial;
@@ -1,11 +1,11 @@
1
- import { ShaderMaterial, Vector2, ShaderChunk, NoBlending } from "three";
2
- export const baseTextureToRenderShader = new ShaderMaterial({
3
- uniforms: {
4
- tDiffuse: { value: null },
5
- resolution: { value: new Vector2(1 / 1024, 1 / 1024) },
6
- /** 抖动强度:1.0 = 标准 ±0.5 LSB(总跨度 1/255),0 = 关闭(A/B 对比用) */
7
- uDitherStrength: { value: 1.0 }
8
- },
1
+ import { ShaderMaterial, Vector2, ShaderChunk, NoBlending } from "three";
2
+ export const baseTextureToRenderShader = new ShaderMaterial({
3
+ uniforms: {
4
+ tDiffuse: { value: null },
5
+ resolution: { value: new Vector2(1 / 1024, 1 / 1024) },
6
+ /** 抖动强度:1.0 = 标准 ±0.5 LSB(总跨度 1/255),0 = 关闭(A/B 对比用) */
7
+ uDitherStrength: { value: 1.0 }
8
+ },
9
9
  vertexShader: `
10
10
  ${ShaderChunk.common}
11
11
  ${ShaderChunk.logdepthbuf_pars_vertex}
@@ -15,7 +15,7 @@ export const baseTextureToRenderShader = new ShaderMaterial({
15
15
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
16
16
  ${ShaderChunk.logdepthbuf_vertex}
17
17
  }
18
- `,
18
+ `,
19
19
  fragmentShader: `
20
20
  ${ShaderChunk.logdepthbuf_pars_fragment}
21
21
  precision highp float;
@@ -220,13 +220,13 @@ export const baseTextureToRenderShader = new ShaderMaterial({
220
220
  gl_FragColor = vec4(srgbColor.rgb + dither, srgbColor.a);
221
221
  ${ShaderChunk.logdepthbuf_fragment}
222
222
  }
223
- `,
224
- blending: NoBlending,
225
- depthTest: false,
226
- depthWrite: false,
227
- transparent: true,
228
- // 终处理:手写 sRGBTransferOETF 已是唯一一次 sRGB 编码;关闭 three 的自动 tonemap/colorspace 注入,
229
- // 防止渲染到屏幕时被 three 再编码一次(本 ShaderMaterial 不写 include 块,three 本就不会注入,
230
- // 这里显式置 false 仅是防御,保证颜色空间语义单一可控)。
231
- toneMapped: false,
232
- });
223
+ `,
224
+ blending: NoBlending,
225
+ depthTest: false,
226
+ depthWrite: false,
227
+ transparent: true,
228
+ // 终处理:手写 sRGBTransferOETF 已是唯一一次 sRGB 编码;关闭 three 的自动 tonemap/colorspace 注入,
229
+ // 防止渲染到屏幕时被 three 再编码一次(本 ShaderMaterial 不写 include 块,three 本就不会注入,
230
+ // 这里显式置 false 仅是防御,保证颜色空间语义单一可控)。
231
+ toneMapped: false,
232
+ });
@@ -1,3 +1,3 @@
1
- import { ShaderMaterial } from "three";
2
- declare const copyShader: ShaderMaterial;
3
- export default copyShader;
1
+ import { ShaderMaterial } from "three";
2
+ declare const copyShader: ShaderMaterial;
3
+ export default copyShader;
@@ -1,9 +1,9 @@
1
- import { ShaderChunk, ShaderMaterial } from "three";
2
- const copyShader = new ShaderMaterial({
3
- uniforms: {
4
- map: { value: null },
5
- opacity: { value: 1 },
6
- },
1
+ import { ShaderChunk, ShaderMaterial } from "three";
2
+ const copyShader = new ShaderMaterial({
3
+ uniforms: {
4
+ map: { value: null },
5
+ opacity: { value: 1 },
6
+ },
7
7
  vertexShader: `
8
8
  ${ShaderChunk.common}
9
9
  ${ShaderChunk.logdepthbuf_pars_vertex}
@@ -13,7 +13,7 @@ const copyShader = new ShaderMaterial({
13
13
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
14
14
  ${ShaderChunk.logdepthbuf_vertex}
15
15
  }
16
- `,
16
+ `,
17
17
  fragmentShader: `
18
18
  ${ShaderChunk.logdepthbuf_pars_fragment}
19
19
  uniform float opacity;
@@ -24,9 +24,9 @@ const copyShader = new ShaderMaterial({
24
24
  gl_FragColor.a *= opacity;
25
25
  ${ShaderChunk.logdepthbuf_fragment}
26
26
  }
27
- `,
28
- depthTest: true,
29
- depthWrite: true,
30
- transparent: true,
31
- });
32
- export default copyShader;
27
+ `,
28
+ depthTest: true,
29
+ depthWrite: true,
30
+ transparent: true,
31
+ });
32
+ export default copyShader;
@@ -1,14 +1,14 @@
1
- import { ShaderMaterial } from "three";
2
- /**
3
- * 调试用:把「全局 base 深度」与「最近一次 glow/stroke 选区的 select 深度」并排显示,
4
- * 用于排查"深度测试全部失效"根因:
5
- * R = 全局 base 深度(baseDepthTexture,排除地板)
6
- * G = 选区自身深度(selectDepthTexture,由 glow_pass/stroke_pass 渲染后写入 debugDepthState)
7
- * 两路都用 `pow(cameraFar+1, d)-1` 反推到近似线性视深再归一化(背景≈1 → 黄白)。
8
- * - R 全白、G 也有内容 → 全局 base 深度没写进(renderAoDepthPass 失效),但选区深度正常;
9
- * - R、G 都全白 → 两路深度都没写进;
10
- * - R 有灰阶、G 全白 → 选区深度没写进(glow/stroke 自身的深度 pass 失效);
11
- * - R、G 都有灰阶 → 深度正常,问题在 depthTestShader 比对侧。
12
- */
13
- declare const debugDepthCompareShader: ShaderMaterial;
14
- export default debugDepthCompareShader;
1
+ import { ShaderMaterial } from "three";
2
+ /**
3
+ * 调试用:把「全局 base 深度」与「最近一次 glow/stroke 选区的 select 深度」并排显示,
4
+ * 用于排查"深度测试全部失效"根因:
5
+ * R = 全局 base 深度(baseDepthTexture,排除地板)
6
+ * G = 选区自身深度(selectDepthTexture,由 glow_pass/stroke_pass 渲染后写入 debugDepthState)
7
+ * 两路都用 `pow(cameraFar+1, d)-1` 反推到近似线性视深再归一化(背景≈1 → 黄白)。
8
+ * - R 全白、G 也有内容 → 全局 base 深度没写进(renderAoDepthPass 失效),但选区深度正常;
9
+ * - R、G 都全白 → 两路深度都没写进;
10
+ * - R 有灰阶、G 全白 → 选区深度没写进(glow/stroke 自身的深度 pass 失效);
11
+ * - R、G 都有灰阶 → 深度正常,问题在 depthTestShader 比对侧。
12
+ */
13
+ declare const debugDepthCompareShader: ShaderMaterial;
14
+ export default debugDepthCompareShader;
@@ -1,49 +1,49 @@
1
- import { ShaderChunk, ShaderMaterial } from "three";
2
- /**
3
- * 调试用:把「全局 base 深度」与「最近一次 glow/stroke 选区的 select 深度」并排显示,
4
- * 用于排查"深度测试全部失效"根因:
5
- * R = 全局 base 深度(baseDepthTexture,排除地板)
6
- * G = 选区自身深度(selectDepthTexture,由 glow_pass/stroke_pass 渲染后写入 debugDepthState)
7
- * 两路都用 `pow(cameraFar+1, d)-1` 反推到近似线性视深再归一化(背景≈1 → 黄白)。
8
- * - R 全白、G 也有内容 → 全局 base 深度没写进(renderAoDepthPass 失效),但选区深度正常;
9
- * - R、G 都全白 → 两路深度都没写进;
10
- * - R 有灰阶、G 全白 → 选区深度没写进(glow/stroke 自身的深度 pass 失效);
11
- * - R、G 都有灰阶 → 深度正常,问题在 depthTestShader 比对侧。
12
- */
13
- const debugDepthCompareShader = new ShaderMaterial({
14
- uniforms: {
15
- tBase: { value: null },
16
- tSelect: { value: null },
17
- cameraFar: { value: 1000.0 },
18
- },
19
- vertexShader: `
20
- ${ShaderChunk.common}
21
- ${ShaderChunk.logdepthbuf_pars_vertex}
22
- varying vec2 vUv;
23
- void main() {
24
- vUv = uv;
25
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
26
- ${ShaderChunk.logdepthbuf_vertex}
27
- }
28
- `,
29
- fragmentShader: `
30
- ${ShaderChunk.logdepthbuf_pars_fragment}
31
- uniform sampler2D tBase;
32
- uniform sampler2D tSelect;
33
- uniform float cameraFar;
34
- varying vec2 vUv;
35
- void main() {
36
- float baseD = texture2D(tBase, vUv).r;
37
- float selD = texture2D(tSelect, vUv).r;
38
- // 与 stroke_pass 的 __STROKE_DEPTH_VIS 同一反推公式,保证两座视图语义一致
39
- float vb = pow(cameraFar + 1.0, baseD) - 1.0;
40
- float vs = pow(cameraFar + 1.0, selD) - 1.0;
41
- gl_FragColor = vec4(vb / cameraFar, vs / cameraFar, 0.0, 1.0);
42
- ${ShaderChunk.logdepthbuf_fragment}
43
- }
44
- `,
45
- depthTest: false,
46
- depthWrite: false,
47
- transparent: true,
48
- });
49
- export default debugDepthCompareShader;
1
+ import { ShaderChunk, ShaderMaterial } from "three";
2
+ /**
3
+ * 调试用:把「全局 base 深度」与「最近一次 glow/stroke 选区的 select 深度」并排显示,
4
+ * 用于排查"深度测试全部失效"根因:
5
+ * R = 全局 base 深度(baseDepthTexture,排除地板)
6
+ * G = 选区自身深度(selectDepthTexture,由 glow_pass/stroke_pass 渲染后写入 debugDepthState)
7
+ * 两路都用 `pow(cameraFar+1, d)-1` 反推到近似线性视深再归一化(背景≈1 → 黄白)。
8
+ * - R 全白、G 也有内容 → 全局 base 深度没写进(renderAoDepthPass 失效),但选区深度正常;
9
+ * - R、G 都全白 → 两路深度都没写进;
10
+ * - R 有灰阶、G 全白 → 选区深度没写进(glow/stroke 自身的深度 pass 失效);
11
+ * - R、G 都有灰阶 → 深度正常,问题在 depthTestShader 比对侧。
12
+ */
13
+ const debugDepthCompareShader = new ShaderMaterial({
14
+ uniforms: {
15
+ tBase: { value: null },
16
+ tSelect: { value: null },
17
+ cameraFar: { value: 1000.0 },
18
+ },
19
+ vertexShader: `
20
+ ${ShaderChunk.common}
21
+ ${ShaderChunk.logdepthbuf_pars_vertex}
22
+ varying vec2 vUv;
23
+ void main() {
24
+ vUv = uv;
25
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
26
+ ${ShaderChunk.logdepthbuf_vertex}
27
+ }
28
+ `,
29
+ fragmentShader: `
30
+ ${ShaderChunk.logdepthbuf_pars_fragment}
31
+ uniform sampler2D tBase;
32
+ uniform sampler2D tSelect;
33
+ uniform float cameraFar;
34
+ varying vec2 vUv;
35
+ void main() {
36
+ float baseD = texture2D(tBase, vUv).r;
37
+ float selD = texture2D(tSelect, vUv).r;
38
+ // 与 stroke_pass 的 __STROKE_DEPTH_VIS 同一反推公式,保证两座视图语义一致
39
+ float vb = pow(cameraFar + 1.0, baseD) - 1.0;
40
+ float vs = pow(cameraFar + 1.0, selD) - 1.0;
41
+ gl_FragColor = vec4(vb / cameraFar, vs / cameraFar, 0.0, 1.0);
42
+ ${ShaderChunk.logdepthbuf_fragment}
43
+ }
44
+ `,
45
+ depthTest: false,
46
+ depthWrite: false,
47
+ transparent: true,
48
+ });
49
+ export default debugDepthCompareShader;
@@ -1,50 +1,50 @@
1
- import { ShaderChunk, ShaderMaterial } from "three";
2
-
3
- /**
4
- * 调试用:把「全局 base 深度」与「最近一次 glow/stroke 选区的 select 深度」并排显示,
5
- * 用于排查"深度测试全部失效"根因:
6
- * R = 全局 base 深度(baseDepthTexture,排除地板)
7
- * G = 选区自身深度(selectDepthTexture,由 glow_pass/stroke_pass 渲染后写入 debugDepthState)
8
- * 两路都用 `pow(cameraFar+1, d)-1` 反推到近似线性视深再归一化(背景≈1 → 黄白)。
9
- * - R 全白、G 也有内容 → 全局 base 深度没写进(renderAoDepthPass 失效),但选区深度正常;
10
- * - R、G 都全白 → 两路深度都没写进;
11
- * - R 有灰阶、G 全白 → 选区深度没写进(glow/stroke 自身的深度 pass 失效);
12
- * - R、G 都有灰阶 → 深度正常,问题在 depthTestShader 比对侧。
13
- */
14
- const debugDepthCompareShader = new ShaderMaterial({
15
- uniforms: {
16
- tBase: { value: null as unknown as import("three").Texture },
17
- tSelect: { value: null as unknown as import("three").Texture },
18
- cameraFar: { value: 1000.0 },
19
- },
20
- vertexShader: `
21
- ${ShaderChunk.common}
22
- ${ShaderChunk.logdepthbuf_pars_vertex}
23
- varying vec2 vUv;
24
- void main() {
25
- vUv = uv;
26
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
27
- ${ShaderChunk.logdepthbuf_vertex}
28
- }
29
- `,
30
- fragmentShader: `
31
- ${ShaderChunk.logdepthbuf_pars_fragment}
32
- uniform sampler2D tBase;
33
- uniform sampler2D tSelect;
34
- uniform float cameraFar;
35
- varying vec2 vUv;
36
- void main() {
37
- float baseD = texture2D(tBase, vUv).r;
38
- float selD = texture2D(tSelect, vUv).r;
39
- // 与 stroke_pass 的 __STROKE_DEPTH_VIS 同一反推公式,保证两座视图语义一致
40
- float vb = pow(cameraFar + 1.0, baseD) - 1.0;
41
- float vs = pow(cameraFar + 1.0, selD) - 1.0;
42
- gl_FragColor = vec4(vb / cameraFar, vs / cameraFar, 0.0, 1.0);
43
- ${ShaderChunk.logdepthbuf_fragment}
44
- }
45
- `,
46
- depthTest: false,
47
- depthWrite: false,
48
- transparent: true,
49
- });
50
- export default debugDepthCompareShader;
1
+ import { ShaderChunk, ShaderMaterial } from "three";
2
+
3
+ /**
4
+ * 调试用:把「全局 base 深度」与「最近一次 glow/stroke 选区的 select 深度」并排显示,
5
+ * 用于排查"深度测试全部失效"根因:
6
+ * R = 全局 base 深度(baseDepthTexture,排除地板)
7
+ * G = 选区自身深度(selectDepthTexture,由 glow_pass/stroke_pass 渲染后写入 debugDepthState)
8
+ * 两路都用 `pow(cameraFar+1, d)-1` 反推到近似线性视深再归一化(背景≈1 → 黄白)。
9
+ * - R 全白、G 也有内容 → 全局 base 深度没写进(renderAoDepthPass 失效),但选区深度正常;
10
+ * - R、G 都全白 → 两路深度都没写进;
11
+ * - R 有灰阶、G 全白 → 选区深度没写进(glow/stroke 自身的深度 pass 失效);
12
+ * - R、G 都有灰阶 → 深度正常,问题在 depthTestShader 比对侧。
13
+ */
14
+ const debugDepthCompareShader = new ShaderMaterial({
15
+ uniforms: {
16
+ tBase: { value: null as unknown as import("three").Texture },
17
+ tSelect: { value: null as unknown as import("three").Texture },
18
+ cameraFar: { value: 1000.0 },
19
+ },
20
+ vertexShader: `
21
+ ${ShaderChunk.common}
22
+ ${ShaderChunk.logdepthbuf_pars_vertex}
23
+ varying vec2 vUv;
24
+ void main() {
25
+ vUv = uv;
26
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
27
+ ${ShaderChunk.logdepthbuf_vertex}
28
+ }
29
+ `,
30
+ fragmentShader: `
31
+ ${ShaderChunk.logdepthbuf_pars_fragment}
32
+ uniform sampler2D tBase;
33
+ uniform sampler2D tSelect;
34
+ uniform float cameraFar;
35
+ varying vec2 vUv;
36
+ void main() {
37
+ float baseD = texture2D(tBase, vUv).r;
38
+ float selD = texture2D(tSelect, vUv).r;
39
+ // 与 stroke_pass 的 __STROKE_DEPTH_VIS 同一反推公式,保证两座视图语义一致
40
+ float vb = pow(cameraFar + 1.0, baseD) - 1.0;
41
+ float vs = pow(cameraFar + 1.0, selD) - 1.0;
42
+ gl_FragColor = vec4(vb / cameraFar, vs / cameraFar, 0.0, 1.0);
43
+ ${ShaderChunk.logdepthbuf_fragment}
44
+ }
45
+ `,
46
+ depthTest: false,
47
+ depthWrite: false,
48
+ transparent: true,
49
+ });
50
+ export default debugDepthCompareShader;
@@ -1,18 +1,18 @@
1
- import { ShaderMaterial } from "three";
2
- /**
3
- * 调试用:把「深度测试判定」本身画出来,用于定位"后处理深度测试全部失效"。
4
- *
5
- * 通道语义(全部为**原始**深度值,不做对数反解,避免饱和丢信息):
6
- * R = 全局 base 深度(baseDepthTexture,排除地板)
7
- * G = 选区自身深度(selectDepthTexture,glow/stroke 渲染后写入 debugDepthState)
8
- * B = 判定结果:baseD < selD - bias ? 1 : 0
9
- * 与 stroke_pass 的 depthTestShader 同一判定式(bias = 0.0006):
10
- * 1(蓝) = 判为被更近物体挡住 → 该像素应 discard;0(黑) = 不丢弃。
11
- *
12
- * 判读:
13
- * - 物体区域(G 明显暗于 1.0 的像素)B 全黑 → 判定从不触发,后处理必"一律显示在最前";
14
- * 再看该区域 R 与 G 谁大:R 反而比 G 大(base 比 select 还远)→ base 深度图里缺了遮挡物。
15
- * - 物体区域 B 有蓝 → 判定本身正常,问题在后续合成(叠加顺序/混合)。
16
- */
17
- declare const debugDepthJudgeShader: ShaderMaterial;
18
- export default debugDepthJudgeShader;
1
+ import { ShaderMaterial } from "three";
2
+ /**
3
+ * 调试用:把「深度测试判定」本身画出来,用于定位"后处理深度测试全部失效"。
4
+ *
5
+ * 通道语义(全部为**原始**深度值,不做对数反解,避免饱和丢信息):
6
+ * R = 全局 base 深度(baseDepthTexture,排除地板)
7
+ * G = 选区自身深度(selectDepthTexture,glow/stroke 渲染后写入 debugDepthState)
8
+ * B = 判定结果:baseD < selD - bias ? 1 : 0
9
+ * 与 stroke_pass 的 depthTestShader 同一判定式(bias = 0.0006):
10
+ * 1(蓝) = 判为被更近物体挡住 → 该像素应 discard;0(黑) = 不丢弃。
11
+ *
12
+ * 判读:
13
+ * - 物体区域(G 明显暗于 1.0 的像素)B 全黑 → 判定从不触发,后处理必"一律显示在最前";
14
+ * 再看该区域 R 与 G 谁大:R 反而比 G 大(base 比 select 还远)→ base 深度图里缺了遮挡物。
15
+ * - 物体区域 B 有蓝 → 判定本身正常,问题在后续合成(叠加顺序/混合)。
16
+ */
17
+ declare const debugDepthJudgeShader: ShaderMaterial;
18
+ export default debugDepthJudgeShader;