three-stdlib 2.35.4 → 2.35.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (514) hide show
  1. package/_polyfill/CapsuleGeometry.cjs +17 -20
  2. package/_polyfill/CapsuleGeometry.cjs.map +1 -1
  3. package/_polyfill/CapsuleGeometry.js +17 -20
  4. package/_polyfill/CapsuleGeometry.js.map +1 -1
  5. package/_polyfill/constants.cjs +1 -1
  6. package/_polyfill/constants.cjs.map +1 -1
  7. package/_polyfill/constants.js +1 -1
  8. package/_polyfill/constants.js.map +1 -1
  9. package/animation/AnimationClipCreator.cjs +13 -13
  10. package/animation/AnimationClipCreator.cjs.map +1 -1
  11. package/animation/AnimationClipCreator.js +13 -13
  12. package/animation/AnimationClipCreator.js.map +1 -1
  13. package/animation/CCDIKSolver.cjs +11 -11
  14. package/animation/CCDIKSolver.cjs.map +1 -1
  15. package/animation/CCDIKSolver.js +12 -12
  16. package/animation/CCDIKSolver.js.map +1 -1
  17. package/animation/MMDAnimationHelper.cjs +1 -1
  18. package/animation/MMDAnimationHelper.cjs.map +1 -1
  19. package/animation/MMDAnimationHelper.js +1 -1
  20. package/animation/MMDAnimationHelper.js.map +1 -1
  21. package/animation/MMDPhysics.cjs +4 -4
  22. package/animation/MMDPhysics.cjs.map +1 -1
  23. package/animation/MMDPhysics.js +4 -4
  24. package/animation/MMDPhysics.js.map +1 -1
  25. package/controls/ArcballControls.cjs +2 -2
  26. package/controls/ArcballControls.cjs.map +1 -1
  27. package/controls/ArcballControls.js +3 -3
  28. package/controls/ArcballControls.js.map +1 -1
  29. package/controls/FirstPersonControls.cjs +1 -1
  30. package/controls/FirstPersonControls.cjs.map +1 -1
  31. package/controls/FirstPersonControls.js +1 -1
  32. package/controls/FirstPersonControls.js.map +1 -1
  33. package/controls/OrbitControls.cjs +2 -2
  34. package/controls/OrbitControls.cjs.map +1 -1
  35. package/controls/OrbitControls.js +3 -3
  36. package/controls/OrbitControls.js.map +1 -1
  37. package/controls/PointerLockControls.cjs +2 -2
  38. package/controls/PointerLockControls.cjs.map +1 -1
  39. package/controls/PointerLockControls.js +3 -3
  40. package/controls/PointerLockControls.js.map +1 -1
  41. package/csm/CSM.cjs +4 -4
  42. package/csm/CSM.cjs.map +1 -1
  43. package/csm/CSM.js +5 -5
  44. package/csm/CSM.js.map +1 -1
  45. package/csm/CSMFrustum.cjs +1 -1
  46. package/csm/CSMFrustum.cjs.map +1 -1
  47. package/csm/CSMFrustum.js +2 -2
  48. package/csm/CSMFrustum.js.map +1 -1
  49. package/deprecated/Geometry.cjs +715 -722
  50. package/deprecated/Geometry.cjs.map +1 -1
  51. package/deprecated/Geometry.js +716 -723
  52. package/deprecated/Geometry.js.map +1 -1
  53. package/effects/AnaglyphEffect.cjs +1 -2
  54. package/effects/AnaglyphEffect.cjs.map +1 -1
  55. package/effects/AnaglyphEffect.js +2 -3
  56. package/effects/AnaglyphEffect.js.map +1 -1
  57. package/effects/OutlineEffect.cjs +1 -2
  58. package/effects/OutlineEffect.cjs.map +1 -1
  59. package/effects/OutlineEffect.js +2 -3
  60. package/effects/OutlineEffect.js.map +1 -1
  61. package/effects/ParallaxBarrierEffect.cjs +1 -2
  62. package/effects/ParallaxBarrierEffect.cjs.map +1 -1
  63. package/effects/ParallaxBarrierEffect.js +2 -3
  64. package/effects/ParallaxBarrierEffect.js.map +1 -1
  65. package/exporters/DRACOExporter.cjs +122 -133
  66. package/exporters/DRACOExporter.cjs.map +1 -1
  67. package/exporters/DRACOExporter.d.ts +21 -23
  68. package/exporters/DRACOExporter.js +122 -133
  69. package/exporters/DRACOExporter.js.map +1 -1
  70. package/exporters/GLTFExporter.cjs +167 -170
  71. package/exporters/GLTFExporter.cjs.map +1 -1
  72. package/exporters/GLTFExporter.js +167 -170
  73. package/exporters/GLTFExporter.js.map +1 -1
  74. package/geometries/LightningStrike.cjs +515 -524
  75. package/geometries/LightningStrike.cjs.map +1 -1
  76. package/geometries/LightningStrike.js +515 -524
  77. package/geometries/LightningStrike.js.map +1 -1
  78. package/geometries/RoundedBoxGeometry.cjs +1 -1
  79. package/geometries/RoundedBoxGeometry.cjs.map +1 -1
  80. package/geometries/RoundedBoxGeometry.js +2 -2
  81. package/geometries/RoundedBoxGeometry.js.map +1 -1
  82. package/helpers/RaycasterHelper.cjs +2 -2
  83. package/helpers/RaycasterHelper.cjs.map +1 -1
  84. package/helpers/RaycasterHelper.js +3 -3
  85. package/helpers/RaycasterHelper.js.map +1 -1
  86. package/helpers/VertexNormalsHelper.cjs +3 -3
  87. package/helpers/VertexNormalsHelper.cjs.map +1 -1
  88. package/helpers/VertexNormalsHelper.js +4 -4
  89. package/helpers/VertexNormalsHelper.js.map +1 -1
  90. package/helpers/VertexTangentsHelper.cjs +2 -2
  91. package/helpers/VertexTangentsHelper.cjs.map +1 -1
  92. package/helpers/VertexTangentsHelper.js +3 -3
  93. package/helpers/VertexTangentsHelper.js.map +1 -1
  94. package/interactive/InteractiveGroup.cjs +1 -1
  95. package/interactive/InteractiveGroup.cjs.map +1 -1
  96. package/interactive/InteractiveGroup.js +2 -2
  97. package/interactive/InteractiveGroup.js.map +1 -1
  98. package/interactive/SelectionBox.cjs +15 -15
  99. package/interactive/SelectionBox.cjs.map +1 -1
  100. package/interactive/SelectionBox.js +16 -16
  101. package/interactive/SelectionBox.js.map +1 -1
  102. package/libs/chevrotain.cjs +1 -1
  103. package/libs/chevrotain.cjs.map +1 -1
  104. package/libs/chevrotain.js +1 -1
  105. package/libs/chevrotain.js.map +1 -1
  106. package/libs/lottie.cjs +1 -1
  107. package/libs/lottie.cjs.map +1 -1
  108. package/libs/lottie.js +1 -1
  109. package/libs/lottie.js.map +1 -1
  110. package/libs/opentype.cjs +1 -1
  111. package/libs/opentype.cjs.map +1 -1
  112. package/libs/opentype.js +1 -1
  113. package/libs/opentype.js.map +1 -1
  114. package/lights/LightProbeGenerator.cjs +5 -5
  115. package/lights/LightProbeGenerator.cjs.map +1 -1
  116. package/lights/LightProbeGenerator.js +5 -5
  117. package/lights/LightProbeGenerator.js.map +1 -1
  118. package/lights/RectAreaLightUniformsLib.cjs +3 -3
  119. package/lights/RectAreaLightUniformsLib.cjs.map +1 -1
  120. package/lights/RectAreaLightUniformsLib.js +3 -3
  121. package/lights/RectAreaLightUniformsLib.js.map +1 -1
  122. package/lines/LineMaterial.cjs +1 -2
  123. package/lines/LineMaterial.cjs.map +1 -1
  124. package/lines/LineMaterial.js +2 -3
  125. package/lines/LineMaterial.js.map +1 -1
  126. package/lines/LineSegments2.cjs +13 -13
  127. package/lines/LineSegments2.cjs.map +1 -1
  128. package/lines/LineSegments2.js +14 -14
  129. package/lines/LineSegments2.js.map +1 -1
  130. package/lines/LineSegmentsGeometry.cjs +2 -2
  131. package/lines/LineSegmentsGeometry.cjs.map +1 -1
  132. package/lines/LineSegmentsGeometry.js +3 -3
  133. package/lines/LineSegmentsGeometry.js.map +1 -1
  134. package/lines/Wireframe.cjs +3 -3
  135. package/lines/Wireframe.cjs.map +1 -1
  136. package/lines/Wireframe.js +4 -4
  137. package/lines/Wireframe.js.map +1 -1
  138. package/loaders/BasisTextureLoader.cjs +435 -441
  139. package/loaders/BasisTextureLoader.cjs.map +1 -1
  140. package/loaders/BasisTextureLoader.js +435 -441
  141. package/loaders/BasisTextureLoader.js.map +1 -1
  142. package/loaders/EXRLoader.cjs +1 -2
  143. package/loaders/EXRLoader.cjs.map +1 -1
  144. package/loaders/EXRLoader.js +2 -3
  145. package/loaders/EXRLoader.js.map +1 -1
  146. package/loaders/FBXLoader.cjs +2 -2
  147. package/loaders/FBXLoader.cjs.map +1 -1
  148. package/loaders/FBXLoader.js +2 -2
  149. package/loaders/FBXLoader.js.map +1 -1
  150. package/loaders/FontLoader.cjs +2 -2
  151. package/loaders/FontLoader.cjs.map +1 -1
  152. package/loaders/FontLoader.d.ts +2 -2
  153. package/loaders/FontLoader.js +2 -2
  154. package/loaders/FontLoader.js.map +1 -1
  155. package/loaders/GLTFLoader.cjs +2 -2
  156. package/loaders/GLTFLoader.cjs.map +1 -1
  157. package/loaders/GLTFLoader.js +2 -2
  158. package/loaders/GLTFLoader.js.map +1 -1
  159. package/loaders/KTX2Loader.cjs +374 -377
  160. package/loaders/KTX2Loader.cjs.map +1 -1
  161. package/loaders/KTX2Loader.js +374 -377
  162. package/loaders/KTX2Loader.js.map +1 -1
  163. package/loaders/LDrawLoader.cjs +4 -5
  164. package/loaders/LDrawLoader.cjs.map +1 -1
  165. package/loaders/LDrawLoader.js +5 -6
  166. package/loaders/LDrawLoader.js.map +1 -1
  167. package/loaders/OBJLoader.cjs +5 -5
  168. package/loaders/OBJLoader.cjs.map +1 -1
  169. package/loaders/OBJLoader.js +6 -6
  170. package/loaders/OBJLoader.js.map +1 -1
  171. package/loaders/PRWMLoader.cjs +43 -46
  172. package/loaders/PRWMLoader.cjs.map +1 -1
  173. package/loaders/PRWMLoader.js +43 -46
  174. package/loaders/PRWMLoader.js.map +1 -1
  175. package/loaders/SVGLoader.cjs +1688 -1694
  176. package/loaders/SVGLoader.cjs.map +1 -1
  177. package/loaders/SVGLoader.js +1688 -1694
  178. package/loaders/SVGLoader.js.map +1 -1
  179. package/loaders/XLoader.cjs +1 -1
  180. package/loaders/XLoader.cjs.map +1 -1
  181. package/loaders/XLoader.js +1 -1
  182. package/loaders/XLoader.js.map +1 -1
  183. package/math/Capsule.cjs +3 -3
  184. package/math/Capsule.cjs.map +1 -1
  185. package/math/Capsule.js +3 -3
  186. package/math/Capsule.js.map +1 -1
  187. package/math/ColorConverter.cjs +9 -9
  188. package/math/ColorConverter.cjs.map +1 -1
  189. package/math/ColorConverter.js +9 -9
  190. package/math/ColorConverter.js.map +1 -1
  191. package/math/ConvexHull.cjs +50 -53
  192. package/math/ConvexHull.cjs.map +1 -1
  193. package/math/ConvexHull.js +50 -53
  194. package/math/ConvexHull.js.map +1 -1
  195. package/math/ImprovedNoise.cjs +1 -1
  196. package/math/ImprovedNoise.cjs.map +1 -1
  197. package/math/ImprovedNoise.js +1 -1
  198. package/math/ImprovedNoise.js.map +1 -1
  199. package/math/MeshSurfaceSampler.cjs +2 -2
  200. package/math/MeshSurfaceSampler.cjs.map +1 -1
  201. package/math/MeshSurfaceSampler.js +2 -2
  202. package/math/MeshSurfaceSampler.js.map +1 -1
  203. package/math/OBB.cjs +14 -14
  204. package/math/OBB.cjs.map +1 -1
  205. package/math/OBB.js +15 -15
  206. package/math/OBB.js.map +1 -1
  207. package/math/Octree.cjs +7 -7
  208. package/math/Octree.cjs.map +1 -1
  209. package/math/Octree.js +8 -8
  210. package/math/Octree.js.map +1 -1
  211. package/misc/ConvexObjectBreaker.cjs +268 -271
  212. package/misc/ConvexObjectBreaker.cjs.map +1 -1
  213. package/misc/ConvexObjectBreaker.js +269 -272
  214. package/misc/ConvexObjectBreaker.js.map +1 -1
  215. package/misc/Gyroscope.cjs +6 -6
  216. package/misc/Gyroscope.cjs.map +1 -1
  217. package/misc/Gyroscope.js +7 -7
  218. package/misc/Gyroscope.js.map +1 -1
  219. package/modifiers/CurveModifier.cjs +1 -1
  220. package/modifiers/CurveModifier.cjs.map +1 -1
  221. package/modifiers/CurveModifier.js +2 -2
  222. package/modifiers/CurveModifier.js.map +1 -1
  223. package/modifiers/SimplifyModifier.cjs +2 -2
  224. package/modifiers/SimplifyModifier.cjs.map +1 -1
  225. package/modifiers/SimplifyModifier.js +2 -2
  226. package/modifiers/SimplifyModifier.js.map +1 -1
  227. package/objects/BatchedMesh.cjs +2 -2
  228. package/objects/BatchedMesh.cjs.map +1 -1
  229. package/objects/BatchedMesh.js +3 -3
  230. package/objects/BatchedMesh.js.map +1 -1
  231. package/objects/GroundProjectedEnv.cjs +1 -2
  232. package/objects/GroundProjectedEnv.cjs.map +1 -1
  233. package/objects/GroundProjectedEnv.js +2 -3
  234. package/objects/GroundProjectedEnv.js.map +1 -1
  235. package/objects/Lensflare.cjs +206 -209
  236. package/objects/Lensflare.cjs.map +1 -1
  237. package/objects/Lensflare.js +206 -209
  238. package/objects/Lensflare.js.map +1 -1
  239. package/objects/Reflector.cjs +146 -154
  240. package/objects/Reflector.cjs.map +1 -1
  241. package/objects/Reflector.js +146 -154
  242. package/objects/Reflector.js.map +1 -1
  243. package/objects/ReflectorForSSRPass.cjs +180 -183
  244. package/objects/ReflectorForSSRPass.cjs.map +1 -1
  245. package/objects/ReflectorForSSRPass.js +180 -183
  246. package/objects/ReflectorForSSRPass.js.map +1 -1
  247. package/objects/Refractor.cjs +161 -164
  248. package/objects/Refractor.cjs.map +1 -1
  249. package/objects/Refractor.js +161 -164
  250. package/objects/Refractor.js.map +1 -1
  251. package/objects/ShadowMesh.cjs +1 -1
  252. package/objects/ShadowMesh.cjs.map +1 -1
  253. package/objects/ShadowMesh.js +2 -2
  254. package/objects/ShadowMesh.js.map +1 -1
  255. package/objects/Sky.cjs +32 -35
  256. package/objects/Sky.cjs.map +1 -1
  257. package/objects/Sky.d.ts +6 -100
  258. package/objects/Sky.js +32 -35
  259. package/objects/Sky.js.map +1 -1
  260. package/objects/Water.cjs +1 -2
  261. package/objects/Water.cjs.map +1 -1
  262. package/objects/Water.js +2 -3
  263. package/objects/Water.js.map +1 -1
  264. package/objects/Water2.cjs +140 -143
  265. package/objects/Water2.cjs.map +1 -1
  266. package/objects/Water2.js +140 -143
  267. package/objects/Water2.js.map +1 -1
  268. package/package.json +1 -1
  269. package/postprocessing/SAOPass.cjs +264 -267
  270. package/postprocessing/SAOPass.cjs.map +1 -1
  271. package/postprocessing/SAOPass.js +264 -267
  272. package/postprocessing/SAOPass.js.map +1 -1
  273. package/postprocessing/SSAOPass.cjs +250 -253
  274. package/postprocessing/SSAOPass.cjs.map +1 -1
  275. package/postprocessing/SSAOPass.js +250 -253
  276. package/postprocessing/SSAOPass.js.map +1 -1
  277. package/postprocessing/SSRPass.cjs +376 -379
  278. package/postprocessing/SSRPass.cjs.map +1 -1
  279. package/postprocessing/SSRPass.js +376 -379
  280. package/postprocessing/SSRPass.js.map +1 -1
  281. package/postprocessing/UnrealBloomPass.cjs +202 -205
  282. package/postprocessing/UnrealBloomPass.cjs.map +1 -1
  283. package/postprocessing/UnrealBloomPass.js +202 -205
  284. package/postprocessing/UnrealBloomPass.js.map +1 -1
  285. package/renderers/CSS2DRenderer.cjs +5 -5
  286. package/renderers/CSS2DRenderer.cjs.map +1 -1
  287. package/renderers/CSS2DRenderer.js +5 -5
  288. package/renderers/CSS2DRenderer.js.map +1 -1
  289. package/renderers/CSS3DRenderer.cjs +5 -5
  290. package/renderers/CSS3DRenderer.cjs.map +1 -1
  291. package/renderers/CSS3DRenderer.js +6 -6
  292. package/renderers/CSS3DRenderer.js.map +1 -1
  293. package/shaders/ACESFilmicToneMappingShader.cjs +46 -71
  294. package/shaders/ACESFilmicToneMappingShader.cjs.map +1 -1
  295. package/shaders/ACESFilmicToneMappingShader.js +46 -71
  296. package/shaders/ACESFilmicToneMappingShader.js.map +1 -1
  297. package/shaders/AfterimageShader.cjs +22 -41
  298. package/shaders/AfterimageShader.cjs.map +1 -1
  299. package/shaders/AfterimageShader.js +22 -41
  300. package/shaders/AfterimageShader.js.map +1 -1
  301. package/shaders/BasicShader.cjs +6 -20
  302. package/shaders/BasicShader.cjs.map +1 -1
  303. package/shaders/BasicShader.js +6 -20
  304. package/shaders/BasicShader.js.map +1 -1
  305. package/shaders/BleachBypassShader.cjs +26 -46
  306. package/shaders/BleachBypassShader.cjs.map +1 -1
  307. package/shaders/BleachBypassShader.js +26 -46
  308. package/shaders/BleachBypassShader.js.map +1 -1
  309. package/shaders/BlendShader.cjs +19 -33
  310. package/shaders/BlendShader.cjs.map +1 -1
  311. package/shaders/BlendShader.js +19 -33
  312. package/shaders/BlendShader.js.map +1 -1
  313. package/shaders/BokehShader.cjs +90 -117
  314. package/shaders/BokehShader.cjs.map +1 -1
  315. package/shaders/BokehShader.js +90 -117
  316. package/shaders/BokehShader.js.map +1 -1
  317. package/shaders/BokehShader2.cjs +232 -333
  318. package/shaders/BokehShader2.cjs.map +1 -1
  319. package/shaders/BokehShader2.js +232 -333
  320. package/shaders/BokehShader2.js.map +1 -1
  321. package/shaders/BrightnessContrastShader.cjs +22 -38
  322. package/shaders/BrightnessContrastShader.cjs.map +1 -1
  323. package/shaders/BrightnessContrastShader.js +22 -38
  324. package/shaders/BrightnessContrastShader.js.map +1 -1
  325. package/shaders/ColorCorrectionShader.cjs +21 -35
  326. package/shaders/ColorCorrectionShader.cjs.map +1 -1
  327. package/shaders/ColorCorrectionShader.js +21 -35
  328. package/shaders/ColorCorrectionShader.js.map +1 -1
  329. package/shaders/ColorifyShader.cjs +19 -34
  330. package/shaders/ColorifyShader.cjs.map +1 -1
  331. package/shaders/ColorifyShader.js +19 -34
  332. package/shaders/ColorifyShader.js.map +1 -1
  333. package/shaders/ConvolutionShader.cjs +24 -43
  334. package/shaders/ConvolutionShader.cjs.map +1 -1
  335. package/shaders/ConvolutionShader.js +24 -43
  336. package/shaders/ConvolutionShader.js.map +1 -1
  337. package/shaders/CopyShader.cjs +16 -30
  338. package/shaders/CopyShader.cjs.map +1 -1
  339. package/shaders/CopyShader.js +16 -30
  340. package/shaders/CopyShader.js.map +1 -1
  341. package/shaders/DOFMipMapShader.cjs +21 -38
  342. package/shaders/DOFMipMapShader.cjs.map +1 -1
  343. package/shaders/DOFMipMapShader.js +21 -38
  344. package/shaders/DOFMipMapShader.js.map +1 -1
  345. package/shaders/DepthLimitedBlurShader.cjs +69 -98
  346. package/shaders/DepthLimitedBlurShader.cjs.map +1 -1
  347. package/shaders/DepthLimitedBlurShader.js +69 -98
  348. package/shaders/DepthLimitedBlurShader.js.map +1 -1
  349. package/shaders/DigitalGlitch.cjs +59 -70
  350. package/shaders/DigitalGlitch.cjs.map +1 -1
  351. package/shaders/DigitalGlitch.js +59 -70
  352. package/shaders/DigitalGlitch.js.map +1 -1
  353. package/shaders/DotScreenShader.cjs +28 -49
  354. package/shaders/DotScreenShader.cjs.map +1 -1
  355. package/shaders/DotScreenShader.js +28 -49
  356. package/shaders/DotScreenShader.js.map +1 -1
  357. package/shaders/FXAAShader.cjs +1089 -1098
  358. package/shaders/FXAAShader.cjs.map +1 -1
  359. package/shaders/FXAAShader.js +1089 -1098
  360. package/shaders/FXAAShader.js.map +1 -1
  361. package/shaders/FilmShader.cjs +29 -57
  362. package/shaders/FilmShader.cjs.map +1 -1
  363. package/shaders/FilmShader.js +29 -57
  364. package/shaders/FilmShader.js.map +1 -1
  365. package/shaders/FocusShader.cjs +43 -70
  366. package/shaders/FocusShader.cjs.map +1 -1
  367. package/shaders/FocusShader.js +43 -70
  368. package/shaders/FocusShader.js.map +1 -1
  369. package/shaders/FreiChenShader.cjs +53 -74
  370. package/shaders/FreiChenShader.cjs.map +1 -1
  371. package/shaders/FreiChenShader.js +53 -74
  372. package/shaders/FreiChenShader.js.map +1 -1
  373. package/shaders/FresnelShader.cjs +35 -55
  374. package/shaders/FresnelShader.cjs.map +1 -1
  375. package/shaders/FresnelShader.js +35 -55
  376. package/shaders/FresnelShader.js.map +1 -1
  377. package/shaders/GammaCorrectionShader.cjs +19 -33
  378. package/shaders/GammaCorrectionShader.cjs.map +1 -1
  379. package/shaders/GammaCorrectionShader.js +19 -33
  380. package/shaders/GammaCorrectionShader.js.map +1 -1
  381. package/shaders/GodRaysShader.cjs +116 -193
  382. package/shaders/GodRaysShader.cjs.map +1 -1
  383. package/shaders/GodRaysShader.js +116 -193
  384. package/shaders/GodRaysShader.js.map +1 -1
  385. package/shaders/HalftoneShader.cjs +192 -270
  386. package/shaders/HalftoneShader.cjs.map +1 -1
  387. package/shaders/HalftoneShader.js +192 -270
  388. package/shaders/HalftoneShader.js.map +1 -1
  389. package/shaders/HorizontalTiltShiftShader.cjs +27 -43
  390. package/shaders/HorizontalTiltShiftShader.cjs.map +1 -1
  391. package/shaders/HorizontalTiltShiftShader.js +27 -43
  392. package/shaders/HorizontalTiltShiftShader.js.map +1 -1
  393. package/shaders/HueSaturationShader.cjs +31 -47
  394. package/shaders/HueSaturationShader.cjs.map +1 -1
  395. package/shaders/HueSaturationShader.js +31 -47
  396. package/shaders/HueSaturationShader.js.map +1 -1
  397. package/shaders/KaleidoShader.cjs +24 -37
  398. package/shaders/KaleidoShader.cjs.map +1 -1
  399. package/shaders/KaleidoShader.js +24 -37
  400. package/shaders/KaleidoShader.js.map +1 -1
  401. package/shaders/LuminosityHighPassShader.cjs +24 -43
  402. package/shaders/LuminosityHighPassShader.cjs.map +1 -1
  403. package/shaders/LuminosityHighPassShader.js +24 -43
  404. package/shaders/LuminosityHighPassShader.js.map +1 -1
  405. package/shaders/LuminosityShader.cjs +17 -34
  406. package/shaders/LuminosityShader.cjs.map +1 -1
  407. package/shaders/LuminosityShader.js +17 -34
  408. package/shaders/LuminosityShader.js.map +1 -1
  409. package/shaders/MirrorShader.cjs +26 -39
  410. package/shaders/MirrorShader.cjs.map +1 -1
  411. package/shaders/MirrorShader.js +26 -39
  412. package/shaders/MirrorShader.js.map +1 -1
  413. package/shaders/NormalMapShader.cjs +21 -36
  414. package/shaders/NormalMapShader.cjs.map +1 -1
  415. package/shaders/NormalMapShader.js +21 -36
  416. package/shaders/NormalMapShader.js.map +1 -1
  417. package/shaders/ParallaxShader.cjs +97 -147
  418. package/shaders/ParallaxShader.cjs.map +1 -1
  419. package/shaders/ParallaxShader.js +97 -147
  420. package/shaders/ParallaxShader.js.map +1 -1
  421. package/shaders/PixelShader.cjs +18 -31
  422. package/shaders/PixelShader.cjs.map +1 -1
  423. package/shaders/PixelShader.js +18 -31
  424. package/shaders/PixelShader.js.map +1 -1
  425. package/shaders/RGBShiftShader.cjs +20 -33
  426. package/shaders/RGBShiftShader.cjs.map +1 -1
  427. package/shaders/RGBShiftShader.js +20 -33
  428. package/shaders/RGBShiftShader.js.map +1 -1
  429. package/shaders/SAOShader.cjs +117 -154
  430. package/shaders/SAOShader.cjs.map +1 -1
  431. package/shaders/SAOShader.js +117 -154
  432. package/shaders/SAOShader.js.map +1 -1
  433. package/shaders/SMAAShader.cjs +270 -358
  434. package/shaders/SMAAShader.cjs.map +1 -1
  435. package/shaders/SMAAShader.js +270 -358
  436. package/shaders/SMAAShader.js.map +1 -1
  437. package/shaders/SSAOShader.cjs +142 -236
  438. package/shaders/SSAOShader.cjs.map +1 -1
  439. package/shaders/SSAOShader.js +142 -236
  440. package/shaders/SSAOShader.js.map +1 -1
  441. package/shaders/SSRShader.cjs +4 -4
  442. package/shaders/SSRShader.cjs.map +1 -1
  443. package/shaders/SSRShader.js +4 -4
  444. package/shaders/SSRShader.js.map +1 -1
  445. package/shaders/SepiaShader.cjs +20 -36
  446. package/shaders/SepiaShader.cjs.map +1 -1
  447. package/shaders/SepiaShader.js +20 -36
  448. package/shaders/SepiaShader.js.map +1 -1
  449. package/shaders/SobelOperatorShader.cjs +37 -64
  450. package/shaders/SobelOperatorShader.cjs.map +1 -1
  451. package/shaders/SobelOperatorShader.js +37 -64
  452. package/shaders/SobelOperatorShader.js.map +1 -1
  453. package/shaders/TechnicolorShader.cjs +16 -29
  454. package/shaders/TechnicolorShader.cjs.map +1 -1
  455. package/shaders/TechnicolorShader.js +16 -29
  456. package/shaders/TechnicolorShader.js.map +1 -1
  457. package/shaders/ToneMapShader.cjs +35 -55
  458. package/shaders/ToneMapShader.cjs.map +1 -1
  459. package/shaders/ToneMapShader.js +35 -55
  460. package/shaders/ToneMapShader.js.map +1 -1
  461. package/shaders/ToonShader.cjs +165 -275
  462. package/shaders/ToonShader.cjs.map +1 -1
  463. package/shaders/ToonShader.js +165 -275
  464. package/shaders/ToonShader.js.map +1 -1
  465. package/shaders/TriangleBlurShader.cjs +27 -50
  466. package/shaders/TriangleBlurShader.cjs.map +1 -1
  467. package/shaders/TriangleBlurShader.js +27 -50
  468. package/shaders/TriangleBlurShader.js.map +1 -1
  469. package/shaders/UnpackDepthRGBAShader.cjs +17 -32
  470. package/shaders/UnpackDepthRGBAShader.cjs.map +1 -1
  471. package/shaders/UnpackDepthRGBAShader.js +17 -32
  472. package/shaders/UnpackDepthRGBAShader.js.map +1 -1
  473. package/shaders/VerticalTiltShiftShader.cjs +27 -43
  474. package/shaders/VerticalTiltShiftShader.cjs.map +1 -1
  475. package/shaders/VerticalTiltShiftShader.js +27 -43
  476. package/shaders/VerticalTiltShiftShader.js.map +1 -1
  477. package/shaders/VignetteShader.cjs +27 -43
  478. package/shaders/VignetteShader.cjs.map +1 -1
  479. package/shaders/VignetteShader.js +27 -43
  480. package/shaders/VignetteShader.js.map +1 -1
  481. package/shaders/VolumeShader.cjs +213 -264
  482. package/shaders/VolumeShader.cjs.map +1 -1
  483. package/shaders/VolumeShader.js +213 -264
  484. package/shaders/VolumeShader.js.map +1 -1
  485. package/shaders/WaterRefractionShader.cjs +35 -63
  486. package/shaders/WaterRefractionShader.cjs.map +1 -1
  487. package/shaders/WaterRefractionShader.js +35 -63
  488. package/shaders/WaterRefractionShader.js.map +1 -1
  489. package/utils/GeometryCompressionUtils.cjs +1 -2
  490. package/utils/GeometryCompressionUtils.cjs.map +1 -1
  491. package/utils/GeometryCompressionUtils.js +2 -3
  492. package/utils/GeometryCompressionUtils.js.map +1 -1
  493. package/utils/RoughnessMipmapper.cjs +3 -3
  494. package/utils/RoughnessMipmapper.cjs.map +1 -1
  495. package/utils/RoughnessMipmapper.js +4 -4
  496. package/utils/RoughnessMipmapper.js.map +1 -1
  497. package/webxr/ARButton.cjs +106 -109
  498. package/webxr/ARButton.cjs.map +1 -1
  499. package/webxr/ARButton.d.ts +3 -4
  500. package/webxr/ARButton.js +106 -109
  501. package/webxr/ARButton.js.map +1 -1
  502. package/webxr/OculusHandPointerModel.cjs +2 -2
  503. package/webxr/OculusHandPointerModel.cjs.map +1 -1
  504. package/webxr/OculusHandPointerModel.js +2 -2
  505. package/webxr/OculusHandPointerModel.js.map +1 -1
  506. package/webxr/VRButton.cjs +95 -98
  507. package/webxr/VRButton.cjs.map +1 -1
  508. package/webxr/VRButton.d.ts +5 -6
  509. package/webxr/VRButton.js +95 -98
  510. package/webxr/VRButton.js.map +1 -1
  511. package/webxr/XRHandPrimitiveModel.cjs +2 -2
  512. package/webxr/XRHandPrimitiveModel.cjs.map +1 -1
  513. package/webxr/XRHandPrimitiveModel.js +3 -3
  514. package/webxr/XRHandPrimitiveModel.js.map +1 -1
