@anov/3d-ability 0.0.4-alpha1 → 0.0.4-alpha12

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 (160) hide show
  1. package/dist/camera/index.d.ts +69 -0
  2. package/dist/camera/index.js +257 -0
  3. package/dist/camera/index.js.map +1 -0
  4. package/dist/city/flyinglead.js +2 -0
  5. package/dist/city/flyinglead.js.map +1 -0
  6. package/dist/city/radar.js +2 -0
  7. package/dist/city/radar.js.map +1 -0
  8. package/dist/city/scanning.js +2 -0
  9. package/dist/city/scanning.js.map +1 -0
  10. package/dist/city/surroundLine.js +2 -0
  11. package/dist/city/surroundLine.js.map +1 -0
  12. package/dist/environment/rain.js +2 -1
  13. package/dist/environment/rain.js.map +1 -0
  14. package/dist/environment/{rainShder → rainShader}/index.js +2 -1
  15. package/dist/environment/rainShader/index.js.map +1 -0
  16. package/dist/environment/{rainShder → rainShader}/shader.js +2 -1
  17. package/dist/environment/rainShader/shader.js.map +1 -0
  18. package/dist/environment/shaderCloud/cloudMaterial.js +2 -1
  19. package/dist/environment/shaderCloud/cloudMaterial.js.map +1 -0
  20. package/dist/environment/shaderCloud/index.js +2 -1
  21. package/dist/environment/shaderCloud/index.js.map +1 -0
  22. package/dist/environment/shaderCloud/shader.js +2 -1
  23. package/dist/environment/shaderCloud/shader.js.map +1 -0
  24. package/dist/environment/{showShder → showShader}/index.js +2 -1
  25. package/dist/environment/showShader/index.js.map +1 -0
  26. package/dist/environment/{showShder → showShader}/shader.js +3 -2
  27. package/dist/environment/showShader/shader.js.map +1 -0
  28. package/dist/environment/sky/index.js +11 -10
  29. package/dist/environment/sky/index.js.map +1 -0
  30. package/dist/environment/skyBox/index.d.ts +41 -0
  31. package/dist/environment/skyBox/index.js +150 -0
  32. package/dist/environment/skyBox/index.js.map +1 -0
  33. package/dist/environment/snow.js +4 -1
  34. package/dist/environment/snow.js.map +1 -0
  35. package/dist/environment/sun/index.js +2 -1
  36. package/dist/environment/sun/index.js.map +1 -0
  37. package/dist/environment/utils/points.js +4 -3
  38. package/dist/environment/utils/points.js.map +1 -0
  39. package/dist/environment/volumetricCloud/cloudMaterial.js +2 -1
  40. package/dist/environment/volumetricCloud/cloudMaterial.js.map +1 -0
  41. package/dist/environment/volumetricCloud/inex.js +2 -1
  42. package/dist/environment/volumetricCloud/inex.js.map +1 -0
  43. package/dist/heatmap/index.d.ts +9 -0
  44. package/dist/heatmap/index.js +138 -0
  45. package/dist/heatmap/index.js.map +1 -0
  46. package/dist/helper/view/index.js +2 -1
  47. package/dist/helper/view/index.js.map +1 -0
  48. package/dist/helper/view/utils.js +2 -1
  49. package/dist/helper/view/utils.js.map +1 -0
  50. package/dist/index.d.ts +11 -6
  51. package/dist/index.js +12 -6
  52. package/dist/index.js.map +1 -0
  53. package/dist/line/curve.d.ts +33 -0
  54. package/dist/line/curve.js +71 -0
  55. package/dist/line/curve.js.map +1 -0
  56. package/dist/line/index.d.ts +0 -0
  57. package/dist/line/index.js +2 -0
  58. package/dist/line/index.js.map +1 -0
  59. package/dist/line/round-curve.d.ts +19 -0
  60. package/dist/line/round-curve.js +212 -0
  61. package/dist/line/round-curve.js.map +1 -0
  62. package/dist/material/finirMaterialMaterial/index.d.ts +9 -0
  63. package/dist/material/finirMaterialMaterial/index.js +47 -0
  64. package/dist/material/finirMaterialMaterial/index.js.map +1 -0
  65. package/dist/material/pristineGridMaterial/index.js +2 -1
  66. package/dist/material/pristineGridMaterial/index.js.map +1 -0
  67. package/dist/material/pristineGridMaterial/shader/fragment.js +2 -1
  68. package/dist/material/pristineGridMaterial/shader/fragment.js.map +1 -0
  69. package/dist/material/pristineGridMaterial/shader/vertex.js +2 -1
  70. package/dist/material/pristineGridMaterial/shader/vertex.js.map +1 -0
  71. package/dist/poi/core/Base.d.ts +7 -0
  72. package/dist/poi/core/Base.js +24 -0
  73. package/dist/poi/core/Base.js.map +1 -0
  74. package/dist/poi/core/Css2D.js +181 -0
  75. package/dist/poi/core/Css2D.js.map +1 -0
  76. package/dist/poi/core/Css3D.d.ts +1 -0
  77. package/dist/poi/core/Css3D.js +24 -0
  78. package/dist/poi/core/Css3D.js.map +1 -0
  79. package/dist/poi/core/Sprite.d.ts +12 -0
  80. package/dist/poi/core/Sprite.js +145 -0
  81. package/dist/poi/core/Sprite.js.map +1 -0
  82. package/dist/poi/core/SpriteBase.d.ts +11 -0
  83. package/dist/poi/core/SpriteBase.js +58 -0
  84. package/dist/poi/core/SpriteBase.js.map +1 -0
  85. package/dist/poi/index.d.ts +12 -0
  86. package/dist/poi/index.js +29 -0
  87. package/dist/poi/index.js.map +1 -0
  88. package/dist/poi/utils/base64.d.ts +3 -0
  89. package/dist/poi/utils/base64.js +4 -0
  90. package/dist/poi/utils/base64.js.map +1 -0
  91. package/dist/poi/utils/canvas.d.ts +3 -0
  92. package/dist/poi/utils/canvas.js +68 -0
  93. package/dist/poi/utils/canvas.js.map +1 -0
  94. package/dist/poi/utils/css.d.ts +35 -0
  95. package/dist/poi/utils/css.js +45 -0
  96. package/dist/poi/utils/css.js.map +1 -0
  97. package/dist/poi/utils/type.d.ts +35 -0
  98. package/dist/poi/utils/type.js +39 -0
  99. package/dist/poi/utils/type.js.map +1 -0
  100. package/dist/poiBack/assets.d.ts +2 -0
  101. package/dist/poiBack/assets.js +3 -0
  102. package/dist/poiBack/assets.js.map +1 -0
  103. package/dist/poiBack/dom.d.ts +2 -0
  104. package/dist/poiBack/dom.js +36 -0
  105. package/dist/poiBack/dom.js.map +1 -0
  106. package/dist/poiBack/index.d.ts +19 -0
  107. package/dist/poiBack/index.js +145 -0
  108. package/dist/poiBack/index.js.map +1 -0
  109. package/dist/poiBack/type.d.ts +20 -0
  110. package/dist/poiBack/type.js +6 -0
  111. package/dist/poiBack/type.js.map +1 -0
  112. package/dist/postEffects/bloomPass.js +2 -1
  113. package/dist/postEffects/bloomPass.js.map +1 -0
  114. package/dist/postEffects/index.js +2 -1
  115. package/dist/postEffects/index.js.map +1 -0
  116. package/dist/postEffects/outlinePass.js +9 -2
  117. package/dist/postEffects/outlinePass.js.map +1 -0
  118. package/dist/scene/grow/grow.d.ts +10 -0
  119. package/dist/scene/grow/grow.js +128 -0
  120. package/dist/scene/grow/grow.js.map +1 -0
  121. package/dist/scene/grow/growStyle.d.ts +2 -0
  122. package/dist/scene/grow/growStyle.js +3 -0
  123. package/dist/scene/grow/growStyle.js.map +1 -0
  124. package/dist/scene/grow/index.d.ts +2 -0
  125. package/dist/scene/grow/index.js +3 -0
  126. package/dist/scene/grow/index.js.map +1 -0
  127. package/dist/scene/grow/style_down.d.ts +13 -0
  128. package/dist/scene/grow/style_down.js +92 -0
  129. package/dist/scene/grow/style_down.js.map +1 -0
  130. package/dist/scene/grow/style_up.d.ts +13 -0
  131. package/dist/scene/grow/style_up.js +96 -0
  132. package/dist/scene/grow/style_up.js.map +1 -0
  133. package/dist/scene/grow/type.d.ts +46 -0
  134. package/dist/scene/grow/type.js +42 -0
  135. package/dist/scene/grow/type.js.map +1 -0
  136. package/dist/scene/index.d.ts +1 -0
  137. package/dist/scene/index.js +2 -0
  138. package/dist/scene/index.js.map +1 -0
  139. package/dist/utils/index.js +2 -1
  140. package/dist/utils/index.js.map +1 -0
  141. package/dist/weather/fog2DMesh.d.ts +14 -0
  142. package/dist/weather/fog2DMesh.js +77 -0
  143. package/dist/weather/fog2DMesh.js.map +1 -0
  144. package/dist/weather/glsl/fog.d.ts +2 -0
  145. package/dist/weather/glsl/fog.js +3 -0
  146. package/dist/weather/glsl/fog.js.map +1 -0
  147. package/dist/weather/index.d.ts +4 -0
  148. package/dist/weather/index.js +12 -0
  149. package/dist/weather/index.js.map +1 -0
  150. package/package.json +10 -3
  151. package/dist/core/mouseDrawe.d.ts +0 -2
  152. package/dist/core/mouseDrawe.js +0 -1
  153. package/dist/environment/cloud/cloud.d.ts +0 -1
  154. package/dist/environment/cloud/cloud.js +0 -1
  155. package/dist/environment/cloud/index.d.ts +0 -7
  156. package/dist/environment/cloud/index.js +0 -60
  157. /package/dist/environment/{rainShder → rainShader}/index.d.ts +0 -0
  158. /package/dist/environment/{rainShder → rainShader}/shader.d.ts +0 -0
  159. /package/dist/environment/{showShder → showShader}/index.d.ts +0 -0
  160. /package/dist/environment/{showShder → showShader}/shader.d.ts +0 -0
