Skip to content

Commit

Permalink
fix: simplify the parmas of createBindings #1527 (#1529) (#1532)
Browse files Browse the repository at this point in the history
* fix: simplify the parmas of createBindings #1527 (#1529)

* fix: simplify the parmas of createBindings #1527

* feat: support cubemap in webgpu

* fix: remove immutable param from Texture #1527

* chore: commit changeset

* fix: add min/maxDepth params in setViewport

* chore: add translation action

* chore: add name for test action

* chore: padding space in test action

* fix: adjust Kernel API

* fix: use device api & remove unused examples

* chore: update action yaml

* fix: rename to @antv/g-device-api

* chore: commit changeset

* chore: commit changeset

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

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 Sep 26, 2023
1 parent 0b59e28 commit 57e5219
Show file tree
Hide file tree
Showing 179 changed files with 4,490 additions and 18,271 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16 # semantic-release 需要 >= 16 的 Node.js 环境
node-version: 16
cache: 'pnpm'

# 发布开始通知
Expand Down
24 changes: 9 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,7 @@ on: [pull_request]
jobs:
test:
name: Test
# jest-electron 需要 macOS 环境, 但是 免费用户 并发有限制, 容易排队 https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
# runs-on: macos-latest # (目前 macos-latest 对应的是 Big Sur 11, macos-12 对应 Monterey 12)
# macOS 3-core CPU, 其他 2-core CPU
runs-on: macos-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
node-version: [16]

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

Expand All @@ -27,24 +19,26 @@ jobs:
with:
version: 7

- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
node-version: 16
cache: 'pnpm'

- name: Install headless-gl dependencies
run: |
sudo apt-get update
sudo apt-get install -y mesa-utils xvfb libgl1-mesa-dri libglapi-mesa libosmesa6
- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm build

- name: Test
run: pnpm test