@@ -6,37 +6,24 @@ const PixelShader = {
6
6
  resolution: { value: null },
7
7
  pixelSize: { value: 1 }
8
8
  },
9
- vertexShader: (
10
- /* glsl */
11
- `
12
- varying highp vec2 vUv;
13
-
14
- void main() {
15
-
16
- vUv = uv;
17
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
18
-
19
- }
20
- `
21
- ),
22
- fragmentShader: (
23
- /* glsl */
24
- `
25
- uniform sampler2D tDiffuse;
26
- uniform float pixelSize;
27
- uniform vec2 resolution;
28
-
29
- varying highp vec2 vUv;
30
-
31
- void main(){
32
-
33
- vec2 dxy = pixelSize / resolution;
34
- vec2 coord = dxy * floor( vUv / dxy );
35
- gl_FragColor = texture2D(tDiffuse, coord);
36
-
37
- }
38
- `
39
- )
9
+ vertexShader: [
10
+ "varying highp vec2 vUv;",
11
+ "void main() {",
12
+ "vUv = uv;",
13
+ "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
14
+ "}"
15
+ ].join("\n"),
16
+ fragmentShader: [
17
+ "uniform sampler2D tDiffuse;",
18
+ "uniform float pixelSize;",
19
+ "uniform vec2 resolution;",
20
+ "varying highp vec2 vUv;",
21
+ "void main(){",
22
+ "vec2 dxy = pixelSize / resolution;",
23
+ "vec2 coord = dxy * floor( vUv / dxy );",
24
+ "gl_FragColor = texture2D(tDiffuse, coord);",
25
+ "}"
26
+ ].join("\n")
40
27
  };