@@ -88,4 +88,5 @@ export var getAxesSpritePoints = function getAxesSpritePoints() {
88
88
  sprite.renderOrder = 1;
89
89
  return sprite;
90
90
  });
91
- };
91
+ };
92
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BufferAttribute","BufferGeometry","CanvasTexture","Color","LineBasicMaterial","LineSegments","RepeatWrapping","Sprite","SpriteMaterial","axesColors","getDomContainer","placement","size","div","document","createElement","style","height","width","borderRadius","position","split","y","x","transform","left","right","top","bottom","getAxesLines","distance","Array","fill","map","_","i","flat","color","toArray","geometry","setAttribute","Float32Array","linewidth","vertexColors","getSpriteMaterial","text","canvas","context","getContext","beginPath","arc","Math","PI","closePath","fillStyle","getStyle","font","textAlign","fillText","toUpperCase","texture","wrapS","wrapT","repeat","toneMapped","transparent","getAxesSpritePoints","axes","isPositive","sign","axis","sprite","userData","type","scale","setScalar","renderOrder"],"sources":["../../../src/helper/view/utils.ts"],"sourcesContent":["import { BufferAttribute, BufferGeometry, CanvasTexture, Color, LineBasicMaterial, LineSegments, RepeatWrapping, Sprite, SpriteMaterial } from '@anov/3d-core'\nimport type { DomPlacement } from './index'\n\nconst axesColors = [\n new Color(0xFF3653),\n new Color(0x8ADB00),\n new Color(0x2C8FFF),\n]\n\nexport const getDomContainer = (placement: DomPlacement, size: number) => {\n const div = document.createElement('div')\n const style = div.style\n\n style.height = `${size}px`\n style.width = `${size}px`\n style.borderRadius = '100%'\n style.position = 'absolute'\n\n const [y, x] = placement.split('-')\n\n style.transform = ''\n style.left = x === 'left' ? '0' : x === 'center' ? '50%' : ''\n style.right = x === 'right' ? '0' : ''\n style.transform += x === 'center' ? 'translateX(-50%)' : ''\n style.top = y === 'top' ? '0' : y === 'bottom' ? '' : '50%'\n style.bottom = y === 'bottom' ? '0' : ''\n style.transform += y === 'center' ? 'translateY(-50%)' : ''\n\n return div\n}\n\nexport const getAxesLines = () => {\n const distance = 0.9\n const position = Array(3)\n .fill(0)\n .map((_, i) => [\n !i ? distance : 0,\n i === 1 ? distance : 0,\n i === 2 ? distance : 0,\n 0,\n 0,\n 0,\n ])\n .flat()\n const color = Array(6)\n .fill(0)\n .map((_, i) =>\n i < 2\n ? axesColors[0].toArray()\n : i < 4\n ? axesColors[1].toArray()\n : axesColors[2].toArray(),\n )\n .flat()\n\n const geometry = new BufferGeometry()\n geometry.setAttribute(\n 'position',\n new BufferAttribute(new Float32Array(position), 3),\n )\n geometry.setAttribute(\n 'color',\n new BufferAttribute(new Float32Array(color), 3),\n )\n\n return new LineSegments(\n geometry,\n new LineBasicMaterial({\n linewidth: 3,\n vertexColors: true,\n }),\n )\n}\n\nexport const getSpriteMaterial = (color: Color, text: 'x' | 'y' | 'z' | null = null) => {\n const canvas = document.createElement('canvas')\n canvas.width = 128\n canvas.height = 64\n\n const context = canvas.getContext('2d') as CanvasRenderingContext2D\n context.beginPath()\n context.arc(32, 32, 32, 0, 2 * Math.PI)\n context.closePath()\n context.fillStyle = color.getStyle()\n context.fill()\n\n context.beginPath()\n context.arc(96, 32, 32, 0, 2 * Math.PI)\n context.closePath()\n context.fillStyle = '#FFF'\n context.fill()\n\n if (text !== null) {\n context.font = 'bold 48px Arial'\n context.textAlign = 'center'\n context.fillStyle = '#000'\n context.fillText(text.toUpperCase(), 32, 48)\n context.fillText(text.toUpperCase(), 96, 48)\n }\n\n const texture = new CanvasTexture(canvas)\n texture.wrapS = texture.wrapT = RepeatWrapping\n texture.repeat.x = 0.5\n\n return new SpriteMaterial({\n map: texture,\n toneMapped: false,\n transparent: true,\n })\n}\n\nexport const getAxesSpritePoints = () => {\n const axes = ['x', 'y', 'z'] as const\n return Array(6)\n .fill(0)\n .map((_, i) => {\n const isPositive = i < 3\n const sign = isPositive ? '+' : '-'\n const axis = axes[i % 3]\n const color = axesColors[i % 3]\n\n const sprite = new Sprite(\n getSpriteMaterial(color, isPositive ? axis : null),\n )\n sprite.userData.type = `${sign}${axis}`\n sprite.scale.setScalar(isPositive ? 0.6 : 0.4)\n sprite.position[axis] = isPositive ? 1.2 : -1.2\n sprite.renderOrder = 1\n\n return sprite\n })\n}"],"mappings":";;;;;;AAAA,SAASA,eAAe,EAAEC,cAAc,EAAEC,aAAa,EAAEC,KAAK,EAAEC,iBAAiB,EAAEC,YAAY,EAAEC,cAAc,EAAEC,MAAM,EAAEC,cAAc,QAAQ,eAAe;AAG9J,IAAMC,UAAU,GAAG,CACjB,IAAIN,KAAK,CAAC,QAAQ,CAAC,EACnB,IAAIA,KAAK,CAAC,QAAQ,CAAC,EACnB,IAAIA,KAAK,CAAC,QAAQ,CAAC,CACpB;AAED,OAAO,IAAMO,eAAe,GAAG,SAAlBA,eAAe,CAAIC,SAAuB,EAAEC,IAAY,EAAK;EACxE,IAAMC,GAAG,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EACzC,IAAMC,KAAK,GAAGH,GAAG,CAACG,KAAK;EAEvBA,KAAK,CAACC,MAAM,aAAML,IAAI,OAAI;EAC1BI,KAAK,CAACE,KAAK,aAAMN,IAAI,OAAI;EACzBI,KAAK,CAACG,YAAY,GAAG,MAAM;EAC3BH,KAAK,CAACI,QAAQ,GAAG,UAAU;EAE3B,uBAAeT,SAAS,CAACU,KAAK,CAAC,GAAG,CAAC;IAAA;IAA5BC,CAAC;IAAEC,CAAC;EAEXP,KAAK,CAACQ,SAAS,GAAG,EAAE;EACpBR,KAAK,CAACS,IAAI,GAAGF,CAAC,KAAK,MAAM,GAAG,GAAG,GAAGA,CAAC,KAAK,QAAQ,GAAG,KAAK,GAAG,EAAE;EAC7DP,KAAK,CAACU,KAAK,GAAGH,CAAC,KAAK,OAAO,GAAG,GAAG,GAAG,EAAE;EACtCP,KAAK,CAACQ,SAAS,IAAID,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C,IAAI,aAAMJ,IAAI,SAAGC,IAAI,CAAE;IACvCC,MAAM,CAACG,KAAK,CAACC,SAAS,CAACP,UAAU,GAAG,GAAG,GAAG,GAAG,CAAC;IAC9CG,MAAM,CAACnD,QAAQ,CAACkD,IAAI,CAAC,GAAGF,UAAU,GAAG,GAAG,GAAG,CAAC,GAAG;IAC/CG,MAAM,CAACK,WAAW,GAAG,CAAC;IAEtB,OAAOL,MAAM;EACf,CAAC,CAAC;AACN,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  import { SceneControl } from '@anov/3d-core';
2
- import { mouseDraweLine } from './core/mouseDrawe';
3
2
  import { createSnow } from './environment/snow';
