@anov/3d-ability 0.0.142 → 0.0.144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/business/Animation/motion/index.js +56 -35
- package/dist/business/Animation/motion/index.js.map +1 -1
- package/dist/business/Animation/type.js +2 -2
- package/dist/business/Area/Fence/FenceBase.js +187 -146
- package/dist/business/Area/Fence/FenceBase.js.map +1 -1
- package/dist/business/Area/Fence/fence_base_01.js +112 -120
- package/dist/business/Area/Fence/fence_base_01.js.map +1 -1
- package/dist/business/Area/Fence/fence_feeting_01.js +130 -218
- package/dist/business/Area/Fence/fence_feeting_01.js.map +1 -1
- package/dist/business/Area/Fence/fence_roll_01.js +130 -140
- package/dist/business/Area/Fence/fence_roll_01.js.map +1 -1
- package/dist/business/Area/FillArea/FillAreaBase.js +126 -87
- package/dist/business/Area/FillArea/FillAreaBase.js.map +1 -1
- package/dist/business/Area/FillArea/fillArea_face_01.js +98 -72
- package/dist/business/Area/FillArea/fillArea_face_01.js.map +1 -1
- package/dist/business/Area/FillArea/fillArea_line_01.js +94 -66
- package/dist/business/Area/FillArea/fillArea_line_01.js.map +1 -1
- package/dist/business/Area/index.js +483 -267
- package/dist/business/Area/index.js.map +1 -1
- package/dist/business/Area/tool.js +26 -14
- package/dist/business/Area/tool.js.map +1 -1
- package/dist/business/Base/ObjectLayer.js +46 -21
- package/dist/business/Base/ObjectLayer.js.map +1 -1
- package/dist/business/Batch/index.js +234 -189
- package/dist/business/Batch/index.js.map +1 -1
- package/dist/business/Box/index.js +81 -52
- package/dist/business/Box/index.js.map +1 -1
- package/dist/business/Cylinder/index.js +79 -51
- package/dist/business/Cylinder/index.js.map +1 -1
- package/dist/business/Flyline/bubble/CircleBubble.js +9 -1
- package/dist/business/Flyline/bubble/CircleBubble.js.map +1 -1
- package/dist/business/Flyline/bubble/index.js +21 -7
- package/dist/business/Flyline/bubble/index.js.map +1 -1
- package/dist/business/Flyline/index.js +162 -96
- package/dist/business/Flyline/index.js.map +1 -1
- package/dist/business/Flyline/line/ArcLine.js +291 -208
- package/dist/business/Flyline/line/ArcLine.js.map +1 -1
- package/dist/business/Flyline/line/index.js +22 -8
- package/dist/business/Flyline/line/index.js.map +1 -1
- package/dist/business/HeatMap/HeatMap.js +467 -380
- package/dist/business/HeatMap/HeatMap.js.map +1 -1
- package/dist/business/HeatMap/core.js +525 -405
- package/dist/business/HeatMap/core.js.map +1 -1
- package/dist/business/HeatMap/shader.js +3 -69
- package/dist/business/HeatMap/shader.js.map +1 -1
- package/dist/business/InfoPanel/index.js +242 -201
- package/dist/business/InfoPanel/index.js.map +1 -1
- package/dist/business/Line/index.js +88 -55
- package/dist/business/Line/index.js.map +1 -1
- package/dist/business/Mark/KeyframeAnimation.js +176 -145
- package/dist/business/Mark/KeyframeAnimation.js.map +1 -1
- package/dist/business/Mark/index.js +294 -196
- package/dist/business/Mark/index.js.map +1 -1
- package/dist/business/Mark/shader/tanhao.js +3 -36
- package/dist/business/Mark/shader/tanhao.js.map +1 -1
- package/dist/business/Mark/type.js +1 -1
- package/dist/business/MaterialSwitch/MaterialSwitchSystem.js +551 -377
- package/dist/business/MaterialSwitch/MaterialSwitchSystem.js.map +1 -1
- package/dist/business/MaterialSwitch/inject.js +58 -92
- package/dist/business/MaterialSwitch/inject.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/finalFade.js +2 -74
- package/dist/business/MaterialSwitch/shader/finalFade.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/ground.js +16 -95
- package/dist/business/MaterialSwitch/shader/ground.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/groundBase64.js +3 -9
- package/dist/business/MaterialSwitch/shader/groundBase64.js.map +1 -1
- package/dist/business/MaterialSwitch/shader/realFade.js +9 -48
- package/dist/business/MaterialSwitch/shader/realFade.js.map +1 -1
- package/dist/business/Plane/index.js +78 -51
- package/dist/business/Plane/index.js.map +1 -1
- package/dist/business/Poi/index.js +336 -248
- package/dist/business/Poi/index.js.map +1 -1
- package/dist/business/Poi/link/Cylinder.js +89 -56
- package/dist/business/Poi/link/Cylinder.js.map +1 -1
- package/dist/business/Poi/link/Pyramid.js +165 -104
- package/dist/business/Poi/link/Pyramid.js.map +1 -1
- package/dist/business/Poi/link/index.d.ts +1 -1
- package/dist/business/Poi/link/index.js +114 -54
- package/dist/business/Poi/link/index.js.map +1 -1
- package/dist/business/Poi/panel/index.js +373 -315
- package/dist/business/Poi/panel/index.js.map +1 -1
- package/dist/business/Poi/panel/utils.js +10 -5
- package/dist/business/Poi/panel/utils.js.map +1 -1
- package/dist/business/Poi/particle/DoubleCircle.js +107 -71
- package/dist/business/Poi/particle/DoubleCircle.js.map +1 -1
- package/dist/business/Poi/particle/DynamicCircle.js +111 -75
- package/dist/business/Poi/particle/DynamicCircle.js.map +1 -1
- package/dist/business/Poi/particle/SingleCircle.js +98 -62
- package/dist/business/Poi/particle/SingleCircle.js.map +1 -1
- package/dist/business/Poi/particle/index.js +117 -49
- package/dist/business/Poi/particle/index.js.map +1 -1
- package/dist/business/Poi/shader/circle.js +3 -31
- package/dist/business/Poi/shader/circle.js.map +1 -1
- package/dist/business/Poi/shader/cylinder.js +3 -37
- package/dist/business/Poi/shader/cylinder.js.map +1 -1
- package/dist/business/Poi/shader/doubleCircle.js +3 -55
- package/dist/business/Poi/shader/doubleCircle.js.map +1 -1
- package/dist/business/Poi/shader/dynamicCircle.js +3 -67
- package/dist/business/Poi/shader/dynamicCircle.js.map +1 -1
- package/dist/business/Poi/title/Border.js +27 -7
- package/dist/business/Poi/title/Border.js.map +1 -1
- package/dist/business/Poi/title/Ellipse.js +27 -7
- package/dist/business/Poi/title/Ellipse.js.map +1 -1
- package/dist/business/Poi/title/index.js +292 -208
- package/dist/business/Poi/title/index.js.map +1 -1
- package/dist/business/Poi/tools.js +17 -18
- package/dist/business/Poi/tools.js.map +1 -1
- package/dist/business/Sphere/index.js +72 -47
- package/dist/business/Sphere/index.js.map +1 -1
- package/dist/business/Spline/index.js +245 -190
- package/dist/business/Spline/index.js.map +1 -1
- package/dist/business/SplitBuilding/index.js +536 -327
- package/dist/business/SplitBuilding/index.js.map +1 -1
- package/dist/business/SplitBuilding/type.js +2 -2
- package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js +275 -218
- package/dist/business/TrafficComponents/RealismTraffic/RealismTraffic.js.map +1 -1
- package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js +177 -132
- package/dist/business/TrafficComponents/StreamerTraffic/StreamerTraffic.js.map +1 -1
- package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js +1 -51
- package/dist/business/TrafficComponents/StreamerTraffic/fragmentShader.js.map +1 -1
- package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js +1 -6
- package/dist/business/TrafficComponents/StreamerTraffic/vertexShader.js.map +1 -1
- package/dist/business/TrafficComponents/base.js +55 -32
- package/dist/business/TrafficComponents/base.js.map +1 -1
- package/dist/business/TrafficComponents/utils.js +24 -25
- package/dist/business/TrafficComponents/utils.js.map +1 -1
- package/dist/business/Utils/Curve.js +56 -40
- package/dist/business/Utils/Curve.js.map +1 -1
- package/dist/business/Utils/constant.js +1 -1
- package/dist/business/Utils/constant.js.map +1 -1
- package/dist/business/Utils/defineProps.js +14 -13
- package/dist/business/Utils/defineProps.js.map +1 -1
- package/dist/business/Utils/round-curve.js +153 -127
- package/dist/business/Utils/round-curve.js.map +1 -1
- package/dist/business/VideoPanel/index.js +319 -258
- package/dist/business/VideoPanel/index.js.map +1 -1
- package/dist/business/Water/index.js +108 -78
- package/dist/business/Water/index.js.map +1 -1
- package/dist/business/Water/types.js +1 -1
- package/dist/business/Water/types.js.map +1 -1
- package/dist/core/Camera/PerspectiveCamera/CameraExpand.js +449 -383
- package/dist/core/Camera/PerspectiveCamera/CameraExpand.js.map +1 -1
- package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js +142 -107
- package/dist/core/Camera/PerspectiveCamera/FollowOrbitControls.js.map +1 -1
- package/dist/core/Controls/FirstViewControl/index.js +96 -84
- package/dist/core/Controls/FirstViewControl/index.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/action/input.js +98 -77
- package/dist/core/Controls/ThirdViewControl/action/input.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/config/constants.js +1 -1
- package/dist/core/Controls/ThirdViewControl/config/constants.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/index.js +28 -19
- package/dist/core/Controls/ThirdViewControl/index.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player/animation.js +155 -126
- package/dist/core/Controls/ThirdViewControl/player/animation.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player/camera.js +63 -47
- package/dist/core/Controls/ThirdViewControl/player/camera.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player/control.js +49 -39
- package/dist/core/Controls/ThirdViewControl/player/control.js.map +1 -1
- package/dist/core/Controls/ThirdViewControl/player.js +91 -66
- package/dist/core/Controls/ThirdViewControl/player.js.map +1 -1
- package/dist/core/Controls/base.js +30 -14
- package/dist/core/Controls/base.js.map +1 -1
- package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js +131 -92
- package/dist/core/Curve/RoundedCornersCurve/RoundedCornersCurve.js.map +1 -1
- package/dist/core/Debug/PerformanceInfo/Performance.js +47 -22
- package/dist/core/Debug/PerformanceInfo/Performance.js.map +1 -1
- package/dist/core/Light/PointLight/PointLightExt.js +21 -4
- package/dist/core/Light/PointLight/PointLightExt.js.map +1 -1
- package/dist/core/Material/FinirMaterial/FinirMaterial.js +57 -37
- package/dist/core/Material/FinirMaterial/FinirMaterial.js.map +1 -1
- package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js +153 -116
- package/dist/core/Material/PristineGridMaterial/PristineGridMaterial.js.map +1 -1
- package/dist/core/Material/PristineGridMaterial/shader/fragment.js +1 -95
- package/dist/core/Material/PristineGridMaterial/shader/fragment.js.map +1 -1
- package/dist/core/Material/PristineGridMaterial/shader/vertex.js +1 -26
- package/dist/core/Material/PristineGridMaterial/shader/vertex.js.map +1 -1
- package/dist/core/Material/SurfaceMaterial/index.js +172 -76
- package/dist/core/Material/SurfaceMaterial/index.js.map +1 -1
- package/dist/core/Material/decorators.js +11 -6
- package/dist/core/Material/decorators.js.map +1 -1
- package/dist/core/PostEffects/addACESFilmicToneMappingPass.js +12 -16
- package/dist/core/PostEffects/addACESFilmicToneMappingPass.js.map +1 -1
- package/dist/core/PostEffects/addBrightnessContrastPass.js +13 -17
- package/dist/core/PostEffects/addBrightnessContrastPass.js.map +1 -1
- package/dist/core/PostEffects/bloomPass.js +10 -17
- package/dist/core/PostEffects/bloomPass.js.map +1 -1
- package/dist/core/PostEffects/bloomSelect.js +43 -60
- package/dist/core/PostEffects/bloomSelect.js.map +1 -1
- package/dist/core/PostEffects/colorifyPass.js +13 -17
- package/dist/core/PostEffects/colorifyPass.js.map +1 -1
- package/dist/core/PostEffects/index.js +22 -28
- package/dist/core/PostEffects/index.js.map +1 -1
- package/dist/core/PostEffects/outlinePass.js +50 -37
- package/dist/core/PostEffects/outlinePass.js.map +1 -1
- package/dist/core/PostEffects/postprocessing.js +12 -14
- package/dist/core/PostEffects/postprocessing.js.map +1 -1
- package/dist/core/PostEffects/saoPass.js +10 -15
- package/dist/core/PostEffects/saoPass.js.map +1 -1
- package/dist/core/PostEffects/shader/colorify.js +3 -22
- package/dist/core/PostEffects/shader/colorify.js.map +1 -1
- package/dist/core/PostEffects/shader/gammaCorrectionShader.js +3 -27
- package/dist/core/PostEffects/shader/gammaCorrectionShader.js.map +1 -1
- package/dist/core/PostEffects/shader/mapping.js +3 -66
- package/dist/core/PostEffects/shader/mapping.js.map +1 -1
- package/dist/core/PostEffects/shader/thermalMaging.js +3 -28
- package/dist/core/PostEffects/shader/thermalMaging.js.map +1 -1
- package/dist/core/SceneEffect/grow/grow.js +101 -85
- package/dist/core/SceneEffect/grow/grow.js.map +1 -1
- package/dist/core/SceneEffect/grow/style_down.js +77 -60
- package/dist/core/SceneEffect/grow/style_down.js.map +1 -1
- package/dist/core/SceneEffect/grow/style_up.js +81 -64
- package/dist/core/SceneEffect/grow/style_up.js.map +1 -1
- package/dist/core/SceneEffect/grow/type.js +2 -2
- package/dist/core/SceneEffect/grow/type.js.map +1 -1
- package/dist/core/WeatherSystem/DynamicWeatherSystem.js +76 -51
- package/dist/core/WeatherSystem/DynamicWeatherSystem.js.map +1 -1
- package/dist/core/WeatherSystem/hdr/index.js +105 -69
- package/dist/core/WeatherSystem/hdr/index.js.map +1 -1
- package/dist/core/WeatherSystem/index.js +124 -77
- package/dist/core/WeatherSystem/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/fog/index.js +80 -52
- package/dist/core/WeatherSystem/objects/fog/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/index.js +84 -72
- package/dist/core/WeatherSystem/objects/rain/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/lineRain.js +118 -88
- package/dist/core/WeatherSystem/objects/rain/lineRain.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/plane.js +146 -116
- package/dist/core/WeatherSystem/objects/rain/plane.js.map +1 -1
- package/dist/core/WeatherSystem/objects/rain/point.js +148 -100
- package/dist/core/WeatherSystem/objects/rain/point.js.map +1 -1
- package/dist/core/WeatherSystem/objects/sky/cloud.js +104 -71
- package/dist/core/WeatherSystem/objects/sky/cloud.js.map +1 -1
- package/dist/core/WeatherSystem/objects/sky/index.js +84 -66
- package/dist/core/WeatherSystem/objects/sky/index.js.map +1 -1
- package/dist/core/WeatherSystem/objects/sky/outline.js +45 -25
- package/dist/core/WeatherSystem/objects/sky/outline.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/cloud.js +3 -74
- package/dist/core/WeatherSystem/shaders/cloud.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/fog.js +3 -103
- package/dist/core/WeatherSystem/shaders/fog.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/rain.js +7 -206
- package/dist/core/WeatherSystem/shaders/rain.js.map +1 -1
- package/dist/core/WeatherSystem/shaders/sky.js +3 -87
- package/dist/core/WeatherSystem/shaders/sky.js.map +1 -1
- package/dist/core/WeatherSystem/sky/index.js +135 -104
- package/dist/core/WeatherSystem/sky/index.js.map +1 -1
- package/dist/core/WeatherSystem/utils/constant.js +38 -44
- package/dist/core/WeatherSystem/utils/constant.js.map +1 -1
- package/dist/core/WeatherSystem/utils/math.js +25 -18
- package/dist/core/WeatherSystem/utils/math.js.map +1 -1
- package/dist/core/WeatherSystem/utils/type.js +1 -1
- package/dist/core/WeatherSystem/utils/type.js.map +1 -1
- package/dist/core/WeatherSystem/weather/index.js +141 -96
- package/dist/core/WeatherSystem/weather/index.js.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Color","MeshStandardMaterial","addUpdateTag","FinirMaterial","_class","
|
|
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,KA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A,OAAApB,KAAA;EACH;EAACuB,YAAA,CAAA9B,aAAA;IAAA+B,GAAA;IAAAC,GAAA,EA1DD,SAAAA,IAAA,EAAsB;MACpB,OAAO,IAAI,CAACd,SAAS;IACvB,CAAC;IAAAe,GAAA,EAED,SAAAA,IACoBR,KAAY,EAAE;MAChC,IAAI,CAACP,SAAS,GAAGO,KAAK;IACxB;EAAC;IAAAM,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAsB;MACpB,OAAO,IAAI,CAACX,SAAS;IACvB,CAAC;IAAAY,GAAA,EAED,SAAAA,IACoBR,KAAa,EAAE;MACjC,IAAI,CAACJ,SAAS,GAAGI,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,9 +1,20 @@
|
|
|
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); }
|
|
1
2
|
var _class;
|
|
2
3
|
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; }
|
|
3
4
|
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); }
|
|
4
15
|
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; }
|
|
5
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" ==
|
|
6
|
-
function _toPrimitive(t, r) { if ("object" !=
|
|
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); }
|
|
7
18
|
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; }
|
|
8
19
|
import * as THREE from '@anov/3d-core';
|
|
9
20
|
import { addUpdateTag } from "../decorators";
|
|
@@ -12,142 +23,168 @@ import fragmentShader from "./shader/fragment";
|
|
|
12
23
|
/**
|
|
13
24
|
* 高性能网格材质
|
|
14
25
|
*/
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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), {}, {
|
|
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), {}, {
|
|
117
71
|
u_baseAlpha: {
|
|
118
72
|
value: 0.5
|
|
119
73
|
},
|
|
120
74
|
u_majorLineWidth: {
|
|
121
|
-
value:
|
|
75
|
+
value: _this._majorLineWidth
|
|
122
76
|
},
|
|
123
77
|
u_minorLineWidth: {
|
|
124
|
-
value:
|
|
78
|
+
value: _this._minorLineWidth
|
|
125
79
|
},
|
|
126
80
|
u_axisLineWidth: {
|
|
127
|
-
value:
|
|
81
|
+
value: _this._axisLineWidth
|
|
128
82
|
},
|
|
129
83
|
u_majorGridDiv: {
|
|
130
|
-
value:
|
|
84
|
+
value: _this._majorGridDiv
|
|
131
85
|
},
|
|
132
86
|
u_gridDiv: {
|
|
133
|
-
value:
|
|
87
|
+
value: _this._gridDiv
|
|
134
88
|
},
|
|
135
89
|
u_majorLineColor: {
|
|
136
|
-
value:
|
|
90
|
+
value: _this._majorLineColor
|
|
137
91
|
},
|
|
138
92
|
u_minorLineColor: {
|
|
139
|
-
value:
|
|
93
|
+
value: _this._minorLineColor
|
|
140
94
|
},
|
|
141
95
|
u_baseColor: {
|
|
142
|
-
value:
|
|
96
|
+
value: _this._baseColor
|
|
143
97
|
},
|
|
144
98
|
u_xAxisColor: {
|
|
145
|
-
value:
|
|
99
|
+
value: _this._xAxisColor
|
|
146
100
|
},
|
|
147
101
|
u_zAxisColor: {
|
|
148
|
-
value:
|
|
102
|
+
value: _this._zAxisColor
|
|
149
103
|
}
|
|
150
104
|
});
|
|
151
|
-
|
|
152
|
-
}
|
|
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);
|
|
153
190
|
//# sourceMappingURL=PristineGridMaterial.js.map
|
|
@@ -1 +1 @@
|
|
|
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;AA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YAAY,GAAAkD,MAAA,CAAAC,wBAAA,CAAA/C,MAAA,CAAA6C,SAAA,iBAAA7C,MAAA,CAAA6C,SAAA,GAAAD,yBAAA,CAAA5C,MAAA,CAAA6C,SAAA,iBASZjD,YAAY,GAAAkD,MAAA,CAAAC,wBAAA,CAAA/C,MAAA,CAAA6C,SAAA,iBAAA7C,MAAA,CAAA6C,SAAA,GAAAD,yBAAA,CAAA5C,MAAA,CAAA6C,SAAA,gBASZjD,YAAY,GAAAkD,MAAA,CAAAC,wBAAA,CAAA/C,MAAA,CAAA6C,SAAA,gBAAA7C,MAAA,CAAA6C,SAAA,IAAA7C,MAAA"}
|
|
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;AAkBrB;AACA;AACA;AACA,WAAaC,YAAY,IAAAC,MAAA,0BAAAC,qBAAA;EAAAC,SAAA,CAAAH,YAAA,EAAAE,qBAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAL,YAAA;EAsGvB,SAAAA,aAAYM,OAAgC,EAAE;IAAA,IAAAC,KAAA;IAAAC,eAAA,OAAAR,YAAA;IAC5CO,KAAA,GAAAH,MAAA,CAAAK,IAAA;IA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D,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,96 +1,2 @@
|
|
|
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
|
-
`;
|
|
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";
|
|
96
2
|
//# 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"}
|
|
@@ -1,27 +1,2 @@
|
|
|
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
|
-
`;
|
|
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";
|
|
27
2
|
//# 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"}
|