41
28
  exports.PixelShader = PixelShader;
42
29
  //# sourceMappingURL=PixelShader.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"PixelShader.cjs","sources":["../../src/shaders/PixelShader.ts"],"sourcesContent":["/**\n * Pixelation shader\n */\n\nexport const PixelShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: null },\n pixelSize: { value: 1 },\n },\n\n vertexShader: /* glsl */ `\n varying highp vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n `,\n\n fragmentShader: /* glsl */ `\n uniform sampler2D tDiffuse;\n uniform float pixelSize;\n uniform vec2 resolution;\n\n varying highp vec2 vUv;\n\n void main(){\n\n vec2 dxy = pixelSize / resolution;\n vec2 coord = dxy * floor( vUv / dxy );\n gl_FragColor = texture2D(tDiffuse, coord);\n\n }\n `,\n}\n"],"names":[],"mappings":";;AAIO,MAAM,cAAc;AAAA,EACzB,UAAU;AAAA,IACR,UAAU,EAAE,OAAO,KAAK;AAAA,IACxB,YAAY,EAAE,OAAO,KAAK;AAAA,IAC1B,WAAW,EAAE,OAAO,EAAE;AAAA,EACxB;AAAA,EAEA;AAAA;AAAA,IAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWzB;AAAA;AAAA,IAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAe7B;;"}
