From 5c6cea4db55a9003867ddb199554715333b75100 Mon Sep 17 00:00:00 2001
From: feng <908087098@qq.com>
Date: Tue, 11 Feb 2025 21:03:28 +0800
Subject: [PATCH 1/4] 1
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 8e7a922..81d752a 100644
--- a/package.json
+++ b/package.json
@@ -60,7 +60,7 @@
"vitest": "^0.32.2"
},
"dependencies": {
- "@feng3d/render-api": "0.0.1",
+ "@feng3d/render-api": "0.0.2",
"@feng3d/serialization": "^0.8.1",
"@feng3d/watcher": "^0.8.7"
}
--
Gitee
From b8d36060fba9ac86c495691d97164da4baf31673 Mon Sep 17 00:00:00 2001
From: feng <908087098@qq.com>
Date: Tue, 11 Feb 2025 22:32:14 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=A4=BA=E4=BE=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.vscode/settings.json | 1 +
README.md | 86 +++++++++++++++++++++++++-
examples/index.html | 2 +-
examples/index.ts | 2 +-
examples/package.json | 2 +-
examples/src/webgl-examples/sample1.ts | 81 +++++++++++++++++-------
package-lock.json | 22 ++++---
package.json | 5 +-
typedoc.json | 2 +-
9 files changed, 165 insertions(+), 38 deletions(-)
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 4745c7f..1e6c6e6 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -6,4 +6,5 @@
"typescript.format.placeOpenBraceOnNewLineForControlBlocks": true,
"javascript.format.placeOpenBraceOnNewLineForFunctions": true,
"javascript.format.placeOpenBraceOnNewLineForControlBlocks": true,
+ "liveServer.settings.port": 5502,
}
\ No newline at end of file
diff --git a/README.md b/README.md
index 4836671..e82bc2d 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,89 @@
-# @feng3d/renderer
+# @feng3d/webgl
+feng3d引擎的WebGL渲染器,可以让用户无需直接接触WebGL的API,只需提供渲染所需数据,组织好渲染数据结构便可渲染,并且支持动态修改数据从而实现动态渲染。
+
+## 示例
+
+[@feng3d/webgl示例](https://feng3d.com/webgl/)
+
+这里实现完整的 [webgl1](https://mdn.github.io/dom-examples/webgl-examples/tutorial/sample1/) [webgl2](https://github.com/WebGLSamples/WebGL2Samples.git) 官方示例(https://github.com/webgpu/webgpu-samples)。
+
+## 安装
+```
+npm install @feng3d/webgl
+```
+
+## 如何使用
+
+```typescript
+import { ISubmit } from "@feng3d/render-api";
+import { WebGL } from "@feng3d/webgl";
+
+const init = async (canvas: HTMLCanvasElement) =>
+{
+ const devicePixelRatio = window.devicePixelRatio || 1;
+ canvas.width = canvas.clientWidth * devicePixelRatio;
+ canvas.height = canvas.clientHeight * devicePixelRatio;
+
+ const webgl = new WebGL({ canvasId: "glcanvas", contextId: "webgl" }); // 初始化WebGL
+
+ const submit: ISubmit = { // 一次GPU提交
+ commandEncoders: [ // 命令编码列表
+ {
+ passEncoders: [ // 通道编码列表
+ { // 渲染通道
+ descriptor: { // 渲染通道描述
+ colorAttachments: [{ // 颜色附件
+ clearValue: [0.0, 0.0, 0.0, 1.0], // 渲染前填充颜色
+ }],
+ },
+ renderObjects: [{ // 渲染对象
+ pipeline: { // 渲染管线
+ vertex: { // 顶点着色器
+ code: `
+ attribute vec4 position;
+
+ void main() {
+ gl_Position = position;
+ }
+ ` },
+ fragment: { // 片段着色器
+ code: `
+ precision highp float;
+ uniform vec4 color;
+ void main() {
+ gl_FragColor = color;
+ // gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+ }
+ ` },
+ },
+ vertices: {
+ position: { data: new Float32Array([0.0, 0.5, -0.5, -0.5, 0.5, -0.5]), format: "float32x2" }, // 顶点坐标数据
+ },
+ indices: new Uint16Array([0, 1, 2]), // 顶点索引数据
+ uniforms: { color: [1, 0, 0, 1] }, // Uniform 颜色值。
+ drawIndexed: { indexCount: 3 }, // 绘制命令
+ }]
+ },
+ ]
+ }
+ ],
+ };
+
+ webgl.submit(submit); // 提交GPU执行
+};
+
+let webglCanvas = document.querySelector("#glcanvas") as HTMLCanvasElement;
+if (!webglCanvas)
+{
+ webglCanvas = document.createElement("canvas");
+ webglCanvas.id = "webgpu";
+ webglCanvas.style.width = "400px";
+ webglCanvas.style.height = "300px";
+ document.body.appendChild(webglCanvas);
+}
+init(webglCanvas);
+```
## 不再支持内容
1. 为了兼容WebGPU,GLSL着色器中数据结构不再支持纹理。
diff --git a/examples/index.html b/examples/index.html
index 04c3fdc..c83f129 100644
--- a/examples/index.html
+++ b/examples/index.html
@@ -228,7 +228,7 @@
-
+
diff --git a/examples/index.ts b/examples/index.ts
index 541c556..1a4d9d4 100644
--- a/examples/index.ts
+++ b/examples/index.ts
@@ -105,7 +105,7 @@ button.id = "button";
button.textContent = "View source";
button.addEventListener("click", function (event)
{
- window.open(`https://gitlab.com/feng3d/renderer/tree/master/examples/src/${selected}.ts`);
+ window.open(`https://gitee.com/feng3d/webgl/tree/master/examples/src/${selected}.ts`);
}, false);
button.style.display = "none";
document.body.appendChild(button);
diff --git a/examples/package.json b/examples/package.json
index 97ac916..bd16a78 100644
--- a/examples/package.json
+++ b/examples/package.json
@@ -13,6 +13,6 @@
},
"dependencies": {
"gl-matrix": "^3.4.3",
- "@feng3d/webgl": "0.0.2"
+ "@feng3d/webgl": "0.0.3"
}
}
\ No newline at end of file
diff --git a/examples/src/webgl-examples/sample1.ts b/examples/src/webgl-examples/sample1.ts
index e42a861..9f334e7 100644
--- a/examples/src/webgl-examples/sample1.ts
+++ b/examples/src/webgl-examples/sample1.ts
@@ -1,32 +1,67 @@
-// see https://github.com/mdn/dom-examples/blob/main/webgl-examples/tutorial/sample1/webgl-demo.js
-// https://mdn.github.io/dom-examples/webgl-examples/tutorial/sample1/
-
import { ISubmit } from "@feng3d/render-api";
-import { IGLCanvasContext, WebGL } from "@feng3d/webgl";
+import { WebGL } from "@feng3d/webgl";
-async function main()
+const init = async (canvas: HTMLCanvasElement) =>
{
- const renderingContext: IGLCanvasContext = { canvasId: "glcanvas", contextId: "webgl" };
+ const devicePixelRatio = window.devicePixelRatio || 1;
+ canvas.width = canvas.clientWidth * devicePixelRatio;
+ canvas.height = canvas.clientHeight * devicePixelRatio;
+
+ const webgl = new WebGL({ canvasId: "glcanvas", contextId: "webgl" }); // 初始化WebGL
- const webgl = new WebGL(renderingContext);
+ const submit: ISubmit = { // 一次GPU提交
+ commandEncoders: [ // 命令编码列表
+ {
+ passEncoders: [ // 通道编码列表
+ { // 渲染通道
+ descriptor: { // 渲染通道描述
+ colorAttachments: [{ // 颜色附件
+ clearValue: [0.0, 0.0, 0.0, 1.0], // 渲染前填充颜色
+ }],
+ },
+ renderObjects: [{ // 渲染对象
+ pipeline: { // 渲染管线
+ vertex: { // 顶点着色器
+ code: `
+ attribute vec4 position;
- const submit: ISubmit = {
- commandEncoders: [{
- passEncoders: [
- {
- descriptor: {
- colorAttachments: [{
- // view: { texture: {} },
- clearValue: [1, 0, 0, 0.5],
- loadOp: "clear",
- }],
+ void main() {
+ gl_Position = position;
+ }
+ ` },
+ fragment: { // 片段着色器
+ code: `
+ precision highp float;
+ uniform vec4 color;
+ void main() {
+ gl_FragColor = color;
+ // gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+ }
+ ` },
+ },
+ vertices: {
+ position: { data: new Float32Array([0.0, 0.5, -0.5, -0.5, 0.5, -0.5]), format: "float32x2" }, // 顶点坐标数据
+ },
+ indices: new Uint16Array([0, 1, 2]), // 顶点索引数据
+ uniforms: { color: [1, 0, 0, 1] }, // Uniform 颜色值。
+ drawIndexed: { indexCount: 3 }, // 绘制命令
+ }]
},
- }
- ]
- }]
+ ]
+ }
+ ],
};
- webgl.submit(submit);
-}
+ webgl.submit(submit); // 提交GPU执行
+};
-window.onload = main;
+let webglCanvas = document.querySelector("#glcanvas") as HTMLCanvasElement;
+if (!webglCanvas)
+{
+ webglCanvas = document.createElement("canvas");
+ webglCanvas.id = "webgpu";
+ webglCanvas.style.width = "400px";
+ webglCanvas.style.height = "300px";
+ document.body.appendChild(webglCanvas);
+}
+init(webglCanvas);
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index dbb265e..c6c54a2 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,20 +1,20 @@
{
"name": "@feng3d/webgl",
- "version": "0.0.2",
+ "version": "0.0.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@feng3d/webgl",
- "version": "0.0.2",
- "license": "MIT",
+ "version": "0.0.3",
"workspaces": [
".",
"./examples"
],
"dependencies": {
+ "@feng3d/render-api": "0.0.2",
"@feng3d/serialization": "^0.8.1",
- "@feng3d/watcher": "^0.8.3"
+ "@feng3d/watcher": "^0.8.7"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "5.17.0",
@@ -33,7 +33,7 @@
"examples": {
"name": "webgl-renderer-examples",
"dependencies": {
- "@feng3d/webgl": "0.0.2",
+ "@feng3d/webgl": "0.0.3",
"gl-matrix": "^3.4.3"
},
"devDependencies": {
@@ -510,6 +510,12 @@
"integrity": "sha512-fenG1YSlgmB0s6qm+vuj+V6n2luCr/PZbmnS2CNPJFB3+Vmq3QZKZP9iyryYN2T52W4PhgqblOcMyq1pIAPwMw==",
"license": "MIT"
},
+ "node_modules/@feng3d/render-api": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/@feng3d/render-api/-/render-api-0.0.2.tgz",
+ "integrity": "sha512-FcNiDTJ2lZgGBe3/x/xfu2thrNbqt4TxPr7D4FVqZdJ5VvZ6GroQYTiHLScgpAqpW+6Q7wAIzuyZ4DTlguyXbw==",
+ "license": "MIT"
+ },
"node_modules/@feng3d/serialization": {
"version": "0.8.3",
"resolved": "http://101.32.206.6:4873/@feng3d/serialization/-/serialization-0.8.3.tgz",
@@ -520,9 +526,9 @@
}
},
"node_modules/@feng3d/watcher": {
- "version": "0.8.6",
- "resolved": "http://101.32.206.6:4873/@feng3d/watcher/-/watcher-0.8.6.tgz",
- "integrity": "sha512-FETJWDTQ2b01MOx2sFryiKiqyjNgEiKE7rjXXclzNxt/6ZpiktFXW7q9zhb1i/jOOkMUc42le6fCHV9dzsUmdg==",
+ "version": "0.8.7",
+ "resolved": "https://registry.npmjs.org/@feng3d/watcher/-/watcher-0.8.7.tgz",
+ "integrity": "sha512-O7H+mUjX/EUYJ9w+4AU3O0rAUX/betozEGePiMpnlmwFthoCFqHPSAufECuHlSfxo/QNE4U08yX+zjF+qvJ97A==",
"license": "MIT"
},
"node_modules/@feng3d/webgl": {
diff --git a/package.json b/package.json
index 81d752a..040ea5e 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,8 @@
{
"name": "@feng3d/webgl",
- "version": "0.0.2",
+ "version": "0.0.3",
"description": "渲染库",
+ "homepage": "https://feng3d.com/webgl/",
"author": "feng",
"type": "module",
"main": "./src/index.ts",
@@ -30,7 +31,7 @@
},
"repository": {
"type": "git",
- "url": "https://gitee.com/feng3d/webgl-renderer.git"
+ "url": "https://gitee.com/feng3d/webgl.git"
},
"publishConfig": {
"access": "public"
diff --git a/typedoc.json b/typedoc.json
index 1b7c73d..7d96556 100644
--- a/typedoc.json
+++ b/typedoc.json
@@ -4,6 +4,6 @@
"entryPoints": [
"src/index.ts"
],
- "sourceLinkTemplate": "https://gitee.com/feng3d/webgl-renderer/tree/master/{path}#L{line}",
+ "sourceLinkTemplate": "https://gitee.com/feng3d/webgl/tree/master/{path}#L{line}",
"out": "public/docs"
}
\ No newline at end of file
--
Gitee
From 3e558a4b9b2e1664cadd080016d566d48d968522 Mon Sep 17 00:00:00 2001
From: feng <908087098@qq.com>
Date: Tue, 11 Feb 2025 22:36:30 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?=
=?UTF-8?q?=E6=A0=BC=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.eslintrc.json | 2 +-
examples/src/WebGL2Samples/buffer_uniform.ts | 4 +-
.../src/WebGL2Samples/draw_instanced_ubo.ts | 2 +-
.../WebGL2Samples/draw_primitive_restart.ts | 4 +-
examples/src/WebGL2Samples/fbo_blit.ts | 2 +-
examples/src/WebGL2Samples/fbo_multisample.ts | 2 +-
.../WebGL2Samples/fbo_new_blend_equation.ts | 5 +-
examples/src/WebGL2Samples/fbo_read_pixels.ts | 2 +-
.../WebGL2Samples/fbo_rtt_texture_array.ts | 2 +-
.../src/WebGL2Samples/geo_vertex_format.ts | 3 +-
examples/src/WebGL2Samples/glsl_centroid.ts | 6 +-
.../glsl_flat_smooth_interpolators.ts | 4 +-
.../WebGL2Samples/glsl_non_square_matrix.ts | 2 +-
examples/src/WebGL2Samples/query_occlusion.ts | 2 +-
examples/src/WebGL2Samples/sampler_filter.ts | 5 +-
examples/src/WebGL2Samples/sampler_object.ts | 2 +-
examples/src/WebGL2Samples/sampler_wrap.ts | 6 +-
examples/src/WebGL2Samples/texture_3d.ts | 2 +-
.../src/WebGL2Samples/texture_derivative.ts | 3 +-
examples/src/WebGL2Samples/texture_fetch.ts | 2 +-
examples/src/WebGL2Samples/texture_format.ts | 4 +-
examples/src/WebGL2Samples/texture_grad.ts | 2 +-
.../src/WebGL2Samples/texture_immutable.ts | 6 +-
examples/src/WebGL2Samples/texture_integer.ts | 2 +-
examples/src/WebGL2Samples/texture_lod.ts | 10 +--
examples/src/WebGL2Samples/texture_offset.ts | 4 +-
.../src/WebGL2Samples/texture_pixel_store.ts | 2 +-
examples/src/WebGL2Samples/texture_srgb.ts | 6 +-
examples/src/WebGL2Samples/texture_vertex.ts | 4 +-
.../transform_feedback_instanced.ts | 2 +-
.../transform_feedback_separated_2.ts | 2 +-
examples/src/regl-examples/bunny.ts | 4 +-
examples/src/regl-examples/cloth.ts | 4 +-
examples/src/regl-examples/cube.ts | 4 +-
examples/src/test/fractalCube.ts | 2 +-
examples/src/webgl-examples/sample2.ts | 2 +-
src/RunWebGL.ts | 6 +-
src/caches/getGLFramebuffer.ts | 13 +--
src/caches/getGLProgram.ts | 54 ++++++-------
src/caches/getGLRenderOcclusionQuery.ts | 2 +-
src/caches/getGLSampler.ts | 6 +-
src/caches/getGLTexture.ts | 9 ++-
src/caches/getIGLDrawMode.ts | 4 +-
...tIGLRenderPassDescriptorWithMultisample.ts | 9 ++-
src/caches/getIGLTextureFormats.ts | 80 +++++++++----------
src/caches/getIGLTextureTarget.ts | 2 +-
src/data/IGLCommandEncoder.ts | 2 +-
src/data/IGLDepthStencilState.ts | 1 -
src/data/IGLOcclusionQuery.ts | 2 +-
src/data/IGLPrimitiveState.ts | 2 +-
src/data/IGLTexturePixelStore.ts | 1 -
src/data/IGLTransformFeedbackPass.ts | 2 +-
src/runs/getIGLBuffer.ts | 6 +-
src/runs/runColorTargetStates.ts | 18 ++---
src/runs/runDepthState.ts | 12 +--
src/runs/runStencilState.ts | 18 ++---
src/utils/getGLRenderPassAttachmentSize.ts | 14 ++--
src/utils/getIGLCullFace.ts | 8 +-
src/utils/getIGLFrontFace.ts | 4 +-
src/utils/getIVertexFormat.ts | 67 ++++++++--------
src/utils/updateBufferBinding.ts | 11 +--
61 files changed, 234 insertions(+), 241 deletions(-)
diff --git a/.eslintrc.json b/.eslintrc.json
index 254a952..dd393e6 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -131,7 +131,7 @@
"no-redeclare": 1,
"no-return-assign": 0,
"no-script-url": 1,
- "no-self-assign": 1,
+ "no-self-assign": 0,
"no-self-compare": 1,
"no-sequences": 1,
"no-unmodified-loop-condition": 1,
diff --git a/examples/src/WebGL2Samples/buffer_uniform.ts b/examples/src/WebGL2Samples/buffer_uniform.ts
index 6e110e7..4928f9c 100644
--- a/examples/src/WebGL2Samples/buffer_uniform.ts
+++ b/examples/src/WebGL2Samples/buffer_uniform.ts
@@ -107,11 +107,11 @@ import { getShaderSource } from "./utility";
// -- update uniform buffer
transforms.transform.MV[0] = 0.1 * Math.cos(uTime) + 0.4;
- transforms.transform.MV = transforms.transform.MV;
+ transforms.transform.MV = transforms.transform.MV; // 强制更新
lightPos.light.position[0] = Math.cos(3 * uTime);
lightPos.light.position[1] = Math.sin(6 * uTime);
- lightPos.light.position = lightPos.light.position;
+ lightPos.light.position = lightPos.light.position; // 强制更新
webgl.submit(submit);
diff --git a/examples/src/WebGL2Samples/draw_instanced_ubo.ts b/examples/src/WebGL2Samples/draw_instanced_ubo.ts
index 339fe65..0f730ef 100644
--- a/examples/src/WebGL2Samples/draw_instanced_ubo.ts
+++ b/examples/src/WebGL2Samples/draw_instanced_ubo.ts
@@ -40,7 +40,7 @@ const transforms = {
const materials = {
Diffuse: [
- [1.0, 0.5, 0.0, 1.0,],
+ [1.0, 0.5, 0.0, 1.0],
[0.0, 0.5, 1.0, 1.0],
]
};
diff --git a/examples/src/WebGL2Samples/draw_primitive_restart.ts b/examples/src/WebGL2Samples/draw_primitive_restart.ts
index 85def9d..7a2e4e5 100644
--- a/examples/src/WebGL2Samples/draw_primitive_restart.ts
+++ b/examples/src/WebGL2Samples/draw_primitive_restart.ts
@@ -45,7 +45,7 @@ const vertexArray: { vertices?: IVertexAttributes } = {
const renderObject: IRenderObject = {
vertices: vertexArray.vertices,
- indices: indices,
+ indices,
uniforms: {},
drawIndexed: { indexCount: 7, instanceCount: 2 },
pipeline: program,
@@ -63,7 +63,7 @@ webgl.submit({
renderObjects: [renderObject]
}]
}]
-})
+});
// -- Delete WebGL resources
webgl.deleteProgram(program);
diff --git a/examples/src/WebGL2Samples/fbo_blit.ts b/examples/src/WebGL2Samples/fbo_blit.ts
index 127c5e1..394d776 100644
--- a/examples/src/WebGL2Samples/fbo_blit.ts
+++ b/examples/src/WebGL2Samples/fbo_blit.ts
@@ -55,7 +55,7 @@ loadImage("../../assets/img/Di-3d.png", (image) =>
size: [image.width, image.height],
format: "rgba8unorm",
sources: [{
- image: image, flipY: true
+ image, flipY: true
}],
};
const samplerDiffuse: ISampler = {
diff --git a/examples/src/WebGL2Samples/fbo_multisample.ts b/examples/src/WebGL2Samples/fbo_multisample.ts
index 8b4b972..00a8f2f 100644
--- a/examples/src/WebGL2Samples/fbo_multisample.ts
+++ b/examples/src/WebGL2Samples/fbo_multisample.ts
@@ -85,7 +85,7 @@ const framebuffer: IRenderPassDescriptor = {
// -- Init VertexArray
const vertexArrays: { vertices?: IVertexAttributes }[] = [
{
- vertices: { position: { data: data, format: "float32x2" } }
+ vertices: { position: { data, format: "float32x2" } }
},
{
vertices: {
diff --git a/examples/src/WebGL2Samples/fbo_new_blend_equation.ts b/examples/src/WebGL2Samples/fbo_new_blend_equation.ts
index 211e340..1180ada 100644
--- a/examples/src/WebGL2Samples/fbo_new_blend_equation.ts
+++ b/examples/src/WebGL2Samples/fbo_new_blend_equation.ts
@@ -102,7 +102,7 @@ loadImage(imageUrl, function (image)
{
texture = {
size: [image.width, image.height],
- sources: [{ image: image, mipLevel: 0 }],
+ sources: [{ image, mipLevel: 0 }],
format: "rgba8unorm",
generateMipmap: true,
};
@@ -129,7 +129,7 @@ function render()
const renderObjects: IRenderPassObject[] = [];
const renderPass: IRenderPass = {
descriptor: { colorAttachments: [{ clearValue: [0.5, 0.0, 0.0, 1.0], loadOp: "clear" }] },
- renderObjects: renderObjects,
+ renderObjects,
};
for (let i = 0; i < Corners.MAX; ++i)
@@ -194,7 +194,6 @@ function render()
webgl.submit({ commandEncoders: [{ passEncoders: [renderPass] }] });
-
// -- Clean up
webgl.deleteTexture(texture);
webgl.deleteProgram(program);
diff --git a/examples/src/WebGL2Samples/fbo_read_pixels.ts b/examples/src/WebGL2Samples/fbo_read_pixels.ts
index beb7eb6..21e86a5 100644
--- a/examples/src/WebGL2Samples/fbo_read_pixels.ts
+++ b/examples/src/WebGL2Samples/fbo_read_pixels.ts
@@ -144,7 +144,7 @@ const renderObjects: IRenderPassObject[] = [];
// Pass 2
const rp: IRenderPass = {
descriptor: { colorAttachments: [{ clearValue: [0.0, 0.0, 0.0, 1.0], loadOp: "clear" }] },
- renderObjects: renderObjects
+ renderObjects
};
const ro: IRenderObject = {
diff --git a/examples/src/WebGL2Samples/fbo_rtt_texture_array.ts b/examples/src/WebGL2Samples/fbo_rtt_texture_array.ts
index 1380527..d18b080 100644
--- a/examples/src/WebGL2Samples/fbo_rtt_texture_array.ts
+++ b/examples/src/WebGL2Samples/fbo_rtt_texture_array.ts
@@ -148,7 +148,7 @@ const renderPass: IRenderPass = {
descriptor: {
colorAttachments: [{ clearValue: [0.0, 0.0, 0.0, 1.0], loadOp: "clear" }],
},
- renderObjects: renderObjects,
+ renderObjects,
};
const renderObject: IRenderObject = {
diff --git a/examples/src/WebGL2Samples/geo_vertex_format.ts b/examples/src/WebGL2Samples/geo_vertex_format.ts
index 3314559..8b590d7 100644
--- a/examples/src/WebGL2Samples/geo_vertex_format.ts
+++ b/examples/src/WebGL2Samples/geo_vertex_format.ts
@@ -148,7 +148,6 @@ import { getShaderSource, loadImage } from "./utility";
20, 21, 22, 20, 22, 23 // left
];
-
// -- Init VertexArray
const vertexArray: { vertices?: IVertexAttributes } = {
@@ -171,7 +170,7 @@ import { getShaderSource, loadImage } from "./utility";
format: "rgba8unorm",
mipLevelCount: 1,
size: [512, 512],
- sources: [{ image: image, flipY: false }],
+ sources: [{ image, flipY: false }],
};
sampler = {
minFilter: "nearest",
diff --git a/examples/src/WebGL2Samples/glsl_centroid.ts b/examples/src/WebGL2Samples/glsl_centroid.ts
index 84c2610..de92550 100644
--- a/examples/src/WebGL2Samples/glsl_centroid.ts
+++ b/examples/src/WebGL2Samples/glsl_centroid.ts
@@ -135,13 +135,13 @@ const vertexArrays: { vertices?: IVertexAttributes }[] = [
{
vertices: {
position: { data: positions, format: "float32x2" },
- data: { data: data, format: "float32" },
+ data: { data, format: "float32" },
}
},
{
vertices: {
position: { data: positions, format: "float32x2" },
- data: { data: data, format: "float32" },
+ data: { data, format: "float32" },
}
},
{
@@ -175,7 +175,7 @@ for (let i = 0; i < VIEWPORTS.MAX; ++i)
const renderObjects: IRenderPassObject[] = [];
// Pass 2
const rp2: IRenderPass = {
- renderObjects: renderObjects,
+ renderObjects,
};
const ro: IRenderObject = {
pipeline: programs[PROGRAM.SPLASH],
diff --git a/examples/src/WebGL2Samples/glsl_flat_smooth_interpolators.ts b/examples/src/WebGL2Samples/glsl_flat_smooth_interpolators.ts
index c345e47..769e135 100644
--- a/examples/src/WebGL2Samples/glsl_flat_smooth_interpolators.ts
+++ b/examples/src/WebGL2Samples/glsl_flat_smooth_interpolators.ts
@@ -111,7 +111,7 @@ glTFLoader.loadGLTF(gltfUrl, function (glTF)
},
},
};
- vertexArrayMaps[mid].push({ vertexArray, indices: indices });
+ vertexArrayMaps[mid].push({ vertexArray, indices });
}
}
@@ -143,7 +143,7 @@ glTFLoader.loadGLTF(gltfUrl, function (glTF)
colorAttachments: [{ clearValue: [0.0, 0.0, 0.0, 1.0], loadOp: "clear" }],
depthStencilAttachment: { depthLoadOp: "clear" }
},
- renderObjects: renderObjects,
+ renderObjects,
};
mat4.rotateY(modelView, modelView, rotatationSpeedY);
diff --git a/examples/src/WebGL2Samples/glsl_non_square_matrix.ts b/examples/src/WebGL2Samples/glsl_non_square_matrix.ts
index b0971f8..87f68bd 100644
--- a/examples/src/WebGL2Samples/glsl_non_square_matrix.ts
+++ b/examples/src/WebGL2Samples/glsl_non_square_matrix.ts
@@ -51,7 +51,7 @@ loadImage("../../assets/img/Di-3d.png", function (image)
size: [image.width, image.height],
format: "rgba8unorm",
sources: [{
- image: image, flipY: false,
+ image, flipY: false,
}]
};
const sampler: ISampler = { minFilter: "nearest", magFilter: "nearest" };
diff --git a/examples/src/WebGL2Samples/query_occlusion.ts b/examples/src/WebGL2Samples/query_occlusion.ts
index f76b58f..d15d444 100644
--- a/examples/src/WebGL2Samples/query_occlusion.ts
+++ b/examples/src/WebGL2Samples/query_occlusion.ts
@@ -48,7 +48,7 @@ const rp: IRenderPass = {
colorAttachments: [{ clearValue: [0.0, 0.0, 0.0, 1.0], loadOp: "clear" }],
depthStencilAttachment: { depthLoadOp: "clear" },
},
- renderObjects: renderObjects,
+ renderObjects,
};
const ro: IRenderObject = {
diff --git a/examples/src/WebGL2Samples/sampler_filter.ts b/examples/src/WebGL2Samples/sampler_filter.ts
index b34d8bd..482de0f 100644
--- a/examples/src/WebGL2Samples/sampler_filter.ts
+++ b/examples/src/WebGL2Samples/sampler_filter.ts
@@ -106,7 +106,6 @@ samplers[Corners.TOP_RIGHT].minFilter = "linear";
samplers[Corners.BOTTOM_RIGHT].minFilter = "linear";
samplers[Corners.BOTTOM_LEFT].minFilter = "linear";
-
// Mag filter
samplers[Corners.TOP_LEFT].magFilter = "nearest";
samplers[Corners.TOP_RIGHT].magFilter = "linear";
@@ -126,7 +125,7 @@ loadImage(imageUrl, function (image)
texture = {
size: [image.width, image.height],
format: "rgba8unorm",
- sources: [{ image: image, mipLevel: 0 }],
+ sources: [{ image, mipLevel: 0 }],
generateMipmap: true,
};
@@ -146,7 +145,7 @@ function render()
const renderObjects: IRenderPassObject[] = [];
const rp: IRenderPass = {
descriptor: { colorAttachments: [{ clearValue: [0.0, 0.0, 0.0, 1.0], loadOp: "clear" }] },
- renderObjects: renderObjects
+ renderObjects
};
const ro: IRenderObject = {
diff --git a/examples/src/WebGL2Samples/sampler_object.ts b/examples/src/WebGL2Samples/sampler_object.ts
index 05bf4ea..79f995f 100644
--- a/examples/src/WebGL2Samples/sampler_object.ts
+++ b/examples/src/WebGL2Samples/sampler_object.ts
@@ -69,7 +69,7 @@ loadImage(imageUrl, function (image)
{
texture = {
size: [image.width, image.height],
- sources: [{ image: image, mipLevel: 0 }],
+ sources: [{ image, mipLevel: 0 }],
format: "rgba8unorm",
generateMipmap: true,
};
diff --git a/examples/src/WebGL2Samples/sampler_wrap.ts b/examples/src/WebGL2Samples/sampler_wrap.ts
index df7eacc..91fbd8f 100644
--- a/examples/src/WebGL2Samples/sampler_wrap.ts
+++ b/examples/src/WebGL2Samples/sampler_wrap.ts
@@ -101,7 +101,7 @@ for (let i = 0; i < Corners.MAX; ++i)
samplers[i] = {
minFilter: "linear",
magFilter: "linear",
- mipmapFilter:"linear",
+ mipmapFilter: "linear",
};
}
@@ -123,7 +123,7 @@ loadImage(imageUrl, function (image)
{
texture = {
size: [image.width, image.height],
- sources: [{ image: image, mipLevel: 0 }],
+ sources: [{ image, mipLevel: 0 }],
format: "rgba8unorm",
generateMipmap: true,
};
@@ -136,7 +136,7 @@ function render()
// Clear color buffer
const rp: IRenderPass = {
descriptor: { colorAttachments: [{ clearValue: [0.0, 0.0, 0.0, 1.0], loadOp: "clear" }] },
- renderObjects: renderObjects,
+ renderObjects,
};
const matrix = new Float32Array([
diff --git a/examples/src/WebGL2Samples/texture_3d.ts b/examples/src/WebGL2Samples/texture_3d.ts
index 3bf11f3..48b1e93 100644
--- a/examples/src/WebGL2Samples/texture_3d.ts
+++ b/examples/src/WebGL2Samples/texture_3d.ts
@@ -84,7 +84,7 @@ import { getShaderSource } from "./utility";
dimension: "3d",
format: "r8unorm",
generateMipmap: true,
- sources: [{ __type: "TextureDataSource", mipLevel: 0, size: [SIZE, SIZE, SIZE], data: data }],
+ sources: [{ __type: "TextureDataSource", mipLevel: 0, size: [SIZE, SIZE, SIZE], data }],
};
const sampler: ISampler = {
lodMinClamp: 0,
diff --git a/examples/src/WebGL2Samples/texture_derivative.ts b/examples/src/WebGL2Samples/texture_derivative.ts
index 26fcca6..5e5762d 100644
--- a/examples/src/WebGL2Samples/texture_derivative.ts
+++ b/examples/src/WebGL2Samples/texture_derivative.ts
@@ -115,7 +115,6 @@ import { getShaderSource, loadImage } from "./utility";
20, 21, 22, 20, 22, 23 // left
];
-
// -- Init VertexArray
const vertexArray: { vertices?: IVertexAttributes } = {
vertices: {
@@ -137,7 +136,7 @@ import { getShaderSource, loadImage } from "./utility";
mipLevelCount: 1,
size: [512, 512],
sources: [{
- image: image, flipY: false,
+ image, flipY: false,
}]
};
sampler = {
diff --git a/examples/src/WebGL2Samples/texture_fetch.ts b/examples/src/WebGL2Samples/texture_fetch.ts
index 03762c8..4283d04 100644
--- a/examples/src/WebGL2Samples/texture_fetch.ts
+++ b/examples/src/WebGL2Samples/texture_fetch.ts
@@ -51,7 +51,7 @@ import { getShaderSource, loadImage } from "./utility";
size: [image.width, image.height],
format: "rgba8unorm",
sources: [{
- mipLevel: 0, image: image, flipY: false,
+ mipLevel: 0, image, flipY: false,
}],
};
const sampler: ISampler = {
diff --git a/examples/src/WebGL2Samples/texture_format.ts b/examples/src/WebGL2Samples/texture_format.ts
index 0630d44..30b0bad 100644
--- a/examples/src/WebGL2Samples/texture_format.ts
+++ b/examples/src/WebGL2Samples/texture_format.ts
@@ -144,7 +144,7 @@ import { getShaderSource, loadImage } from "./utility";
size: [image.width, image.height],
format: textureFormats[i].format,
sources: [{
- mipLevel: 0, image: image, flipY: false,
+ mipLevel: 0, image, flipY: false,
}],
};
samplers[i] = {
@@ -166,7 +166,7 @@ import { getShaderSource, loadImage } from "./utility";
const renderObjects: IRenderPassObject[] = [];
const rp: IRenderPass = {
descriptor: { colorAttachments: [{ clearValue: [0.0, 0.0, 0.0, 1.0], loadOp: "clear" }] },
- renderObjects: renderObjects
+ renderObjects
};
for (i = 0; i < TextureTypes.RGB8UI; ++i)
diff --git a/examples/src/WebGL2Samples/texture_grad.ts b/examples/src/WebGL2Samples/texture_grad.ts
index f2bf9a6..7f38b7d 100644
--- a/examples/src/WebGL2Samples/texture_grad.ts
+++ b/examples/src/WebGL2Samples/texture_grad.ts
@@ -131,7 +131,7 @@ import { getShaderSource, loadImage } from "./utility";
mipLevelCount: 1,
size: [512, 512],
sources: [{
- image: image, flipY: false,
+ image, flipY: false,
}]
};
sampler = {
diff --git a/examples/src/WebGL2Samples/texture_immutable.ts b/examples/src/WebGL2Samples/texture_immutable.ts
index e8a9981..9ad3d4d 100644
--- a/examples/src/WebGL2Samples/texture_immutable.ts
+++ b/examples/src/WebGL2Samples/texture_immutable.ts
@@ -88,7 +88,7 @@ import { getShaderSource, loadImage } from "./utility";
mipLevelCount: 1,
size: [512, 512],
sources: [{
- image: image, flipY: false,
+ image, flipY: false,
}],
};
const sampler2D: ISampler = {
@@ -111,7 +111,7 @@ import { getShaderSource, loadImage } from "./utility";
const renderObjects: IRenderPassObject[] = [];
const rp: IRenderPass = {
descriptor: { colorAttachments: [{ clearValue: [0.0, 0.0, 0.0, 1.0], loadOp: "clear" }] },
- renderObjects: renderObjects
+ renderObjects
};
renderObjects.push(
@@ -172,7 +172,7 @@ import { getShaderSource, loadImage } from "./utility";
generateMipmap: true,
mipLevelCount: Math.log2(SIZE),
size: [SIZE, SIZE, SIZE],
- sources: [{ __type: "TextureDataSource", size: [SIZE, SIZE, SIZE], data: data }],
+ sources: [{ __type: "TextureDataSource", size: [SIZE, SIZE, SIZE], data }],
};
const sampler3D: ISampler = {
lodMinClamp: 0,
diff --git a/examples/src/WebGL2Samples/texture_integer.ts b/examples/src/WebGL2Samples/texture_integer.ts
index c3c4e4a..5fe9048 100644
--- a/examples/src/WebGL2Samples/texture_integer.ts
+++ b/examples/src/WebGL2Samples/texture_integer.ts
@@ -53,7 +53,7 @@ import { getShaderSource, loadImage } from "./utility";
size: [image.width, image.height],
format: "rgba8uint",
sources: [{
- mipLevel: 0, image: image, flipY: false,
+ mipLevel: 0, image, flipY: false,
}],
};
const sampler: ISampler = {
diff --git a/examples/src/WebGL2Samples/texture_lod.ts b/examples/src/WebGL2Samples/texture_lod.ts
index 2720e97..a2c740a 100644
--- a/examples/src/WebGL2Samples/texture_lod.ts
+++ b/examples/src/WebGL2Samples/texture_lod.ts
@@ -128,7 +128,7 @@ import { getShaderSource, loadImage } from "./utility";
size: [image.width, image.height],
format: "rgba8unorm",
generateMipmap: true,
- sources: [{ mipLevel: 0, image: image }],
+ sources: [{ mipLevel: 0, image }],
};
samplers[Corners.TOP_LEFT] = {
minFilter: "linear",
@@ -140,7 +140,7 @@ import { getShaderSource, loadImage } from "./utility";
size: [image.width, image.height],
format: "rgba8unorm",
generateMipmap: true,
- sources: [{ mipLevel: 0, image: image }],
+ sources: [{ mipLevel: 0, image }],
};
samplers[Corners.TOP_RIGHT] = {
minFilter: "linear",
@@ -154,7 +154,7 @@ import { getShaderSource, loadImage } from "./utility";
size: [image.width, image.height],
format: "rgba8unorm",
generateMipmap: true,
- sources: [{ mipLevel: 0, image: image }],
+ sources: [{ mipLevel: 0, image }],
};
samplers[Corners.BOTTOM_LEFT] = {
minFilter: "linear",
@@ -168,7 +168,7 @@ import { getShaderSource, loadImage } from "./utility";
size: [image.width, image.height],
format: "rgba8unorm",
generateMipmap: true,
- sources: [{ mipLevel: 0, image: image }],
+ sources: [{ mipLevel: 0, image }],
};
samplers[Corners.BOTTOM_RIGHT] = {
minFilter: "linear",
@@ -187,7 +187,7 @@ import { getShaderSource, loadImage } from "./utility";
// Clear color buffer
const rp: IRenderPass = {
descriptor: { colorAttachments: [{ clearValue: [0.0, 0.0, 0.0, 1.0], loadOp: "clear" }] },
- renderObjects: renderObjects,
+ renderObjects,
};
const matrix = new Float32Array([
diff --git a/examples/src/WebGL2Samples/texture_offset.ts b/examples/src/WebGL2Samples/texture_offset.ts
index dd59350..b423614 100644
--- a/examples/src/WebGL2Samples/texture_offset.ts
+++ b/examples/src/WebGL2Samples/texture_offset.ts
@@ -75,7 +75,7 @@ import { getShaderSource, loadImage } from "./utility";
const texture: ITexture = {
size: [image.width, image.height],
format: "rgba8unorm",
- sources: [{ mipLevel: 0, image: image, flipY: false, }],
+ sources: [{ mipLevel: 0, image, flipY: false }],
};
const sampler: ISampler = {
minFilter: "nearest",
@@ -88,7 +88,7 @@ import { getShaderSource, loadImage } from "./utility";
// -- Render
const rp: IRenderPass = {
descriptor: { colorAttachments: [{ clearValue: [0.0, 0.0, 0.0, 1.0], loadOp: "clear" }] },
- renderObjects: renderObjects
+ renderObjects
};
const matrix = new Float32Array([
diff --git a/examples/src/WebGL2Samples/texture_pixel_store.ts b/examples/src/WebGL2Samples/texture_pixel_store.ts
index cfe63ca..89d05f5 100644
--- a/examples/src/WebGL2Samples/texture_pixel_store.ts
+++ b/examples/src/WebGL2Samples/texture_pixel_store.ts
@@ -80,7 +80,7 @@ import { getShaderSource, loadImage } from "./utility";
// -- Render
const rp: IRenderPass = {
descriptor: { colorAttachments: [{ clearValue: [0.0, 0.0, 0.0, 1.0], loadOp: "clear" }] },
- renderObjects: renderObjects,
+ renderObjects,
};
const matrix = new Float32Array([
diff --git a/examples/src/WebGL2Samples/texture_srgb.ts b/examples/src/WebGL2Samples/texture_srgb.ts
index 4aca404..f5a947e 100644
--- a/examples/src/WebGL2Samples/texture_srgb.ts
+++ b/examples/src/WebGL2Samples/texture_srgb.ts
@@ -47,7 +47,7 @@ import { getShaderSource, loadImage } from "./utility";
const vertices: IVertexAttributes = {
position: { data: vertexPosBuffer, format: "float32x2" },
textureCoordinates: { data: vertexTexBuffer, format: "float32x2" },
- }
+ };
// -- Load texture then render
@@ -59,7 +59,7 @@ import { getShaderSource, loadImage } from "./utility";
texture = {
size: [image.width, image.height],
format: "rgba8unorm-srgb",
- sources: [{ mipLevel: 0, image: image }],
+ sources: [{ mipLevel: 0, image }],
};
sampler = { minFilter: "nearest", magFilter: "nearest" };
@@ -72,7 +72,7 @@ import { getShaderSource, loadImage } from "./utility";
// Clear color buffer
const rp: IRenderPass = {
descriptor: { colorAttachments: [{ clearValue: [0.0, 0.0, 0.0, 1.0], loadOp: "clear" }] },
- renderObjects: renderObjects,
+ renderObjects,
};
const matrix = new Float32Array([
diff --git a/examples/src/WebGL2Samples/texture_vertex.ts b/examples/src/WebGL2Samples/texture_vertex.ts
index 152a8ca..79edd93 100644
--- a/examples/src/WebGL2Samples/texture_vertex.ts
+++ b/examples/src/WebGL2Samples/texture_vertex.ts
@@ -111,7 +111,7 @@ import { getShaderSource, loadImage } from "./utility";
format: "rgba8unorm",
mipLevelCount: 1,
size: [256, 256],
- sources: [{ image: image, flipY: false, }],
+ sources: [{ image, flipY: false }],
};
sampler = {
minFilter: "nearest",
@@ -192,7 +192,7 @@ import { getShaderSource, loadImage } from "./utility";
colorAttachments: [{ clearValue: [0.0, 0.0, 0.0, 1.0], loadOp: "clear" }],
depthStencilAttachment: { depthLoadOp: "clear" }
},
- renderObjects: renderObjects,
+ renderObjects,
};
orientation[0] = 0.00020; // yaw
diff --git a/examples/src/WebGL2Samples/transform_feedback_instanced.ts b/examples/src/WebGL2Samples/transform_feedback_instanced.ts
index 28907b7..0fd0b22 100644
--- a/examples/src/WebGL2Samples/transform_feedback_instanced.ts
+++ b/examples/src/WebGL2Samples/transform_feedback_instanced.ts
@@ -159,7 +159,7 @@ import { getShaderSource } from "./utility";
}
]
}]
- }
+ };
function transform()
{
diff --git a/examples/src/WebGL2Samples/transform_feedback_separated_2.ts b/examples/src/WebGL2Samples/transform_feedback_separated_2.ts
index 6dae627..055ade8 100644
--- a/examples/src/WebGL2Samples/transform_feedback_separated_2.ts
+++ b/examples/src/WebGL2Samples/transform_feedback_separated_2.ts
@@ -164,7 +164,7 @@ import { getShaderSource } from "./utility";
}
]
}]
- }
+ };
function transform()
{
diff --git a/examples/src/regl-examples/bunny.ts b/examples/src/regl-examples/bunny.ts
index 2fb76c8..388a196 100644
--- a/examples/src/regl-examples/bunny.ts
+++ b/examples/src/regl-examples/bunny.ts
@@ -82,8 +82,8 @@ function draw()
[0, 2.5, 0],
[0, 1, 0]);
- renderObject.uniforms.projection =
- mat4.perspective([],
+ renderObject.uniforms.projection
+ = mat4.perspective([],
Math.PI / 4,
viewportWidth / viewportHeight,
0.01,
diff --git a/examples/src/regl-examples/cloth.ts b/examples/src/regl-examples/cloth.ts
index e4cf4d7..b67600e 100644
--- a/examples/src/regl-examples/cloth.ts
+++ b/examples/src/regl-examples/cloth.ts
@@ -370,8 +370,8 @@ import * as vec3 from "./stackgl/gl-vec3";
camera.tick();
renderObject.uniforms.view = camera.view();
- renderObject.uniforms.projection =
- mat4.perspective([],
+ renderObject.uniforms.projection
+ = mat4.perspective([],
Math.PI / 4,
viewportWidth / viewportHeight,
0.01,
diff --git a/examples/src/regl-examples/cube.ts b/examples/src/regl-examples/cube.ts
index 7c53d43..f1dfad8 100644
--- a/examples/src/regl-examples/cube.ts
+++ b/examples/src/regl-examples/cube.ts
@@ -118,8 +118,8 @@ import * as mat4 from "./stackgl/gl-mat4";
[5 * Math.cos(t), 2.5 * Math.sin(t), 5 * Math.sin(t)],
[0, 0.0, 0],
[0, 1, 0]);
- renderObject.uniforms.projection =
- mat4.perspective([],
+ renderObject.uniforms.projection
+ = mat4.perspective([],
Math.PI / 4,
viewportWidth / viewportHeight,
0.01,
diff --git a/examples/src/test/fractalCube.ts b/examples/src/test/fractalCube.ts
index c9841d9..35e98ed 100644
--- a/examples/src/test/fractalCube.ts
+++ b/examples/src/test/fractalCube.ts
@@ -97,7 +97,7 @@ async function main()
},
]
}]
- }
+ };
let then = 0;
diff --git a/examples/src/webgl-examples/sample2.ts b/examples/src/webgl-examples/sample2.ts
index d24120b..be3e0e3 100644
--- a/examples/src/webgl-examples/sample2.ts
+++ b/examples/src/webgl-examples/sample2.ts
@@ -44,7 +44,7 @@ function main()
},
vertices: {
aVertexPosition: {
- format:"float32x2",
+ format: "float32x2",
data: new Float32Array([
1.0, 1.0,
-1.0, 1.0,
diff --git a/src/RunWebGL.ts b/src/RunWebGL.ts
index 051166b..fa75989 100644
--- a/src/RunWebGL.ts
+++ b/src/RunWebGL.ts
@@ -458,7 +458,7 @@ export class RunWebGL
*/
private runUniform(gl: WebGLRenderingContext, type: IGLUniformBufferType, uniformInfo: IUniformItemInfo, data: any)
{
- if (typeof data === 'number')
+ if (typeof data === "number")
{
data = [data];
}
@@ -718,7 +718,7 @@ export class RunWebGL
{
if (depthStencil && (depthStencil.depthWriteEnabled || depthStencil.depthCompare !== "always"))
{
- const depthCompare: IGLCompareFunction = getIGLCompareFunction(depthStencil.depthCompare ?? 'less');
+ const depthCompare: IGLCompareFunction = getIGLCompareFunction(depthStencil.depthCompare ?? "less");
const depthWriteEnabled = depthStencil.depthWriteEnabled ?? true;
//
gl.enable(gl.DEPTH_TEST);
@@ -783,7 +783,7 @@ export class RunWebGL
gl.colorMask(colorMask[0], colorMask[1], colorMask[2], colorMask[3]);
//
- let blend = targets?.[0]?.blend;
+ const blend = targets?.[0]?.blend;
if (blend)
{
const color: IBlendComponent = blend.color;
diff --git a/src/caches/getGLFramebuffer.ts b/src/caches/getGLFramebuffer.ts
index 7c31e00..57983ea 100644
--- a/src/caches/getGLFramebuffer.ts
+++ b/src/caches/getGLFramebuffer.ts
@@ -111,18 +111,19 @@ export function getGLFramebuffer(gl: WebGLRenderingContext, passDescriptor: IRen
}
/**
- *
- * @param gl
- * @param passDescriptor
+ *
+ * @param gl
+ * @param passDescriptor
* @param handleMultisample 处理存在多重采样的渲染通道描述。
- * @returns
+ * @returns
*/
export function deleteFramebuffer(gl: WebGLRenderingContext, passDescriptor: IRenderPassDescriptor, handleMultisample = true)
{
if (handleMultisample && passDescriptor?.[_IGLRenderPassDescriptorWithMultisample])
{
deleteRenderPassDescriptorWithMultisample(gl, passDescriptor[_IGLRenderPassDescriptorWithMultisample]);
- return;
+
+return;
}
const webGLFramebuffer = gl._framebuffers.get(passDescriptor);
@@ -139,5 +140,5 @@ function deleteRenderPassDescriptorWithMultisample(gl: WebGLRenderingContext, re
renderPassDescriptorWithMultisample.renderbuffers.forEach((v) =>
{
deleteRenderbuffer(gl, v);
- })
+ });
}
\ No newline at end of file
diff --git a/src/caches/getGLProgram.ts b/src/caches/getGLProgram.ts
index d15247b..5c38125 100644
--- a/src/caches/getGLProgram.ts
+++ b/src/caches/getGLProgram.ts
@@ -349,7 +349,7 @@ function getBufferBindingInfo(uniformBlock: IUniformBlockInfo): IBufferBindingIn
//
const paths = itemInfo.paths.slice(1);
//
- items.push({ paths, offset: itemInfoOffset, size: itemInfoSize, Cls: Cls });
+ items.push({ paths, offset: itemInfoOffset, size: itemInfoSize, Cls });
});
});
currentSize = roundUp(16, currentSize); // 整个统一块数据对齐
@@ -370,7 +370,7 @@ function roundUp(k: number, n: number): number
}
/**
- *
+ *
* @see https://github.com/brendan-duncan/wgsl_reflect/blob/main/src/wgsl_reflect.ts#L1206
* @see https://www.orillusion.com/zh/wgsl.html#memory-layouts
*/
@@ -381,29 +381,29 @@ const uniformBufferTypeAlignSizeMap: {
clsType: Float32ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor,
}
} = {
- "FLOAT": { align: 4, size: 4, clsType: Float32Array },
- "FLOAT_VEC2": { align: 8, size: 8, clsType: Float32Array },
- "FLOAT_VEC3": { align: 16, size: 12, clsType: Float32Array },
- "FLOAT_VEC4": { align: 16, size: 16, clsType: Float32Array },
- "INT": { align: 4, size: 4, clsType: Int32Array },
- "INT_VEC2": { align: 8, size: 8, clsType: Int32Array },
- "INT_VEC3": { align: 16, size: 12, clsType: Int32Array },
- "INT_VEC4": { align: 16, size: 16, clsType: Int32Array },
- "BOOL": { align: 4, size: 4, clsType: Int32Array },
- "BOOL_VEC2": { align: 8, size: 8, clsType: Int32Array },
- "BOOL_VEC3": { align: 16, size: 12, clsType: Int32Array },
- "BOOL_VEC4": { align: 16, size: 16, clsType: Int32Array },
- "FLOAT_MAT2": { align: 8, size: 16, clsType: Float32Array },
- "FLOAT_MAT3": { align: 16, size: 48, clsType: Float32Array },
- "FLOAT_MAT4": { align: 16, size: 64, clsType: Float32Array },
- "UNSIGNED_INT": { align: 4, size: 4, clsType: Uint32Array },
- "UNSIGNED_INT_VEC2": { align: 8, size: 8, clsType: Uint32Array },
- "UNSIGNED_INT_VEC3": { align: 16, size: 12, clsType: Uint32Array },
- "UNSIGNED_INT_VEC4": { align: 16, size: 16, clsType: Uint32Array },
- "FLOAT_MAT2x3": { align: 16, size: 32, clsType: Float32Array },
- "FLOAT_MAT2x4": { align: 16, size: 32, clsType: Float32Array },
- "FLOAT_MAT3x2": { align: 8, size: 24, clsType: Float32Array },
- "FLOAT_MAT3x4": { align: 16, size: 48, clsType: Float32Array },
- "FLOAT_MAT4x2": { align: 8, size: 32, clsType: Float32Array },
- "FLOAT_MAT4x3": { align: 16, size: 64, clsType: Float32Array },
+ FLOAT: { align: 4, size: 4, clsType: Float32Array },
+ FLOAT_VEC2: { align: 8, size: 8, clsType: Float32Array },
+ FLOAT_VEC3: { align: 16, size: 12, clsType: Float32Array },
+ FLOAT_VEC4: { align: 16, size: 16, clsType: Float32Array },
+ INT: { align: 4, size: 4, clsType: Int32Array },
+ INT_VEC2: { align: 8, size: 8, clsType: Int32Array },
+ INT_VEC3: { align: 16, size: 12, clsType: Int32Array },
+ INT_VEC4: { align: 16, size: 16, clsType: Int32Array },
+ BOOL: { align: 4, size: 4, clsType: Int32Array },
+ BOOL_VEC2: { align: 8, size: 8, clsType: Int32Array },
+ BOOL_VEC3: { align: 16, size: 12, clsType: Int32Array },
+ BOOL_VEC4: { align: 16, size: 16, clsType: Int32Array },
+ FLOAT_MAT2: { align: 8, size: 16, clsType: Float32Array },
+ FLOAT_MAT3: { align: 16, size: 48, clsType: Float32Array },
+ FLOAT_MAT4: { align: 16, size: 64, clsType: Float32Array },
+ UNSIGNED_INT: { align: 4, size: 4, clsType: Uint32Array },
+ UNSIGNED_INT_VEC2: { align: 8, size: 8, clsType: Uint32Array },
+ UNSIGNED_INT_VEC3: { align: 16, size: 12, clsType: Uint32Array },
+ UNSIGNED_INT_VEC4: { align: 16, size: 16, clsType: Uint32Array },
+ FLOAT_MAT2x3: { align: 16, size: 32, clsType: Float32Array },
+ FLOAT_MAT2x4: { align: 16, size: 32, clsType: Float32Array },
+ FLOAT_MAT3x2: { align: 8, size: 24, clsType: Float32Array },
+ FLOAT_MAT3x4: { align: 16, size: 48, clsType: Float32Array },
+ FLOAT_MAT4x2: { align: 8, size: 32, clsType: Float32Array },
+ FLOAT_MAT4x3: { align: 16, size: 64, clsType: Float32Array },
};
\ No newline at end of file
diff --git a/src/caches/getGLRenderOcclusionQuery.ts b/src/caches/getGLRenderOcclusionQuery.ts
index cc8c974..36fba8b 100644
--- a/src/caches/getGLRenderOcclusionQuery.ts
+++ b/src/caches/getGLRenderOcclusionQuery.ts
@@ -108,7 +108,7 @@ export function getGLOcclusionQueryStep(gl: WebGL2RenderingContext, occlusionQue
}
return undefined;
- }
+ };
return { begin, end, resolve } as IGLOcclusionQueryStep;
}
diff --git a/src/caches/getGLSampler.ts b/src/caches/getGLSampler.ts
index dca0041..9fe3d6b 100644
--- a/src/caches/getGLSampler.ts
+++ b/src/caches/getGLSampler.ts
@@ -67,7 +67,7 @@ export function getIGLTextureWrap(addressMode: IAddressMode = "repeat")
const addressModeMap: { [key: string]: IGLTextureWrap } = {
"clamp-to-edge": "CLAMP_TO_EDGE",
- "repeat": "REPEAT",
+ repeat: "REPEAT",
"mirror-repeat": "MIRRORED_REPEAT",
};
@@ -118,6 +118,6 @@ export function getIGLTextureMagFilter(magFilter: IFilterMode = "nearest")
}
const magFilterMap: { [key: string]: IGLTextureMagFilter } = {
- "nearest": "NEAREST",
- "linear": "LINEAR",
+ nearest: "NEAREST",
+ linear: "LINEAR",
};
\ No newline at end of file
diff --git a/src/caches/getGLTexture.ts b/src/caches/getGLTexture.ts
index 126b568..c8cce70 100644
--- a/src/caches/getGLTexture.ts
+++ b/src/caches/getGLTexture.ts
@@ -230,7 +230,7 @@ export function getGLTexture(gl: WebGLRenderingContext, texture: ITexture)
{
for (let i = 0; i < mipLevelCount; i++)
{
- gl.texImage2D(gl[target], i, gl[format], width, height, 0, gl[format], gl[type], null)
+ gl.texImage2D(gl[target], i, gl[format], width, height, 0, gl[format], gl[type], null);
}
}
else
@@ -239,7 +239,7 @@ export function getGLTexture(gl: WebGLRenderingContext, texture: ITexture)
}
}
}
- }
+ };
createTexture();
const updateSources = () =>
@@ -325,7 +325,8 @@ export function getGLTexture(gl: WebGLRenderingContext, texture: ITexture)
console.error(`WebGL1 中 不支持 ${target} 纹理类型!`);
}
}
- return;
+
+return;
}
// 处理数据资源
@@ -373,7 +374,7 @@ export function getGLTexture(gl: WebGLRenderingContext, texture: ITexture)
gl.texSubImage2D(gl[bindTarget], mipLevel, xoffset, yoffset, width, height, gl[format], gl[type], data);
- console.assert(!offset, `WebGL1 不支持 IGLTextureDataSource.dataLayout.offset !`)
+ console.assert(!offset, `WebGL1 不支持 IGLTextureDataSource.dataLayout.offset !`);
}
else
{
diff --git a/src/caches/getIGLDrawMode.ts b/src/caches/getIGLDrawMode.ts
index 529e35b..77980f0 100644
--- a/src/caches/getIGLDrawMode.ts
+++ b/src/caches/getIGLDrawMode.ts
@@ -17,8 +17,8 @@ const drawModeMap: { [key: string]: IGLDrawMode } = {
"line-strip": "LINE_STRIP",
"triangle-list": "TRIANGLES",
"triangle-strip": "TRIANGLE_STRIP",
- "LINE_LOOP": "LINE_LOOP",
- "TRIANGLE_FAN": "TRIANGLE_FAN",
+ LINE_LOOP: "LINE_LOOP",
+ TRIANGLE_FAN: "TRIANGLE_FAN",
};
/**
diff --git a/src/caches/getIGLRenderPassDescriptorWithMultisample.ts b/src/caches/getIGLRenderPassDescriptorWithMultisample.ts
index 326c343..d5022c5 100644
--- a/src/caches/getIGLRenderPassDescriptorWithMultisample.ts
+++ b/src/caches/getIGLRenderPassDescriptorWithMultisample.ts
@@ -4,11 +4,11 @@ import { GLRenderbufferInternalformat, IGLRenderbuffer } from "../data/IGLRender
import { getIGLTextureFormats } from "./getIGLTextureFormats";
/**
- *
+ *
* 当需要渲染到纹理并且开启多重采样时,就必须使用支持多重采样的渲染缓冲区来进行接受中间结果再拷贝到模板纹理上。
- *
+ *
* 当`passDescriptor.multisample`值存在时,引擎将会自动创建支持`multisample`的`IGLRenderbuffer`用于接收颜色附件的结果。在渲染通道执行结束后在由`IGLRenderbuffer`拷贝到对应纹理上。
- *
+ *
* @param sourcePassDescriptor 需要渲染到纹理并且开启多重采样的渲染通道描述。
*/
export function getIGLRenderPassDescriptorWithMultisample(sourcePassDescriptor: IRenderPassDescriptor): IGLRenderPassDescriptorWithMultisample
@@ -38,7 +38,8 @@ export function getIGLRenderPassDescriptorWithMultisample(sourcePassDescriptor:
...v,
view: renderbuffer as any,
};
- return colorAttachment;
+
+return colorAttachment;
}),
depthStencilAttachment: sourcePassDescriptor.depthStencilAttachment,
sampleCount: sourcePassDescriptor.sampleCount,
diff --git a/src/caches/getIGLTextureFormats.ts b/src/caches/getIGLTextureFormats.ts
index 995dfae..f688e6c 100644
--- a/src/caches/getIGLTextureFormats.ts
+++ b/src/caches/getIGLTextureFormats.ts
@@ -11,48 +11,48 @@ export function getIGLTextureFormats(format: ITextureFormat = "rgba8unorm")
}
const formatMap: { [key: string]: IGLTextureFormats } = {
- "r8unorm": { internalformat: "R8", format: "RED", type: "UNSIGNED_BYTE", },
- "r8snorm": undefined,
- "r8uint": { internalformat: "R8", format: "RED", type: "UNSIGNED_BYTE", },
- "r8sint": undefined,
- "r16uint": undefined,
- "r16sint": undefined,
- "r16float": { internalformat: "R16F", format: "RED", type: "HALF_FLOAT" },
- "rg8unorm": undefined,
- "rg8snorm": undefined,
- "rg8uint": undefined,
- "rg8sint": undefined,
- "r32uint": undefined,
- "r32sint": undefined,
- "r32float": undefined,
- "rg16uint": undefined,
- "rg16sint": undefined,
- "rg16float": { internalformat: "RG16F", format: "RG", type: "HALF_FLOAT" },
- "rgba8unorm": { internalformat: "RGBA8", format: "RGBA", type: "UNSIGNED_BYTE" },
- "rgba8unorm-srgb": { internalformat: "SRGB8", format: "RGB", type: "UNSIGNED_BYTE", },
- "rgba8snorm": undefined,
- "rgba8uint": { internalformat: "RGBA8UI", format: "RGBA_INTEGER", type: "UNSIGNED_BYTE", },
- "rgba8sint": undefined,
- "bgra8unorm": undefined,
+ r8unorm: { internalformat: "R8", format: "RED", type: "UNSIGNED_BYTE" },
+ r8snorm: undefined,
+ r8uint: { internalformat: "R8", format: "RED", type: "UNSIGNED_BYTE" },
+ r8sint: undefined,
+ r16uint: undefined,
+ r16sint: undefined,
+ r16float: { internalformat: "R16F", format: "RED", type: "HALF_FLOAT" },
+ rg8unorm: undefined,
+ rg8snorm: undefined,
+ rg8uint: undefined,
+ rg8sint: undefined,
+ r32uint: undefined,
+ r32sint: undefined,
+ r32float: undefined,
+ rg16uint: undefined,
+ rg16sint: undefined,
+ rg16float: { internalformat: "RG16F", format: "RG", type: "HALF_FLOAT" },
+ rgba8unorm: { internalformat: "RGBA8", format: "RGBA", type: "UNSIGNED_BYTE" },
+ "rgba8unorm-srgb": { internalformat: "SRGB8", format: "RGB", type: "UNSIGNED_BYTE" },
+ rgba8snorm: undefined,
+ rgba8uint: { internalformat: "RGBA8UI", format: "RGBA_INTEGER", type: "UNSIGNED_BYTE" },
+ rgba8sint: undefined,
+ bgra8unorm: undefined,
"bgra8unorm-srgb": undefined,
- "rgb9e5ufloat": undefined,
- "rgb10a2uint": undefined,
- "rgb10a2unorm": undefined,
- "rg11b10ufloat": undefined,
- "rg32uint": undefined,
- "rg32sint": undefined,
- "rg32float": undefined,
- "rgba16uint": undefined,
- "rgba16sint": undefined,
- "rgba16float": { internalformat: "RGB16F", format: "RGB", type: "HALF_FLOAT" },
- "rgba32uint": undefined,
- "rgba32sint": undefined,
- "rgba32float": { internalformat: "RGBA32F", format: "RGBA", type: "FLOAT" },
- "stencil8": undefined,
- "depth16unorm": { internalformat: "DEPTH_COMPONENT16", format: "DEPTH_COMPONENT", type: "UNSIGNED_SHORT", },
- "depth24plus": undefined,
+ rgb9e5ufloat: undefined,
+ rgb10a2uint: undefined,
+ rgb10a2unorm: undefined,
+ rg11b10ufloat: undefined,
+ rg32uint: undefined,
+ rg32sint: undefined,
+ rg32float: undefined,
+ rgba16uint: undefined,
+ rgba16sint: undefined,
+ rgba16float: { internalformat: "RGB16F", format: "RGB", type: "HALF_FLOAT" },
+ rgba32uint: undefined,
+ rgba32sint: undefined,
+ rgba32float: { internalformat: "RGBA32F", format: "RGBA", type: "FLOAT" },
+ stencil8: undefined,
+ depth16unorm: { internalformat: "DEPTH_COMPONENT16", format: "DEPTH_COMPONENT", type: "UNSIGNED_SHORT" },
+ depth24plus: undefined,
"depth24plus-stencil8": undefined,
- "depth32float": undefined,
+ depth32float: undefined,
"depth32float-stencil8": undefined,
"bc1-rgba-unorm": undefined,
"bc1-rgba-unorm-srgb": undefined,
diff --git a/src/caches/getIGLTextureTarget.ts b/src/caches/getIGLTextureTarget.ts
index 284df9a..77e7f47 100644
--- a/src/caches/getIGLTextureTarget.ts
+++ b/src/caches/getIGLTextureTarget.ts
@@ -13,7 +13,7 @@ const dimensionMap: { [key: string]: IGLTextureTarget } = {
"1d": undefined,
"2d": "TEXTURE_2D",
"2d-array": "TEXTURE_2D_ARRAY",
- "cube": "TEXTURE_CUBE_MAP",
+ cube: "TEXTURE_CUBE_MAP",
"cube-array": undefined,
"3d": "TEXTURE_3D",
};
\ No newline at end of file
diff --git a/src/data/IGLCommandEncoder.ts b/src/data/IGLCommandEncoder.ts
index bbcfa7b..32bff98 100644
--- a/src/data/IGLCommandEncoder.ts
+++ b/src/data/IGLCommandEncoder.ts
@@ -17,7 +17,7 @@ declare module "@feng3d/render-api"
export interface IImageCopyTexture
{
/**
- *
+ *
* 注:当值设置为 null或者undefined时表示当前画布。
*/
texture: ITextureLike;
diff --git a/src/data/IGLDepthStencilState.ts b/src/data/IGLDepthStencilState.ts
index dc5f101..6e4f1db 100644
--- a/src/data/IGLDepthStencilState.ts
+++ b/src/data/IGLDepthStencilState.ts
@@ -1,4 +1,3 @@
-
/**
* 深度状态。
*/
diff --git a/src/data/IGLOcclusionQuery.ts b/src/data/IGLOcclusionQuery.ts
index 416155e..778c777 100644
--- a/src/data/IGLOcclusionQuery.ts
+++ b/src/data/IGLOcclusionQuery.ts
@@ -14,7 +14,7 @@ export interface IGLOcclusionQuery
/**
* 临时变量, 执行过程中由引擎自动填充。
- *
+ *
* @internal
*/
_step?: IGLOcclusionQueryStep;
diff --git a/src/data/IGLPrimitiveState.ts b/src/data/IGLPrimitiveState.ts
index e1e876e..2b40897 100644
--- a/src/data/IGLPrimitiveState.ts
+++ b/src/data/IGLPrimitiveState.ts
@@ -33,7 +33,7 @@ declare module "@feng3d/render-api"
/**
* * `FRONT_AND_BACK` 剔除正面与背面,仅在WebGL中生效!
- *
+ *
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/cullFace
*/
readonly cullFace?: ICullFace;
diff --git a/src/data/IGLTexturePixelStore.ts b/src/data/IGLTexturePixelStore.ts
index 346ffc3..381a7bb 100644
--- a/src/data/IGLTexturePixelStore.ts
+++ b/src/data/IGLTexturePixelStore.ts
@@ -1,4 +1,3 @@
-
/**
* 像素解包打包时参数。
*
diff --git a/src/data/IGLTransformFeedbackPass.ts b/src/data/IGLTransformFeedbackPass.ts
index 413eb17..2e9228e 100644
--- a/src/data/IGLTransformFeedbackPass.ts
+++ b/src/data/IGLTransformFeedbackPass.ts
@@ -36,7 +36,7 @@ export interface IGLTransformFeedbackObject
/**
* 根据顶点数据绘制图元。
- *
+ *
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawVertex
*/
readonly drawVertex: IDrawVertex;
diff --git a/src/runs/getIGLBuffer.ts b/src/runs/getIGLBuffer.ts
index 646fc32..8ac9694 100644
--- a/src/runs/getIGLBuffer.ts
+++ b/src/runs/getIGLBuffer.ts
@@ -7,9 +7,9 @@ export function getIGLBuffer(data: TypedArray, target?: IGLBufferTarget, usage:
const buffer: IBuffer = {
size: Math.ceil(data.byteLength / 4) * 4,
- target: target,
- usage: usage,
- data: data,
+ target,
+ usage,
+ data,
};
data[_IGLBuffer] = buffer;
diff --git a/src/runs/runColorTargetStates.ts b/src/runs/runColorTargetStates.ts
index e46060a..ad9f59c 100644
--- a/src/runs/runColorTargetStates.ts
+++ b/src/runs/runColorTargetStates.ts
@@ -12,11 +12,11 @@ export function getIGLBlendEquation(operation?: IBlendOperation)
}
const operationMap: { [key: string]: IGLBlendEquation } = {
- "add": "FUNC_ADD",
- "subtract": "FUNC_SUBTRACT",
+ add: "FUNC_ADD",
+ subtract: "FUNC_SUBTRACT",
"reverse-subtract": "FUNC_REVERSE_SUBTRACT",
- "min": "MIN",
- "max": "MAX",
+ min: "MIN",
+ max: "MAX",
};
export function getIGLBlendFactor(blendFactor: IBlendFactor, operation: IBlendOperation)
@@ -33,18 +33,18 @@ export function getIGLBlendFactor(blendFactor: IBlendFactor, operation: IBlendOp
}
const blendFactorMap: { [key: string]: IGLBlendFactor } = {
- "zero": "ZERO",
- "one": "ONE",
- "src": "SRC_COLOR",
+ zero: "ZERO",
+ one: "ONE",
+ src: "SRC_COLOR",
"one-minus-src": "ONE_MINUS_SRC_COLOR",
"src-alpha": "SRC_ALPHA",
"one-minus-src-alpha": "ONE_MINUS_SRC_ALPHA",
- "dst": "DST_COLOR",
+ dst: "DST_COLOR",
"one-minus-dst": "ONE_MINUS_DST_COLOR",
"dst-alpha": "DST_ALPHA",
"one-minus-dst-alpha": "ONE_MINUS_DST_ALPHA",
"src-alpha-saturated": "SRC_ALPHA_SATURATE",
- "constant": "CONSTANT_COLOR",
+ constant: "CONSTANT_COLOR",
"one-minus-constant": "ONE_MINUS_CONSTANT_COLOR",
};
diff --git a/src/runs/runDepthState.ts b/src/runs/runDepthState.ts
index 9d99e8b..b4d5ca0 100644
--- a/src/runs/runDepthState.ts
+++ b/src/runs/runDepthState.ts
@@ -6,17 +6,17 @@ export function getIGLCompareFunction(depthCompare: ICompareFunction)
const glDepthCompare: IGLCompareFunction = depthCompareMap[depthCompare];
console.assert(!!glDepthCompare, `接收到错误值,请从 ${Object.keys(depthCompareMap).toString()} 中取值!`);
-
+
return glDepthCompare;
}
const depthCompareMap: { [key: string]: IGLCompareFunction } = {
- "never": "NEVER",
- "less": "LESS",
- "equal": "EQUAL",
+ never: "NEVER",
+ less: "LESS",
+ equal: "EQUAL",
"less-equal": "LEQUAL",
- "greater": "GREATER",
+ greater: "GREATER",
"not-equal": "NOTEQUAL",
"greater-equal": "GEQUAL",
- "always": "ALWAYS",
+ always: "ALWAYS",
};
\ No newline at end of file
diff --git a/src/runs/runStencilState.ts b/src/runs/runStencilState.ts
index 39ab879..d4a114b 100644
--- a/src/runs/runStencilState.ts
+++ b/src/runs/runStencilState.ts
@@ -8,14 +8,14 @@ export function getIGLStencilFunc(compare: ICompareFunction)
return stencilFunc;
}
const compareMap: { [key: string]: IGLStencilFunc } = {
- "never": "NEVER",
- "less": "LESS",
- "equal": "EQUAL",
+ never: "NEVER",
+ less: "LESS",
+ equal: "EQUAL",
"less-equal": "LEQUAL",
- "greater": "GREATER",
+ greater: "GREATER",
"not-equal": "NOTEQUAL",
"greater-equal": "GEQUAL",
- "always": "ALWAYS",
+ always: "ALWAYS",
};
export function getIGLStencilOp(stencilOperation?: IStencilOperation)
@@ -25,10 +25,10 @@ export function getIGLStencilOp(stencilOperation?: IStencilOperation)
return glStencilOp;
}
const stencilOperationMap: { [key: string]: IGLStencilOp } = {
- "keep": "KEEP",
- "zero": "ZERO",
- "replace": "REPLACE",
- "invert": "INVERT",
+ keep: "KEEP",
+ zero: "ZERO",
+ replace: "REPLACE",
+ invert: "INVERT",
"increment-clamp": "INCR",
"decrement-clamp": "DECR",
"increment-wrap": "INCR_WRAP",
diff --git a/src/utils/getGLRenderPassAttachmentSize.ts b/src/utils/getGLRenderPassAttachmentSize.ts
index 94e52b1..3cb7a0b 100644
--- a/src/utils/getGLRenderPassAttachmentSize.ts
+++ b/src/utils/getGLRenderPassAttachmentSize.ts
@@ -2,9 +2,9 @@ import { IRenderPassDescriptor } from "@feng3d/render-api";
/**
* 获取渲染通道附件尺寸。
- *
- * @param gl
- * @param descriptor
+ *
+ * @param gl
+ * @param descriptor
*/
export function getGLRenderPassAttachmentSize(gl: WebGLRenderingContext, descriptor: IRenderPassDescriptor): { readonly width: number; readonly height: number; }
{
@@ -20,10 +20,8 @@ export function getGLRenderPassAttachmentSize(gl: WebGLRenderingContext, descrip
{
return { width: view.texture.size[0], height: view.texture.size[1] };
}
- else
- {
+
return { width: gl.drawingBufferWidth, height: gl.drawingBufferHeight };
- }
}
}
@@ -35,10 +33,8 @@ export function getGLRenderPassAttachmentSize(gl: WebGLRenderingContext, descrip
{
return { width: view.texture.size[0], height: view.texture.size[1] };
}
- else
- {
+
return { width: gl.drawingBufferWidth, height: gl.drawingBufferHeight };
- }
}
return { width: gl.drawingBufferWidth, height: gl.drawingBufferHeight };
diff --git a/src/utils/getIGLCullFace.ts b/src/utils/getIGLCullFace.ts
index eaff698..fb670de 100644
--- a/src/utils/getIGLCullFace.ts
+++ b/src/utils/getIGLCullFace.ts
@@ -10,10 +10,10 @@ export function getIGLCullFace(cullFace: ICullFace)
}
const cullFaceMap: { [key: string]: IGLCullFace } = {
- "FRONT_AND_BACK": "FRONT_AND_BACK",
- "none": "BACK", // 不会开启剔除面功能,什么值无所谓。
- "front": "FRONT",
- "back": "BACK",
+ FRONT_AND_BACK: "FRONT_AND_BACK",
+ none: "BACK", // 不会开启剔除面功能,什么值无所谓。
+ front: "FRONT",
+ back: "BACK",
};
/**
diff --git a/src/utils/getIGLFrontFace.ts b/src/utils/getIGLFrontFace.ts
index 144f380..de4c926 100644
--- a/src/utils/getIGLFrontFace.ts
+++ b/src/utils/getIGLFrontFace.ts
@@ -9,8 +9,8 @@ export function getIGLFrontFace(frontFace: IFrontFace)
return glFrontFace;
}
const frontFaceMap: { [key: string]: IGLFrontFace } = {
- "ccw": "CCW",
- "cw": "CW",
+ ccw: "CCW",
+ cw: "CW",
};
/**
diff --git a/src/utils/getIVertexFormat.ts b/src/utils/getIVertexFormat.ts
index 1474fa1..b0161e7 100644
--- a/src/utils/getIVertexFormat.ts
+++ b/src/utils/getIVertexFormat.ts
@@ -6,9 +6,9 @@ export function getIVertexFormat(numComponents: 1 | 2 | 3 | 4, type: IGLVertexAt
{
const element = formatMap[key];
if (
- element.numComponents === numComponents &&
- element.type === type &&
- !element.normalized === !normalized
+ element.numComponents === numComponents
+ && element.type === type
+ && !element.normalized === !normalized
)
{
return key as IVertexFormat;
@@ -31,40 +31,39 @@ export function getIGLVertexFormat(format: IVertexFormat): IGLVertexFormat
export const formatMap: { [key: string]: IGLVertexFormat } = {
- "uint8x2": { numComponents: 2, type: "UNSIGNED_BYTE", normalized: false },
- "uint8x4": { numComponents: 4, type: "UNSIGNED_BYTE", normalized: false },
- "sint8x2": { numComponents: 2, type: "BYTE", normalized: false },
- "sint8x4": { numComponents: 4, type: "BYTE", normalized: false },
- "unorm8x2": { numComponents: 2, type: "UNSIGNED_BYTE", normalized: true },
- "unorm8x4": { numComponents: 4, type: "UNSIGNED_BYTE", normalized: true },
- "snorm8x2": { numComponents: 2, type: "BYTE", normalized: true },
- "snorm8x4": { numComponents: 4, type: "BYTE", normalized: true },
- "uint16x2": { numComponents: 2, type: "UNSIGNED_SHORT", normalized: false },
- "uint16x4": { numComponents: 4, type: "UNSIGNED_SHORT", normalized: false },
- "sint16x2": { numComponents: 2, type: "SHORT", normalized: false },
- "sint16x4": { numComponents: 4, type: "SHORT", normalized: false },
- "unorm16x2": { numComponents: 2, type: "UNSIGNED_SHORT", normalized: true },
- "unorm16x4": { numComponents: 4, type: "UNSIGNED_SHORT", normalized: true },
- "snorm16x2": { numComponents: 2, type: "SHORT", normalized: true },
- "snorm16x4": { numComponents: 4, type: "SHORT", normalized: true },
- "float16x2": { numComponents: 2, type: "HALF_FLOAT", normalized: false },
- "float16x4": { numComponents: 4, type: "HALF_FLOAT", normalized: false },
- "float32": { numComponents: 1, type: "FLOAT", normalized: false },
- "float32x2": { numComponents: 2, type: "FLOAT", normalized: false },
- "float32x3": { numComponents: 3, type: "FLOAT", normalized: false },
- "float32x4": { numComponents: 4, type: "FLOAT", normalized: false },
- "uint32": { numComponents: 1, type: "UNSIGNED_INT", normalized: false },
- "uint32x2": { numComponents: 2, type: "UNSIGNED_INT", normalized: false },
- "uint32x3": { numComponents: 3, type: "UNSIGNED_INT", normalized: false },
- "uint32x4": { numComponents: 4, type: "UNSIGNED_INT", normalized: false },
- "sint32": { numComponents: 1, type: "INT", normalized: false },
- "sint32x2": { numComponents: 2, type: "INT", normalized: false },
- "sint32x3": { numComponents: 3, type: "INT", normalized: false },
- "sint32x4": { numComponents: 4, type: "INT", normalized: false },
+ uint8x2: { numComponents: 2, type: "UNSIGNED_BYTE", normalized: false },
+ uint8x4: { numComponents: 4, type: "UNSIGNED_BYTE", normalized: false },
+ sint8x2: { numComponents: 2, type: "BYTE", normalized: false },
+ sint8x4: { numComponents: 4, type: "BYTE", normalized: false },
+ unorm8x2: { numComponents: 2, type: "UNSIGNED_BYTE", normalized: true },
+ unorm8x4: { numComponents: 4, type: "UNSIGNED_BYTE", normalized: true },
+ snorm8x2: { numComponents: 2, type: "BYTE", normalized: true },
+ snorm8x4: { numComponents: 4, type: "BYTE", normalized: true },
+ uint16x2: { numComponents: 2, type: "UNSIGNED_SHORT", normalized: false },
+ uint16x4: { numComponents: 4, type: "UNSIGNED_SHORT", normalized: false },
+ sint16x2: { numComponents: 2, type: "SHORT", normalized: false },
+ sint16x4: { numComponents: 4, type: "SHORT", normalized: false },
+ unorm16x2: { numComponents: 2, type: "UNSIGNED_SHORT", normalized: true },
+ unorm16x4: { numComponents: 4, type: "UNSIGNED_SHORT", normalized: true },
+ snorm16x2: { numComponents: 2, type: "SHORT", normalized: true },
+ snorm16x4: { numComponents: 4, type: "SHORT", normalized: true },
+ float16x2: { numComponents: 2, type: "HALF_FLOAT", normalized: false },
+ float16x4: { numComponents: 4, type: "HALF_FLOAT", normalized: false },
+ float32: { numComponents: 1, type: "FLOAT", normalized: false },
+ float32x2: { numComponents: 2, type: "FLOAT", normalized: false },
+ float32x3: { numComponents: 3, type: "FLOAT", normalized: false },
+ float32x4: { numComponents: 4, type: "FLOAT", normalized: false },
+ uint32: { numComponents: 1, type: "UNSIGNED_INT", normalized: false },
+ uint32x2: { numComponents: 2, type: "UNSIGNED_INT", normalized: false },
+ uint32x3: { numComponents: 3, type: "UNSIGNED_INT", normalized: false },
+ uint32x4: { numComponents: 4, type: "UNSIGNED_INT", normalized: false },
+ sint32: { numComponents: 1, type: "INT", normalized: false },
+ sint32x2: { numComponents: 2, type: "INT", normalized: false },
+ sint32x3: { numComponents: 3, type: "INT", normalized: false },
+ sint32x4: { numComponents: 4, type: "INT", normalized: false },
"unorm10-10-10-2": { numComponents: 4, type: "UNSIGNED_INT_2_10_10_10_REV", normalized: true },
};
-
interface IGLVertexFormat
{
/**
diff --git a/src/utils/updateBufferBinding.ts b/src/utils/updateBufferBinding.ts
index f7cb79a..032e6c6 100644
--- a/src/utils/updateBufferBinding.ts
+++ b/src/utils/updateBufferBinding.ts
@@ -4,10 +4,10 @@ import { IBufferBindingInfo } from "../caches/getGLProgram";
import { getIGLBuffer } from "../runs/getIGLBuffer";
/**
- *
- * @param uniformBlock
- * @param uniformData
- *
+ *
+ * @param uniformBlock
+ * @param uniformData
+ *
* @see https://learnopengl-cn.readthedocs.io/zh/latest/04%20Advanced%20OpenGL/08%20Advanced%20GLSL/#uniform_1
*/
export function updateBufferBinding(bufferBindingInfo: IBufferBindingInfo, uniformData: IBufferBinding)
@@ -57,6 +57,7 @@ export function updateBufferBinding(bufferBindingInfo: IBufferBindingInfo, unifo
{
console.warn(`没有找到 统一块变量属性 ${paths.join(".")} 的值!`);
}
+
return;
}
}
@@ -78,7 +79,7 @@ export function updateBufferBinding(bufferBindingInfo: IBufferBindingInfo, unifo
const writeBuffers = buffer.writeBuffers ?? [];
writeBuffers.push({ data: data.buffer, bufferOffset: offset + itemInfoOffset, size: Math.min(itemInfoSize, data.byteLength) });
buffer.writeBuffers = writeBuffers;
- }
+ };
update();
watcher.watchchain(uniformData, paths.join("."), update, undefined, false);
--
Gitee
From bab81b4d2fecb07f6ea75ede3bac9eeedabc2ced Mon Sep 17 00:00:00 2001
From: feng <908087098@qq.com>
Date: Tue, 11 Feb 2025 22:37:41 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E5=8F=91=E5=B8=83=20@feng3d/webgl@0.0.3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index e82bc2d..c03993a 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ feng3d引擎的WebGL渲染器,可以让用户无需直接接触WebGL的API,
## 安装
```
-npm install @feng3d/webgl
+npm i @feng3d/webgl@0.0.3
```
## 如何使用
--
Gitee