- name: Cov
run: |
pnpm cov
xvfb-run -s "-ac -screen 0 1280x1024x16" pnpm cov
env:
CI: true
- name: Coveralls
Expand Down
4 changes: 2 additions & 2 deletions __tests__/integration/__node__tests__/webgl/material.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const {
ShaderMaterial,
BufferGeometry,
Mesh,
VertexBufferFrequency,
VertexStepMode,
Format,
VertexAttributeBufferIndex,
VertexAttributeLocation,
Expand Down Expand Up @@ -81,7 +81,7 @@ describe('Render custom material with g-webgl', () => {
bufferGeometry.setVertexBuffer({
bufferIndex: VertexAttributeBufferIndex.POSITION,
byteStride: 4 * 3,
frequency: VertexBufferFrequency.VERTEX,
frequency: VertexStepMode.VERTEX,
attributes: [
{
format: Format.F32_RGB,
Expand Down
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,28 @@
},
"devDependencies": {
"@antv/util": "^3.3.4",
"@changesets/cli": "^2.26.2",
"@commitlint/cli": "^8.3.6",
"@commitlint/config-angular": "^9.1.2",
"@changesets/cli": "^2.26.2",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^21.1.0",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-node-resolve": "^15.2.1",
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.1.1",
"@rollup/plugin-typescript": "^11.1.3",
"@types/gl": "^6.0.2",
"@types/jest": "^26.0.24",
"@types/node": "^14.18.51",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"@types/node": "^14.18.61",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"canvas": "^2.11.2",
"case-police": "^0.5.10",
"case-police": "^0.5.14",
"cross-env": "^6.0.3",
"d3": "^7.8.5",
"eslint": "^7.32.0",
"eslint-plugin-jest": "24.3.6",
"get-pixels": "3.3.3",
"git-contributor": "~1.0.11",
"gl": "^6.0.2",
"get-pixels": "3.3.3",
"hammerjs": "^2.0.8",
"husky": "^7.0.4",
"is-ci": "2.0.0",
Expand All @@ -87,12 +88,12 @@
"pngjs": "^6.0.0",
"prettier": "^2.8.8",
"rimraf": "^4.4.1",
"rollup": "^3.25.1",
"rollup": "^3.29.2",
"rollup-plugin-polyfill-node": "^0.8.0",
"rollup-plugin-visualizer": "^5.9.2",
"sinon": "^11.1.2",
"ts-jest": "^26.5.6",
"typescript": "^5.1.3",
"typescript": "^5.2.2",
"vite": "^3.2.7",
"xmlserializer": "^0.6.1"
},
Expand Down
9 changes: 9 additions & 0 deletions packages/g-mobile-webgl/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @antv/g-mobile-webgl

## 0.9.21

### Patch Changes

- 83195bb7: Use @antv/g-device-api.
- Updated dependencies [83195bb7]
- Updated dependencies [769480aa]
- @antv/g-plugin-device-renderer@1.9.18

## 0.9.20

### 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": "0.9.20",
"version": "0.9.21",
"description": "A renderer implemented by WebGL1/2 in mobile environment",
"keywords": [
"antv",
Expand Down Expand Up @@ -44,7 +44,7 @@
"@antv/g-plugin-html-renderer": "workspace:*",
"@antv/g-plugin-image-loader": "workspace:*",
"@antv/g-plugin-mobile-interaction": "workspace:*",
"@antv/g-plugin-webgl-device": "workspace:*",
"@antv/g-device-api": "^1.2.2",
"@antv/util": "^3.3.4",
"tslib": "^2.5.3"
},
Expand Down
18 changes: 16 additions & 2 deletions packages/g-mobile-webgl/src/ContextRegisterPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
import { AbstractRendererPlugin } from '@antv/g-lite';
import type * as DeviceRenderer from '@antv/g-plugin-device-renderer';
import { WebGLDeviceContribution } from '@antv/g-device-api';
import { WebGLContextService } from './WebGLContextService';
import { MobileWebglRenderConfig } from '.';
export class ContextRegisterPlugin extends AbstractRendererPlugin {
name = 'mobile-webgl-context-register';

constructor(private rendererPlugin: DeviceRenderer.Plugin) {
constructor(
private rendererPlugin: DeviceRenderer.Plugin,
private config: MobileWebglRenderConfig,
) {
super();
}

init(): void {
this.context.ContextService = WebGLContextService;
// @ts-ignore
this.context.deviceRendererPlugin = this.rendererPlugin;
const config = this.config;
this.context.deviceContribution = new WebGLDeviceContribution({
...(config?.targets
? {
targets: config.targets,
}
: {
targets: ['webgl2', 'webgl1'],
}),
});
}
destroy(): void {
delete this.context.ContextService;
Expand Down
28 changes: 11 additions & 17 deletions packages/g-mobile-webgl/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@ import * as DragDropEvent from '@antv/g-plugin-dragndrop';
import * as HTMLRenderer from '@antv/g-plugin-html-renderer';
import * as ImageLoader from '@antv/g-plugin-image-loader';
import * as DomInteraction from '@antv/g-plugin-mobile-interaction';
import * as WebGLDevice from '@antv/g-plugin-webgl-device';
import { isNil } from '@antv/util';
import { ContextRegisterPlugin } from './ContextRegisterPlugin';

export { DomInteraction, DeviceRenderer, WebGLDevice, HTMLRenderer };
export { DomInteraction, DeviceRenderer, HTMLRenderer };

interface WebGLRendererConfig extends RendererConfig {
export interface WebGLRendererConfig extends RendererConfig {
targets: ('webgl1' | 'webgl2')[];
}

type MobileWebglRenderConfig = Partial<
export type MobileWebglRenderConfig = Partial<
WebGLRendererConfig & {
isDocumentDraggable: boolean;
isDocumentDroppable: boolean;
Expand All @@ -30,26 +29,21 @@ export class Renderer extends AbstractRenderer {

const deviceRendererPlugin = new DeviceRenderer.Plugin();

this.registerPlugin(new ContextRegisterPlugin(deviceRendererPlugin));
this.registerPlugin(new ImageLoader.Plugin());
this.registerPlugin(
new WebGLDevice.Plugin(
config?.targets
? {
targets: config.targets,
}
: {
targets: ['webgl2', 'webgl1'],
},
),
new ContextRegisterPlugin(deviceRendererPlugin, config),
);
this.registerPlugin(new ImageLoader.Plugin());
this.registerPlugin(deviceRendererPlugin);
this.registerPlugin(new DomInteraction.Plugin());
this.registerPlugin(new HTMLRenderer.Plugin());
this.registerPlugin(
new DragDropEvent.Plugin({
isDocumentDraggable: isNil(config?.isDocumentDraggable) ? true : config.isDocumentDraggable,
isDocumentDroppable: isNil(config?.isDocumentDroppable) ? true : config.isDocumentDroppable,
isDocumentDraggable: isNil(config?.isDocumentDraggable)
? true
: config.isDocumentDraggable,
isDocumentDroppable: isNil(config?.isDocumentDroppable)
? true
: config.isDocumentDroppable,
dragstartDistanceThreshold: isNil(config?.dragstartDistanceThreshold)
? 10
: config.dragstartDistanceThreshold,
Expand Down
9 changes: 9 additions & 0 deletions packages/g-plugin-3d/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @antv/g-plugin-3d

## 1.9.18

### Patch Changes

- 83195bb7: Use @antv/g-device-api.
- Updated dependencies [83195bb7]
- Updated dependencies [769480aa]
- @antv/g-plugin-device-renderer@1.9.18

## 1.9.17

### Patch Changes
Expand Down
3 changes: 2 additions & 1 deletion 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": "1.9.17",
"version": "1.9.18",
"description": "Provide 3D extension for G",
"keywords": [
"antv",
Expand Down Expand Up @@ -41,6 +41,7 @@
"@antv/g-lite": "workspace:*",
"@antv/g-plugin-device-renderer": "workspace:*",
"@antv/g-shader-components": "workspace:*",
"@antv/g-device-api": "^1.2.2",
"gl-matrix": "^3.4.3",
"tslib": "^2.5.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-3d/src/geometries/CapsuleGeometry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Device } from '@antv/g-plugin-device-renderer';
import type { Device } from '@antv/g-device-api';
import { ProceduralGeometry } from './ProceduralGeometry';
import { createConeData } from './util';

Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-3d/src/geometries/ConeGeometry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Device } from '@antv/g-plugin-device-renderer';
import type { Device } from '@antv/g-device-api';
import { ProceduralGeometry } from './ProceduralGeometry';
import { createConeData } from './util';

Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-3d/src/geometries/CubeGeometry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Device } from '@antv/g-plugin-device-renderer';
import type { Device } from '@antv/g-device-api';
import { vec3 } from 'gl-matrix';
import { ProceduralGeometry } from './ProceduralGeometry';
import { primitiveUv1Padding, primitiveUv1PaddingScale } from './util';
Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-3d/src/geometries/CylinderGeometry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Device } from '@antv/g-plugin-device-renderer';
import type { Device } from '@antv/g-device-api';
import { ProceduralGeometry } from './ProceduralGeometry';
import { createConeData } from './util';

Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-3d/src/geometries/PlaneGeometry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Device } from '@antv/g-plugin-device-renderer';
import type { Device } from '@antv/g-device-api';
import { ProceduralGeometry } from './ProceduralGeometry';

export interface PlaneGeometryProps {
Expand Down
5 changes: 2 additions & 3 deletions packages/g-plugin-3d/src/geometries/ProceduralGeometry.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { AABB } from '@antv/g-lite';
import {
BufferGeometry,
Format,
VertexAttributeBufferIndex,
VertexAttributeLocation,
VertexStepMode,
} from '@antv/g-plugin-device-renderer';
import type { Device } from '@antv/g-plugin-device-renderer';
import type { Device } from '@antv/g-device-api';
import { Format, VertexStepMode } from '@antv/g-device-api';
import { mat4, vec3, vec4 } from 'gl-matrix';

export interface Topology {
Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-3d/src/geometries/SphereGeometry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Device } from '@antv/g-plugin-device-renderer';
import type { Device } from '@antv/g-device-api';
import { ProceduralGeometry } from './ProceduralGeometry';

export interface SphereGeometryProps {
Expand Down
2 changes: 1 addition & 1 deletion packages/g-plugin-3d/src/geometries/TorusGeometry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Device } from '@antv/g-plugin-device-renderer';
import type { Device } from '@antv/g-device-api';
import { ProceduralGeometry } from './ProceduralGeometry';

export interface TorusGeometryProps {
Expand Down
Loading

0 comments on commit 57e5219

Please sign in to comment.