1
+ {"version":3,"file":"PixelShader.cjs","sources":["../../src/shaders/PixelShader.ts"],"sourcesContent":["/**\n * Pixelation shader\n */\n\nexport const PixelShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: null },\n pixelSize: { value: 1 },\n },\n\n vertexShader: [\n 'varying highp vec2 vUv;',\n\n 'void main() {',\n\n 'vUv = uv;',\n 'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform float pixelSize;',\n 'uniform vec2 resolution;',\n\n 'varying highp vec2 vUv;',\n\n 'void main(){',\n\n 'vec2 dxy = pixelSize / resolution;',\n 'vec2 coord = dxy * floor( vUv / dxy );',\n 'gl_FragColor = texture2D(tDiffuse, coord);',\n\n '}',\n ].join('\\n'),\n}\n"],"names":[],"mappings":";;AAIO,MAAM,cAAc;AAAA,EACzB,UAAU;AAAA,IACR,UAAU,EAAE,OAAO,KAAK;AAAA,IACxB,YAAY,EAAE,OAAO,KAAK;AAAA,IAC1B,WAAW,EAAE,OAAO,EAAE;AAAA,EACxB;AAAA,EAEA,cAAc;AAAA,IACZ;AAAA,IAEA;AAAA,IAEA;AAAA,IACA;AAAA,IAEA;AAAA,EAAA,EACA,KAAK,IAAI;AAAA,EAEX,gBAAgB;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IAEA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,EAAA,EACA,KAAK,IAAI;AACb;;"}
@@ -4,37 +4,24 @@ const PixelShader = {
4
4
  resolution: { value: null },
5
5
  pixelSize: { value: 1 }
6
6
  },
7
- vertexShader: (
8
- /* glsl */
9
- `
10
- varying highp vec2 vUv;
11
-
12
- void main() {
13
-
14
- vUv = uv;
15
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
16
-
17
- }
18
- `
19
- ),
20
- fragmentShader: (
21
- /* glsl */
22
- `
23
- uniform sampler2D tDiffuse;
24
- uniform float pixelSize;
25
- uniform vec2 resolution;
26
-
27
- varying highp vec2 vUv;
28
-
29
- void main(){
30
-
31
- vec2 dxy = pixelSize / resolution;
32
- vec2 coord = dxy * floor( vUv / dxy );
33
- gl_FragColor = texture2D(tDiffuse, coord);
34
-
35
- }
36
- `
37
- )
7
+ vertexShader: [
8
+ "varying highp vec2 vUv;",
9
+ "void main() {",
10
+ "vUv = uv;",
11
+ "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
12
+ "}"
13
+ ].join("\n"),
14
+ fragmentShader: [
15
+ "uniform sampler2D tDiffuse;",
16
+ "uniform float pixelSize;",
17
+ "uniform vec2 resolution;",
18
+ "varying highp vec2 vUv;",
19
+ "void main(){",
20
+ "vec2 dxy = pixelSize / resolution;",
21
+ "vec2 coord = dxy * floor( vUv / dxy );",
22
+ "gl_FragColor = texture2D(tDiffuse, coord);",
23
+ "}"
24
+ ].join("\n")
38
25
  };
39
26
  export {
40
27
  PixelShader
@@ -1 +1 @@
1
- {"version":3,"file":"PixelShader.js","sources":["../../src/shaders/PixelShader.ts"],"sourcesContent":["/**\n * Pixelation shader\n */\n\nexport const PixelShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: null },\n pixelSize: { value: 1 },\n },\n\n vertexShader: /* glsl */ `\n varying highp vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n `,\n\n fragmentShader: /* glsl */ `\n uniform sampler2D tDiffuse;\n uniform float pixelSize;\n uniform vec2 resolution;\n\n varying highp vec2 vUv;\n\n void main(){\n\n vec2 dxy = pixelSize / resolution;\n vec2 coord = dxy * floor( vUv / dxy );\n gl_FragColor = texture2D(tDiffuse, coord);\n\n }\n `,\n}\n"],"names":[],"mappings":"AAIO,MAAM,cAAc;AAAA,EACzB,UAAU;AAAA,IACR,UAAU,EAAE,OAAO,KAAK;AAAA,IACxB,YAAY,EAAE,OAAO,KAAK;AAAA,IAC1B,WAAW,EAAE,OAAO,EAAE;AAAA,EACxB;AAAA,EAEA;AAAA;AAAA,IAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWzB;AAAA;AAAA,IAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAe7B;"}
1
+ {"version":3,"file":"PixelShader.js","sources":["../../src/shaders/PixelShader.ts"],"sourcesContent":["/**\n * Pixelation shader\n */\n\nexport const PixelShader = {\n uniforms: {\n tDiffuse: { value: null },\n resolution: { value: null },\n pixelSize: { value: 1 },\n },\n\n vertexShader: [\n 'varying highp vec2 vUv;',\n\n 'void main() {',\n\n 'vUv = uv;',\n 'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform float pixelSize;',\n 'uniform vec2 resolution;',\n\n 'varying highp vec2 vUv;',\n\n 'void main(){',\n\n 'vec2 dxy = pixelSize / resolution;',\n 'vec2 coord = dxy * floor( vUv / dxy );',\n 'gl_FragColor = texture2D(tDiffuse, coord);',\n\n '}',\n ].join('\\n'),\n}\n"],"names":[],"mappings":"AAIO,MAAM,cAAc;AAAA,EACzB,UAAU;AAAA,IACR,UAAU,EAAE,OAAO,KAAK;AAAA,IACxB,YAAY,EAAE,OAAO,KAAK;AAAA,IAC1B,WAAW,EAAE,OAAO,EAAE;AAAA,EACxB;AAAA,EAEA,cAAc;AAAA,IACZ;AAAA,IAEA;AAAA,IAEA;AAAA,IACA;AAAA,IAEA;AAAA,EAAA,EACA,KAAK,IAAI;AAAA,EAEX,gBAAgB;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IAEA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,EAAA,EACA,KAAK,IAAI;AACb;"}
@@ -6,39 +6,26 @@ const RGBShiftShader = {
6
6
  amount: { value: 5e-3 },
7
7
  angle: { value: 0 }
8
8
  },
9
- vertexShader: (
10
- /* glsl */
11
- `
12
- varying vec2 vUv;
13
-
14
- void main() {
15
-
16
- vUv = uv;
17
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
18
-
19
- }
20
- `
21
- ),
22
- fragmentShader: (
23
- /* glsl */
24
- `
25
- uniform sampler2D tDiffuse;
26
- uniform float amount;
27
- uniform float angle;
28
-
29
- varying vec2 vUv;
30
-
31
- void main() {
32
-
33
- vec2 offset = amount * vec2( cos(angle), sin(angle));
34
- vec4 cr = texture2D(tDiffuse, vUv + offset);
35
- vec4 cga = texture2D(tDiffuse, vUv);
36
- vec4 cb = texture2D(tDiffuse, vUv - offset);
37
- gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);
38
-
39
- }
40
- `
41
- )
9
+ vertexShader: [
10
+ "varying vec2 vUv;",
11
+ "void main() {",
12
+ " vUv = uv;",
13
+ " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
14
+ "}"
15
+ ].join("\n"),
16
+ fragmentShader: [
17
+ "uniform sampler2D tDiffuse;",
18
+ "uniform float amount;",
19
+ "uniform float angle;",
20
+ "varying vec2 vUv;",
21
+ "void main() {",
22
+ " vec2 offset = amount * vec2( cos(angle), sin(angle));",
23
+ " vec4 cr = texture2D(tDiffuse, vUv + offset);",
24
+ " vec4 cga = texture2D(tDiffuse, vUv);",
25
+ " vec4 cb = texture2D(tDiffuse, vUv - offset);",
26
+ " gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);",
27
+ "}"
28
+ ].join("\n")
42
29
  };