4
3
  import { createRain } from './environment/rain';
5
- import createCloud from './environment/cloud';
6
4
  import { initPostEffects } from './postEffects';
7
5
  import createHighSelectedTool from './postEffects/outlinePass';
8
6
  import { createSun } from './environment/sun';
@@ -11,8 +9,15 @@ import ViewHelper from './helper/view';
11
9
  import createSkySystem from './environment/sky';
12
10
  import createVolumetricCloud from './environment/volumetricCloud/inex';
13
11
  import createSkyCloud from './environment/shaderCloud/index';
14
- import Snow from './environment/showShder';
15
- import Rain from './environment/rainShder';
12
+ import Snow from './environment/showShader';
13
+ import Rain from './environment/rainShader';
14
+ import Poi, { EPoiType } from './poi';
15
+ import HeatMap from './heatmap/index';
16
+ import SkyBox from './environment/skyBox';
17
+ import Camera from './camera/index';
18
+ import { RoundLineGeometry, createRoundLineWallMesh } from './line/round-curve';
19
+ import Fog2DMesh from './weather/fog2DMesh';
20
+ export * from './scene';
16
21
  export { SceneControl, // todo remove
17
- mouseDraweLine, createRain, createSnow, createCloud, createSun, createSkySystem, createVolumetricCloud, createSkyCloud, Snow, Rain, initPostEffects, // effect
18
- createHighSelectedTool, GridMaterial, ViewHelper, };
22
+ createRain, createSnow, createSun, createSkySystem, createVolumetricCloud, createSkyCloud, Snow, Rain, Poi, EPoiType, HeatMap, initPostEffects, // effect
23
+ createHighSelectedTool, GridMaterial, SkyBox, ViewHelper, Camera, RoundLineGeometry, createRoundLineWallMesh, Fog2DMesh, };
package/dist/index.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import { SceneControl } from '@anov/3d-core';
2
- import { mouseDraweLine } from "./core/mouseDrawe";
3
2
  import { createSnow } from "./environment/snow";
4
3
  import { createRain } from "./environment/rain";
5
- import createCloud from "./environment/cloud";
6
4
  import { initPostEffects } from "./postEffects";
7
5
  import createHighSelectedTool from "./postEffects/outlinePass";
8
6
  import { createSun } from "./environment/sun";
@@ -11,10 +9,18 @@ import ViewHelper from "./helper/view";
11
9
  import createSkySystem from "./environment/sky";
12
10
  import createVolumetricCloud from "./environment/volumetricCloud/inex";
13
11
  import createSkyCloud from "./environment/shaderCloud/index";
