diff --git a/__tests__/integration/__node__tests__/webgl/snapshots/d3-barchart.png b/__tests__/integration/__node__tests__/webgl/snapshots/d3-barchart.png index 01d881c00..3adaf86ed 100644 Binary files a/__tests__/integration/__node__tests__/webgl/snapshots/d3-barchart.png and b/__tests__/integration/__node__tests__/webgl/snapshots/d3-barchart.png differ diff --git a/__tests__/integration/__node__tests__/webgl/snapshots/line.png b/__tests__/integration/__node__tests__/webgl/snapshots/line.png index 77e0c5b54..5d1a33430 100644 Binary files a/__tests__/integration/__node__tests__/webgl/snapshots/line.png and b/__tests__/integration/__node__tests__/webgl/snapshots/line.png differ diff --git a/packages/g-gesture/CHANGELOG.md b/packages/g-gesture/CHANGELOG.md index 6e289879a..c913ad3d0 100644 --- a/packages/g-gesture/CHANGELOG.md +++ b/packages/g-gesture/CHANGELOG.md @@ -1,5 +1,11 @@ # @antv/g-gesture +## 2.2.8 + +### Patch Changes + +- d9e769f2: Stop propagation in g-gesture. + ## 2.2.7 ### Patch Changes diff --git a/packages/g-gesture/package.json b/packages/g-gesture/package.json index 668f50a45..92b89665e 100644 --- a/packages/g-gesture/package.json +++ b/packages/g-gesture/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-gesture", - "version": "2.2.7", + "version": "2.2.8", "description": "G Gesture", "keywords": [ "antv", diff --git a/packages/g-mobile-webgl/CHANGELOG.md b/packages/g-mobile-webgl/CHANGELOG.md index 6d72d3374..ba35708a1 100644 --- a/packages/g-mobile-webgl/CHANGELOG.md +++ b/packages/g-mobile-webgl/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-mobile-webgl +## 0.9.10 + +### Patch Changes + +- Updated dependencies [d9e769f2] +- Updated dependencies [d9e769f2] +- Updated dependencies [d9e769f2] + - @antv/g-plugin-device-renderer@1.9.9 + - @antv/g-plugin-webgl-device@1.9.9 + ## 0.9.9 ### Patch Changes diff --git a/packages/g-mobile-webgl/package.json b/packages/g-mobile-webgl/package.json index e45ed7e59..afeb3070e 100644 --- a/packages/g-mobile-webgl/package.json +++ b/packages/g-mobile-webgl/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-mobile-webgl", - "version": "0.9.9", + "version": "0.9.10", "description": "A renderer implemented by WebGL1/2 in mobile environment", "keywords": [ "antv", diff --git a/packages/g-plugin-3d/CHANGELOG.md b/packages/g-plugin-3d/CHANGELOG.md index a35ae96dd..84fd874de 100644 --- a/packages/g-plugin-3d/CHANGELOG.md +++ b/packages/g-plugin-3d/CHANGELOG.md @@ -1,5 +1,14 @@ # @antv/g-plugin-3d +## 1.9.9 + +### Patch Changes + +- Updated dependencies [d9e769f2] +- Updated dependencies [d9e769f2] +- Updated dependencies [d9e769f2] + - @antv/g-plugin-device-renderer@1.9.9 + ## 1.9.8 ### Patch Changes diff --git a/packages/g-plugin-3d/package.json b/packages/g-plugin-3d/package.json index 064a5eef2..73e8feae2 100644 --- a/packages/g-plugin-3d/package.json +++ b/packages/g-plugin-3d/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-3d", - "version": "1.9.8", + "version": "1.9.9", "description": "Provide 3D extension for G", "keywords": [ "antv", diff --git a/packages/g-plugin-device-renderer/CHANGELOG.md b/packages/g-plugin-device-renderer/CHANGELOG.md index 0bdb1fcfd..eb7f39a78 100644 --- a/packages/g-plugin-device-renderer/CHANGELOG.md +++ b/packages/g-plugin-device-renderer/CHANGELOG.md @@ -1,5 +1,13 @@ # @antv/g-plugin-device-renderer +## 1.9.9 + +### Patch Changes + +- d9e769f2: Merge anchor into modelmatrix. +- d9e769f2: Fix dash effect in webgl. +- d9e769f2: Stop propagation in g-gesture. + ## 1.9.8 ### Patch Changes diff --git a/packages/g-plugin-device-renderer/package.json b/packages/g-plugin-device-renderer/package.json index 57f7ffbcd..8abe294e3 100644 --- a/packages/g-plugin-device-renderer/package.json +++ b/packages/g-plugin-device-renderer/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-device-renderer", - "version": "1.9.8", + "version": "1.9.9", "description": "A G plugin of renderer implementation with GPUDevice", "keywords": [ "antv", diff --git a/packages/g-plugin-device-renderer/src/drawcalls/InstancedFill.ts b/packages/g-plugin-device-renderer/src/drawcalls/InstancedFill.ts index 38bbe8c93..2686eb902 100644 --- a/packages/g-plugin-device-renderer/src/drawcalls/InstancedFill.ts +++ b/packages/g-plugin-device-renderer/src/drawcalls/InstancedFill.ts @@ -16,6 +16,8 @@ import { BatchContext } from '../renderer'; const SEGMENT_NUM = 12; export class InstancedFillDrawcall extends Instanced { + protected mergeAnchorIntoModelMatrix = true; + constructor( protected renderHelper: RenderHelper, protected texturePool: TexturePool, diff --git a/packages/g-plugin-device-renderer/src/shader/instanced-line.frag b/packages/g-plugin-device-renderer/src/shader/instanced-line.frag index 6aa2b386c..cd8aa70de 100644 --- a/packages/g-plugin-device-renderer/src/shader/instanced-line.frag +++ b/packages/g-plugin-device-renderer/src/shader/instanced-line.frag @@ -37,6 +37,6 @@ void main() { outputColor.a = outputColor.a * blur * u_Opacity * u_StrokeOpacity - * ceil(mod(v_Dash.x + u_dash_offset, u_dash_array) - (u_dash_array * u_dash_ratio)); + * (u_dash_array < 1.0 ? (ceil((u_dash_array * u_dash_ratio) - mod(v_Dash.x + u_dash_offset, u_dash_array))) : 1.0); } } \ No newline at end of file diff --git a/packages/g-plugin-device-renderer/src/shader/instanced-line.vert b/packages/g-plugin-device-renderer/src/shader/instanced-line.vert index db096fca8..4e637e38b 100644 --- a/packages/g-plugin-device-renderer/src/shader/instanced-line.vert +++ b/packages/g-plugin-device-renderer/src/shader/instanced-line.vert @@ -33,9 +33,7 @@ void main() { float clampedStrokeWidth = max(strokeWidth, 1.0); float isBillboard = a_Dash.w; - bool isPerspective = isPerspectiveMatrix(u_ProjectionMatrix); - - if (isBillboard > 0.5 && isPerspective) { + if (isBillboard > 0.5) { // clip space vec4 clip0 = project(vec4(a_PointA, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix); vec4 clip1 = project(vec4(a_PointB, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix); diff --git a/packages/g-plugin-gpgpu/CHANGELOG.md b/packages/g-plugin-gpgpu/CHANGELOG.md index 182a4441a..67d92f66d 100644 --- a/packages/g-plugin-gpgpu/CHANGELOG.md +++ b/packages/g-plugin-gpgpu/CHANGELOG.md @@ -1,5 +1,11 @@ # @antv/g-plugin-gpgpu +## 1.9.10 + +### Patch Changes + +- @antv/g-webgpu@1.9.10 + ## 1.9.9 ### Patch Changes diff --git a/packages/g-plugin-gpgpu/package.json b/packages/g-plugin-gpgpu/package.json index e6910b9e8..2c849357a 100644 --- a/packages/g-plugin-gpgpu/package.json +++ b/packages/g-plugin-gpgpu/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-gpgpu", - "version": "1.9.9", + "version": "1.9.10", "description": "A G plugin for GPGPU based on WebGPU", "keywords": [ "webgpu", diff --git a/packages/g-plugin-webgl-device/CHANGELOG.md b/packages/g-plugin-webgl-device/CHANGELOG.md index 01a834430..db25f1796 100644 --- a/packages/g-plugin-webgl-device/CHANGELOG.md +++ b/packages/g-plugin-webgl-device/CHANGELOG.md @@ -1,5 +1,14 @@ # @antv/g-plugin-webgl-device +## 1.9.9 + +### Patch Changes + +- Updated dependencies [d9e769f2] +- Updated dependencies [d9e769f2] +- Updated dependencies [d9e769f2] + - @antv/g-plugin-device-renderer@1.9.9 + ## 1.9.8 ### Patch Changes diff --git a/packages/g-plugin-webgl-device/package.json b/packages/g-plugin-webgl-device/package.json index 9f129c2fe..c1918485b 100644 --- a/packages/g-plugin-webgl-device/package.json +++ b/packages/g-plugin-webgl-device/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-webgl-device", - "version": "1.9.8", + "version": "1.9.9", "description": "A G plugin implements GPUDevice interface with WebGL API", "keywords": [ "antv", diff --git a/packages/g-plugin-webgpu-device/CHANGELOG.md b/packages/g-plugin-webgpu-device/CHANGELOG.md index 6af2a6a11..7cd68e5bd 100644 --- a/packages/g-plugin-webgpu-device/CHANGELOG.md +++ b/packages/g-plugin-webgpu-device/CHANGELOG.md @@ -1,5 +1,14 @@ # @antv/g-plugin-webgpu-device +## 1.9.9 + +### Patch Changes + +- Updated dependencies [d9e769f2] +- Updated dependencies [d9e769f2] +- Updated dependencies [d9e769f2] + - @antv/g-plugin-device-renderer@1.9.9 + ## 1.9.8 ### Patch Changes diff --git a/packages/g-plugin-webgpu-device/package.json b/packages/g-plugin-webgpu-device/package.json index 34b6edb73..a01b90c09 100644 --- a/packages/g-plugin-webgpu-device/package.json +++ b/packages/g-plugin-webgpu-device/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-plugin-webgpu-device", - "version": "1.9.8", + "version": "1.9.9", "description": "A G plugin implements GPUDevice interface with WebGPU API", "keywords": [ "antv", diff --git a/packages/g-web-components/CHANGELOG.md b/packages/g-web-components/CHANGELOG.md index 22d3f0254..b48fbe4f0 100644 --- a/packages/g-web-components/CHANGELOG.md +++ b/packages/g-web-components/CHANGELOG.md @@ -1,5 +1,11 @@ # @antv/g-web-components +## 1.9.10 + +### Patch Changes + +- @antv/g-webgl@1.9.10 + ## 1.9.9 ### Patch Changes diff --git a/packages/g-web-components/package.json b/packages/g-web-components/package.json index 74c001420..8b95bf74e 100644 --- a/packages/g-web-components/package.json +++ b/packages/g-web-components/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-web-components", - "version": "1.9.9", + "version": "1.9.10", "description": "A declarative usage for G implemented with WebComponents", "keywords": [ "antv", diff --git a/packages/g-webgl/CHANGELOG.md b/packages/g-webgl/CHANGELOG.md index 2ea71bbd9..3a077e939 100644 --- a/packages/g-webgl/CHANGELOG.md +++ b/packages/g-webgl/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-webgl +## 1.9.10 + +### Patch Changes + +- Updated dependencies [d9e769f2] +- Updated dependencies [d9e769f2] +- Updated dependencies [d9e769f2] + - @antv/g-plugin-device-renderer@1.9.9 + - @antv/g-plugin-webgl-device@1.9.9 + ## 1.9.9 ### Patch Changes diff --git a/packages/g-webgl/package.json b/packages/g-webgl/package.json index 573670716..ebec02034 100644 --- a/packages/g-webgl/package.json +++ b/packages/g-webgl/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-webgl", - "version": "1.9.9", + "version": "1.9.10", "description": "A renderer implemented by WebGL1/2", "keywords": [ "antv", diff --git a/packages/g-webgpu/CHANGELOG.md b/packages/g-webgpu/CHANGELOG.md index 891bc9d25..ee79ddb48 100644 --- a/packages/g-webgpu/CHANGELOG.md +++ b/packages/g-webgpu/CHANGELOG.md @@ -1,5 +1,15 @@ # @antv/g-webgpu +## 1.9.10 + +### Patch Changes + +- Updated dependencies [d9e769f2] +- Updated dependencies [d9e769f2] +- Updated dependencies [d9e769f2] + - @antv/g-plugin-device-renderer@1.9.9 + - @antv/g-plugin-webgpu-device@1.9.9 + ## 1.9.9 ### Patch Changes diff --git a/packages/g-webgpu/package.json b/packages/g-webgpu/package.json index 7ef9bdcb9..a0b5a0051 100644 --- a/packages/g-webgpu/package.json +++ b/packages/g-webgpu/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g-webgpu", - "version": "1.9.9", + "version": "1.9.10", "description": "A renderer implemented by WebGPU", "keywords": [ "antv", diff --git a/site/examples/3d/3d-basic/demo/billboard.js b/site/examples/3d/3d-basic/demo/billboard.js new file mode 100644 index 000000000..ac6a18796 --- /dev/null +++ b/site/examples/3d/3d-basic/demo/billboard.js @@ -0,0 +1,153 @@ +import { + runtime, + Canvas, + CanvasEvent, + Line, + Text, + Rect, + Image, + Circle, + Path, +} from '@antv/g'; +import { Renderer } from '@antv/g-webgl'; +import { + MeshPhongMaterial, + SphereGeometry, + DirectionalLight, + Mesh, + Plugin as Plugin3D, +} from '@antv/g-plugin-3d'; +import { Plugin as PluginControl } from '@antv/g-plugin-control'; +import * as lil from 'lil-gui'; +import Stats from 'stats.js'; + +runtime.enableCSSParsing = false; + +// create a renderer +const renderer = new Renderer(); +renderer.registerPlugin(new Plugin3D()); +renderer.registerPlugin(new PluginControl()); + +// create a canvas +const canvas = new Canvas({ + container: 'container', + width: 400, + height: 400, + renderer, +}); + +(async () => { + // wait for canvas' initialization complete + await canvas.ready; + // use GPU device + const plugin = renderer.getPlugin('device-renderer'); + const device = plugin.getDevice(); + + const origin = new Image({ + style: { + x: 200, + y: 200, + z: 0, + width: 20, + height: 20, + src: 'https://gw.alipayobjects.com/mdn/rms_6ae20b/afts/img/A*N4ZMS7gHsUIAAAAAAAAAAABkARQnAQ', + isBillboard: true, + }, + }); + canvas.appendChild(origin); + + const x = origin.cloneNode(); + x.attr({ + x: 300, + }); + canvas.appendChild(x); + + const y = origin.cloneNode(); + y.attr({ + y: 100, + }); + canvas.appendChild(y); + + const z = origin.cloneNode(); + z.attr({ + z: 100, + }); + canvas.appendChild(z); + + const xAxis = new Line({ + style: { + x1: 200, + y1: 200, + z1: 0, + x2: 300, + y2: 200, + z2: 0, + stroke: 'black', + lineWidth: 2, + isBillboard: true, + }, + }); + canvas.appendChild(xAxis); + + const yAxis = new Line({ + style: { + x1: 200, + y1: 200, + z1: 0, + x2: 200, + y2: 100, + z2: 0, + stroke: 'black', + lineWidth: 2, + isBillboard: true, + }, + }); + canvas.appendChild(yAxis); + + const zAxis = new Line({ + style: { + x1: 200, + y1: 200, + z1: 0, + x2: 200, + y2: 200, + z2: 100, + stroke: 'black', + lineWidth: 2, + isBillboard: true, + }, + }); + canvas.appendChild(zAxis); + + // add a directional light into scene + const light = new DirectionalLight({ + style: { + fill: 'white', + direction: [-1, 0, 1], + }, + }); + canvas.appendChild(light); + + // adjust camera's position + // const camera = canvas.getCamera(); + // camera.setPerspective(0.1, 5000, 90, 400 / 400); + + // stats + const stats = new Stats(); + stats.showPanel(0); + const $stats = stats.dom; + $stats.style.position = 'absolute'; + $stats.style.left = '0px'; + $stats.style.top = '0px'; + const $wrapper = document.getElementById('container'); + $wrapper.appendChild($stats); + canvas.addEventListener(CanvasEvent.AFTER_RENDER, () => { + if (stats) { + stats.update(); + } + }); + + // GUI + const gui = new lil.GUI({ autoPlace: false }); + $wrapper.appendChild(gui.domElement); +})(); diff --git a/site/examples/3d/3d-basic/demo/meta.json b/site/examples/3d/3d-basic/demo/meta.json index b561a1dc6..dd2e5b0c8 100644 --- a/site/examples/3d/3d-basic/demo/meta.json +++ b/site/examples/3d/3d-basic/demo/meta.json @@ -20,6 +20,14 @@ }, "screenshot": "https://gw.alipayobjects.com/mdn/rms_6ae20b/afts/img/A*nKFQQZdL3-IAAAAAAAAAAAAAARQnAQ" }, + { + "filename": "billboard.js", + "title": { + "zh": "公告牌效果", + "en": "Billboard effect" + }, + "screenshot": "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*V44QR4my8ZwAAAAAAAAAAAAADmJ7AQ/original" + }, { "filename": "sprite.js", "title": {