43
30
  exports.RGBShiftShader = RGBShiftShader;
44
31
  //# sourceMappingURL=RGBShiftShader.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"RGBShiftShader.cjs","sources":["../../src/shaders/RGBShiftShader.ts"],"sourcesContent":["/**\n * RGB Shift Shader\n * Shifts red and blue channels from center in opposite directions\n * Ported from http://kriss.cx/tom/2009/05/rgb-shift/\n * by Tom Butterworth / http://kriss.cx/tom/\n *\n * amount: shift distance (1 is width of input)\n * angle: shift angle in radians\n */\n\nexport const RGBShiftShader = {\n uniforms: {\n tDiffuse: { value: null },\n amount: { value: 0.005 },\n angle: { value: 0.0 },\n },\n\n vertexShader: /* glsl */ `\n varying vec2 vUv;\n\n void main() {\n\n \tvUv = uv;\n \tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n `,\n\n fragmentShader: /* glsl */ `\n uniform sampler2D tDiffuse;\n uniform float amount;\n uniform float angle;\n\n varying vec2 vUv;\n\n void main() {\n\n \tvec2 offset = amount * vec2( cos(angle), sin(angle));\n \tvec4 cr = texture2D(tDiffuse, vUv + offset);\n \tvec4 cga = texture2D(tDiffuse, vUv);\n \tvec4 cb = texture2D(tDiffuse, vUv - offset);\n \tgl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);\n\n }\n `,\n}\n"],"names":[],"mappings":";;AAUO,MAAM,iBAAiB;AAAA,EAC5B,UAAU;AAAA,IACR,UAAU,EAAE,OAAO,KAAK;AAAA,IACxB,QAAQ,EAAE,OAAO,KAAM;AAAA,IACvB,OAAO,EAAE,OAAO,EAAI;AAAA,EACtB;AAAA,EAEA;AAAA;AAAA,IAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWzB;AAAA;AAAA,IAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiB7B;;"}
1
+ {"version":3,"file":"RGBShiftShader.cjs","sources":["../../src/shaders/RGBShiftShader.ts"],"sourcesContent":["/**\n * RGB Shift Shader\n * Shifts red and blue channels from center in opposite directions\n * Ported from http://kriss.cx/tom/2009/05/rgb-shift/\n * by Tom Butterworth / http://kriss.cx/tom/\n *\n * amount: shift distance (1 is width of input)\n * angle: shift angle in radians\n */\n\nexport const RGBShiftShader = {\n uniforms: {\n tDiffuse: { value: null },\n amount: { value: 0.005 },\n angle: { value: 0.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform float amount;',\n 'uniform float angle;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec2 offset = amount * vec2( cos(angle), sin(angle));',\n '\tvec4 cr = texture2D(tDiffuse, vUv + offset);',\n '\tvec4 cga = texture2D(tDiffuse, vUv);',\n '\tvec4 cb = texture2D(tDiffuse, vUv - offset);',\n '\tgl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);',\n\n '}',\n ].join('\\n'),\n}\n"],"names":[],"mappings":";;AAUO,MAAM,iBAAiB;AAAA,EAC5B,UAAU;AAAA,IACR,UAAU,EAAE,OAAO,KAAK;AAAA,IACxB,QAAQ,EAAE,OAAO,KAAM;AAAA,IACvB,OAAO,EAAE,OAAO,EAAI;AAAA,EACtB;AAAA,EAEA,cAAc;AAAA,IACZ;AAAA,IAEA;AAAA,IAEA;AAAA,IACA;AAAA,IAEA;AAAA,EAAA,EACA,KAAK,IAAI;AAAA,EAEX,gBAAgB;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IAEA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,EAAA,EACA,KAAK,IAAI;AACb;;"}
@@ -4,39 +4,26 @@ const RGBShiftShader = {
4
4
  amount: { value: 5e-3 },
5
5
  angle: { value: 0 }
6
6
  },
7
- vertexShader: (
8
- /* glsl */
9
- `
10
- varying vec2 vUv;
11
-
12
- void main() {
13
-
14
- vUv = uv;
15
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
16
-
17
- }
18
- `
19
- ),
20
- fragmentShader: (
21
- /* glsl */
22
- `
23
- uniform sampler2D tDiffuse;
24
- uniform float amount;
25
- uniform float angle;
26
-
27
- varying vec2 vUv;
28
-
29
- void main() {
30
-
31
- vec2 offset = amount * vec2( cos(angle), sin(angle));
32
- vec4 cr = texture2D(tDiffuse, vUv + offset);
33
- vec4 cga = texture2D(tDiffuse, vUv);
34
- vec4 cb = texture2D(tDiffuse, vUv - offset);
35
- gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);
36
-
37
- }
38
- `
39
- )
7
+ vertexShader: [
8
+ "varying vec2 vUv;",
9
+ "void main() {",
10
+ " vUv = uv;",
11
+ " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
12
+ "}"
13
+ ].join("\n"),
14
+ fragmentShader: [
15
+ "uniform sampler2D tDiffuse;",
16
+ "uniform float amount;",
17
+ "uniform float angle;",
18
+ "varying vec2 vUv;",
19
+ "void main() {",
20
+ " vec2 offset = amount * vec2( cos(angle), sin(angle));",
21
+ " vec4 cr = texture2D(tDiffuse, vUv + offset);",
22
+ " vec4 cga = texture2D(tDiffuse, vUv);",
23
+ " vec4 cb = texture2D(tDiffuse, vUv - offset);",
24
+ " gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);",
25
+ "}"
26
+ ].join("\n")
40
27
  };