14
- import Snow from "./environment/showShder";
15
- import Rain from "./environment/rainShder";
12
+ import Snow from "./environment/showShader";
13
+ import Rain from "./environment/rainShader";
14
+ import Poi, { EPoiType } from "./poi";
15
+ import HeatMap from "./heatmap/index";
16
+ import SkyBox from "./environment/skyBox";
17
+ import Camera from "./camera/index";
18
+ import { RoundLineGeometry, createRoundLineWallMesh } from "./line/round-curve";
19
+ import Fog2DMesh from "./weather/fog2DMesh";
20
+ export * from "./scene";
16
21
  export { SceneControl,
17
22
  // todo remove
18
- mouseDraweLine, createRain, createSnow, createCloud, createSun, createSkySystem, createVolumetricCloud, createSkyCloud, Snow, Rain, initPostEffects,
23
+ createRain, createSnow, createSun, createSkySystem, createVolumetricCloud, createSkyCloud, Snow, Rain, Poi, EPoiType, HeatMap, initPostEffects,
19
24
  // effect
20
- createHighSelectedTool, GridMaterial, ViewHelper };
25
+ createHighSelectedTool, GridMaterial, SkyBox, ViewHelper, Camera, RoundLineGeometry, createRoundLineWallMesh, Fog2DMesh };
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SceneControl","createSnow","createRain","initPostEffects","createHighSelectedTool","createSun","GridMaterial","ViewHelper","createSkySystem","createVolumetricCloud","createSkyCloud","Snow","Rain","Poi","EPoiType","HeatMap","SkyBox","Camera","RoundLineGeometry","createRoundLineWallMesh","Fog2DMesh"],"sources":["../src/index.ts"],"sourcesContent":["import { SceneControl } from '@anov/3d-core'\nimport { createSnow } from './environment/snow'\nimport { createRain } from './environment/rain'\nimport { initPostEffects } from './postEffects'\nimport createHighSelectedTool from './postEffects/outlinePass'\nimport { createSun } from './environment/sun'\nimport GridMaterial from './material/pristineGridMaterial'\nimport ViewHelper from './helper/view'\nimport createSkySystem from './environment/sky'\nimport createVolumetricCloud from './environment/volumetricCloud/inex'\nimport createSkyCloud from './environment/shaderCloud/index'\nimport Snow from './environment/showShader'\nimport Rain from './environment/rainShader'\nimport Poi, { EPoiType } from './poi'\nimport HeatMap from './heatmap/index'\nimport SkyBox from './environment/skyBox'\nimport Camera from './camera/index'\nimport { RoundLineGeometry, createRoundLineWallMesh } from './line/round-curve'\nimport Fog2DMesh from './weather/fog2DMesh'\n\nexport * from './scene'\n\nexport {\n SceneControl, // todo remove\n createRain,\n createSnow,\n createSun,\n createSkySystem,\n createVolumetricCloud,\n createSkyCloud,\n Snow,\n Rain,\n Poi, EPoiType,\n HeatMap,\n initPostEffects, // effect\n createHighSelectedTool,\n GridMaterial,\n SkyBox,\n ViewHelper,\n Camera,\n RoundLineGeometry,\n createRoundLineWallMesh,\n Fog2DMesh,\n}\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,eAAe;AAC5C,SAASC,UAAU;AACnB,SAASC,UAAU;AACnB,SAASC,eAAe;AACxB,OAAOC,sBAAsB;AAC7B,SAASC,SAAS;AAClB,OAAOC,YAAY;AACnB,OAAOC,UAAU;AACjB,OAAOC,eAAe;AACtB,OAAOC,qBAAqB;AAC5B,OAAOC,cAAc;AACrB,OAAOC,IAAI;AACX,OAAOC,IAAI;AACX,OAAOC,GAAG,IAAIC,QAAQ;AACtB,OAAOC,OAAO;AACd,OAAOC,MAAM;AACb,OAAOC,MAAM;AACb,SAASC,iBAAiB,EAAEC,uBAAuB;AACnD,OAAOC,SAAS;AAEhB;AAEA,SACEpB,YAAY;AAAE;AACdE,UAAU,EACVD,UAAU,EACVI,SAAS,EACTG,eAAe,EACfC,qBAAqB,EACrBC,cAAc,EACdC,IAAI,EACJC,IAAI,EACJC,GAAG,EAAEC,QAAQ,EACbC,OAAO,EACPZ,eAAe;AAAE;AACjBC,sBAAsB,EACtBE,YAAY,EACZU,MAAM,EACNT,UAAU,EACVU,MAAM,EACNC,iBAAiB,EACjBC,uBAAuB,EACvBC,SAAS"}
@@ -0,0 +1,33 @@
1
+ import type { Vector3 } from '@anov/3d-core';
2
+ import { Color, Line } from '@anov/3d-core';
3
+ export declare type CurveType = 'CatmullRomCurve3' | 'CubicBezierCurve' | 'CubicBezierCurve3';
4
+ export declare type CurveInterface = {
5
+ curveType?: CurveType;
6
+ points: Vector3[];
7
+ color?: Color;
8
+ pointNum?: number;
9
+ };
10
+ declare class CurveManage {
11
+ points: Vector3[];
12
+ line: Line | null;
13
+ constructor();
14
+ /**
15
+ * create curve
16
+ * @param params
17
+ */
18
+ createCurve(params: CurveInterface): void;
19
+ /**
20
+ * catmullRomCurve3
21
+ * @param points
22
+ * @returns
23
+ */
24
+ private createRoundDotsByCatmullRomCurve3;
25
+ /**
26
+ * generate line object3d
27
+ * @param curve
28
+ * @param pointNum
29
+ * @returns
30
+ */
31
+ private createCurveObject3D;
32
+ }
33
+ export default CurveManage;
@@ -0,0 +1,71 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
+ 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); } }
4
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ 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; }
6
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
+ import { BufferGeometry, CatmullRomCurve3, Color, Line, LineBasicMaterial } from '@anov/3d-core';
9
+ var CurveManage = /*#__PURE__*/function () {
10
+ function CurveManage() {
11
+ _classCallCheck(this, CurveManage);
12
+ _defineProperty(this, "points", []);
13
+ _defineProperty(this, "line", null);
14
+ }
15
+
16
+ /**
17
+ * create curve
18
+ * @param params
19
+ */
20
+ _createClass(CurveManage, [{
21
+ key: "createCurve",
22
+ value: function createCurve(params) {
23
+ var _params$curveType = params.curveType,
24
+ curveType = _params$curveType === void 0 ? 'CatmullRomCurve3' : _params$curveType,
25
+ points = params.points,
26
+ _params$color = params.color,
27
+ color = _params$color === void 0 ? new Color(0xFF0000) : _params$color,
28
+ _params$pointNum = params.pointNum,
29
+ pointNum = _params$pointNum === void 0 ? 50 : _params$pointNum;
30
+
31
+ // @ts-ignore
32
+ var curve = this["createRoundDotsBy".concat(curveType)](points);
33
+ this.line = this.createCurveObject3D(curve, pointNum, color);
34
+ }
35
+
36
+ /**
37
+ * catmullRomCurve3
38
+ * @param points
39
+ * @returns
40
+ */
41
+ }, {
42
+ key: "createRoundDotsByCatmullRomCurve3",
43
+ value: function createRoundDotsByCatmullRomCurve3(points) {
44
+ var curve = new CatmullRomCurve3(points);
45
+ return curve;
46
+ }
47
+
48
+ /**
49
+ * generate line object3d
50
+ * @param curve
51
+ * @param pointNum
52
+ * @returns
53
+ */
54
+ }, {
55
+ key: "createCurveObject3D",
56
+ value: function createCurveObject3D(curve) {
57
+ var pointNum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 50;
58
+ var color = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Color(0xFF0000);
59
+ var points = curve.getPoints(pointNum);
60
+ this.points = points;
61
+ var geometry = new BufferGeometry().setFromPoints(points);
62
+ var material = new LineBasicMaterial({
63
+ color: color
64
+ });
65
+ return new Line(geometry, material);
66
+ }
67
+ }]);
68
+ return CurveManage;
69
+ }();
70
+ export default CurveManage;
71
+ //# sourceMappingURL=curve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BufferGeometry","CatmullRomCurve3","Color","Line","LineBasicMaterial","CurveManage","params","curveType","points","color","pointNum","curve","line","createCurveObject3D","getPoints","geometry","setFromPoints","material"],"sources":["../../src/line/curve.ts"],"sourcesContent":["import type { Curve, Vector3 } from '@anov/3d-core'\nimport { BufferGeometry, CatmullRomCurve3, Color, Line, LineBasicMaterial } from '@anov/3d-core'\n\nexport type CurveType = 'CatmullRomCurve3' | 'CubicBezierCurve' | 'CubicBezierCurve3'\n\nexport type CurveInterface = {\n curveType?: CurveType\n points: Vector3[]\n color?: Color\n pointNum?: number\n}\n\nclass CurveManage {\n points: Vector3[] = []\n\n line: Line | null = null\n\n constructor() { }\n\n /**\n * create curve\n * @param params\n */\n createCurve(params: CurveInterface) {\n const { curveType = 'CatmullRomCurve3', points, color = new Color(0xFF0000), pointNum = 50 } = params\n\n // @ts-ignore\n const curve = this[`createRoundDotsBy${curveType}`](points) as Curve<Vector3>\n\n this.line = this.createCurveObject3D(curve, pointNum, color)\n }\n\n /**\n * catmullRomCurve3\n * @param points\n * @returns\n */\n private createRoundDotsByCatmullRomCurve3(points: Vector3[]) {\n const curve = new CatmullRomCurve3(points)\n\n return curve\n }\n\n /**\n * generate line object3d\n * @param curve\n * @param pointNum\n * @returns\n */\n private createCurveObject3D(curve: Curve<Vector3>, pointNum = 50, color: Color = new Color(0xFF0000)) {\n const points = curve.getPoints(pointNum)\n\n this.points = points\n\n const geometry = new BufferGeometry().setFromPoints(points)\n const material = new LineBasicMaterial({\n color,\n })\n\n return new Line(geometry, material)\n }\n}\n\nexport default CurveManage"],"mappings":";;;;;;;AACA,SAASA,cAAc,EAAEC,gBAAgB,EAAEC,KAAK,EAAEC,IAAI,EAAEC,iBAAiB,QAAQ,eAAe;AAAA,IAW1FC,WAAW;EAKf,uBAAc;IAAA;IAAA,gCAJM,EAAE;IAAA,8BAEF,IAAI;EAER;;EAEhB;AACF;AACA;AACA;EAHE;IAAA;IAAA,OAIA,qBAAYC,MAAsB,EAAE;MAClC,wBAA+FA,MAAM,CAA7FC,SAAS;QAATA,SAAS,kCAAG,kBAAkB;QAAEC,MAAM,GAAiDF,MAAM,CAA7DE,MAAM;QAAA,gBAAiDF,MAAM,CAArDG,KAAK;QAALA,KAAK,8BAAG,IAAIP,KAAK,CAAC,QAAQ,CAAC;QAAA,mBAAoBI,MAAM,CAAxBI,QAAQ;QAARA,QAAQ,iCAAG,EAAE;;MAE1F;MACA,IAAMC,KAAK,GAAG,IAAI,4BAAqBJ,SAAS,EAAG,CAACC,MAAM,CAAmB;MAE7E,IAAI,CAACI,IAAI,GAAG,IAAI,CAACC,mBAAmB,CAACF,KAAK,EAAED,QAAQ,EAAED,KAAK,CAAC;IAC9D;;IAEA;AACF;AACA;AACA;AACA;EAJE;IAAA;IAAA,OAKA,2CAA0CD,MAAiB,EAAE;MAC3D,IAAMG,KAAK,GAAG,IAAIV,gBAAgB,CAACO,MAAM,CAAC;MAE1C,OAAOG,KAAK;IACd;;IAEA;AACF;AACA;AACA;AACA;AACA;EALE;IAAA;IAAA,OAMA,6BAA4BA,KAAqB,EAAqD;MAAA,IAAnDD,QAAQ,uEAAG,EAAE;MAAA,IAAED,KAAY,uEAAG,IAAIP,KAAK,CAAC,QAAQ,CAAC;MAClG,IAAMM,MAAM,GAAGG,KAAK,CAACG,SAAS,CAACJ,QAAQ,CAAC;MAExC,IAAI,CAACF,MAAM,GAAGA,MAAM;MAEpB,IAAMO,QAAQ,GAAG,IAAIf,cAAc,EAAE,CAACgB,aAAa,CAACR,MAAM,CAAC;MAC3D,IAAMS,QAAQ,GAAG,IAAIb,iBAAiB,CAAC;QACrCK,KAAK,EAALA;MACF,CAAC,CAAC;MAEF,OAAO,IAAIN,IAAI,CAACY,QAAQ,EAAEE,QAAQ,CAAC;IACrC;EAAC;EAAA;AAAA;AAGH,eAAeZ,WAAW"}
File without changes
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/line/index.ts"],"sourcesContent":[""],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import { BufferGeometry, ShaderMaterial, Vector3 } from '@anov/3d-core';
2
+ export interface TextureParamsType {
3
+ texture?: string;
4
+ repeatX?: number;
5
+ repeatY?: number;
6
+ wrapS?: number;
7
+ wrapT?: number;
8
+ }
9
+ declare type RoundLineGeometryOption = {
10
+ radius: number;
11
+ close: boolean;
12
+ pointNum?: number;
13
+ height?: number;
14
+ };
15
+ declare class RoundLineGeometry extends BufferGeometry {
16
+ constructor(points: Vector3[], option: RoundLineGeometryOption);
17
+ }
18
+ declare const createRoundLineWallMesh: (points: Vector3[], option: RoundLineGeometryOption, material?: ShaderMaterial) => any;
19
+ export { RoundLineGeometry, createRoundLineWallMesh, };
@@ -0,0 +1,212 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
7
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
+ 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); } }
9
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
11
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
12
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
+ 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); }
14
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
15
+ 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); }; }
16
+ 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); }
17
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
18
+ 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; } }
19
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
20
+ /* eslint-disable no-void */
21
+ import { BoxGeometry, BufferGeometry, Color, CurvePath, ExtrudeGeometry, Group, LineCurve3, Mesh, MeshBasicMaterial, QuadraticBezierCurve3, Quaternion, ShaderMaterial, Shape, Vector3 } from '@anov/3d-core';
22
+ /**
23
+ * TODO: 参数优化
24
+ * create box geometry by two points
25
+ * just provide data not create mesh
26
+ * @param a
27
+ * @param b
28
+ * @param height
29
+ * @param depth
30
+ */
31
+ var createBoxGeometryByPoints = function createBoxGeometryByPoints(a, b) {
32
+ var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 30;
33
+ var depth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 10;
34
+ var material = arguments.length > 4 ? arguments[4] : undefined;
35
+ var width = a.distanceTo(b);
36
+ var box = new BoxGeometry(width, height, depth);
37
+ var currentMaterial = new MeshBasicMaterial({
38
+ color: new Color('#fff')
39
+ });
40
+ if (material) currentMaterial = material;
41
+ var mesh = new Mesh(box, currentMaterial);
42
+ var midpoint = new Vector3().addVectors(a, b).multiplyScalar(0.5);
43
+ mesh.position.x = midpoint.x;
44
+ mesh.position.y = midpoint.y + height / 2;
45
+ mesh.position.z = midpoint.z;
46
+ var direction = new Vector3();
47
+ direction.subVectors(a, b);
48
+ direction.normalize();
49
+ var axis = new Vector3(0, 1, 0); // axis
50
+ var angle = new Vector3(1, 0, 0).angleTo(direction);
51
+ var quaternion = new Quaternion().setFromAxisAngle(axis, angle);
52
+ var newDirection = new Vector3(1, 0, 0).applyQuaternion(quaternion);
53
+ if (!newDirection.angleTo(direction)) mesh.rotateOnAxis(axis, angle);else mesh.rotateOnAxis(axis, -angle);
54
+ return mesh;
55
+ };
56
+
57
+ /**
58
+ * rectangle shape
59
+ * @param w
60
+ * @param h
61
+ * @returns
62
+ */
63
+ var rectangle = function rectangle() {
64
+ var w = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.1;
65
+ var h = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 50;
66
+ var shape = new Shape();
67
+ shape.moveTo(0, 0);
68
+ shape.lineTo(0, w);
69
+ shape.lineTo(h, w);
70
+ shape.lineTo(h, 0);
71
+ shape.lineTo(0, 0);
72
+ return shape;
73
+ };
74
+ var defMaterial = new ShaderMaterial({
75
+ uniforms: {
76
+ u_color: {
77
+ value: new Color('#fab73f')
78
+ },
79
+ u_height: {
80
+ value: 100
81
+ },
82
+ u_opacity: {
83
+ value: 1.0
84
+ }
85
+ },
86
+ vertexShader: "\n uniform float u_height;\n uniform float u_speed;\n varying float v_opacity;\n\n void main() {\n v_opacity = mix(1.0, 0.0, position.y / u_height);\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",
87
+ fragmentShader: "\n uniform vec3 u_color;\n uniform float u_opacity;\n varying float v_opacity;\n\n void main() {\n gl_FragColor = vec4(u_color, 1.0);\n }\n ",
88
+ transparent: true,
89
+ side: 2,
90
+ depthTest: false
91
+ });
92
+
93
+ // const material = new MeshBasicMaterial({ color: new Color('#fab73f'), side: DoubleSide })
94
+
95
+ /**
96
+ * create round curve
97
+ * @param points
98
+ * @param radius
99
+ * @param close
100
+ * @returns
101
+ */
102
+ var createCurve = function createCurve(points) {
103
+ var radius = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 20;
104
+ var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
105
+ var close = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
106
+ var material = arguments.length > 4 ? arguments[4] : undefined;
107
+ if (!material) material = defMaterial;
108
+ var curve = new CurvePath();
109
+ var shape = rectangle(0.1, height);
110
+ if (points.length < 2) throw new Error('At least two points are required to create a curve');
111
+ if (points.length === 2) {
112
+ var line = new LineCurve3(points[0], points[1]);
113
+ curve.curves.push(line);
114
+ return curve;
115
+ }
116
+ var lines = [];
117
+ for (var i = 0; i < points.length - 1; i++) {
118
+ if (i === 0) {
119
+ var dir = points[0].clone().sub(points[1]).normalize();
120
+ var realEndPoints = points[1].clone().add(dir.multiplyScalar(radius));
121
+ var firstPoint = points[0];
122
+ if (close) firstPoint = points[0].clone().add(points[1].clone().sub(points[0]).normalize().multiplyScalar(radius));
123
+ lines.push(new LineCurve3(firstPoint, realEndPoints));
124
+ } else if (i === points.length - 1) {
125
+ //
126
+ } else {
127
+ var dir1 = points[i - 1].clone().sub(points[i]).normalize();
128
+ var dir2 = points[i + 1].clone().sub(points[i]).normalize();
129
+ var dir3 = points[i].clone().sub(points[i + 1]).normalize();
130
+ var nextDir1 = dir2.clone();
131
+ var nextDir2 = points[i].clone().sub(points[i + 1]).normalize();
132
+ var p1 = points[i].clone().add(dir1.multiplyScalar(radius));
133
+ var p2 = points[i].clone();
134
+ var p3 = points[i].clone().add(dir2.multiplyScalar(radius));
135
+ var beziercurve = new QuadraticBezierCurve3(p1, p2, p3);
136
+ var realLastPoints = points[i].clone().add(nextDir1.multiplyScalar(radius));
137
+ var _realEndPoints = points[i + 1].clone().add(nextDir2.multiplyScalar(radius));
138
+ lines.push(beziercurve);
139
+ lines.push(new LineCurve3(realLastPoints, i + 1 === points.length - 1 ? close ? points[i + 1].clone().add(dir3.multiplyScalar(radius)) : points[i + 1] : _realEndPoints));
140
+ }
141
+ }
142
+ if (close) {
143
+ // first point
144
+ var _dir = points[1].clone().sub(points[0]).normalize();
145
+ var _dir2 = points[points.length - 1].clone().sub(points[0]).normalize();
146
+ var _p = points[0].clone().add(_dir.multiplyScalar(radius));
147
+ var _p2 = points[0];
148
+ var _p3 = points[0].clone().add(_dir2.multiplyScalar(radius));
149
+ var _beziercurve = new QuadraticBezierCurve3(_p3, _p2, _p);
150
+
151
+ // last point
152
+ var _dir3 = points[0].clone().sub(points[points.length - 1]).normalize();
153
+ var dir4 = points[points.length - 2].clone().sub(points[points.length - 1]).normalize();
154
+ var p4 = points[points.length - 1].clone().add(_dir3.multiplyScalar(radius));
155
+ var p5 = points[points.length - 1];
156
+ var p6 = points[points.length - 1].clone().add(dir4.multiplyScalar(radius));
157
+ var beziercurve2 = new QuadraticBezierCurve3(p6, p5, p4);
158
+
159
+ // last line
160
+ var laseLine = new LineCurve3(p4, _p3);
161
+ lines.push(beziercurve2);
162
+ lines.push(laseLine);
163
+ lines.push(_beziercurve);
164
+ }
165
+ var group = new Group();
166
+ lines.forEach(function (line) {
167
+ curve.curves.push(line);
168
+ if (line.type === 'QuadraticBezierCurve3') {
169
+ var extrudeSettings = {
170
+ steps: 100,
171
+ bevelEnabled: false,
172
+ extrudePath: line
173
+ };
174
+ var geometry = new ExtrudeGeometry(shape, extrudeSettings);
175
+ var arcWall = new Mesh(geometry, material);
176
+ arcWall.translateY(arcWall.position.y + height);
177
+ if (radius) group.add(arcWall);
178
+ } else {
179
+ var mesh = createBoxGeometryByPoints(line.v1, line.v2, height, 0.1, material);
180
+ group.add(mesh);
181
+ }
182
+ });
183
+ return [curve, group];
184
+ };
185
+ var RoundLineGeometry = /*#__PURE__*/function (_BufferGeometry) {
186
+ _inherits(RoundLineGeometry, _BufferGeometry);
187
+ var _super = _createSuper(RoundLineGeometry);
188
+ function RoundLineGeometry(points, option) {
189
+ var _option$radius;
190
+ var _this;
191
+ _classCallCheck(this, RoundLineGeometry);
192
+ _this = _super.call(this);
193
+ var _createCurve = createCurve(points, (_option$radius = option.radius) !== null && _option$radius !== void 0 ? _option$radius : 20, void 0, option.close || false),
194
+ _createCurve2 = _slicedToArray(_createCurve, 1),
195
+ curve = _createCurve2[0];
196
+ var currentPoints = curve.getPoints(option.pointNum || 1000);
197
+ var geometry = new BufferGeometry();
198
+ geometry.setFromPoints(currentPoints);
199
+ return _possibleConstructorReturn(_this, geometry);
200
+ }
201
+ return _createClass(RoundLineGeometry);
202
+ }(BufferGeometry);
203
+ var createRoundLineWallMesh = function createRoundLineWallMesh(points, option, material) {
204
+ var _option$radius2, _option$height;
205
+ var _createCurve3 = createCurve(points, (_option$radius2 = option.radius) !== null && _option$radius2 !== void 0 ? _option$radius2 : 20, (_option$height = option.height) !== null && _option$height !== void 0 ? _option$height : 50, option.close || false, material),
206
+ _createCurve4 = _slicedToArray(_createCurve3, 2),
207
+ _ = _createCurve4[0],
208
+ group = _createCurve4[1];
209
+ return group;
210
+ };
211
+ export { RoundLineGeometry, createRoundLineWallMesh };
212
+ //# sourceMappingURL=round-curve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BoxGeometry","BufferGeometry","Color","CurvePath","ExtrudeGeometry","Group","LineCurve3","Mesh","MeshBasicMaterial","QuadraticBezierCurve3","Quaternion","ShaderMaterial","Shape","Vector3","createBoxGeometryByPoints","a","b","height","depth","material","width","distanceTo","box","currentMaterial","color","mesh","midpoint","addVectors","multiplyScalar","position","x","y","z","direction","subVectors","normalize","axis","angle","angleTo","quaternion","setFromAxisAngle","newDirection","applyQuaternion","rotateOnAxis","rectangle","w","h","shape","moveTo","lineTo","defMaterial","uniforms","u_color","value","u_height","u_opacity","vertexShader","fragmentShader","transparent","side","depthTest","createCurve","points","radius","close","curve","length","Error","line","curves","push","lines","i","dir","clone","sub","realEndPoints","add","firstPoint","dir1","dir2","dir3","nextDir1","nextDir2","p1","p2","p3","beziercurve","realLastPoints","dir4","p4","p5","p6","beziercurve2","laseLine","group","forEach","type","extrudeSettings","steps","bevelEnabled","extrudePath","geometry","arcWall","translateY","v1","v2","RoundLineGeometry","option","currentPoints","getPoints","pointNum","setFromPoints","createRoundLineWallMesh","_"],"sources":["../../src/line/round-curve.ts"],"sourcesContent":["/* eslint-disable no-void */\nimport { BoxGeometry, BufferGeometry, Color, CurvePath, ExtrudeGeometry, Group, LineCurve3, Mesh, MeshBasicMaterial, QuadraticBezierCurve3, Quaternion, ShaderMaterial, Shape, Vector3 } from '@anov/3d-core'\n\nexport interface TextureParamsType {\n texture?: string\n repeatX?: number\n repeatY?: number\n wrapS?: number\n wrapT?: number\n}\n\n/**\n * TODO: 参数优化\n * create box geometry by two points\n * just provide data not create mesh\n * @param a\n * @param b\n * @param height\n * @param depth\n */\nconst createBoxGeometryByPoints = (a: Vector3, b: Vector3, height = 30, depth = 10, material?: ShaderMaterial) => {\n const width = a.distanceTo(b)\n const box = new BoxGeometry(width, height, depth)\n\n let currentMaterial: MeshBasicMaterial | ShaderMaterial = new MeshBasicMaterial({ color: new Color('#fff') })\n if (material)\n currentMaterial = material\n\n const mesh = new Mesh(box, currentMaterial)\n const midpoint = new Vector3().addVectors(a, b).multiplyScalar(0.5)\n\n mesh.position.x = midpoint.x\n mesh.position.y = midpoint.y + height / 2\n mesh.position.z = midpoint.z\n\n const direction = new Vector3()\n direction.subVectors(a, b)\n direction.normalize()\n\n const axis = new Vector3(0, 1, 0) // axis\n const angle = new Vector3(1, 0, 0).angleTo(direction)\n\n const quaternion = new Quaternion().setFromAxisAngle(axis, angle)\n const newDirection = new Vector3(1, 0, 0).applyQuaternion(quaternion)\n\n if (!newDirection.angleTo(direction))\n mesh.rotateOnAxis(axis, angle)\n else\n mesh.rotateOnAxis(axis, -angle)\n\n return mesh\n}\n\n/**\n * rectangle shape\n * @param w\n * @param h\n * @returns\n */\nconst rectangle = (w = 0.1, h = 50) => {\n const shape = new Shape()\n\n shape.moveTo(0, 0)\n shape.lineTo(0, w)\n shape.lineTo(h, w)\n shape.lineTo(h, 0)\n shape.lineTo(0, 0)\n\n return shape\n}\n\nconst defMaterial = new ShaderMaterial({\n uniforms: {\n u_color: { value: new Color('#fab73f') },\n u_height: { value: 100 },\n u_opacity: { value: 1.0 },\n },\n\n vertexShader: `\n uniform float u_height;\n uniform float u_speed;\n varying float v_opacity;\n\n void main() {\n v_opacity = mix(1.0, 0.0, position.y / u_height);\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }`,\n fragmentShader: `\n uniform vec3 u_color;\n uniform float u_opacity;\n varying float v_opacity;\n\n void main() {\n gl_FragColor = vec4(u_color, 1.0);\n }\n `,\n transparent: true,\n side: 2,\n depthTest: false,\n})\n\n// const material = new MeshBasicMaterial({ color: new Color('#fab73f'), side: DoubleSide })\n\n/**\n * create round curve\n * @param points\n * @param radius\n * @param close\n * @returns\n */\nconst createCurve = (points: Vector3[], radius = 20, height = 50, close = false, material?: ShaderMaterial) => {\n if (!material)\n material = defMaterial\n\n const curve = new CurvePath()\n const shape = rectangle(0.1, height)\n\n if (points.length < 2)\n throw new Error('At least two points are required to create a curve')\n\n if (points.length === 2) {\n const line = new LineCurve3(points[0], points[1])\n curve.curves.push(line)\n\n return curve\n }\n\n const lines = []\n\n for (let i = 0; i < points.length - 1; i++) {\n if (i === 0) {\n const dir = points[0].clone().sub(points[1]).normalize()\n const realEndPoints = points[1].clone().add(dir.multiplyScalar(radius))\n\n let firstPoint = points[0]\n\n if (close)\n firstPoint = points[0].clone().add(points[1].clone().sub(points[0]).normalize().multiplyScalar(radius))\n\n lines.push(new LineCurve3(firstPoint, realEndPoints))\n }\n else if (i === points.length - 1) {\n //\n }\n else {\n const dir1 = points[i - 1].clone().sub(points[i]).normalize()\n const dir2 = points[i + 1].clone().sub(points[i]).normalize()\n const dir3 = points[i].clone().sub(points[i + 1]).normalize()\n\n const nextDir1 = dir2.clone()\n const nextDir2 = points[i].clone().sub(points[i + 1]).normalize()\n\n const p1 = points[i].clone().add(dir1.multiplyScalar(radius))\n const p2 = points[i].clone()\n const p3 = points[i].clone().add(dir2.multiplyScalar(radius))\n\n const beziercurve = new QuadraticBezierCurve3(p1, p2, p3)\n\n const realLastPoints = points[i].clone().add(nextDir1.multiplyScalar(radius))\n const realEndPoints = points[i + 1].clone().add(nextDir2.multiplyScalar(radius))\n\n lines.push(beziercurve)\n lines.push(new LineCurve3(realLastPoints, i + 1 === points.length - 1\n ? close\n ? points[i + 1].clone().add(dir3.multiplyScalar(radius))\n : points[i + 1]\n : realEndPoints))\n }\n }\n\n if (close) {\n // first point\n const dir1 = points[1].clone().sub(points[0]).normalize()\n const dir2 = points[points.length - 1].clone().sub(points[0]).normalize()\n\n const p1 = points[0].clone().add(dir1.multiplyScalar(radius))\n const p2 = points[0]\n const p3 = points[0].clone().add(dir2.multiplyScalar(radius))\n\n const beziercurve = new QuadraticBezierCurve3(p3, p2, p1)\n\n // last point\n const dir3 = points[0].clone().sub(points[points.length - 1]).normalize()\n const dir4 = points[points.length - 2].clone().sub(points[points.length - 1]).normalize()\n\n const p4 = points[points.length - 1].clone().add(dir3.multiplyScalar(radius))\n const p5 = points[points.length - 1]\n const p6 = points[points.length - 1].clone().add(dir4.multiplyScalar(radius))\n\n const beziercurve2 = new QuadraticBezierCurve3(p6, p5, p4)\n\n // last line\n const laseLine = new LineCurve3(p4, p3)\n\n lines.push(beziercurve2)\n lines.push(laseLine)\n lines.push(beziercurve)\n }\n\n const group = new Group()\n\n lines.forEach((line) => {\n curve.curves.push(line)\n\n if (line.type === 'QuadraticBezierCurve3') {\n const extrudeSettings = {\n steps: 100,\n bevelEnabled: false,\n extrudePath: line,\n }\n\n const geometry = new ExtrudeGeometry(shape, extrudeSettings)\n const arcWall = new Mesh(geometry, material)\n\n arcWall.translateY(arcWall.position.y + height)\n\n if (radius)\n group.add(arcWall)\n }\n else {\n const mesh = createBoxGeometryByPoints(line.v1, line.v2, height, 0.1, material)\n group.add(mesh)\n }\n })\n\n return [curve, group] as any\n}\n\ntype RoundLineGeometryOption = {\n radius: number\n close: boolean\n pointNum?: number\n height?: number\n}\n\nclass RoundLineGeometry extends BufferGeometry {\n constructor(points: Vector3[], option: RoundLineGeometryOption) {\n super()\n\n const [curve] = createCurve(points, option.radius ?? 20, void 0, option.close || false)\n const currentPoints = curve.getPoints(option.pointNum || 1000)\n\n const geometry = new BufferGeometry()\n geometry.setFromPoints(currentPoints)\n\n return geometry\n }\n}\n\nconst createRoundLineWallMesh = (points: Vector3[], option: RoundLineGeometryOption, material?: ShaderMaterial) => {\n const [_, group] = createCurve(points, option.radius ?? 20, option.height ?? 50, option.close || false, material)\n\n return group\n}\n\nexport {\n RoundLineGeometry,\n createRoundLineWallMesh,\n}"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA,SAASA,WAAW,EAAEC,cAAc,EAAEC,KAAK,EAAEC,SAAS,EAAEC,eAAe,EAAEC,KAAK,EAAEC,UAAU,EAAEC,IAAI,EAAEC,iBAAiB,EAAEC,qBAAqB,EAAEC,UAAU,EAAEC,cAAc,EAAEC,KAAK,EAAEC,OAAO,QAAQ,eAAe;AAU7M;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,yBAAyB,GAAG,SAA5BA,yBAAyB,CAAIC,CAAU,EAAEC,CAAU,EAAyD;EAAA,IAAvDC,MAAM,uEAAG,EAAE;EAAA,IAAEC,KAAK,uEAAG,EAAE;EAAA,IAAEC,QAAyB;EAC3G,IAAMC,KAAK,GAAGL,CAAC,CAACM,UAAU,CAACL,CAAC,CAAC;EAC7B,IAAMM,GAAG,GAAG,IAAItB,WAAW,CAACoB,KAAK,EAAEH,MAAM,EAAEC,KAAK,CAAC;EAEjD,IAAIK,eAAmD,GAAG,IAAIf,iBAAiB,CAAC;IAAEgB,KAAK,EAAE,IAAItB,KAAK,CAAC,MAAM;EAAE,CAAC,CAAC;EAC7G,IAAIiB,QAAQ,EACVI,eAAe,GAAGJ,QAAQ;EAE5B,IAAMM,IAAI,GAAG,IAAIlB,IAAI,CAACe,GAAG,EAAEC,eAAe,CAAC;EAC3C,IAAMG,QAAQ,GAAG,IAAIb,OAAO,EAAE,CAACc,UAAU,CAACZ,CAAC,EAAEC,CAAC,CAAC,CAACY,cAAc,CAAC,GAAG,CAAC;EAEnEH,IAAI,CAACI,QAAQ,CAACC,CAAC,GAAGJ,QAAQ,CAACI,CAAC;EAC5BL,IAAI,CAACI,QAAQ,CAACE,CAAC,GAAGL,QAAQ,CAACK,CAAC,GAAGd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,KAAK,EAAE7C,QAAQ,CAAC;IAAA;IAA1G+F,CAAC;IAAEnB,KAAK;EAEf,OAAOA,KAAK;AACd,CAAC;AAED,SACEY,iBAAiB,EACjBM,uBAAuB"}
@@ -0,0 +1,9 @@
1
+ import { Color, MeshStandardMaterial } from '@anov/3d-core';
2
+ declare type FinirMaterialOption = {
3
+ rimColor?: Color;
4
+ rimPower?: number;
5
+ };
6
+ declare class FinirMaterial extends MeshStandardMaterial {
7
+ constructor(options?: FinirMaterialOption);
8
+ }
9
+ export default FinirMaterial;
@@ -0,0 +1,47 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ 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); } }
3
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
5
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7
+ 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); }
8
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
9
+ 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); }; }
10
+ 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); }
11
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
12
+ 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; } }
13
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
14
+ import { Color, MeshStandardMaterial } from '@anov/3d-core';
15
+ var FinirMaterial = /*#__PURE__*/function (_MeshStandardMaterial) {
16
+ _inherits(FinirMaterial, _MeshStandardMaterial);
17
+ var _super = _createSuper(FinirMaterial);
18
+ function FinirMaterial(options) {
19
+ var _this;
20
+ _classCallCheck(this, FinirMaterial);
21
+ _this = _super.call(this);
22
+ var finirMaterial = new MeshStandardMaterial({
23
+ opacity: 0.0,
24
+ transparent: true,
25
+ depthWrite: false
26
+ });
27
+ var _ref = options || {},
28
+ _ref$rimColor = _ref.rimColor,
29
+ rimColor = _ref$rimColor === void 0 ? new Color(0x00FFFF) : _ref$rimColor,
30
+ _ref$rimPower = _ref.rimPower,
31
+ rimPower = _ref$rimPower === void 0 ? 0.9 : _ref$rimPower;
32
+ finirMaterial.onBeforeCompile = function (shader) {
33
+ shader.uniforms.rimColor = {
34
+ value: rimColor
35
+ };
36
+ shader.uniforms.rimPower = {
37
+ value: rimPower
38
+ };
39
+ shader.fragmentShader = shader.fragmentShader.replace('void main() {', ['uniform vec3 rimColor;', 'uniform float rimPower;', 'void main() {'].join('\n'));
40
+ shader.fragmentShader = shader.fragmentShader.replace('#include <dithering_fragment>', "#include <dithering_fragment>\n float dotNV = 1.0-saturate( dot( normal, geometry.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.;");
41
+ };
42
+ return _possibleConstructorReturn(_this, finirMaterial);
43
+ }
44
+ return _createClass(FinirMaterial);
45
+ }(MeshStandardMaterial);
46
+ export default FinirMaterial;
47
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Color","MeshStandardMaterial","FinirMaterial","options","finirMaterial","opacity","transparent","depthWrite","rimColor","rimPower","onBeforeCompile","shader","uniforms","value","fragmentShader","replace","join"],"sources":["../../../src/material/finirMaterialMaterial/index.ts"],"sourcesContent":["import { Color, MeshStandardMaterial } from '@anov/3d-core'\n\ntype FinirMaterialOption = {\n rimColor?: Color\n rimPower?: number\n}\n\nclass FinirMaterial extends MeshStandardMaterial {\n constructor(options?: FinirMaterialOption) {\n super()\n\n const finirMaterial = new MeshStandardMaterial({\n opacity: 0.0,\n transparent: true,\n depthWrite: false,\n })\n\n const { rimColor = new Color(0x00FFFF), rimPower = 0.9 } = options || {}\n\n finirMaterial.onBeforeCompile = (shader) => {\n shader.uniforms.rimColor = { value: rimColor }\n shader.uniforms.rimPower = { value: rimPower }\n shader.fragmentShader = shader.fragmentShader.replace(\n 'void main() {',\n [\n 'uniform vec3 rimColor;',\n 'uniform float rimPower;',\n 'void main() {',\n ].join('\\n'),\n )\n shader.fragmentShader = shader.fragmentShader.replace(\n '#include <dithering_fragment>',\n `#include <dithering_fragment>\n float dotNV = 1.0-saturate( dot( normal, geometry.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 return finirMaterial\n }\n}\n\nexport default FinirMaterial"],"mappings":";;;;;;;;;;;;;AAAA,SAASA,KAAK,EAAEC,oBAAoB,QAAQ,eAAe;AAAA,IAOrDC,aAAa;EAAA;EAAA;EACjB,uBAAYC,OAA6B,EAAE;IAAA;IAAA;IACzC;IAEA,IAAMC,aAAa,GAAG,IAAIH,oBAAoB,CAAC;MAC7CI,OAAO,EAAE,GAAG;MACZC,WAAW,EAAE,IAAI;MACjBC,UAAU,EAAE;IACd,CAAC,CAAC;IAEF,WAA2DJ,OAAO,IAAI,CAAC,CAAC;MAAA,qBAAhEK,QAAQ;MAARA,QAAQ,8BAAG,IAAIR,KAAK,CAAC,QAAQ,CAAC;MAAA,qBAAES,QAAQ;MAARA,QAAQ,8BAAG,GAAG;IAEtDL,aAAa,CAACM,eAAe,GAAG,UAACC,MAAM,EAAK;MAC1CA,MAAM,CAACC,QAAQ,CAACJ,QAAQ,GAAG;QAAEK,KAAK,EAAEL;MAAS,CAAC;MAC9CG,MAAM,CAACC,QAAQ,CAACH,QAAQ,GAAG;QAAEI,KAAK,EAAEJ;MAAS,CAAC;MAC9CE,MAAM,CAACG,cAAc,GAAGH,MAAM,CAACG,cAAc,CAACC,OAAO,CACnD,eAAe,EACf,CACE,wBAAwB,EACxB,yBAAyB,EACzB,eAAe,CAChB,CAACC,IAAI,CAAC,IAAI,CAAC,CACb;MACDL,MAAM,CAACG,cAAc,GAAGH,MAAM,CAACG,cAAc,CAACC,OAAO,CACnD,+BAA+B,0RAMhC;IACH,CAAC;IAED,yCAAOX,aAAa;EACtB;EAAC;AAAA,EAlCyBH,oBAAoB;AAqChD,eAAeC,aAAa"}
@@ -99,4 +99,5 @@ var GridMaterial = /*#__PURE__*/function (_THREE$Material) {
99
99
  }
100
100
  return _createClass(GridMaterial);
101
101
  }(THREE.Material);
102
- export default GridMaterial;
102
+ export default GridMaterial;
103
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["THREE","vertexShader","fragmentShader","GridMaterial","options","side","transparent","theme","majorLineWidth","minorLineWidth","axisLineWidth","name","majorGridDiv","gridDiv","majorLineColor","minorLineColor","xAxisColor","zAxisColor","_majorLineWidth","_minorLineWidth","_axisLineWidth","_majorGridDiv","_gridDiv","_majorLineColor","Color","_minorLineColor","_xAxisColor","_zAxisColor","ShaderMaterial","DoubleSide","glslVersion","GLSL3","uniforms","u_baseAlpha","value","u_majorLineWidth","u_minorLineWidth","u_axisLineWidth","u_majorGridDiv","u_gridDiv","u_majorLineColor","u_minorLineColor","u_baseColor","u_xAxisColor","u_zAxisColor","Material"],"sources":["../../../src/material/pristineGridMaterial/index.ts"],"sourcesContent":["import * as THREE from '@anov/3d-core'\nimport vertexShader from './shader/vertex'\nimport fragmentShader from './shader/fragment'\n\ntype GridMaterialParameters = {\n name?: string\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\nclass GridMaterial extends THREE.Material {\n constructor(options?: GridMaterialParameters) {\n super()\n\n const { side, transparent, theme, majorLineWidth, minorLineWidth, axisLineWidth, name, majorGridDiv, gridDiv, majorLineColor, minorLineColor, xAxisColor, zAxisColor } = options || {}\n const _majorLineWidth = majorLineWidth ?? 0.04\n const _minorLineWidth = minorLineWidth ?? 0.01\n const _axisLineWidth = axisLineWidth ?? 0.15\n const _majorGridDiv = majorGridDiv ?? 10.0\n const _gridDiv = gridDiv ?? 4.0\n const _majorLineColor = majorLineColor ?? new THREE.Color()\n const _minorLineColor = minorLineColor ?? new THREE.Color()\n const _xAxisColor = xAxisColor ?? new THREE.Color(1, 0.3, 0.3)\n const _zAxisColor = zAxisColor ?? new THREE.Color(0.3, 0.3, 1)\n\n return new THREE.ShaderMaterial({\n side: side ?? THREE.DoubleSide,\n glslVersion: THREE.GLSL3,\n transparent: transparent ?? true,\n name: name ?? 'GridMaterial',\n vertexShader,\n fragmentShader,\n uniforms: {\n u_baseAlpha: { value: 0.5 },\n u_majorLineWidth: { value: _majorLineWidth }, // Example default value , 大网格线宽\n u_minorLineWidth: { value: _minorLineWidth }, // Example default value ,小网格线宽\n u_axisLineWidth: { value: _axisLineWidth }, // Example default value ,坐标轴线宽\n u_majorGridDiv: { value: _majorGridDiv }, // Example default value, 大网格间隔\n u_gridDiv: { value: _gridDiv }, // Example default value, 小网格间隔\n u_majorLineColor: { value: _majorLineColor }, // White color\n u_minorLineColor: { value: _minorLineColor }, // White color\n u_baseColor: { value: theme ?? new THREE.Color('#707070') }, // Black color\n u_xAxisColor: { value: _xAxisColor }, // Red color\n u_zAxisColor: { value: _zAxisColor }, // Blue color\n },\n })\n }\n}\n\nexport default GridMaterial\n"],"mappings":";;;;;;;;;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,eAAe;AACtC,OAAOC,YAAY;AACnB,OAAOC,cAAc;AAAyB,IAkBxCC,YAAY;EAAA;EAAA;EAChB,sBAAYC,OAAgC,EAAE;IAAA;IAAA;IAC5C;IAEA,WAAyKA,OAAO,IAAI,CAAC,CAAC;MAA9KC,IAAI,QAAJA,IAAI;MAAEC,WAAW,QAAXA,WAAW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AAK,CAAC6B,UAAU;MAC9BC,WAAW,EAAE9B,KAAK,CAAC+B,KAAK;MACxBzB,WAAW,EAAEA,WAAW,aAAXA,WAAW,cAAXA,WAAW,GAAI,IAAI;MAChCK,IAAI,EAAEA,IAAI,aAAJA,IAAI,cAAJA,IAAI,GAAI,cAAc;MAC5BV,YAAY,EAAZA,YAAY;MACZC,cAAc,EAAdA,cAAc;MACd8B,QAAQ,EAAE;QACRC,WAAW,EAAE;UAAEC,KAAK,EAAE;QAAI,CAAC;QAC3BC,gBAAgB,EAAE;UAAED,KAAK,EAAEhB;QAAgB,CAAC;QAAE;QAC9CkB,gBAAgB,EAAE;UAAEF,KAAK,EAAEf;QAAgB,CAAC;QAAE;QAC9CkB,eAAe,EAAE;UAAEH,KAAK,EAAEd;QAAe,CAAC;QAAE;QAC5CkB,cAAc,EAAE;UAAEJ,KAAK,EAAEb;QAAc,CAAC;QAAE;QAC1CkB,SAAS,EAAE;UAAEL,KAAK,EAAEZ;QAAS,CAAC;QAAE;QAChCkB,gBAAgB,EAAE;UAAEN,KAAK,EAAEX;QAAgB,CAAC;QAAE;QAC9CkB,gBAAgB,EAAE;UAAEP,KAAK,EAAET;QAAgB,CAAC;QAAE;QAC9CiB,WAAW,EAAE;UAAER,KAAK,EAAE3B,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,IAAIP,KAAK,CAACwB,KAAK,CAAC,SAAS;QAAE,CAAC;QAAE;QAC7DmB,YAAY,EAAE;UAAET,KAAK,EAAER;QAAY,CAAC;QAAE;QACtCkB,YAAY,EAAE;UAAEV,KAAK,EAAEP;QAAY,CAAC,CAAE;MACxC;IACF,CAAC,CAAC;EACJ;EAAC;AAAA,EApCwB3B,KAAK,CAAC6C,QAAQ;AAuCzC,eAAe1C,YAAY"}
@@ -1 +1,2 @@
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 */"\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";
2
+ //# sourceMappingURL=fragment.js.map