Skip to content

Commit

Permalink
fix(core): fix Program setStates method and update Renderer types…
Browse files Browse the repository at this point in the history
… def.
  • Loading branch information
sakitam-fdd committed Feb 4, 2023
1 parent dbba315 commit a82fa00
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 19 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"commonjs": "dist/index.cjs.js",
"namespace": "ve",
"types": "dist/index.d.ts",
"type": "module",
"author": "sakitam-fdd <smilefdd@gmail.com>",
"repository": {
"url": "https://github.com/sakitam-gis/vis-engine.git"
Expand Down Expand Up @@ -51,16 +50,16 @@
},
"scripts": {
"dev": "rollup -wm --config rollup.config.ts --configPlugin esbuild --environment NODE_ENV:development",
"build": "rollup --config rollup.config.ts --configPlugin esbuild --environment NODE_ENV:production",
"build:minify": "rollup --config rollup.config.ts --configPlugin esbuild --environment MINIFY,NODE_ENV:production",
"build": "rollup --config rollup.config.ts --configPlugin esbuild --environment NODE_ENV:production && pnpm run --filter=./adapters/* -r build",
"build:minify": "rollup --config rollup.config.ts --configPlugin esbuild --environment MINIFY,NODE_ENV:production && pnpm run --filter=./adapters/* -r build:minify",
"build:analyze": "cross-env BUILD_ANALYZER=true pnpm run build",
"build:docs": "pnpm run build && cd documents && pnpm run api && pnpm run build",
"lint": "eslint src --ext js,jsx,ts,tsx",
"prepublishOnly": "npm run build && npm run build:minify",
"test": "npm run build && npm run test-only",
"test-only": "vitest run",
"coverage": "vitest run --coverage",
"semantic-release": "semantic-release --branches master"
"semantic-release": "semantic-release --branches master && node multirelease.cjs.js"
},
"dependencies": {
"gl-matrix": "^3.4.3",
Expand Down Expand Up @@ -111,6 +110,7 @@
"eslint-plugin-react": "^7.25.1",
"eslint-plugin-react-hooks": "^4.2.0",
"lint-staged": "^13.0.3",
"multi-semantic-release": "^3.0.1",
"prettier": "^2.7.0",
"rollup": "^3.2.3",
"rollup-plugin-dts": "^5.0.0",
Expand Down
138 changes: 136 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 11 additions & 7 deletions src/core/Program.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isNull, isUndef, parseShader, uid } from '../utils';
import { isNull, isUndef, omit, parseShader, uid } from '../utils';
import type { WithNull } from '../types';

import Resource from './Resource';
Expand Down Expand Up @@ -498,16 +498,20 @@ export default class Program extends Resource<ProgramOptions> {
} else {
this.#renderState = {
...this.#renderState,
...states,
blendFunc: {
...omit(states, ['blendFunc', 'blendEquation']),
} as ProgramRenderState;
if (states.blendFunc) {
this.#renderState.blendFunc = {
...this.#renderState.blendFunc,
...states.blendFunc,
},
blendEquation: {
};
}
if (states.blendEquation) {
this.#renderState.blendEquation = {
...this.#renderState.blendEquation,
...states.blendEquation,
},
} as ProgramRenderState;
};
}
}
}

Expand Down
24 changes: 18 additions & 6 deletions src/core/Renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,24 @@ export default class Renderer {

readonly #frustumCull: boolean;

public vertexAttribDivisor: any;
public drawArraysInstanced: any;
public drawElementsInstanced: any;
public createVertexArray: any;
public bindVertexArray: any;
public deleteVertexArray: any;
public vertexAttribDivisor:
| ANGLE_instanced_arrays['vertexAttribDivisorANGLE']
| WebGL2RenderingContext['vertexAttribDivisor'];
public drawArraysInstanced:
| ANGLE_instanced_arrays['drawArraysInstancedANGLE']
| WebGL2RenderingContext['drawArraysInstanced'];
public drawElementsInstanced:
| ANGLE_instanced_arrays['drawElementsInstancedANGLE']
| WebGL2RenderingContext['drawElementsInstanced'];
public createVertexArray:
| OES_vertex_array_object['createVertexArrayOES']
| WebGL2RenderingContext['createVertexArray'];
public bindVertexArray:
| OES_vertex_array_object['bindVertexArrayOES']
| WebGL2RenderingContext['bindVertexArray'];
public deleteVertexArray:
| OES_vertex_array_object['deleteVertexArrayOES']
| WebGL2RenderingContext['deleteVertexArray'];

public width: number;

Expand Down

0 comments on commit a82fa00

Please sign in to comment.