Skip to content

Commit

Permalink
Release (#1690)
Browse files Browse the repository at this point in the history
* fix: support cameras array (#1688)

* fix: support cameras array

* chore: disable enableDirtyRectangleRenderingDebug by default

* fix: set viewport

* chore: commit changeset

* chore(release): bump version (#1689)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored May 22, 2024
1 parent 4c60621 commit 0e4aab1
Show file tree
Hide file tree
Showing 17 changed files with 303 additions and 218 deletions.
135 changes: 68 additions & 67 deletions __tests__/demos/3d/force.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,7 @@ export async function force(context) {
const material = new MeshPhongMaterial(device, {
shininess: 30,
});
// material.polygonOffset = true;

// @see https://antv.vision/en/docs/specification/language/palette#%E5%88%86%E7%B1%BB%E8%89%B2%E6%9D%BF
const colorPalette = [
Expand Down Expand Up @@ -1683,78 +1684,78 @@ export async function force(context) {
sphere.style.fill = fill;
});

const icon = new Image({
style: {
x: node.x + 310,
y: node.y + 250,
z: node.z - 1,
width: 10,
height: 10,
src: 'https://gw.alipayobjects.com/mdn/rms_6ae20b/afts/img/A*N4ZMS7gHsUIAAAAAAAAAAABkARQnAQ',
isBillboard: true,
},
});
canvas.appendChild(icon);
// const icon = new Image({
// style: {
// x: node.x + 310,
// y: node.y + 250,
// z: node.z - 1,
// width: 10,
// height: 10,
// src: 'https://gw.alipayobjects.com/mdn/rms_6ae20b/afts/img/A*N4ZMS7gHsUIAAAAAAAAAAABkARQnAQ',
// isBillboard: true,
// },
// });
// canvas.appendChild(icon);

const circle = new Circle({
style: {
cx: node.x + 310,
cy: node.y + 250,
cz: node.z - 2,
r: 2.5,
fill: 'red',
isBillboard: true,
},
});
canvas.appendChild(circle);
// const circle = new Circle({
// style: {
// cx: node.x + 310,
// cy: node.y + 250,
// cz: node.z - 2,
// r: 2.5,
// fill: 'red',
// isBillboard: true,
// },
// });
// canvas.appendChild(circle);

const label = new Text({
style: {
x: node.x + 310,
y: node.y + 250,
z: node.z + 1,
fontFamily: 'sans-serif',
text: node.id,
fontSize: 6,
fill: 'black',
isBillboard: true,
},
});
// const label = new Text({
// style: {
// x: node.x + 310,
// y: node.y + 250,
// z: node.z + 1,
// fontFamily: 'sans-serif',
// text: node.id,
// fontSize: 6,
// fill: 'black',
// isBillboard: true,
// },
// });

const rect = new Rect({
style: {
x: node.x + 310,
y: node.y + 250,
z: node.z,
width: label.getBBox().width,
height: 8,
fill: 'grey',
isBillboard: true,
fillOpacity: 0.6,
},
});
canvas.appendChild(rect);
canvas.appendChild(label);
// const rect = new Rect({
// style: {
// x: node.x + 310,
// y: node.y + 250,
// z: node.z,
// width: label.getBBox().width,
// height: 8,
// fill: 'grey',
// isBillboard: true,
// fillOpacity: 0.6,
// },
// });
// canvas.appendChild(rect);
// canvas.appendChild(label);
});

dataset.links.forEach((edge) => {
const { source, target } = edge;
const line = new Line({
style: {
x1: source.x + 300,
y1: source.y + 250,
z1: source.z,
x2: target.x + 300,
y2: target.y + 250,
z2: target.z,
stroke: 'black',
lineWidth: 2,
opacity: 0.5,
isBillboard: true, // 始终面向屏幕
},
});
canvas.appendChild(line);
});
// dataset.links.forEach((edge) => {
// const { source, target } = edge;
// const line = new Line({
// style: {
// x1: source.x + 300,
// y1: source.y + 250,
// z1: source.z,
// x2: target.x + 300,
// y2: target.y + 250,
// z2: target.z,
// stroke: 'black',
// lineWidth: 2,
// opacity: 0.5,
// isBillboard: true, // 始终面向屏幕
// },
// });
// canvas.appendChild(line);
// });

// add a directional light into scene
const light = new DirectionalLight({
Expand Down
6 changes: 4 additions & 2 deletions __tests__/demos/3d/webar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ export async function ar(context) {
});

// cube.setOrigin(300, 250, 200);
cube.setPosition(300, 250, 200);
cube.setPosition(300, 250, -200);

canvas.appendChild(cube);

// Called every time a XRSession requests that a new frame be drawn.
// @see https://github.com/immersive-web/webxr-samples/blob/main/immersive-ar-session.html#L173
canvas.addEventListener(CanvasEvent.AFTER_RENDER, () => {
cube.rotate(0, 0, 0);
cube.rotate(0, 0.2, 0);
});

canvas.getConfig().disableHitTesting = true;
Expand Down
25 changes: 0 additions & 25 deletions __tests__/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,31 +244,6 @@ function createSpecRender(object) {
});
}

if (
selectRenderer.value === 'canvas' &&
renderer.getConfig().enableDirtyRectangleRendering &&
renderer.getConfig().enableDirtyRectangleRenderingDebug
) {
// display dirty rectangle
const $dirtyRectangle = document.createElement('div');
$dirtyRectangle.style.cssText = `
position: absolute;
pointer-events: none;
background: rgba(255, 0, 0, 0.5);
`;
$div.appendChild($dirtyRectangle);
canvas.addEventListener(CanvasEvent.DIRTY_RECTANGLE, (e) => {
const { dirtyRect } = e.detail;
const { x, y, width, height } = dirtyRect;
const dpr = window.devicePixelRatio;
// convert from canvas coords to viewport
$dirtyRectangle.style.left = `${x / dpr}px`;
$dirtyRectangle.style.top = `${y / dpr}px`;
$dirtyRectangle.style.width = `${width / dpr}px`;
$dirtyRectangle.style.height = `${height / dpr}px`;
});
}

container.append($div);
};
};
Expand Down
7 changes: 7 additions & 0 deletions packages/g-mobile-webgl/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @antv/g-mobile-webgl