41
28
  export {
42
29
  RGBShiftShader
@@ -1 +1 @@
1
- {"version":3,"file":"RGBShiftShader.js","sources":["../../src/shaders/RGBShiftShader.ts"],"sourcesContent":["/**\n * RGB Shift Shader\n * Shifts red and blue channels from center in opposite directions\n * Ported from http://kriss.cx/tom/2009/05/rgb-shift/\n * by Tom Butterworth / http://kriss.cx/tom/\n *\n * amount: shift distance (1 is width of input)\n * angle: shift angle in radians\n */\n\nexport const RGBShiftShader = {\n uniforms: {\n tDiffuse: { value: null },\n amount: { value: 0.005 },\n angle: { value: 0.0 },\n },\n\n vertexShader: /* glsl */ `\n varying vec2 vUv;\n\n void main() {\n\n \tvUv = uv;\n \tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n `,\n\n fragmentShader: /* glsl */ `\n uniform sampler2D tDiffuse;\n uniform float amount;\n uniform float angle;\n\n varying vec2 vUv;\n\n void main() {\n\n \tvec2 offset = amount * vec2( cos(angle), sin(angle));\n \tvec4 cr = texture2D(tDiffuse, vUv + offset);\n \tvec4 cga = texture2D(tDiffuse, vUv);\n \tvec4 cb = texture2D(tDiffuse, vUv - offset);\n \tgl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);\n\n }\n `,\n}\n"],"names":[],"mappings":"AAUO,MAAM,iBAAiB;AAAA,EAC5B,UAAU;AAAA,IACR,UAAU,EAAE,OAAO,KAAK;AAAA,IACxB,QAAQ,EAAE,OAAO,KAAM;AAAA,IACvB,OAAO,EAAE,OAAO,EAAI;AAAA,EACtB;AAAA,EAEA;AAAA;AAAA,IAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWzB;AAAA;AAAA,IAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiB7B;"}
1
+ {"version":3,"file":"RGBShiftShader.js","sources":["../../src/shaders/RGBShiftShader.ts"],"sourcesContent":["/**\n * RGB Shift Shader\n * Shifts red and blue channels from center in opposite directions\n * Ported from http://kriss.cx/tom/2009/05/rgb-shift/\n * by Tom Butterworth / http://kriss.cx/tom/\n *\n * amount: shift distance (1 is width of input)\n * angle: shift angle in radians\n */\n\nexport const RGBShiftShader = {\n uniforms: {\n tDiffuse: { value: null },\n amount: { value: 0.005 },\n angle: { value: 0.0 },\n },\n\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n '}',\n ].join('\\n'),\n\n fragmentShader: [\n 'uniform sampler2D tDiffuse;',\n 'uniform float amount;',\n 'uniform float angle;',\n\n 'varying vec2 vUv;',\n\n 'void main() {',\n\n '\tvec2 offset = amount * vec2( cos(angle), sin(angle));',\n '\tvec4 cr = texture2D(tDiffuse, vUv + offset);',\n '\tvec4 cga = texture2D(tDiffuse, vUv);',\n '\tvec4 cb = texture2D(tDiffuse, vUv - offset);',\n '\tgl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);',\n\n '}',\n ].join('\\n'),\n}\n"],"names":[],"mappings":"AAUO,MAAM,iBAAiB;AAAA,EAC5B,UAAU;AAAA,IACR,UAAU,EAAE,OAAO,KAAK;AAAA,IACxB,QAAQ,EAAE,OAAO,KAAM;AAAA,IACvB,OAAO,EAAE,OAAO,EAAI;AAAA,EACtB;AAAA,EAEA,cAAc;AAAA,IACZ;AAAA,IAEA;AAAA,IAEA;AAAA,IACA;AAAA,IAEA;AAAA,EAAA,EACA,KAAK,IAAI;AAAA,EAEX,gBAAgB;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IAEA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,EAAA,EACA,KAAK,IAAI;AACb;"}
@@ -14,11 +14,11 @@ const SAOShader = {
14
14
  tDepth: { value: null },
15
15
  tDiffuse: { value: null },
16
16
  tNormal: { value: null },
17
- size: { value: /* @__PURE__ */ new THREE.Vector2(512, 512) },
17
+ size: { value: new THREE.Vector2(512, 512) },
18
18
  cameraNear: { value: 1 },
19
19
  cameraFar: { value: 100 },
20
- cameraProjectionMatrix: { value: /* @__PURE__ */ new THREE.Matrix4() },
21
- cameraInverseProjectionMatrix: { value: /* @__PURE__ */ new THREE.Matrix4() },
20
+ cameraProjectionMatrix: { value: new THREE.Matrix4() },
21
+ cameraInverseProjectionMatrix: { value: new THREE.Matrix4() },
22
22
  scale: { value: 1 },
23
23
  intensity: { value: 0.1 },
24
24
  bias: { value: 0.5 },
@@ -26,157 +26,120 @@ const SAOShader = {
26
26
  kernelRadius: { value: 100 },
27
27
  randomSeed: { value: 0 }
28
28
  },
29
- vertexShader: (
30
- /* glsl */
31
- `
32
- varying vec2 vUv;
33
-
34
- void main() {
35
- vUv = uv;
36
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
37
- }
38
- `
39
- ),
40
- fragmentShader: (
41
- /* glsl */
42
- `
43
- #include <common>
44
-
45
- varying vec2 vUv;
46
-
47
- #if DIFFUSE_TEXTURE == 1
48
- uniform sampler2D tDiffuse;
49
- #endif
50
-
51
- uniform sampler2D tDepth;
52
-
53
- #if NORMAL_TEXTURE == 1
54
- uniform sampler2D tNormal;
55
- #endif
56
-
57
- uniform float cameraNear;
58
- uniform float cameraFar;
59
- uniform mat4 cameraProjectionMatrix;
60
- uniform mat4 cameraInverseProjectionMatrix;
61
-
62
- uniform float scale;
63
- uniform float intensity;
64
- uniform float bias;
65
- uniform float kernelRadius;
66
- uniform float minResolution;
67
- uniform vec2 size;
68
- uniform float randomSeed;
69
-
70
- // RGBA depth
71
-
72
- #include <packing>
73
-
74
- vec4 getDefaultColor( const in vec2 screenPosition ) {
75
- #if DIFFUSE_TEXTURE == 1
76
- return texture2D( tDiffuse, vUv );
77
- #else
78
- return vec4( 1.0 );
79
- #endif
80
- }
81
-
82
- float getDepth( const in vec2 screenPosition ) {
83
- #if DEPTH_PACKING == 1
84
- return unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );
85
- #else
86
- return texture2D( tDepth, screenPosition ).x;
87
- #endif
88
- }
89
-
90
- float getViewZ( const in float depth ) {
91
- #if PERSPECTIVE_CAMERA == 1
92
- return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );
93
- #else
94
- return orthographicDepthToViewZ( depth, cameraNear, cameraFar );
95
- #endif
96
- }
97
-
98
- vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {
99
- float clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];
100
- vec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );
101
- clipPosition *= clipW; // unprojection.
102
-
103
- return ( cameraInverseProjectionMatrix * clipPosition ).xyz;
104
- }
105
-
106
- vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPosition ) {
107
- #if NORMAL_TEXTURE == 1
108
- return unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );
109
- #else
110
- return normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );
111
- #endif
112
- }
113
-
114
- float scaleDividedByCameraFar;
115
- float minResolutionMultipliedByCameraFar;
116
-
117
- float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {
118
- vec3 viewDelta = sampleViewPosition - centerViewPosition;
119
- float viewDistance = length( viewDelta );
120
- float scaledScreenDistance = scaleDividedByCameraFar * viewDistance;
121
-
122
- return max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - bias) / (1.0 + pow2( scaledScreenDistance ) );
123
- }
124
-
125
- // moving costly divides into consts
126
- const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );
127
- const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );
128
-
129
- float getAmbientOcclusion( const in vec3 centerViewPosition ) {
130
- // precompute some variables require in getOcclusion.
131
- scaleDividedByCameraFar = scale / cameraFar;
132
- minResolutionMultipliedByCameraFar = minResolution * cameraFar;
133
- vec3 centerViewNormal = getViewNormal( centerViewPosition, vUv );
134
-
135
- // jsfiddle that shows sample pattern: https://jsfiddle.net/a16ff1p7/
136
- float angle = rand( vUv + randomSeed ) * PI2;
137
- vec2 radius = vec2( kernelRadius * INV_NUM_SAMPLES ) / size;
138
- vec2 radiusStep = radius;
139
-
140
- float occlusionSum = 0.0;
141
- float weightSum = 0.0;
142
-
143
- for( int i = 0; i < NUM_SAMPLES; i ++ ) {
144
- vec2 sampleUv = vUv + vec2( cos( angle ), sin( angle ) ) * radius;
145
- radius += radiusStep;
146
- angle += ANGLE_STEP;
147
-
148
- float sampleDepth = getDepth( sampleUv );
149
- if( sampleDepth >= ( 1.0 - EPSILON ) ) {
150
- continue;
151
- }
152
-
153
- float sampleViewZ = getViewZ( sampleDepth );
154
- vec3 sampleViewPosition = getViewPosition( sampleUv, sampleDepth, sampleViewZ );
155
- occlusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );
156
- weightSum += 1.0;
157
- }
158
-
159
- if( weightSum == 0.0 ) discard;
160
-
161
- return occlusionSum * ( intensity / weightSum );
162
- }
163
-
164
- void main() {
165
- float centerDepth = getDepth( vUv );
166
- if( centerDepth >= ( 1.0 - EPSILON ) ) {
167
- discard;
168
- }
169
-
170
- float centerViewZ = getViewZ( centerDepth );
171
- vec3 viewPosition = getViewPosition( vUv, centerDepth, centerViewZ );
172
-
173
- float ambientOcclusion = getAmbientOcclusion( viewPosition );
174
-
175
- gl_FragColor = getDefaultColor( vUv );
176
- gl_FragColor.xyz *= 1.0 - ambientOcclusion;
177
- }
178
- `
179
- )
29
+ vertexShader: [
30
+ "varying vec2 vUv;",
31
+ "void main() {",
32
+ " vUv = uv;",
33
+ " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
34
+ "}"
35
+ ].join("\n"),
36
+ fragmentShader: [
37
+ "#include <common>",
38
+ "varying vec2 vUv;",
39
+ "#if DIFFUSE_TEXTURE == 1",
40
+ "uniform sampler2D tDiffuse;",
41
+ "#endif",
42
+ "uniform sampler2D tDepth;",
43
+ "#if NORMAL_TEXTURE == 1",
44
+ "uniform sampler2D tNormal;",
45
+ "#endif",
46
+ "uniform float cameraNear;",
47
+ "uniform float cameraFar;",
48
+ "uniform mat4 cameraProjectionMatrix;",
49
+ "uniform mat4 cameraInverseProjectionMatrix;",
50
+ "uniform float scale;",
51
+ "uniform float intensity;",
52
+ "uniform float bias;",
53
+ "uniform float kernelRadius;",
54
+ "uniform float minResolution;",
55
+ "uniform vec2 size;",
56
+ "uniform float randomSeed;",
57
+ "// RGBA depth",
58
+ "#include <packing>",
59
+ "vec4 getDefaultColor( const in vec2 screenPosition ) {",
60
+ " #if DIFFUSE_TEXTURE == 1",
61
+ " return texture2D( tDiffuse, vUv );",
62
+ " #else",
63
+ " return vec4( 1.0 );",
64
+ " #endif",
65
+ "}",
66
+ "float getDepth( const in vec2 screenPosition ) {",
67
+ " #if DEPTH_PACKING == 1",
68
+ " return unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );",
69
+ " #else",
70
+ " return texture2D( tDepth, screenPosition ).x;",
71
+ " #endif",
72
+ "}",
73
+ "float getViewZ( const in float depth ) {",
74
+ " #if PERSPECTIVE_CAMERA == 1",
75
+ " return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );",
76
+ " #else",
77
+ " return orthographicDepthToViewZ( depth, cameraNear, cameraFar );",
78
+ " #endif",
79
+ "}",
80
+ "vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {",
81
+ " float clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];",
82
+ " vec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );",
83
+ " clipPosition *= clipW; // unprojection.",
84
+ " return ( cameraInverseProjectionMatrix * clipPosition ).xyz;",
85
+ "}",
86
+ "vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPosition ) {",
87
+ " #if NORMAL_TEXTURE == 1",
88
+ " return unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );",
89
+ " #else",
90
+ " return normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );",
91
+ " #endif",
92
+ "}",
93
+ "float scaleDividedByCameraFar;",
94
+ "float minResolutionMultipliedByCameraFar;",
95
+ "float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {",
96
+ " vec3 viewDelta = sampleViewPosition - centerViewPosition;",
97
+ " float viewDistance = length( viewDelta );",
98
+ " float scaledScreenDistance = scaleDividedByCameraFar * viewDistance;",
99
+ " return max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - bias) / (1.0 + pow2( scaledScreenDistance ) );",
100
+ "}",
101
+ "// moving costly divides into consts",
102
+ "const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );",
103
+ "const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );",
104
+ "float getAmbientOcclusion( const in vec3 centerViewPosition ) {",
105
+ " // precompute some variables require in getOcclusion.",
106
+ " scaleDividedByCameraFar = scale / cameraFar;",
107
+ " minResolutionMultipliedByCameraFar = minResolution * cameraFar;",
108
+ " vec3 centerViewNormal = getViewNormal( centerViewPosition, vUv );",
109
+ " // jsfiddle that shows sample pattern: https://jsfiddle.net/a16ff1p7/",
110
+ " float angle = rand( vUv + randomSeed ) * PI2;",
111
+ " vec2 radius = vec2( kernelRadius * INV_NUM_SAMPLES ) / size;",
112
+ " vec2 radiusStep = radius;",
113
+ " float occlusionSum = 0.0;",
114
+ " float weightSum = 0.0;",
115
+ " for( int i = 0; i < NUM_SAMPLES; i ++ ) {",
116
+ " vec2 sampleUv = vUv + vec2( cos( angle ), sin( angle ) ) * radius;",
117
+ " radius += radiusStep;",
118
+ " angle += ANGLE_STEP;",
119
+ " float sampleDepth = getDepth( sampleUv );",
120
+ " if( sampleDepth >= ( 1.0 - EPSILON ) ) {",
121
+ " continue;",
122
+ " }",
123
+ " float sampleViewZ = getViewZ( sampleDepth );",
124
+ " vec3 sampleViewPosition = getViewPosition( sampleUv, sampleDepth, sampleViewZ );",
125
+ " occlusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );",
126
+ " weightSum += 1.0;",
127
+ " }",
128
+ " if( weightSum == 0.0 ) discard;",
129
+ " return occlusionSum * ( intensity / weightSum );",
130
+ "}",
131
+ "void main() {",
132
+ " float centerDepth = getDepth( vUv );",
133
+ " if( centerDepth >= ( 1.0 - EPSILON ) ) {",
134
+ " discard;",
135
+ " }",
136
+ " float centerViewZ = getViewZ( centerDepth );",
137
+ " vec3 viewPosition = getViewPosition( vUv, centerDepth, centerViewZ );",
138
+ " float ambientOcclusion = getAmbientOcclusion( viewPosition );",
139
+ " gl_FragColor = getDefaultColor( vUv );",
140
+ " gl_FragColor.xyz *= 1.0 - ambientOcclusion;",
141
+ "}"
142
+ ].join("\n")
180
143
  };
181
144
  exports.SAOShader = SAOShader;
182
145
  //# sourceMappingURL=SAOShader.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"SAOShader.cjs","sources":["../../src/shaders/SAOShader.ts"],"sourcesContent":["import { Matrix4, Vector2 } from 'three'\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type SAOShaderDefines = Record<\n 'DEPTH_PACKING' | 'DIFFUSE_TEXTURE' | 'NORMAL_TEXTURE' | 'NUM_RINGS' | 'NUM_SAMPLES' | 'PERSPECTIVE_CAMERA',\n number\n>\n\nexport type SAOShaderUniforms = {\n bias: IUniform<number>\n cameraFar: IUniform<number>\n cameraInverseProjectionMatrix: IUniform<Matrix4>\n cameraNear: IUniform<number>\n cameraProjectionMatrix: IUniform<Matrix4>\n intensity: IUniform<number>\n kernelRadius: IUniform<number>\n minResolution: IUniform<number>\n randomSeed: IUniform<number>\n scale: IUniform<number>\n size: IUniform<Vector2>\n tDepth: IUniform<Texture | null>\n tDiffuse: IUniform<Texture | null>\n tNormal: IUniform<Texture | null>\n}\n\nexport interface ISAOShader extends IShader<SAOShaderUniforms, SAOShaderDefines> {\n defines: SAOShaderDefines\n needsUpdate?: boolean\n}\n\nexport const SAOShader: ISAOShader = {\n defines: {\n NUM_SAMPLES: 7,\n NUM_RINGS: 4,\n NORMAL_TEXTURE: 0,\n DIFFUSE_TEXTURE: 0,\n DEPTH_PACKING: 1,\n PERSPECTIVE_CAMERA: 1,\n },\n uniforms: {\n tDepth: { value: null },\n tDiffuse: { value: null },\n tNormal: { value: null },\n size: { value: /* @__PURE__ */ new Vector2(512, 512) },\n\n cameraNear: { value: 1 },\n cameraFar: { value: 100 },\n cameraProjectionMatrix: { value: /* @__PURE__ */ new Matrix4() },\n cameraInverseProjectionMatrix: { value: /* @__PURE__ */ new Matrix4() },\n\n scale: { value: 1.0 },\n intensity: { value: 0.1 },\n bias: { value: 0.5 },\n\n minResolution: { value: 0.0 },\n kernelRadius: { value: 100.0 },\n randomSeed: { value: 0.0 },\n },\n vertexShader: /* glsl */ `\n varying vec2 vUv;\n\n void main() {\n \tvUv = uv;\n \tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n `,\n fragmentShader: /* glsl */ `\n #include <common>\n\n varying vec2 vUv;\n\n #if DIFFUSE_TEXTURE == 1\n uniform sampler2D tDiffuse;\n #endif\n\n uniform sampler2D tDepth;\n\n #if NORMAL_TEXTURE == 1\n uniform sampler2D tNormal;\n #endif\n\n uniform float cameraNear;\n uniform float cameraFar;\n uniform mat4 cameraProjectionMatrix;\n uniform mat4 cameraInverseProjectionMatrix;\n\n uniform float scale;\n uniform float intensity;\n uniform float bias;\n uniform float kernelRadius;\n uniform float minResolution;\n uniform vec2 size;\n uniform float randomSeed;\n\n // RGBA depth\n\n #include <packing>\n\n vec4 getDefaultColor( const in vec2 screenPosition ) {\n \t#if DIFFUSE_TEXTURE == 1\n \treturn texture2D( tDiffuse, vUv );\n \t#else\n \treturn vec4( 1.0 );\n \t#endif\n }\n\n float getDepth( const in vec2 screenPosition ) {\n \t#if DEPTH_PACKING == 1\n \treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );\n \t#else\n \treturn texture2D( tDepth, screenPosition ).x;\n \t#endif\n }\n\n float getViewZ( const in float depth ) {\n \t#if PERSPECTIVE_CAMERA == 1\n \treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );\n \t#else\n \treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );\n \t#endif\n }\n\n vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {\n \tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];\n \tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );\n \tclipPosition *= clipW; // unprojection.\n\n \treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;\n }\n\n vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPosition ) {\n \t#if NORMAL_TEXTURE == 1\n \treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );\n \t#else\n \treturn normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );\n \t#endif\n }\n\n float scaleDividedByCameraFar;\n float minResolutionMultipliedByCameraFar;\n\n float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {\n \tvec3 viewDelta = sampleViewPosition - centerViewPosition;\n \tfloat viewDistance = length( viewDelta );\n \tfloat scaledScreenDistance = scaleDividedByCameraFar * viewDistance;\n\n \treturn max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - bias) / (1.0 + pow2( scaledScreenDistance ) );\n }\n\n // moving costly divides into consts\n const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );\n const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );\n\n float getAmbientOcclusion( const in vec3 centerViewPosition ) {\n \t// precompute some variables require in getOcclusion.\n \tscaleDividedByCameraFar = scale / cameraFar;\n \tminResolutionMultipliedByCameraFar = minResolution * cameraFar;\n \tvec3 centerViewNormal = getViewNormal( centerViewPosition, vUv );\n\n \t// jsfiddle that shows sample pattern: https://jsfiddle.net/a16ff1p7/\n \tfloat angle = rand( vUv + randomSeed ) * PI2;\n \tvec2 radius = vec2( kernelRadius * INV_NUM_SAMPLES ) / size;\n \tvec2 radiusStep = radius;\n\n \tfloat occlusionSum = 0.0;\n \tfloat weightSum = 0.0;\n\n \tfor( int i = 0; i < NUM_SAMPLES; i ++ ) {\n \t\tvec2 sampleUv = vUv + vec2( cos( angle ), sin( angle ) ) * radius;\n \t\tradius += radiusStep;\n \t\tangle += ANGLE_STEP;\n\n \t\tfloat sampleDepth = getDepth( sampleUv );\n \t\tif( sampleDepth >= ( 1.0 - EPSILON ) ) {\n \t\t\tcontinue;\n \t\t}\n\n \t\tfloat sampleViewZ = getViewZ( sampleDepth );\n \t\tvec3 sampleViewPosition = getViewPosition( sampleUv, sampleDepth, sampleViewZ );\n \t\tocclusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );\n \t\tweightSum += 1.0;\n \t}\n\n \tif( weightSum == 0.0 ) discard;\n\n \treturn occlusionSum * ( intensity / weightSum );\n }\n\n void main() {\n \tfloat centerDepth = getDepth( vUv );\n \tif( centerDepth >= ( 1.0 - EPSILON ) ) {\n \t\tdiscard;\n \t}\n\n \tfloat centerViewZ = getViewZ( centerDepth );\n \tvec3 viewPosition = getViewPosition( vUv, centerDepth, centerViewZ );\n\n \tfloat ambientOcclusion = getAmbientOcclusion( viewPosition );\n\n \tgl_FragColor = getDefaultColor( vUv );\n \tgl_FragColor.xyz *= 1.0 - ambientOcclusion;\n }\n `,\n}\n"],"names":["Vector2","Matrix4"],"mappings":";;;AAgCO,MAAM,YAAwB;AAAA,EACnC,SAAS;AAAA,IACP,aAAa;AAAA,IACb,WAAW;AAAA,IACX,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,eAAe;AAAA,IACf,oBAAoB;AAAA,EACtB;AAAA,EACA,UAAU;AAAA,IACR,QAAQ,EAAE,OAAO,KAAK;AAAA,IACtB,UAAU,EAAE,OAAO,KAAK;AAAA,IACxB,SAAS,EAAE,OAAO,KAAK;AAAA,IACvB,MAAM,EAAE,2BAA2BA,MAAQ,QAAA,KAAK,GAAG,EAAE;AAAA,IAErD,YAAY,EAAE,OAAO,EAAE;AAAA,IACvB,WAAW,EAAE,OAAO,IAAI;AAAA,IACxB,wBAAwB,EAAE,OAAuB,oBAAIC,MAAAA,UAAU;AAAA,IAC/D,+BAA+B,EAAE,OAAuB,oBAAIA,MAAAA,UAAU;AAAA,IAEtE,OAAO,EAAE,OAAO,EAAI;AAAA,IACpB,WAAW,EAAE,OAAO,IAAI;AAAA,IACxB,MAAM,EAAE,OAAO,IAAI;AAAA,IAEnB,eAAe,EAAE,OAAO,EAAI;AAAA,IAC5B,cAAc,EAAE,OAAO,IAAM;AAAA,IAC7B,YAAY,EAAE,OAAO,EAAI;AAAA,EAC3B;AAAA,EACA;AAAA;AAAA,IAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQzB;AAAA;AAAA,IAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyI7B;;"}
1
+ {"version":3,"file":"SAOShader.cjs","sources":["../../src/shaders/SAOShader.ts"],"sourcesContent":["import { Matrix4, Vector2 } from 'three'\n\nimport type { IUniform, Texture } from 'three'\nimport type { IShader } from './types'\n\nexport type SAOShaderDefines = Record<\n 'DEPTH_PACKING' | 'DIFFUSE_TEXTURE' | 'NORMAL_TEXTURE' | 'NUM_RINGS' | 'NUM_SAMPLES' | 'PERSPECTIVE_CAMERA',\n number\n>\n\nexport type SAOShaderUniforms = {\n bias: IUniform<number>\n cameraFar: IUniform<number>\n cameraInverseProjectionMatrix: IUniform<Matrix4>\n cameraNear: IUniform<number>\n cameraProjectionMatrix: IUniform<Matrix4>\n intensity: IUniform<number>\n kernelRadius: IUniform<number>\n minResolution: IUniform<number>\n randomSeed: IUniform<number>\n scale: IUniform<number>\n size: IUniform<Vector2>\n tDepth: IUniform<Texture | null>\n tDiffuse: IUniform<Texture | null>\n tNormal: IUniform<Texture | null>\n}\n\nexport interface ISAOShader extends IShader<SAOShaderUniforms, SAOShaderDefines> {\n defines: SAOShaderDefines\n needsUpdate?: boolean\n}\n\nexport const SAOShader: ISAOShader = {\n defines: {\n NUM_SAMPLES: 7,\n NUM_RINGS: 4,\n NORMAL_TEXTURE: 0,\n DIFFUSE_TEXTURE: 0,\n DEPTH_PACKING: 1,\n PERSPECTIVE_CAMERA: 1,\n },\n uniforms: {\n tDepth: { value: null },\n tDiffuse: { value: null },\n tNormal: { value: null },\n size: { value: new Vector2(512, 512) },\n\n cameraNear: { value: 1 },\n cameraFar: { value: 100 },\n cameraProjectionMatrix: { value: new Matrix4() },\n cameraInverseProjectionMatrix: { value: new Matrix4() },\n\n scale: { value: 1.0 },\n intensity: { value: 0.1 },\n bias: { value: 0.5 },\n\n minResolution: { value: 0.0 },\n kernelRadius: { value: 100.0 },\n randomSeed: { value: 0.0 },\n },\n vertexShader: [\n 'varying vec2 vUv;',\n\n 'void main() {',\n '\tvUv = uv;',\n '\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n '}',\n ].join('\\n'),\n fragmentShader: [\n '#include <common>',\n\n 'varying vec2 vUv;',\n\n '#if DIFFUSE_TEXTURE == 1',\n 'uniform sampler2D tDiffuse;',\n '#endif',\n\n 'uniform sampler2D tDepth;',\n\n '#if NORMAL_TEXTURE == 1',\n 'uniform sampler2D tNormal;',\n '#endif',\n\n 'uniform float cameraNear;',\n 'uniform float cameraFar;',\n 'uniform mat4 cameraProjectionMatrix;',\n 'uniform mat4 cameraInverseProjectionMatrix;',\n\n 'uniform float scale;',\n 'uniform float intensity;',\n 'uniform float bias;',\n 'uniform float kernelRadius;',\n 'uniform float minResolution;',\n 'uniform vec2 size;',\n 'uniform float randomSeed;',\n\n '// RGBA depth',\n\n '#include <packing>',\n\n 'vec4 getDefaultColor( const in vec2 screenPosition ) {',\n '\t#if DIFFUSE_TEXTURE == 1',\n '\treturn texture2D( tDiffuse, vUv );',\n '\t#else',\n '\treturn vec4( 1.0 );',\n '\t#endif',\n '}',\n\n 'float getDepth( const in vec2 screenPosition ) {',\n '\t#if DEPTH_PACKING == 1',\n '\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );',\n '\t#else',\n '\treturn texture2D( tDepth, screenPosition ).x;',\n '\t#endif',\n '}',\n\n 'float getViewZ( const in float depth ) {',\n '\t#if PERSPECTIVE_CAMERA == 1',\n '\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );',\n '\t#else',\n '\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );',\n '\t#endif',\n '}',\n\n 'vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {',\n '\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];',\n '\tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );',\n '\tclipPosition *= clipW; // unprojection.',\n\n '\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;',\n '}',\n\n 'vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPosition ) {',\n '\t#if NORMAL_TEXTURE == 1',\n '\treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );',\n '\t#else',\n '\treturn normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );',\n '\t#endif',\n '}',\n\n 'float scaleDividedByCameraFar;',\n 'float minResolutionMultipliedByCameraFar;',\n\n 'float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {',\n '\tvec3 viewDelta = sampleViewPosition - centerViewPosition;',\n '\tfloat viewDistance = length( viewDelta );',\n '\tfloat scaledScreenDistance = scaleDividedByCameraFar * viewDistance;',\n\n '\treturn max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - bias) / (1.0 + pow2( scaledScreenDistance ) );',\n '}',\n\n '// moving costly divides into consts',\n 'const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );',\n 'const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );',\n\n 'float getAmbientOcclusion( const in vec3 centerViewPosition ) {',\n '\t// precompute some variables require in getOcclusion.',\n '\tscaleDividedByCameraFar = scale / cameraFar;',\n '\tminResolutionMultipliedByCameraFar = minResolution * cameraFar;',\n '\tvec3 centerViewNormal = getViewNormal( centerViewPosition, vUv );',\n\n '\t// jsfiddle that shows sample pattern: https://jsfiddle.net/a16ff1p7/',\n '\tfloat angle = rand( vUv + randomSeed ) * PI2;',\n '\tvec2 radius = vec2( kernelRadius * INV_NUM_SAMPLES ) / size;',\n '\tvec2 radiusStep = radius;',\n\n '\tfloat occlusionSum = 0.0;',\n '\tfloat weightSum = 0.0;',\n\n '\tfor( int i = 0; i < NUM_SAMPLES; i ++ ) {',\n '\t\tvec2 sampleUv = vUv + vec2( cos( angle ), sin( angle ) ) * radius;',\n '\t\tradius += radiusStep;',\n '\t\tangle += ANGLE_STEP;',\n\n '\t\tfloat sampleDepth = getDepth( sampleUv );',\n '\t\tif( sampleDepth >= ( 1.0 - EPSILON ) ) {',\n '\t\t\tcontinue;',\n '\t\t}',\n\n '\t\tfloat sampleViewZ = getViewZ( sampleDepth );',\n '\t\tvec3 sampleViewPosition = getViewPosition( sampleUv, sampleDepth, sampleViewZ );',\n '\t\tocclusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );',\n '\t\tweightSum += 1.0;',\n '\t}',\n\n '\tif( weightSum == 0.0 ) discard;',\n\n '\treturn occlusionSum * ( intensity / weightSum );',\n '}',\n\n 'void main() {',\n '\tfloat centerDepth = getDepth( vUv );',\n '\tif( centerDepth >= ( 1.0 - EPSILON ) ) {',\n '\t\tdiscard;',\n '\t}',\n\n '\tfloat centerViewZ = getViewZ( centerDepth );',\n '\tvec3 viewPosition = getViewPosition( vUv, centerDepth, centerViewZ );',\n\n '\tfloat ambientOcclusion = getAmbientOcclusion( viewPosition );',\n\n '\tgl_FragColor = getDefaultColor( vUv );',\n '\tgl_FragColor.xyz *= 1.0 - ambientOcclusion;',\n '}',\n ].join('\\n'),\n}\n"],"names":["Vector2","Matrix4"],"mappings":";;;AAgCO,MAAM,YAAwB;AAAA,EACnC,SAAS;AAAA,IACP,aAAa;AAAA,IACb,WAAW;AAAA,IACX,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,eAAe;AAAA,IACf,oBAAoB;AAAA,EACtB;AAAA,EACA,UAAU;AAAA,IACR,QAAQ,EAAE,OAAO,KAAK;AAAA,IACtB,UAAU,EAAE,OAAO,KAAK;AAAA,IACxB,SAAS,EAAE,OAAO,KAAK;AAAA,IACvB,MAAM,EAAE,OAAO,IAAIA,MAAQ,QAAA,KAAK,GAAG,EAAE;AAAA,IAErC,YAAY,EAAE,OAAO,EAAE;AAAA,IACvB,WAAW,EAAE,OAAO,IAAI;AAAA,IACxB,wBAAwB,EAAE,OAAO,IAAIC,MAAAA,UAAU;AAAA,IAC/C,+BAA+B,EAAE,OAAO,IAAIA,MAAAA,UAAU;AAAA,IAEtD,OAAO,EAAE,OAAO,EAAI;AAAA,IACpB,WAAW,EAAE,OAAO,IAAI;AAAA,IACxB,MAAM,EAAE,OAAO,IAAI;AAAA,IAEnB,eAAe,EAAE,OAAO,EAAI;AAAA,IAC5B,cAAc,EAAE,OAAO,IAAM;AAAA,IAC7B,YAAY,EAAE,OAAO,EAAI;AAAA,EAC3B;AAAA,EACA,cAAc;AAAA,IACZ;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,KAAK,IAAI;AAAA,EACX,gBAAgB;AAAA,IACd;AAAA,IAEA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IAEA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IAEA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,IACA;AAAA,IAEA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,KAAK,IAAI;AACb;;"}