@anov/3d-ability 0.0.140 → 0.0.141

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 (265) hide show
  1. package/dist/business/Animation/motion/index.js +35 -56
  2. package/dist/business/Animation/motion/index.js.map +1 -1
  3. package/dist/business/Animation/type.js +2 -2
  4. package/dist/business/Area/Fence/FenceBase.js +146 -187
  5. package/dist/business/Area/Fence/FenceBase.js.map +1 -1
  6. package/dist/business/Area/Fence/fence_base_01.js +120 -112
  7. package/dist/business/Area/Fence/fence_base_01.js.map +1 -1
  8. package/dist/business/Area/Fence/fence_feeting_01.js +218 -130
  9. package/dist/business/Area/Fence/fence_feeting_01.js.map +1 -1
  10. package/dist/business/Area/Fence/fence_roll_01.js +140 -130
  11. package/dist/business/Area/Fence/fence_roll_01.js.map +1 -1
  12. package/dist/business/Area/FillArea/FillAreaBase.js +87 -126
  13. package/dist/business/Area/FillArea/FillAreaBase.js.map +1 -1
  14. package/dist/business/Area/FillArea/fillArea_face_01.js +72 -98
  15. package/dist/business/Area/FillArea/fillArea_face_01.js.map +1 -1
  16. package/dist/business/Area/FillArea/fillArea_line_01.js +66 -94
  17. package/dist/business/Area/FillArea/fillArea_line_01.js.map +1 -1
  18. package/dist/business/Area/index.js +267 -483
  19. package/dist/business/Area/index.js.map +1 -1
  20. package/dist/business/Area/tool.js +14 -26
  21. package/dist/business/Area/tool.js.map +1 -1
  22. package/dist/business/Base/ObjectLayer.js +21 -46
  23. package/dist/business/Base/ObjectLayer.js.map +1 -1
  24. package/dist/business/Batch/index.js +189 -234
  25. package/dist/business/Batch/index.js.map +1 -1
  26. package/dist/business/Box/index.js +52 -81
  27. package/dist/business/Box/index.js.map +1 -1
  28. package/dist/business/Cylinder/index.js +51 -79
  29. package/dist/business/Cylinder/index.js.map +1 -1
  30. package/dist/business/Flyline/bubble/CircleBubble.js +1 -9
  31. package/dist/business/Flyline/bubble/CircleBubble.js.map +1 -1
  32. package/dist/business/Flyline/bubble/index.js +7 -21
  33. package/dist/business/Flyline/bubble/index.js.map +1 -1
  34. package/dist/business/Flyline/index.js +96 -162
  35. package/dist/business/Flyline/index.js.map +1 -1
  36. package/dist/business/Flyline/line/ArcLine.js +208 -291
  37. package/dist/business/Flyline/line/ArcLine.js.map +1 -1
  38. package/dist/business/Flyline/line/index.js +8 -22
  39. package/dist/business/Flyline/line/index.js.map +1 -1
  40. package/dist/business/HeatMap/HeatMap.js +380 -467
  41. package/dist/business/HeatMap/HeatMap.js.map +1 -1
  42. package/dist/business/HeatMap/core.js +405 -525
  43. package/dist/business/HeatMap/core.js.map +1 -1
  44. package/dist/business/HeatMap/shader.js +69 -3
  45. package/dist/business/HeatMap/shader.js.map +1 -1
  46. package/dist/business/InfoPanel/index.js +201 -242
  47. package/dist/business/InfoPanel/index.js.map +1 -1
  48. package/dist/business/Line/index.js +55 -88
  49. package/dist/business/Line/index.js.map +1 -1
  50. package/dist/business/Mark/KeyframeAnimation.js +145 -176
  51. package/dist/business/Mark/KeyframeAnimation.js.map +1 -1
  52. package/dist/business/Mark/index.js +196 -294
  53. package/dist/business/Mark/index.js.map +1 -1
  54. package/dist/business/Mark/shader/tanhao.js +36 -3
  55. package/dist/business/Mark/shader/tanhao.js.map +1 -1
  56. package/dist/business/Mark/type.js +1 -1
  57. package/dist/business/MaterialSwitch/MaterialSwitchSystem.js +377 -551
  58. package/dist/business/MaterialSwitch/MaterialSwitchSystem.js.map +1 -1
  59. package/dist/business/MaterialSwitch/inject.js +92 -58
  60. package/dist/business/MaterialSwitch/inject.js.map +1 -1
  61. package/dist/business/MaterialSwitch/shader/finalFade.js +74 -2
  62. package/dist/business/MaterialSwitch/shader/finalFade.js.map +1 -1
  63. package/dist/business/MaterialSwitch/shader/ground.js +95 -16
  64. package/dist/business/MaterialSwitch/shader/ground.js.map +1 -1
  65. package/dist/business/MaterialSwitch/shader/groundBase64.js +9 -3
  66. package/dist/business/MaterialSwitch/shader/groundBase64.js.map +1 -1
  67. package/dist/business/MaterialSwitch/shader/realFade.js +48 -9
  68. package/dist/business/MaterialSwitch/shader/realFade.js.map +1 -1
  69. package/dist/business/Plane/index.js +51 -78
  70. package/dist/business/Plane/index.js.map +1 -1
  71. package/dist/business/Poi/index.d.ts +5 -0
  72. package/dist/business/Poi/index.js +256 -295
  73. package/dist/business/Poi/index.js.map +1 -1
  74. package/dist/business/Poi/link/Cylinder.js +56 -89
  75. package/dist/business/Poi/link/Cylinder.js.map +1 -1
  76. package/dist/business/Poi/link/Pyramid.js +104 -165
  77. package/dist/business/Poi/link/Pyramid.js.map +1 -1
  78. package/dist/business/Poi/link/index.d.ts +1 -1
  79. package/dist/business/Poi/link/index.js +54 -114
  80. package/dist/business/Poi/link/index.js.map +1 -1
  81. package/dist/business/Poi/panel/index.d.ts +124 -0
  82. package/dist/business/Poi/panel/index.js +474 -0
  83. package/dist/business/Poi/panel/index.js.map +1 -0
  84. package/dist/business/Poi/panel/interfaces.d.ts +67 -0
  85. package/dist/business/Poi/panel/interfaces.js +2 -0
  86. package/dist/business/Poi/panel/interfaces.js.map +1 -0
  87. package/dist/business/Poi/panel/utils.d.ts +72 -0
  88. package/dist/business/Poi/panel/utils.js +126 -0
  89. package/dist/business/Poi/panel/utils.js.map +1 -0
  90. package/dist/business/Poi/particle/DoubleCircle.js +71 -107
  91. package/dist/business/Poi/particle/DoubleCircle.js.map +1 -1
  92. package/dist/business/Poi/particle/DynamicCircle.js +75 -111
  93. package/dist/business/Poi/particle/DynamicCircle.js.map +1 -1
  94. package/dist/business/Poi/particle/SingleCircle.js +62 -98
  95. package/dist/business/Poi/particle/SingleCircle.js.map +1 -1
  96. package/dist/business/Poi/particle/index.js +49 -117
  97. package/dist/business/Poi/particle/index.js.map +1 -1
  98. package/dist/business/Poi/shader/circle.js +31 -3
  99. package/dist/business/Poi/shader/circle.js.map +1 -1
  100. package/dist/business/Poi/shader/cylinder.js +37 -3
  101. package/dist/business/Poi/shader/cylinder.js.map +1 -1
  102. package/dist/business/Poi/shader/doubleCircle.js +55 -3
  103. package/dist/business/Poi/shader/doubleCircle.js.map +1 -1
  104. package/dist/business/Poi/shader/dynamicCircle.js +67 -3
  105. package/dist/business/Poi/shader/dynamicCircle.js.map +1 -1
  106. package/dist/business/Poi/title/Border.js +7 -27
  107. package/dist/business/Poi/title/Border.js.map +1 -1
  108. package/dist/business/Poi/title/Ellipse.js +7 -27
  109. package/dist/business/Poi/title/Ellipse.js.map +1 -1
  110. package/dist/business/Poi/title/index.js +208 -292
  111. package/dist/business/Poi/title/index.js.map +1 -1
  112. package/dist/business/Poi/tools.js +22 -19
  113. package/dist/business/Poi/tools.js.map +1 -1
  114. package/dist/business/Poi/types.d.ts +3 -0
  115. package/dist/business/Poi/types.js.map +1 -1
  116. package/dist/business/Sphere/index.js +47 -72
  117. package/dist/business/Sphere/index.js.map +1 -1
  118. package/dist/business/Spline/index.js +190 -245
  119. package/dist/business/Spline/index.js.map +1 -1
  120. package/dist/business/SplitBuilding/index.js +327 -536
  121. package/dist/business/SplitBuilding/index.js.map +1 -1
  122. package/dist/business/SplitBuilding/type.js +2 -2
  123. package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js +218 -275
  124. package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js.map +1 -1
  125. package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js +132 -177
  126. package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js.map +1 -1
  127. package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js +51 -1
  128. package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js.map +1 -1
  129. package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js +6 -1
  130. package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js.map +1 -1
  131. package/dist/business/TrafficComponents/base.js +32 -55
  132. package/dist/business/TrafficComponents/base.js.map +1 -1
  133. package/dist/business/TrafficComponents/utils.js +25 -24
  134. package/dist/business/TrafficComponents/utils.js.map +1 -1
  135. package/dist/business/Utils/Curve.js +40 -56
  136. package/dist/business/Utils/Curve.js.map +1 -1
  137. package/dist/business/Utils/constant.js +1 -1
  138. package/dist/business/Utils/constant.js.map +1 -1
  139. package/dist/business/Utils/defineProps.js +13 -14
  140. package/dist/business/Utils/defineProps.js.map +1 -1
  141. package/dist/business/Utils/round-curve.js +127 -153
  142. package/dist/business/Utils/round-curve.js.map +1 -1
  143. package/dist/business/VideoPanel/index.js +258 -319
  144. package/dist/business/VideoPanel/index.js.map +1 -1
  145. package/dist/business/Water/index.js +78 -108
  146. package/dist/business/Water/index.js.map +1 -1
  147. package/dist/business/Water/types.js +1 -1
  148. package/dist/business/Water/types.js.map +1 -1
  149. package/dist/core/Camera/PerspectiveCamera/CameraExpand.js +383 -449
  150. package/dist/core/Camera/PerspectiveCamera/CameraExpand.js.map +1 -1
  151. package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js +107 -142
  152. package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js.map +1 -1
  153. package/dist/core/Controls/FirstViewControl/index.js +84 -96
  154. package/dist/core/Controls/FirstViewControl/index.js.map +1 -1
  155. package/dist/core/Controls/ThirdViewControl/action/input.js +77 -98
  156. package/dist/core/Controls/ThirdViewControl/action/input.js.map +1 -1
  157. package/dist/core/Controls/ThirdViewControl/config/constants.js +1 -1
  158. package/dist/core/Controls/ThirdViewControl/config/constants.js.map +1 -1
  159. package/dist/core/Controls/ThirdViewControl/index.js +19 -28
  160. package/dist/core/Controls/ThirdViewControl/index.js.map +1 -1
  161. package/dist/core/Controls/ThirdViewControl/player/animation.js +126 -155
  162. package/dist/core/Controls/ThirdViewControl/player/animation.js.map +1 -1
  163. package/dist/core/Controls/ThirdViewControl/player/camera.js +47 -63
  164. package/dist/core/Controls/ThirdViewControl/player/camera.js.map +1 -1
  165. package/dist/core/Controls/ThirdViewControl/player/control.js +39 -49
  166. package/dist/core/Controls/ThirdViewControl/player/control.js.map +1 -1
  167. package/dist/core/Controls/ThirdViewControl/player.js +66 -91
  168. package/dist/core/Controls/ThirdViewControl/player.js.map +1 -1
  169. package/dist/core/Controls/base.js +14 -30
  170. package/dist/core/Controls/base.js.map +1 -1
  171. package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js +92 -131
  172. package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js.map +1 -1
  173. package/dist/core/Debug/PerformanceInfo/Performance.js +22 -47
  174. package/dist/core/Debug/PerformanceInfo/Performance.js.map +1 -1
  175. package/dist/core/Light/PointLight/PointLightExt.js +4 -21
  176. package/dist/core/Light/PointLight/PointLightExt.js.map +1 -1
  177. package/dist/core/Material/FinirMaterial/FinirMaterial.js +37 -57
  178. package/dist/core/Material/FinirMaterial/FinirMaterial.js.map +1 -1
  179. package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js +116 -153
  180. package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js.map +1 -1
  181. package/dist/core/Material/PristineGridMaterial/shader/fragment.js +95 -1
  182. package/dist/core/Material/PristineGridMaterial/shader/fragment.js.map +1 -1
  183. package/dist/core/Material/PristineGridMaterial/shader/vertex.js +26 -1
  184. package/dist/core/Material/PristineGridMaterial/shader/vertex.js.map +1 -1
  185. package/dist/core/Material/SurfaceMaterial/index.js +76 -172
  186. package/dist/core/Material/SurfaceMaterial/index.js.map +1 -1
  187. package/dist/core/Material/decorators.js +6 -11
  188. package/dist/core/Material/decorators.js.map +1 -1
  189. package/dist/core/PostEffects/addACESFilmicToneMappingPass.js +16 -12
  190. package/dist/core/PostEffects/addACESFilmicToneMappingPass.js.map +1 -1
  191. package/dist/core/PostEffects/addBrightnessContrastPass.js +17 -13
  192. package/dist/core/PostEffects/addBrightnessContrastPass.js.map +1 -1
  193. package/dist/core/PostEffects/bloomPass.js +17 -10
  194. package/dist/core/PostEffects/bloomPass.js.map +1 -1
  195. package/dist/core/PostEffects/bloomSelect.js +60 -43
  196. package/dist/core/PostEffects/bloomSelect.js.map +1 -1
  197. package/dist/core/PostEffects/colorifyPass.js +17 -13
  198. package/dist/core/PostEffects/colorifyPass.js.map +1 -1
  199. package/dist/core/PostEffects/index.js +28 -22
  200. package/dist/core/PostEffects/index.js.map +1 -1
  201. package/dist/core/PostEffects/outlinePass.js +37 -50
  202. package/dist/core/PostEffects/outlinePass.js.map +1 -1
  203. package/dist/core/PostEffects/postprocessing.js +14 -12
  204. package/dist/core/PostEffects/postprocessing.js.map +1 -1
  205. package/dist/core/PostEffects/saoPass.js +15 -10
  206. package/dist/core/PostEffects/saoPass.js.map +1 -1
  207. package/dist/core/PostEffects/shader/colorify.js +22 -3
  208. package/dist/core/PostEffects/shader/colorify.js.map +1 -1
  209. package/dist/core/PostEffects/shader/gammaCorrectionShader.js +27 -3
  210. package/dist/core/PostEffects/shader/gammaCorrectionShader.js.map +1 -1
  211. package/dist/core/PostEffects/shader/mapping.js +66 -3
  212. package/dist/core/PostEffects/shader/mapping.js.map +1 -1
  213. package/dist/core/PostEffects/shader/thermalMaging.js +28 -3
  214. package/dist/core/PostEffects/shader/thermalMaging.js.map +1 -1
  215. package/dist/core/SceneEffect/grow/grow.js +85 -101
  216. package/dist/core/SceneEffect/grow/grow.js.map +1 -1
  217. package/dist/core/SceneEffect/grow/style_down.js +60 -77
  218. package/dist/core/SceneEffect/grow/style_down.js.map +1 -1
  219. package/dist/core/SceneEffect/grow/style_up.js +64 -81
  220. package/dist/core/SceneEffect/grow/style_up.js.map +1 -1
  221. package/dist/core/SceneEffect/grow/type.js +2 -2
  222. package/dist/core/SceneEffect/grow/type.js.map +1 -1
  223. package/dist/core/WeatherSystem/DynamicWeatherSystem.js +51 -76
  224. package/dist/core/WeatherSystem/DynamicWeatherSystem.js.map +1 -1
  225. package/dist/core/WeatherSystem/hdr/index.js +69 -105
  226. package/dist/core/WeatherSystem/hdr/index.js.map +1 -1
  227. package/dist/core/WeatherSystem/index.js +77 -124
  228. package/dist/core/WeatherSystem/index.js.map +1 -1
  229. package/dist/core/WeatherSystem/objects/fog/index.js +52 -80
  230. package/dist/core/WeatherSystem/objects/fog/index.js.map +1 -1
  231. package/dist/core/WeatherSystem/objects/rain/index.js +72 -84
  232. package/dist/core/WeatherSystem/objects/rain/index.js.map +1 -1
  233. package/dist/core/WeatherSystem/objects/rain/lineRain.js +88 -118
  234. package/dist/core/WeatherSystem/objects/rain/lineRain.js.map +1 -1
  235. package/dist/core/WeatherSystem/objects/rain/plane.js +116 -146
  236. package/dist/core/WeatherSystem/objects/rain/plane.js.map +1 -1
  237. package/dist/core/WeatherSystem/objects/rain/point.js +100 -148
  238. package/dist/core/WeatherSystem/objects/rain/point.js.map +1 -1
  239. package/dist/core/WeatherSystem/objects/sky/cloud.js +71 -104
  240. package/dist/core/WeatherSystem/objects/sky/cloud.js.map +1 -1
  241. package/dist/core/WeatherSystem/objects/sky/index.js +66 -84
  242. package/dist/core/WeatherSystem/objects/sky/index.js.map +1 -1
  243. package/dist/core/WeatherSystem/objects/sky/outline.js +25 -45
  244. package/dist/core/WeatherSystem/objects/sky/outline.js.map +1 -1
  245. package/dist/core/WeatherSystem/shaders/cloud.js +74 -3
  246. package/dist/core/WeatherSystem/shaders/cloud.js.map +1 -1
  247. package/dist/core/WeatherSystem/shaders/fog.js +103 -3
  248. package/dist/core/WeatherSystem/shaders/fog.js.map +1 -1
  249. package/dist/core/WeatherSystem/shaders/rain.js +206 -7
  250. package/dist/core/WeatherSystem/shaders/rain.js.map +1 -1
  251. package/dist/core/WeatherSystem/shaders/sky.js +87 -3
  252. package/dist/core/WeatherSystem/shaders/sky.js.map +1 -1
  253. package/dist/core/WeatherSystem/sky/index.js +104 -135
  254. package/dist/core/WeatherSystem/sky/index.js.map +1 -1
  255. package/dist/core/WeatherSystem/utils/constant.js +44 -38
  256. package/dist/core/WeatherSystem/utils/constant.js.map +1 -1
  257. package/dist/core/WeatherSystem/utils/math.js +18 -25
  258. package/dist/core/WeatherSystem/utils/math.js.map +1 -1
  259. package/dist/core/WeatherSystem/utils/type.js +1 -1
  260. package/dist/core/WeatherSystem/utils/type.js.map +1 -1
  261. package/dist/core/WeatherSystem/weather/index.js +96 -141
  262. package/dist/core/WeatherSystem/weather/index.js.map +1 -1
  263. package/dist/utils/index.js +1 -1
  264. package/dist/utils/index.js.map +1 -1
  265. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"names":["Color","MeshStandardMaterial","addUpdateTag","FinirMaterial","_class","_MeshStandardMaterial","_inherits","_super","_createSuper","options","_this","_classCallCheck","call","opacity","transparent","depthWrite","_defineProperty","_assertThisInitialized","_ref","_ref$rimColor","rimColor","_rimColor","_ref$rimPower","rimPower","_rimPower","onBeforeCompile","shader","uniforms","value","vertexShader","replace","join","fragmentShader","_createClass","key","get","set","clone","constructor","_applyDecoratedDescriptor","prototype","Object","getOwnPropertyDescriptor"],"sources":["../../../../src/core/Material/FinirMaterial/FinirMaterial.ts"],"sourcesContent":["import { Color, MeshStandardMaterial } from '@anov/3d-core'\nimport { addUpdateTag } from '../decorators'\nimport type { FinirMaterialInterface } from '.'\n\ntype FinirMaterialOption = {\n rimColor?: Color\n rimPower?: number\n}\n\n/**\n * 菲尼尔材质\n */\nexport class FinirMaterial extends MeshStandardMaterial implements FinirMaterialInterface {\n private _rimColor = new Color(0x00FFFF)\n private _rimPower = 0.9\n\n public get rimColor() {\n return this._rimColor\n }\n\n @addUpdateTag\n public set rimColor(value: Color) {\n this._rimColor = value\n }\n\n public get rimPower() {\n return this._rimPower\n }\n\n @addUpdateTag\n public set rimPower(value: number) {\n this._rimPower = value\n }\n\n constructor(options?: FinirMaterialOption) {\n super({\n opacity: 0.0,\n transparent: true,\n depthWrite: false,\n })\n\n const { rimColor = this._rimColor, rimPower = this._rimPower } = options || {}\n\n this.onBeforeCompile = (shader) => {\n shader.uniforms.rimColor = { value: rimColor }\n shader.uniforms.rimPower = { value: rimPower }\n shader.vertexShader = shader.vertexShader.replace(\n 'void main() {',\n [\n 'varying vec3 vViewDirection;',\n 'void main() {',\n 'vec4 worldPosition1 = modelMatrix * vec4(position, 1.0);',\n 'vViewDirection = normalize(cameraPosition - worldPosition1.xyz);',\n ].join('\\n'),\n )\n shader.fragmentShader = shader.fragmentShader.replace(\n 'void main() {',\n [\n 'uniform vec3 rimColor;',\n 'uniform float rimPower;',\n 'varying vec3 vViewDirection;',\n 'void main() {',\n ].join('\\n'),\n )\n shader.fragmentShader = shader.fragmentShader.replace(\n '#include <dithering_fragment>',\n `#include <dithering_fragment>\n vec3 viewDir = normalize(vViewDirection);\n float dotNV = 1.0-saturate( dot( normal, viewDir ) );\n gl_FragColor.rgb += rimPower*dotNV*rimColor;\n vec3 fresnelall =rimPower*dotNV*rimColor;\n gl_FragColor.a +=(fresnelall.r+fresnelall.g+fresnelall.b)/3.;`,\n )\n }\n }\n\n override clone(): this {\n return new (this.constructor as any)({\n rimColor: this._rimColor,\n rimPower: this._rimPower,\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAASA,KAAK,EAAEC,oBAAoB,QAAQ,eAAe;AAC3D,SAASC,YAAY;AAQrB;AACA;AACA;AACA,WAAaC,aAAa,IAAAC,MAAA,0BAAAC,qBAAA;EAAAC,SAAA,CAAAH,aAAA,EAAAE,qBAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAL,aAAA;EAsBxB,SAAAA,cAAYM,OAA6B,EAAE;IAAA,IAAAC,KAAA;IAAAC,eAAA,OAAAR,aAAA;IACzCO,KAAA,GAAAH,MAAA,CAAAK,IAAA,OAAM;MACJC,OAAO,EAAE,GAAG;MACZC,WAAW,EAAE,IAAI;MACjBC,UAAU,EAAE;IACd,CAAC;IAACC,eAAA,CAAAC,sBAAA,CAAAP,KAAA,gBA1BgB,IAAIV,KAAK,CAAC,QAAQ,CAAC;IAAAgB,eAAA,CAAAC,sBAAA,CAAAP,KAAA,gBACnB,GAAG;IA2BrB,IAAAQ,IAAA,GAAiET,OAAO,IAAI,CAAC,CAAC;MAAAU,aAAA,GAAAD,IAAA,CAAtEE,QAAQ;MAARA,QAAQ,GAA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AAGI,KAAK;IACxB;EAAC;IAAAM,GAAA;IAAAN,KAAA,EA4CD,SAAAS,MAAA,EAAuB;MACrB,OAAO,IAAK,IAAI,CAACC,WAAW,CAAS;QACnClB,QAAQ,EAAE,IAAI,CAACC,SAAS;QACxBE,QAAQ,EAAE,IAAI,CAACC;MACjB,CAAC,CAAC;IACJ;EAAC;EAAA,OAAArB,aAAA;AAAA,EArEgCF,oBAAoB,IAAAsC,yBAAA,CAAAnC,MAAA,CAAAoC,SAAA,eAQpDtC,YAAY,GAAAuC,MAAA,CAAAC,wBAAA,CAAAtC,MAAA,CAAAoC,SAAA,eAAApC,MAAA,CAAAoC,SAAA,GAAAD,yBAAA,CAAAnC,MAAA,CAAAoC,SAAA,eASZtC,YAAY,GAAAuC,MAAA,CAAAC,wBAAA,CAAAtC,MAAA,CAAAoC,SAAA,eAAApC,MAAA,CAAAoC,SAAA,IAAApC,MAAA"}