## 1.0.7

### Patch Changes

- Updated dependencies [6dd79bc4]
- @antv/g-plugin-device-renderer@2.0.7

## 1.0.6

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/g-mobile-webgl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-mobile-webgl",
"version": "1.0.6",
"version": "1.0.7",
"description": "A renderer implemented by WebGL1/2 in mobile environment",
"keywords": [
"antv",
Expand Down Expand Up @@ -45,7 +45,7 @@
"@antv/g-plugin-html-renderer": "workspace:*",
"@antv/g-plugin-image-loader": "workspace:*",
"@antv/g-plugin-mobile-interaction": "workspace:*",
"@antv/g-device-api": "^1.3.6",
"@antv/g-device-api": "^1.6.10",
"@antv/util": "^3.3.5",
"tslib": "^2.5.3"
},
Expand Down
7 changes: 7 additions & 0 deletions packages/g-plugin-3d/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @antv/g-plugin-3d

## 2.0.7

### Patch Changes

- Updated dependencies [6dd79bc4]
- @antv/g-plugin-device-renderer@2.0.7

## 2.0.6

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/g-plugin-3d/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-plugin-3d",
"version": "2.0.6",
"version": "2.0.7",
"description": "Provide 3D extension for G",
"keywords": [
"antv",
Expand Down Expand Up @@ -41,7 +41,7 @@
"@antv/g-lite": "workspace:*",
"@antv/g-plugin-device-renderer": "workspace:*",
"@antv/g-shader-components": "workspace:*",
"@antv/g-device-api": "^1.3.6",
"@antv/g-device-api": "^1.6.10",
"gl-matrix": "^3.4.3",
"tslib": "^2.5.3"
},
Expand Down
6 changes: 6 additions & 0 deletions packages/g-plugin-device-renderer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @antv/g-plugin-device-renderer

## 2.0.7

### Patch Changes

- 6dd79bc4: Support multiple viewport.

## 2.0.6

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/g-plugin-device-renderer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g-plugin-device-renderer",
"version": "2.0.6",
"version": "2.0.7",
"description": "A G plugin of renderer implementation with GPUDevice",
"keywords": [
"antv",
Expand Down Expand Up @@ -43,7 +43,7 @@
"@antv/g-plugin-image-loader": "workspace:*",
"@antv/g-shader-components": "workspace:*",
"@antv/util": "^3.3.5",
"@antv/g-device-api": "^1.3.6",
"@antv/g-device-api": "^1.6.10",
"@webgpu/types": "^0.1.6",
"earcut": "^2.2.3",
"eventemitter3": "^5.0.1",
Expand Down
Loading

0 comments on commit 0e4aab1

Please sign in to comment.