1
+ {"version":3,"names":["Color","MeshStandardMaterial","addUpdateTag","FinirMaterial","_class","rimColor","_rimColor","value","rimPower","_rimPower","constructor","options","opacity","transparent","depthWrite","_defineProperty","onBeforeCompile","shader","uniforms","vertexShader","replace","join","fragmentShader","clone","_applyDecoratedDescriptor","prototype","Object","getOwnPropertyDescriptor"],"sources":["../../../../src/core/Material/FinirMaterial/FinirMaterial.ts"],"sourcesContent":["import { Color, MeshStandardMaterial } from '@anov/3d-core'\nimport { addUpdateTag } from '../decorators'\nimport type { FinirMaterialInterface } from '.'\n\ntype FinirMaterialOption = {\n rimColor?: Color\n rimPower?: number\n}\n\n/**\n * 菲尼尔材质\n */\nexport class FinirMaterial extends MeshStandardMaterial implements FinirMaterialInterface {\n private _rimColor = new Color(0x00FFFF)\n private _rimPower = 0.9\n\n public get rimColor() {\n return this._rimColor\n }\n\n @addUpdateTag\n public set rimColor(value: Color) {\n this._rimColor = value\n }\n\n public get rimPower() {\n return this._rimPower\n }\n\n @addUpdateTag\n public set rimPower(value: number) {\n this._rimPower = value\n }\n\n constructor(options?: FinirMaterialOption) {\n super({\n opacity: 0.0,\n transparent: true,\n depthWrite: false,\n })\n\n const { rimColor = this._rimColor, rimPower = this._rimPower } = options || {}\n\n this.onBeforeCompile = (shader) => {\n shader.uniforms.rimColor = { value: rimColor }\n shader.uniforms.rimPower = { value: rimPower }\n shader.vertexShader = shader.vertexShader.replace(\n 'void main() {',\n [\n 'varying vec3 vViewDirection;',\n 'void main() {',\n 'vec4 worldPosition1 = modelMatrix * vec4(position, 1.0);',\n 'vViewDirection = normalize(cameraPosition - worldPosition1.xyz);',\n ].join('\\n'),\n )\n shader.fragmentShader = shader.fragmentShader.replace(\n 'void main() {',\n [\n 'uniform vec3 rimColor;',\n 'uniform float rimPower;',\n 'varying vec3 vViewDirection;',\n 'void main() {',\n ].join('\\n'),\n )\n shader.fragmentShader = shader.fragmentShader.replace(\n '#include <dithering_fragment>',\n `#include <dithering_fragment>\n vec3 viewDir = normalize(vViewDirection);\n float dotNV = 1.0-saturate( dot( normal, viewDir ) );\n gl_FragColor.rgb += rimPower*dotNV*rimColor;\n vec3 fresnelall =rimPower*dotNV*rimColor;\n gl_FragColor.a +=(fresnelall.r+fresnelall.g+fresnelall.b)/3.;`,\n )\n }\n }\n\n override clone(): this {\n return new (this.constructor as any)({\n rimColor: this._rimColor,\n rimPower: this._rimPower,\n })\n }\n}\n"],"mappings":";;;;;AAAA,SAASA,KAAK,EAAEC,oBAAoB,QAAQ,eAAe;AAC3D,SAASC,YAAY;AAQrB;AACA;AACA;AACA,WAAaC,aAAa,IAAAC,MAAA,GAAnB,MAAMD,aAAa,SAASF,oBAAoB,CAAmC;EAIxF,IAAWI,QAAQA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACC,SAAS;EACvB;EAEA,IACWD,QAAQA,CAACE,KAAY,EAAE;IAChC,IAAI,CAACD,SAAS,GAAGC,KAAK;EACxB;EAEA,IAAWC,QAAQA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACC,SAAS;EACvB;EAEA,IACWD,QAAQA,C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ACC;IACjB,CAAC,CAAC;EACJ;AACF,CAAC,GAAAe,yBAAA,CAAApB,MAAA,CAAAqB,SAAA,eA9DEvB,YAAY,GAAAwB,MAAA,CAAAC,wBAAA,CAAAvB,MAAA,CAAAqB,SAAA,eAAArB,MAAA,CAAAqB,SAAA,GAAAD,yBAAA,CAAApB,MAAA,CAAAqB,SAAA,eASZvB,YAAY,GAAAwB,MAAA,CAAAC,wBAAA,CAAAvB,MAAA,CAAAqB,SAAA,eAAArB,MAAA,CAAAqB,SAAA,IAAArB,MAAA"}
@@ -1,20 +1,9 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
1
  var _class;
3
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
7
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
9
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
10
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
12
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
13
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
15
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
17
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
7
  function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
19
8
  import * as THREE from '@anov/3d-core';
20
9
  import { addUpdateTag } from "../decorators";
@@ -23,168 +12,142 @@ import fragmentShader from "./shader/fragment";
23
12
  /**
24
13
  * 高性能网格材质
25
14
  */
26
- export var GridMaterial = (_class = /*#__PURE__*/function (_THREE$ShaderMaterial) {
27
- _inherits(GridMaterial, _THREE$ShaderMaterial);
28
- var _super = _createSuper(GridMaterial);
29
- function GridMaterial(options) {
30
- var _this;
31
- _classCallCheck(this, GridMaterial);
32
- _this = _super.call(this);
33
- _defineProperty(_assertThisInitialized(_this), "_majorLineWidth", 0.04);
34
- _defineProperty(_assertThisInitialized(_this), "_minorLineWidth", 0.01);
35
- _defineProperty(_assertThisInitialized(_this), "_axisLineWidth", 0.15);
36
- _defineProperty(_assertThisInitialized(_this), "_majorGridDiv", 10.0);
37
- _defineProperty(_assertThisInitialized(_this), "_gridDiv", 4.0);
38
- _defineProperty(_assertThisInitialized(_this), "_majorLineColor", new THREE.Color());
39
- _defineProperty(_assertThisInitialized(_this), "_minorLineColor", new THREE.Color());
40
- _defineProperty(_assertThisInitialized(_this), "_xAxisColor", new THREE.Color(1, 0.3, 0.3));
41
- _defineProperty(_assertThisInitialized(_this), "_zAxisColor", new THREE.Color(0.3, 0.3, 1));
42
- _defineProperty(_assertThisInitialized(_this), "_baseColor", new THREE.Color('#707070'));
43
- var _ref = options || {},
44
- side = _ref.side,
45
- transparent = _ref.transparent,
46
- theme = _ref.theme,
47
- majorLineWidth = _ref.majorLineWidth,
48
- minorLineWidth = _ref.minorLineWidth,
49
- axisLineWidth = _ref.axisLineWidth,
50
- majorGridDiv = _ref.majorGridDiv,
51
- gridDiv = _ref.gridDiv,
52
- majorLineColor = _ref.majorLineColor,
53
- minorLineColor = _ref.minorLineColor,
54
- xAxisColor = _ref.xAxisColor,
55
- zAxisColor = _ref.zAxisColor;
56
- _this._majorLineWidth = majorLineWidth;
57
- _this._minorLineWidth = minorLineWidth;
58
- _this._axisLineWidth = axisLineWidth;
59
- _this._majorGridDiv = majorGridDiv;
60
- _this._gridDiv = gridDiv;
61
- _this._majorLineColor = majorLineColor;
62
- _this._minorLineColor = minorLineColor;
63
- _this._xAxisColor = xAxisColor;
64
- _this._zAxisColor = zAxisColor;
65
- _this._baseColor = theme;
66
- _this.side = side !== null && side !== void 0 ? side : THREE.DoubleSide;
67
- _this.transparent = transparent !== null && transparent !== void 0 ? transparent : true;
68
- _this.vertexShader = vertexShader;
69
- _this.fragmentShader = fragmentShader;
70
- _this.uniforms = _objectSpread(_objectSpread({}, _this.uniforms), {}, {
15
+ export let GridMaterial = (_class = class GridMaterial extends THREE.ShaderMaterial {
16
+ get majorLineWidth() {
17
+ return this.majorLineWidth;
18
+ }
19
+ set majorLineWidth(value) {
20
+ this._majorLineWidth = value;
21
+ }
22
+ get minorLineWidth() {
23
+ return this._minorLineWidth;
24
+ }
25
+ set minorLineWidth(value) {
26
+ this._minorLineWidth = value;
27
+ }
28
+ get axisLineWidth() {
29
+ return this._axisLineWidth;
30
+ }
31
+ set axisLineWidth(value) {
32
+ this._axisLineWidth = value;
33
+ }
34
+ get majorGridDiv() {
35
+ return this._majorGridDiv;
36
+ }
37
+ set majorGridDiv(value) {
38
+ this._majorGridDiv = value;
39
+ }
40
+ get gridDiv() {
41
+ return this._gridDiv;
42
+ }
43
+ set gridDiv(value) {
44
+ this._gridDiv = value;
45
+ }
46
+ get majorLineColor() {
47
+ return this._majorLineColor;
48
+ }
49
+ set majorLineColor(value) {
50
+ this._majorLineColor = value;
51
+ }
52
+ get minorLineColor() {
53
+ return this._minorLineColor;
54
+ }
55
+ set minorLineColor(value) {
56
+ this._minorLineColor = value;
57
+ }
58
+ get xAxisColor() {
59
+ return this._xAxisColor;
60
+ }
61
+ set xAxisColor(value) {
62
+ this._xAxisColor = value;
63
+ }
64
+ get zAxisColor() {
65
+ return this._zAxisColor;
66
+ }
67
+ set zAxisColor(value) {
68
+ this._zAxisColor = value;
69
+ }
70
+ get baseColor() {
71
+ return this._baseColor;
72
+ }
73
+ set baseColor(value) {
74
+ this._baseColor = value;
75
+ }
76
+ constructor(options) {
77
+ super();
78
+ _defineProperty(this, "_majorLineWidth", 0.04);
79
+ _defineProperty(this, "_minorLineWidth", 0.01);
80
+ _defineProperty(this, "_axisLineWidth", 0.15);
81
+ _defineProperty(this, "_majorGridDiv", 10.0);
82
+ _defineProperty(this, "_gridDiv", 4.0);
83
+ _defineProperty(this, "_majorLineColor", new THREE.Color());
84
+ _defineProperty(this, "_minorLineColor", new THREE.Color());
85
+ _defineProperty(this, "_xAxisColor", new THREE.Color(1, 0.3, 0.3));
86
+ _defineProperty(this, "_zAxisColor", new THREE.Color(0.3, 0.3, 1));
87
+ _defineProperty(this, "_baseColor", new THREE.Color('#707070'));
88
+ const {
89
+ side,
90
+ transparent,
91
+ theme,
92
+ majorLineWidth,
93
+ minorLineWidth,
94
+ axisLineWidth,
95
+ majorGridDiv,
96
+ gridDiv,
97
+ majorLineColor,
98
+ minorLineColor,
99
+ xAxisColor,
100
+ zAxisColor
101
+ } = options || {};
102
+ this._majorLineWidth = majorLineWidth;
103
+ this._minorLineWidth = minorLineWidth;
104
+ this._axisLineWidth = axisLineWidth;
105
+ this._majorGridDiv = majorGridDiv;
106
+ this._gridDiv = gridDiv;
107
+ this._majorLineColor = majorLineColor;
108
+ this._minorLineColor = minorLineColor;
109
+ this._xAxisColor = xAxisColor;
110
+ this._zAxisColor = zAxisColor;
111
+ this._baseColor = theme;
112
+ this.side = side !== null && side !== void 0 ? side : THREE.DoubleSide;
113
+ this.transparent = transparent !== null && transparent !== void 0 ? transparent : true;
114
+ this.vertexShader = vertexShader;
115
+ this.fragmentShader = fragmentShader;
116
+ this.uniforms = _objectSpread(_objectSpread({}, this.uniforms), {}, {
71
117
  u_baseAlpha: {
72
118
  value: 0.5
73
119
  },
74
120
  u_majorLineWidth: {
75
- value: _this._majorLineWidth
121
+ value: this._majorLineWidth
76
122
  },
77
123
  u_minorLineWidth: {
78
- value: _this._minorLineWidth
124
+ value: this._minorLineWidth
79
125
  },
80
126
  u_axisLineWidth: {
81
- value: _this._axisLineWidth
127
+ value: this._axisLineWidth
82
128
  },
83
129
  u_majorGridDiv: {
84
- value: _this._majorGridDiv
130
+ value: this._majorGridDiv
85
131
  },
86
132
  u_gridDiv: {
87
- value: _this._gridDiv
133
+ value: this._gridDiv
88
134
  },
89
135
  u_majorLineColor: {
90
- value: _this._majorLineColor
136
+ value: this._majorLineColor
91
137
  },
92
138
  u_minorLineColor: {
93
- value: _this._minorLineColor
139
+ value: this._minorLineColor
94
140
  },
95
141
  u_baseColor: {
96
- value: _this._baseColor
142
+ value: this._baseColor
97
143
  },
98
144
  u_xAxisColor: {
99
- value: _this._xAxisColor
145
+ value: this._xAxisColor
100
146
  },
101
147
  u_zAxisColor: {
102
- value: _this._zAxisColor
148
+ value: this._zAxisColor
103
149
  }
104
150
  });
105
- return _this;
106
- }
107
- _createClass(GridMaterial, [{
108
- key: "majorLineWidth",
109
- get: function get() {
110
- return this.majorLineWidth;
111
- },
112
- set: function set(value) {
113
- this._majorLineWidth = value;
114
- }
115
- }, {
116
- key: "minorLineWidth",
117
- get: function get() {
118
- return this._minorLineWidth;
119
- },
120
- set: function set(value) {
121
- this._minorLineWidth = value;
122
- }
123
- }, {
124
- key: "axisLineWidth",
125
- get: function get() {
126
- return this._axisLineWidth;
127
- },
128
- set: function set(value) {
129
- this._axisLineWidth = value;
130
- }
131
- }, {
132
- key: "majorGridDiv",
133
- get: function get() {
134
- return this._majorGridDiv;
135
- },
136
- set: function set(value) {
137
- this._majorGridDiv = value;
138
- }
139
- }, {
140
- key: "gridDiv",
141
- get: function get() {
142
- return this._gridDiv;
143
- },
144
- set: function set(value) {
145
- this._gridDiv = value;
146
- }
147
- }, {
148
- key: "majorLineColor",
149
- get: function get() {
150
- return this._majorLineColor;
151
- },
152
- set: function set(value) {
153
- this._majorLineColor = value;
154
- }
155
- }, {
156
- key: "minorLineColor",
157
- get: function get() {
158
- return this._minorLineColor;
159
- },
160
- set: function set(value) {
161
- this._minorLineColor = value;
162
- }
163
- }, {
164
- key: "xAxisColor",
165
- get: function get() {
166
- return this._xAxisColor;
167
- },
168
- set: function set(value) {
169
- this._xAxisColor = value;
170
- }
171
- }, {
172
- key: "zAxisColor",
173
- get: function get() {
174
- return this._zAxisColor;
175
- },
176
- set: function set(value) {
177
- this._zAxisColor = value;
178
- }
179
- }, {
180
- key: "baseColor",
181
- get: function get() {
182
- return this._baseColor;
183
- },
184
- set: function set(value) {
185
- this._baseColor = value;
186
- }
187
- }]);
188
- return GridMaterial;
189
- }(THREE.ShaderMaterial), (_applyDecoratedDescriptor(_class.prototype, "majorLineWidth", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "majorLineWidth"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "minorLineWidth", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "minorLineWidth"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "axisLineWidth", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "axisLineWidth"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "majorGridDiv", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "majorGridDiv"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "gridDiv", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "gridDiv"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "majorLineColor", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "majorLineColor"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "minorLineColor", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "minorLineColor"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "xAxisColor", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "xAxisColor"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "zAxisColor", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "zAxisColor"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "baseColor", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "baseColor"), _class.prototype)), _class);
151
+ }
152
+ }, (_applyDecoratedDescriptor(_class.prototype, "majorLineWidth", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "majorLineWidth"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "minorLineWidth", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "minorLineWidth"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "axisLineWidth", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "axisLineWidth"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "majorGridDiv", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "majorGridDiv"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "gridDiv", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "gridDiv"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "majorLineColor", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "majorLineColor"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "minorLineColor", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "minorLineColor"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "xAxisColor", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "xAxisColor"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "zAxisColor", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "zAxisColor"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "baseColor", [addUpdateTag], Object.getOwnPropertyDescriptor(_class.prototype, "baseColor"), _class.prototype)), _class);
190
153
  //# sourceMappingURL=PristineGridMaterial.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["THREE","addUpdateTag","vertexShader","fragmentShader","GridMaterial","_class","_THREE$ShaderMaterial","_inherits","_super","_createSuper","options","_this","_classCallCheck","call","_defineProperty","_assertThisInitialized","Color","_ref","side","transparent","theme","majorLineWidth","minorLineWidth","axisLineWidth","majorGridDiv","gridDiv","majorLineColor","minorLineColor","xAxisColor","zAxisColor","_majorLineWidth","_minorLineWidth","_axisLineWidth","_majorGridDiv","_gridDiv","_majorLineColor","_minorLineColor","_xAxisColor","_zAxisColor","_baseColor","DoubleSide","uniforms","_objectSpread","u_baseAlpha","value","u_majorLineWidth","u_minorLineWidth","u_axisLineWidth","u_majorGridDiv","u_gridDiv","u_majorLineColor","u_minorLineColor","u_baseColor","u_xAxisColor","u_zAxisColor","_createClass","key","get","set","ShaderMaterial","_applyDecoratedDescriptor","prototype","Object","getOwnPropertyDescriptor"],"sources":["../../../../src/core/Material/PristineGridMaterial/PristineGridMaterial.ts"],"sourcesContent":["import * as THREE from '@anov/3d-core'\nimport { addUpdateTag } from '../decorators'\nimport vertexShader from './shader/vertex'\nimport fragmentShader from './shader/fragment'\nimport type { GridMaterialInterface } from '.'\n\ntype GridMaterialParameters = {\n side?: THREE.Side\n transparent?: boolean\n theme?: THREE.Color\n majorLineWidth?: number\n minorLineWidth?: number\n axisLineWidth?: number\n majorGridDiv?: number\n gridDiv?: number\n majorLineColor?: THREE.Color\n minorLineColor?: THREE.Color\n xAxisColor?: THREE.Color\n zAxisColor?: THREE.Color\n}\n\n/**\n * 高性能网格材质\n */\nexport class GridMaterial extends THREE.ShaderMaterial implements GridMaterialInterface {\n private _majorLineWidth = 0.04\n private _minorLineWidth = 0.01\n private _axisLineWidth = 0.15\n private _majorGridDiv = 10.0\n private _gridDiv = 4.0\n private _majorLineColor = new THREE.Color()\n private _minorLineColor = new THREE.Color()\n private _xAxisColor = new THREE.Color(1, 0.3, 0.3)\n private _zAxisColor = new THREE.Color(0.3, 0.3, 1)\n private _baseColor = new THREE.Color('#707070')\n\n public get majorLineWidth() {\n return this.majorLineWidth\n }\n\n @addUpdateTag\n public set majorLineWidth(value: number) {\n this._majorLineWidth = value\n }\n\n public get minorLineWidth() {\n return this._minorLineWidth\n }\n\n @addUpdateTag\n public set minorLineWidth(value: number) {\n this._minorLineWidth = value\n }\n\n public get axisLineWidth() {\n return this._axisLineWidth\n }\n\n @addUpdateTag\n public set axisLineWidth(value: number) {\n this._axisLineWidth = value\n }\n\n public get majorGridDiv() {\n return this._majorGridDiv\n }\n\n @addUpdateTag\n public set majorGridDiv(value: number) {\n this._majorGridDiv = value\n }\n\n public get gridDiv() {\n return this._gridDiv\n }\n\n @addUpdateTag\n public set gridDiv(value: number) {\n this._gridDiv = value\n }\n\n public get majorLineColor() {\n return this._majorLineColor\n }\n\n @addUpdateTag\n public set majorLineColor(value: THREE.Color) {\n this._majorLineColor = value\n }\n\n public get minorLineColor() {\n return this._minorLineColor\n }\n\n @addUpdateTag\n public set minorLineColor(value: THREE.Color) {\n this._minorLineColor = value\n }\n\n public get xAxisColor() {\n return this._xAxisColor\n }\n\n @addUpdateTag\n public set xAxisColor(value: THREE.Color) {\n this._xAxisColor = value\n }\n\n public get zAxisColor() {\n return this._zAxisColor\n }\n\n @addUpdateTag\n public set zAxisColor(value: THREE.Color) {\n this._zAxisColor = value\n }\n\n public get baseColor() {\n return this._baseColor\n }\n\n @addUpdateTag\n public set baseColor(value: THREE.Color) {\n this._baseColor = value\n }\n\n constructor(options?: GridMaterialParameters) {\n super()\n\n const { side, transparent, theme, majorLineWidth, minorLineWidth, axisLineWidth, majorGridDiv, gridDiv, majorLineColor, minorLineColor, xAxisColor, zAxisColor } = options || {}\n\n this._majorLineWidth = majorLineWidth\n this._minorLineWidth = minorLineWidth\n this._axisLineWidth = axisLineWidth\n this._majorGridDiv = majorGridDiv\n this._gridDiv = gridDiv\n this._majorLineColor = majorLineColor\n this._minorLineColor = minorLineColor\n this._xAxisColor = xAxisColor\n this._zAxisColor = zAxisColor\n this._baseColor = theme\n\n this.side = side ?? THREE.DoubleSide\n this.transparent = transparent ?? true\n this.vertexShader = vertexShader\n this.fragmentShader = fragmentShader\n this.uniforms = {\n ...this.uniforms,\n u_baseAlpha: { value: 0.5 },\n u_majorLineWidth: { value: this._majorLineWidth },\n u_minorLineWidth: { value: this._minorLineWidth },\n u_axisLineWidth: { value: this._axisLineWidth },\n u_majorGridDiv: { value: this._majorGridDiv },\n u_gridDiv: { value: this._gridDiv },\n u_majorLineColor: { value: this._majorLineColor },\n u_minorLineColor: { value: this._minorLineColor },\n u_baseColor: { value: this._baseColor },\n u_xAxisColor: { value: this._xAxisColor },\n u_zAxisColor: { value: this._zAxisColor },\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,eAAe;AACtC,SAASC,YAAY;AACrB,OAAOC,YAAY;AACnB,OAAOC,cAAc;A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AAA,qBAAAxD,MAAA,CAAAwD,SAAA,GAAAD,yBAAA,CAAAvD,MAAA,CAAAwD,SAAA,iBASZ5D,YAAY,GAAA6D,MAAA,CAAAC,wBAAA,CAAA1D,MAAA,CAAAwD,SAAA,iBAAAxD,MAAA,CAAAwD,SAAA,GAAAD,yBAAA,CAAAvD,MAAA,CAAAwD,SAAA,iBASZ5D,YAAY,GAAA6D,MAAA,CAAAC,wBAAA,CAAA1D,MAAA,CAAAwD,SAAA,iBAAAxD,MAAA,CAAAwD,SAAA,GAAAD,yBAAA,CAAAvD,MAAA,CAAAwD,SAAA,gBASZ5D,YAAY,GAAA6D,MAAA,CAAAC,wBAAA,CAAA1D,MAAA,CAAAwD,SAAA,gBAAAxD,MAAA,CAAAwD,SAAA,IAAAxD,MAAA"}
1
+ {"version":3,"names":["THREE","addUpdateTag","vertexShader","fragmentShader","GridMaterial","_class","ShaderMaterial","majorLineWidth","value","_majorLineWidth","minorLineWidth","_minorLineWidth","axisLineWidth","_axisLineWidth","majorGridDiv","_majorGridDiv","gridDiv","_gridDiv","majorLineColor","_majorLineColor","minorLineColor","_minorLineColor","xAxisColor","_xAxisColor","zAxisColor","_zAxisColor","baseColor","_baseColor","constructor","options","_defineProperty","Color","side","transparent","theme","DoubleSide","uniforms","_objectSpread","u_baseAlpha","u_majorLineWidth","u_minorLineWidth","u_axisLineWidth","u_majorGridDiv","u_gridDiv","u_majorLineColor","u_minorLineColor","u_baseColor","u_xAxisColor","u_zAxisColor","_applyDecoratedDescriptor","prototype","Object","getOwnPropertyDescriptor"],"sources":["../../../../src/core/Material/PristineGridMaterial/PristineGridMaterial.ts"],"sourcesContent":["import * as THREE from '@anov/3d-core'\nimport { addUpdateTag } from '../decorators'\nimport vertexShader from './shader/vertex'\nimport fragmentShader from './shader/fragment'\nimport type { GridMaterialInterface } from '.'\n\ntype GridMaterialParameters = {\n side?: THREE.Side\n transparent?: boolean\n theme?: THREE.Color\n majorLineWidth?: number\n minorLineWidth?: number\n axisLineWidth?: number\n majorGridDiv?: number\n gridDiv?: number\n majorLineColor?: THREE.Color\n minorLineColor?: THREE.Color\n xAxisColor?: THREE.Color\n zAxisColor?: THREE.Color\n}\n\n/**\n * 高性能网格材质\n */\nexport class GridMaterial extends THREE.ShaderMaterial implements GridMaterialInterface {\n private _majorLineWidth = 0.04\n private _minorLineWidth = 0.01\n private _axisLineWidth = 0.15\n private _majorGridDiv = 10.0\n private _gridDiv = 4.0\n private _majorLineColor = new THREE.Color()\n private _minorLineColor = new THREE.Color()\n private _xAxisColor = new THREE.Color(1, 0.3, 0.3)\n private _zAxisColor = new THREE.Color(0.3, 0.3, 1)\n private _baseColor = new THREE.Color('#707070')\n\n public get majorLineWidth() {\n return this.majorLineWidth\n }\n\n @addUpdateTag\n public set majorLineWidth(value: number) {\n this._majorLineWidth = value\n }\n\n public get minorLineWidth() {\n return this._minorLineWidth\n }\n\n @addUpdateTag\n public set minorLineWidth(value: number) {\n this._minorLineWidth = value\n }\n\n public get axisLineWidth() {\n return this._axisLineWidth\n }\n\n @addUpdateTag\n public set axisLineWidth(value: number) {\n this._axisLineWidth = value\n }\n\n public get majorGridDiv() {\n return this._majorGridDiv\n }\n\n @addUpdateTag\n public set majorGridDiv(value: number) {\n this._majorGridDiv = value\n }\n\n public get gridDiv() {\n return this._gridDiv\n }\n\n @addUpdateTag\n public set gridDiv(value: number) {\n this._gridDiv = value\n }\n\n public get majorLineColor() {\n return this._majorLineColor\n }\n\n @addUpdateTag\n public set majorLineColor(value: THREE.Color) {\n this._majorLineColor = value\n }\n\n public get minorLineColor() {\n return this._minorLineColor\n }\n\n @addUpdateTag\n public set minorLineColor(value: THREE.Color) {\n this._minorLineColor = value\n }\n\n public get xAxisColor() {\n return this._xAxisColor\n }\n\n @addUpdateTag\n public set xAxisColor(value: THREE.Color) {\n this._xAxisColor = value\n }\n\n public get zAxisColor() {\n return this._zAxisColor\n }\n\n @addUpdateTag\n public set zAxisColor(value: THREE.Color) {\n this._zAxisColor = value\n }\n\n public get baseColor() {\n return this._baseColor\n }\n\n @addUpdateTag\n public set baseColor(value: THREE.Color) {\n this._baseColor = value\n }\n\n constructor(options?: GridMaterialParameters) {\n super()\n\n const { side, transparent, theme, majorLineWidth, minorLineWidth, axisLineWidth, majorGridDiv, gridDiv, majorLineColor, minorLineColor, xAxisColor, zAxisColor } = options || {}\n\n this._majorLineWidth = majorLineWidth\n this._minorLineWidth = minorLineWidth\n this._axisLineWidth = axisLineWidth\n this._majorGridDiv = majorGridDiv\n this._gridDiv = gridDiv\n this._majorLineColor = majorLineColor\n this._minorLineColor = minorLineColor\n this._xAxisColor = xAxisColor\n this._zAxisColor = zAxisColor\n this._baseColor = theme\n\n this.side = side ?? THREE.DoubleSide\n this.transparent = transparent ?? true\n this.vertexShader = vertexShader\n this.fragmentShader = fragmentShader\n this.uniforms = {\n ...this.uniforms,\n u_baseAlpha: { value: 0.5 },\n u_majorLineWidth: { value: this._majorLineWidth },\n u_minorLineWidth: { value: this._minorLineWidth },\n u_axisLineWidth: { value: this._axisLineWidth },\n u_majorGridDiv: { value: this._majorGridDiv },\n u_gridDiv: { value: this._gridDiv },\n u_majorLineColor: { value: this._majorLineColor },\n u_minorLineColor: { value: this._minorLineColor },\n u_baseColor: { value: this._baseColor },\n u_xAxisColor: { value: this._xAxisColor },\n u_zAxisColor: { value: this._zAxisColor },\n }\n }\n}\n"],"mappings":";;;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,eAAe;AACtC,SAASC,YAAY;AACrB,OAAOC,YAAY;AACnB,OAAOC,cAAc;AAkBrB;AACA;AACA;AACA,WAAaC,YAAY,IAAAC,MAAA,GAAlB,MAAMD,YAAY,SAASJ,KAAK,CAACM,cAAc,CAAkC;EAYtF,IAAWC,cAAcA,CAAA,EAAG;IAC1B,OAAO,IAAI,CAACA,cAAc;EAC5B;EAEA,IACWA,cAAcA,CAACC,KAAa,EAAE;IACvC,IAAI,CAACC,eAAe,GAAGD,KAAK;EAC9B;EAEA,IAAWE,cAAcA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6C,SAAA,gBASZjD,YAAY,GAAAkD,MAAA,CAAAC,wBAAA,CAAA/C,MAAA,CAAA6C,SAAA,gBAAA7C,MAAA,CAAA6C,SAAA,IAAA7C,MAAA"}
@@ -1,2 +1,96 @@
1
- export default /* glsl */"\nprecision highp float;\n\n// Varyings from the vertex shader\nin vec2 v_uv;\nin vec2 v_worldPos;\n\n// Uniforms\nuniform float u_majorLineWidth, u_minorLineWidth, u_axisLineWidth;\nuniform vec3 u_majorLineColor, u_minorLineColor, u_baseColor;\nuniform vec3 u_xAxisColor, u_zAxisColor;\nuniform float u_majorGridDiv, u_baseAlpha;\nuniform vec2 u_resolution;\n\n// Output color\nout vec4 gColor;\n\nfloat saturate(float value) {\nreturn clamp(value, 0.0, 1.0);\n}\n\nvoid main() {\n // Calculate derivatives for anti-aliasing\nvec4 uvDDXY = vec4(dFdx(v_uv), dFdy(v_uv));\nvec2 uvDeriv = vec2(length(uvDDXY.xz), length(uvDDXY.yw));\n\nvec4 worldPosDDXY = vec4(dFdx(v_worldPos), dFdy(v_worldPos));\nvec2 worldPosDeriv = vec2(length(worldPosDDXY.xz), length(worldPosDDXY.yw));\n\n // Axis lines calculation\nfloat axisLineWidth = max(u_majorLineWidth, u_axisLineWidth);\n\nvec2 axisDrawWidth = vec2(axisLineWidth) + worldPosDeriv * 0.5; // Adjust for AA\nvec2 axisLineAA = worldPosDeriv * 1.5;\nvec2 axisLines2 = smoothstep(axisDrawWidth + axisLineAA, axisDrawWidth - axisLineAA, abs(v_worldPos.xy * 2.0));\naxisLines2 *= (axisLineWidth / axisDrawWidth);\n\n // Major grid lines\nfloat div = max(2.0, round(u_majorGridDiv));\nvec2 majorUVDeriv = worldPosDeriv / div;\nfloat majorLineWidth = u_majorLineWidth / div;\nvec2 majorDrawWidth = clamp(vec2(majorLineWidth), majorUVDeriv, vec2(0.5));\nvec2 majorLineAA = majorUVDeriv * 1.5;\nvec2 majorGridUV = 1.0 - abs(fract(v_worldPos.xy / div) * 2.0 - 1.0);\nvec2 majorGrid2 = smoothstep(majorDrawWidth + majorLineAA, majorDrawWidth - majorLineAA, majorGridUV);\nmajorGrid2 *= (majorLineWidth / majorDrawWidth);\n\n // Minor grid lines\nfloat minorLineWidth = u_minorLineWidth;\nbool minorInvertLine = minorLineWidth > 0.5;\nfloat minorTargetWidth = minorInvertLine ? 1.0 - minorLineWidth : minorLineWidth;\nvec2 minorDrawWidth = clamp(vec2(minorTargetWidth), uvDeriv, vec2(0.5));\nvec2 minorLineAA = uvDeriv * 1.5;\nvec2 minorGridUV = abs(fract(v_uv) * 2.0 - 1.0);\nminorGridUV = minorInvertLine ? minorGridUV : 1.0 - minorGridUV;\nvec2 minorGrid2 = smoothstep(minorDrawWidth + minorLineAA, minorDrawWidth - minorLineAA, minorGridUV);\nminorGrid2 *= (minorTargetWidth / minorDrawWidth);\n\nif(max(axisLines2.x, axisLines2.y) > 0.) {\n // If we're drawing axis lines, don't draw grid lines on axis\nmajorGrid2 = vec2(0.);\nminorGrid2 = vec2(0.);\n}\n\n // Combine minor and major grid lines\nfloat minorGrid = mix(minorGrid2.x, 1.0, minorGrid2.y);\nfloat majorGrid = mix(majorGrid2.x, 1.0, majorGrid2.y);\n\n // Final color calculations for grid\nvec3 gridColor = mix(u_baseColor, u_minorLineColor, minorGrid);\ngridColor = mix(gridColor, u_majorLineColor, majorGrid);\nfloat gridAlpha = u_baseAlpha;\n\n // Apply base alpha to the grid lines\nif(minorGrid > 0.0) {\ngridAlpha = saturate(mix(gridAlpha, 1.0, minorGrid));\n}\nif(majorGrid > 0.0) {\ngridAlpha = saturate(mix(gridAlpha, 1.0, majorGrid));\n}\n\n // Apply axis color to the axis lines\nvec3 axisColor = mix(vec3(1.), u_xAxisColor, step(0.5, abs(v_worldPos.x)));\naxisColor = mix(axisColor, u_zAxisColor, step(0.5, abs(v_worldPos.y)));\n\nvec3 finalColor = mix(gridColor, axisColor, max(axisLines2.x, axisLines2.y));\n\nif(max(axisLines2.x, axisLines2.y) > 0.) {\ngridAlpha = saturate(mix(gridAlpha, 1.0, max(axisLines2.x, axisLines2.y)));\n}\n\n // Set the final fragment color\ngColor = vec4(finalColor, gridAlpha);\n}\n";
1
+ export default /* glsl */`
2
+ precision highp float;
3
+
4
+ // Varyings from the vertex shader
5
+ in vec2 v_uv;
6
+ in vec2 v_worldPos;
7
+
8
+ // Uniforms
9
+ uniform float u_majorLineWidth, u_minorLineWidth, u_axisLineWidth;
10
+ uniform vec3 u_majorLineColor, u_minorLineColor, u_baseColor;
11
+ uniform vec3 u_xAxisColor, u_zAxisColor;
12
+ uniform float u_majorGridDiv, u_baseAlpha;
13
+ uniform vec2 u_resolution;
14
+
15
+ // Output color
16
+ out vec4 gColor;
17
+
18
+ float saturate(float value) {
19
+ return clamp(value, 0.0, 1.0);
20
+ }
21
+
22
+ void main() {
23
+ // Calculate derivatives for anti-aliasing
24
+ vec4 uvDDXY = vec4(dFdx(v_uv), dFdy(v_uv));
25
+ vec2 uvDeriv = vec2(length(uvDDXY.xz), length(uvDDXY.yw));
26
+
27
+ vec4 worldPosDDXY = vec4(dFdx(v_worldPos), dFdy(v_worldPos));
28
+ vec2 worldPosDeriv = vec2(length(worldPosDDXY.xz), length(worldPosDDXY.yw));
29
+
30
+ // Axis lines calculation
31
+ float axisLineWidth = max(u_majorLineWidth, u_axisLineWidth);
32
+
33
+ vec2 axisDrawWidth = vec2(axisLineWidth) + worldPosDeriv * 0.5; // Adjust for AA
34
+ vec2 axisLineAA = worldPosDeriv * 1.5;
35
+ vec2 axisLines2 = smoothstep(axisDrawWidth + axisLineAA, axisDrawWidth - axisLineAA, abs(v_worldPos.xy * 2.0));
36
+ axisLines2 *= (axisLineWidth / axisDrawWidth);
37
+
38
+ // Major grid lines
39
+ float div = max(2.0, round(u_majorGridDiv));
40
+ vec2 majorUVDeriv = worldPosDeriv / div;
41
+ float majorLineWidth = u_majorLineWidth / div;
42
+ vec2 majorDrawWidth = clamp(vec2(majorLineWidth), majorUVDeriv, vec2(0.5));
43
+ vec2 majorLineAA = majorUVDeriv * 1.5;
44
+ vec2 majorGridUV = 1.0 - abs(fract(v_worldPos.xy / div) * 2.0 - 1.0);
45
+ vec2 majorGrid2 = smoothstep(majorDrawWidth + majorLineAA, majorDrawWidth - majorLineAA, majorGridUV);
46
+ majorGrid2 *= (majorLineWidth / majorDrawWidth);
47
+
48
+ // Minor grid lines
49
+ float minorLineWidth = u_minorLineWidth;
50
+ bool minorInvertLine = minorLineWidth > 0.5;
51
+ float minorTargetWidth = minorInvertLine ? 1.0 - minorLineWidth : minorLineWidth;
52
+ vec2 minorDrawWidth = clamp(vec2(minorTargetWidth), uvDeriv, vec2(0.5));
53
+ vec2 minorLineAA = uvDeriv * 1.5;
54
+ vec2 minorGridUV = abs(fract(v_uv) * 2.0 - 1.0);
55
+ minorGridUV = minorInvertLine ? minorGridUV : 1.0 - minorGridUV;
56
+ vec2 minorGrid2 = smoothstep(minorDrawWidth + minorLineAA, minorDrawWidth - minorLineAA, minorGridUV);
57
+ minorGrid2 *= (minorTargetWidth / minorDrawWidth);
58
+
59
+ if(max(axisLines2.x, axisLines2.y) > 0.) {
60
+ // If we're drawing axis lines, don't draw grid lines on axis
61
+ majorGrid2 = vec2(0.);
62
+ minorGrid2 = vec2(0.);
63
+ }
64
+
65
+ // Combine minor and major grid lines
66
+ float minorGrid = mix(minorGrid2.x, 1.0, minorGrid2.y);
67
+ float majorGrid = mix(majorGrid2.x, 1.0, majorGrid2.y);
68
+
69
+ // Final color calculations for grid
70
+ vec3 gridColor = mix(u_baseColor, u_minorLineColor, minorGrid);
71
+ gridColor = mix(gridColor, u_majorLineColor, majorGrid);
72
+ float gridAlpha = u_baseAlpha;
73
+
74
+ // Apply base alpha to the grid lines
75
+ if(minorGrid > 0.0) {
76
+ gridAlpha = saturate(mix(gridAlpha, 1.0, minorGrid));
77
+ }
78
+ if(majorGrid > 0.0) {
79
+ gridAlpha = saturate(mix(gridAlpha, 1.0, majorGrid));
80
+ }
81
+
82
+ // Apply axis color to the axis lines
83
+ vec3 axisColor = mix(vec3(1.), u_xAxisColor, step(0.5, abs(v_worldPos.x)));
84
+ axisColor = mix(axisColor, u_zAxisColor, step(0.5, abs(v_worldPos.y)));
85
+
86
+ vec3 finalColor = mix(gridColor, axisColor, max(axisLines2.x, axisLines2.y));
87
+
88
+ if(max(axisLines2.x, axisLines2.y) > 0.) {
89
+ gridAlpha = saturate(mix(gridAlpha, 1.0, max(axisLines2.x, axisLines2.y)));
90
+ }
91
+
92
+ // Set the final fragment color
93
+ gColor = vec4(finalColor, gridAlpha);
94
+ }
95
+ `;
2
96
  //# sourceMappingURL=fragment.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../../../src/core/Material/PristineGridMaterial/shader/fragment.ts"],"sourcesContent":["export default /* glsl */ `\nprecision highp float;\n\n// Varyings from the vertex shader\nin vec2 v_uv;\nin vec2 v_worldPos;\n\n// Uniforms\nuniform float u_majorLineWidth, u_minorLineWidth, u_axisLineWidth;\nuniform vec3 u_majorLineColor, u_minorLineColor, u_baseColor;\nuniform vec3 u_xAxisColor, u_zAxisColor;\nuniform float u_majorGridDiv, u_baseAlpha;\nuniform vec2 u_resolution;\n\n// Output color\nout vec4 gColor;\n\nfloat saturate(float value) {\nreturn clamp(value, 0.0, 1.0);\n}\n\nvoid main() {\n // Calculate derivatives for anti-aliasing\nvec4 uvDDXY = vec4(dFdx(v_uv), dFdy(v_uv));\nvec2 uvDeriv = vec2(length(uvDDXY.xz), length(uvDDXY.yw));\n\nvec4 worldPosDDXY = vec4(dFdx(v_worldPos), dFdy(v_worldPos));\nvec2 worldPosDeriv = vec2(length(worldPosDDXY.xz), length(worldPosDDXY.yw));\n\n // Axis lines calculation\nfloat axisLineWidth = max(u_majorLineWidth, u_axisLineWidth);\n\nvec2 axisDrawWidth = vec2(axisLineWidth) + worldPosDeriv * 0.5; // Adjust for AA\nvec2 axisLineAA = worldPosDeriv * 1.5;\nvec2 axisLines2 = smoothstep(axisDrawWidth + axisLineAA, axisDrawWidth - axisLineAA, abs(v_worldPos.xy * 2.0));\naxisLines2 *= (axisLineWidth / axisDrawWidth);\n\n // Major grid lines\nfloat div = max(2.0, round(u_majorGridDiv));\nvec2 majorUVDeriv = worldPosDeriv / div;\nfloat majorLineWidth = u_majorLineWidth / div;\nvec2 majorDrawWidth = clamp(vec2(majorLineWidth), majorUVDeriv, vec2(0.5));\nvec2 majorLineAA = majorUVDeriv * 1.5;\nvec2 majorGridUV = 1.0 - abs(fract(v_worldPos.xy / div) * 2.0 - 1.0);\nvec2 majorGrid2 = smoothstep(majorDrawWidth + majorLineAA, majorDrawWidth - majorLineAA, majorGridUV);\nmajorGrid2 *= (majorLineWidth / majorDrawWidth);\n\n // Minor grid lines\nfloat minorLineWidth = u_minorLineWidth;\nbool minorInvertLine = minorLineWidth > 0.5;\nfloat minorTargetWidth = minorInvertLine ? 1.0 - minorLineWidth : minorLineWidth;\nvec2 minorDrawWidth = clamp(vec2(minorTargetWidth), uvDeriv, vec2(0.5));\nvec2 minorLineAA = uvDeriv * 1.5;\nvec2 minorGridUV = abs(fract(v_uv) * 2.0 - 1.0);\nminorGridUV = minorInvertLine ? minorGridUV : 1.0 - minorGridUV;\nvec2 minorGrid2 = smoothstep(minorDrawWidth + minorLineAA, minorDrawWidth - minorLineAA, minorGridUV);\nminorGrid2 *= (minorTargetWidth / minorDrawWidth);\n\nif(max(axisLines2.x, axisLines2.y) > 0.) {\n // If we're drawing axis lines, don't draw grid lines on axis\nmajorGrid2 = vec2(0.);\nminorGrid2 = vec2(0.);\n}\n\n // Combine minor and major grid lines\nfloat minorGrid = mix(minorGrid2.x, 1.0, minorGrid2.y);\nfloat majorGrid = mix(majorGrid2.x, 1.0, majorGrid2.y);\n\n // Final color calculations for grid\nvec3 gridColor = mix(u_baseColor, u_minorLineColor, minorGrid);\ngridColor = mix(gridColor, u_majorLineColor, majorGrid);\nfloat gridAlpha = u_baseAlpha;\n\n // Apply base alpha to the grid lines\nif(minorGrid > 0.0) {\ngridAlpha = saturate(mix(gridAlpha, 1.0, minorGrid));\n}\nif(majorGrid > 0.0) {\ngridAlpha = saturate(mix(gridAlpha, 1.0, majorGrid));\n}\n\n // Apply axis color to the axis lines\nvec3 axisColor = mix(vec3(1.), u_xAxisColor, step(0.5, abs(v_worldPos.x)));\naxisColor = mix(axisColor, u_zAxisColor, step(0.5, abs(v_worldPos.y)));\n\nvec3 finalColor = mix(gridColor, axisColor, max(axisLines2.x, axisLines2.y));\n\nif(max(axisLines2.x, axisLines2.y) > 0.) {\ngridAlpha = saturate(mix(gridAlpha, 1.0, max(axisLines2.x, axisLines2.y)));\n}\n\n // Set the final fragment color\ngColor = vec4(finalColor, gridAlpha);\n}\n`"],"mappings":"AAAA,eAAe"}
1
+ {"version":3,"names":[],"sources":["../../../../../src/core/Material/PristineGridMaterial/shader/fragment.ts"],"sourcesContent":["export default /* glsl */ `\nprecision highp float;\n\n// Varyings from the vertex shader\nin vec2 v_uv;\nin vec2 v_worldPos;\n\n// Uniforms\nuniform float u_majorLineWidth, u_minorLineWidth, u_axisLineWidth;\nuniform vec3 u_majorLineColor, u_minorLineColor, u_baseColor;\nuniform vec3 u_xAxisColor, u_zAxisColor;\nuniform float u_majorGridDiv, u_baseAlpha;\nuniform vec2 u_resolution;\n\n// Output color\nout vec4 gColor;\n\nfloat saturate(float value) {\nreturn clamp(value, 0.0, 1.0);\n}\n\nvoid main() {\n // Calculate derivatives for anti-aliasing\nvec4 uvDDXY = vec4(dFdx(v_uv), dFdy(v_uv));\nvec2 uvDeriv = vec2(length(uvDDXY.xz), length(uvDDXY.yw));\n\nvec4 worldPosDDXY = vec4(dFdx(v_worldPos), dFdy(v_worldPos));\nvec2 worldPosDeriv = vec2(length(worldPosDDXY.xz), length(worldPosDDXY.yw));\n\n // Axis lines calculation\nfloat axisLineWidth = max(u_majorLineWidth, u_axisLineWidth);\n\nvec2 axisDrawWidth = vec2(axisLineWidth) + worldPosDeriv * 0.5; // Adjust for AA\nvec2 axisLineAA = worldPosDeriv * 1.5;\nvec2 axisLines2 = smoothstep(axisDrawWidth + axisLineAA, axisDrawWidth - axisLineAA, abs(v_worldPos.xy * 2.0));\naxisLines2 *= (axisLineWidth / axisDrawWidth);\n\n // Major grid lines\nfloat div = max(2.0, round(u_majorGridDiv));\nvec2 majorUVDeriv = worldPosDeriv / div;\nfloat majorLineWidth = u_majorLineWidth / div;\nvec2 majorDrawWidth = clamp(vec2(majorLineWidth), majorUVDeriv, vec2(0.5));\nvec2 majorLineAA = majorUVDeriv * 1.5;\nvec2 majorGridUV = 1.0 - abs(fract(v_worldPos.xy / div) * 2.0 - 1.0);\nvec2 majorGrid2 = smoothstep(majorDrawWidth + majorLineAA, majorDrawWidth - majorLineAA, majorGridUV);\nmajorGrid2 *= (majorLineWidth / majorDrawWidth);\n\n // Minor grid lines\nfloat minorLineWidth = u_minorLineWidth;\nbool minorInvertLine = minorLineWidth > 0.5;\nfloat minorTargetWidth = minorInvertLine ? 1.0 - minorLineWidth : minorLineWidth;\nvec2 minorDrawWidth = clamp(vec2(minorTargetWidth), uvDeriv, vec2(0.5));\nvec2 minorLineAA = uvDeriv * 1.5;\nvec2 minorGridUV = abs(fract(v_uv) * 2.0 - 1.0);\nminorGridUV = minorInvertLine ? minorGridUV : 1.0 - minorGridUV;\nvec2 minorGrid2 = smoothstep(minorDrawWidth + minorLineAA, minorDrawWidth - minorLineAA, minorGridUV);\nminorGrid2 *= (minorTargetWidth / minorDrawWidth);\n\nif(max(axisLines2.x, axisLines2.y) > 0.) {\n // If we're drawing axis lines, don't draw grid lines on axis\nmajorGrid2 = vec2(0.);\nminorGrid2 = vec2(0.);\n}\n\n // Combine minor and major grid lines\nfloat minorGrid = mix(minorGrid2.x, 1.0, minorGrid2.y);\nfloat majorGrid = mix(majorGrid2.x, 1.0, majorGrid2.y);\n\n // Final color calculations for grid\nvec3 gridColor = mix(u_baseColor, u_minorLineColor, minorGrid);\ngridColor = mix(gridColor, u_majorLineColor, majorGrid);\nfloat gridAlpha = u_baseAlpha;\n\n // Apply base alpha to the grid lines\nif(minorGrid > 0.0) {\ngridAlpha = saturate(mix(gridAlpha, 1.0, minorGrid));\n}\nif(majorGrid > 0.0) {\ngridAlpha = saturate(mix(gridAlpha, 1.0, majorGrid));\n}\n\n // Apply axis color to the axis lines\nvec3 axisColor = mix(vec3(1.), u_xAxisColor, step(0.5, abs(v_worldPos.x)));\naxisColor = mix(axisColor, u_zAxisColor, step(0.5, abs(v_worldPos.y)));\n\nvec3 finalColor = mix(gridColor, axisColor, max(axisLines2.x, axisLines2.y));\n\nif(max(axisLines2.x, axisLines2.y) > 0.) {\ngridAlpha = saturate(mix(gridAlpha, 1.0, max(axisLines2.x, axisLines2.y)));\n}\n\n // Set the final fragment color\ngColor = vec4(finalColor, gridAlpha);\n}\n`"],"mappings":"AAAA,eAAe,UAAY;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC"}
@@ -1,2 +1,27 @@
1
- export default /* glsl */"\n\nprecision highp float;\n\n// Uniforms\nuniform float u_majorGridDiv;\nuniform float u_gridDiv;\n\nout vec2 v_uv; // Passed to the fragment shader\nout vec2 v_worldPos;\nvoid main() {\n vec4 transformed = vec4(position, 1.0);\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * transformed;\n\n vec3 worldPosition = (modelMatrix * transformed).xyz;\n\n v_worldPos = worldPosition.xz * u_gridDiv;\n\n // Use local position for grid calculations\n vec3 localPos = transformed.xyz;\n vec3 cameraCenteringOffset = floor(cameraPosition);\n vec3 cameraSnappedWorldPos = worldPosition.xyz - cameraCenteringOffset;\n v_uv = cameraSnappedWorldPos.xz * u_gridDiv;\n\n}\n";
1
+ export default /* glsl */`
2
+
3
+ precision highp float;
4
+
5
+ // Uniforms
6
+ uniform float u_majorGridDiv;
7
+ uniform float u_gridDiv;
8
+
9
+ out vec2 v_uv; // Passed to the fragment shader
10
+ out vec2 v_worldPos;
11
+ void main() {
12
+ vec4 transformed = vec4(position, 1.0);
13
+ gl_Position = projectionMatrix * viewMatrix * modelMatrix * transformed;
14
+
15
+ vec3 worldPosition = (modelMatrix * transformed).xyz;
16
+
17
+ v_worldPos = worldPosition.xz * u_gridDiv;
18
+
19
+ // Use local position for grid calculations
20
+ vec3 localPos = transformed.xyz;
21
+ vec3 cameraCenteringOffset = floor(cameraPosition);
22
+ vec3 cameraSnappedWorldPos = worldPosition.xyz - cameraCenteringOffset;
23
+ v_uv = cameraSnappedWorldPos.xz * u_gridDiv;
24
+
25
+ }
26
+ `;
2
27
  //# sourceMappingURL=vertex.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../../../src/core/Material/PristineGridMaterial/shader/vertex.ts"],"sourcesContent":["export default /* glsl */ `\n\nprecision highp float;\n\n// Uniforms\nuniform float u_majorGridDiv;\nuniform float u_gridDiv;\n\nout vec2 v_uv; // Passed to the fragment shader\nout vec2 v_worldPos;\nvoid main() {\n vec4 transformed = vec4(position, 1.0);\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * transformed;\n\n vec3 worldPosition = (modelMatrix * transformed).xyz;\n\n v_worldPos = worldPosition.xz * u_gridDiv;\n\n // Use local position for grid calculations\n vec3 localPos = transformed.xyz;\n vec3 cameraCenteringOffset = floor(cameraPosition);\n vec3 cameraSnappedWorldPos = worldPosition.xyz - cameraCenteringOffset;\n v_uv = cameraSnappedWorldPos.xz * u_gridDiv;\n\n}\n`"],"mappings":"AAAA,eAAe"}
1
+ {"version":3,"names":[],"sources":["../../../../../src/core/Material/PristineGridMaterial/shader/vertex.ts"],"sourcesContent":["export default /* glsl */ `\n\nprecision highp float;\n\n// Uniforms\nuniform float u_majorGridDiv;\nuniform float u_gridDiv;\n\nout vec2 v_uv; // Passed to the fragment shader\nout vec2 v_worldPos;\nvoid main() {\n vec4 transformed = vec4(position, 1.0);\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * transformed;\n\n vec3 worldPosition = (modelMatrix * transformed).xyz;\n\n v_worldPos = worldPosition.xz * u_gridDiv;\n\n // Use local position for grid calculations\n vec3 localPos = transformed.xyz;\n vec3 cameraCenteringOffset = floor(cameraPosition);\n vec3 cameraSnappedWorldPos = worldPosition.xyz - cameraCenteringOffset;\n v_uv = cameraSnappedWorldPos.xz * u_gridDiv;\n\n}\n`"],"mappings":"AAAA,eAAe,UAAY;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC"}