@thi.ng/webgl 6.0.0 → 6.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/README.md +4 -3
- package/api/buffers.d.ts +1 -1
- package/api/canvas.d.ts +1 -1
- package/api/material.d.ts +1 -1
- package/api/model.d.ts +3 -3
- package/api/multipass.d.ts +4 -4
- package/api/shader.d.ts +5 -5
- package/api/texture.d.ts +1 -1
- package/buffer.d.ts +2 -2
- package/buffer.js +3 -7
- package/canvas.d.ts +2 -2
- package/canvas.js +1 -1
- package/checks.d.ts +1 -1
- package/checks.js +1 -1
- package/draw.d.ts +1 -1
- package/draw.js +3 -3
- package/fbo.d.ts +1 -1
- package/fbo.js +4 -8
- package/geo/cube.d.ts +1 -1
- package/geo/cube.js +1 -1
- package/geo/quad.d.ts +1 -1
- package/geo/quad.js +1 -1
- package/index.d.ts +32 -32
- package/index.js +32 -32
- package/material.d.ts +2 -2
- package/matrices.d.ts +2 -2
- package/multipass.d.ts +1 -1
- package/multipass.js +8 -8
- package/package.json +22 -19
- package/rbo.d.ts +1 -1
- package/rbo.js +1 -6
- package/readpixels.d.ts +1 -1
- package/readpixels.js +1 -1
- package/shader.d.ts +2 -2
- package/shader.js +10 -15
- package/shaders/lambert.d.ts +2 -2
- package/shaders/lambert.js +3 -3
- package/shaders/phong.d.ts +2 -2
- package/shaders/phong.js +3 -3
- package/shaders/pipeline.d.ts +1 -1
- package/syntax.d.ts +1 -1
- package/texture.d.ts +1 -1
- package/texture.js +3 -11
- package/uniforms.d.ts +1 -1
- package/utils.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,46 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [6.0.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@6.0.4...@thi.ng/webgl@6.0.5) (2021-10-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @thi.ng/webgl
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [6.0.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@6.0.3...@thi.ng/webgl@6.0.4) (2021-10-15)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @thi.ng/webgl
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [6.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@6.0.2...@thi.ng/webgl@6.0.3) (2021-10-15)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @thi.ng/webgl
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [6.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@6.0.1...@thi.ng/webgl@6.0.2) (2021-10-13)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @thi.ng/webgl
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [6.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@6.0.0...@thi.ng/webgl@6.0.1) (2021-10-13)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @thi.ng/webgl
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
6
46
|
# [6.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/webgl@5.0.14...@thi.ng/webgl@6.0.0) (2021-10-12)
|
|
7
47
|
|
|
8
48
|
|
package/README.md
CHANGED
|
@@ -91,15 +91,16 @@ ES module import:
|
|
|
91
91
|
|
|
92
92
|
[Skypack documentation](https://docs.skypack.dev/)
|
|
93
93
|
|
|
94
|
-
For
|
|
94
|
+
For Node.js REPL:
|
|
95
95
|
|
|
96
96
|
```text
|
|
97
|
-
|
|
97
|
+
# with flag only for < v16
|
|
98
|
+
node --experimental-repl-await
|
|
98
99
|
|
|
99
100
|
> const webgl = await import("@thi.ng/webgl");
|
|
100
101
|
```
|
|
101
102
|
|
|
102
|
-
Package sizes (gzipped, pre-treeshake): ESM: 12.
|
|
103
|
+
Package sizes (gzipped, pre-treeshake): ESM: 12.14 KB
|
|
103
104
|
|
|
104
105
|
## Dependencies
|
|
105
106
|
|
package/api/buffers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IBind, IRelease } from "@thi.ng/api";
|
|
2
|
-
import type { ITexture } from "./texture";
|
|
2
|
+
import type { ITexture } from "./texture.js";
|
|
3
3
|
export declare type IndexBufferData = Uint16Array | Uint32Array;
|
|
4
4
|
export interface IWebGLBuffer<T> extends IBind<void>, IRelease {
|
|
5
5
|
set(data: T, mode?: GLenum): void;
|
package/api/canvas.d.ts
CHANGED
package/api/material.d.ts
CHANGED
package/api/model.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { GLType, IObjectOf, Type } from "@thi.ng/api";
|
|
2
2
|
import type { AttribPool } from "@thi.ng/vector-pools";
|
|
3
|
-
import type { IndexBufferSpec, IWebGLBuffer } from "./buffers";
|
|
4
|
-
import type { AttribBufferData, IShader, UniformValues } from "./shader";
|
|
5
|
-
import type { ITexture } from "./texture";
|
|
3
|
+
import type { IndexBufferSpec, IWebGLBuffer } from "./buffers.js";
|
|
4
|
+
import type { AttribBufferData, IShader, UniformValues } from "./shader.js";
|
|
5
|
+
import type { ITexture } from "./texture.js";
|
|
6
6
|
export declare enum DrawMode {
|
|
7
7
|
POINTS = 0,
|
|
8
8
|
LINES = 1,
|
package/api/multipass.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { IObjectOf } from "@thi.ng/api";
|
|
2
2
|
import type { AttribPool } from "@thi.ng/vector-pools";
|
|
3
|
-
import type { IFbo, IndexBufferSpec } from "./buffers";
|
|
4
|
-
import type { InstancingSpec, ModelAttributeSpecs, ModelSpec } from "./model";
|
|
5
|
-
import type { ShaderAttribSpecs, ShaderFn, ShaderState, ShaderVaryingSpecs, UniformDecl, UniformValues } from "./shader";
|
|
6
|
-
import type { ITexture, TextureOpts } from "./texture";
|
|
3
|
+
import type { IFbo, IndexBufferSpec } from "./buffers.js";
|
|
4
|
+
import type { InstancingSpec, ModelAttributeSpecs, ModelSpec } from "./model.js";
|
|
5
|
+
import type { ShaderAttribSpecs, ShaderFn, ShaderState, ShaderVaryingSpecs, UniformDecl, UniformValues } from "./shader.js";
|
|
6
|
+
import type { ITexture, TextureOpts } from "./texture.js";
|
|
7
7
|
export interface Multipass {
|
|
8
8
|
start(): void;
|
|
9
9
|
stop(): void;
|
package/api/shader.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import type { Fn, Fn2, Fn3, Fn4, IBind, IDeref, IObjectOf, IRelease, NumericArra
|
|
|
2
2
|
import type { Func, Sym } from "@thi.ng/shader-ast";
|
|
3
3
|
import type { GLSLTarget } from "@thi.ng/shader-ast-glsl";
|
|
4
4
|
import type { ReadonlyVec } from "@thi.ng/vectors";
|
|
5
|
-
import type { BlendEquation, BlendFunc } from "./blend";
|
|
6
|
-
import type { ExtensionBehaviors } from "./ext";
|
|
7
|
-
import type { GLIntVec, GLIntVec2, GLIntVec3, GLIntVec4, GLMat2, GLMat3, GLMat4, GLSL, GLSLArrayType, GLSLScalarType, GLUintVec, GLVec, GLVec2, GLVec3, GLVec4 } from "./glsl";
|
|
8
|
-
import type { ModelAttributeSpecs, ModelSpec } from "./model";
|
|
9
|
-
import type { StencilFnParams, StencilOpParams } from "./stencil";
|
|
5
|
+
import type { BlendEquation, BlendFunc } from "./blend.js";
|
|
6
|
+
import type { ExtensionBehaviors } from "./ext.js";
|
|
7
|
+
import type { GLIntVec, GLIntVec2, GLIntVec3, GLIntVec4, GLMat2, GLMat3, GLMat4, GLSL, GLSLArrayType, GLSLScalarType, GLUintVec, GLVec, GLVec2, GLVec3, GLVec4 } from "./glsl.js";
|
|
8
|
+
import type { ModelAttributeSpecs, ModelSpec } from "./model.js";
|
|
9
|
+
import type { StencilFnParams, StencilOpParams } from "./stencil.js";
|
|
10
10
|
export interface GLSLSyntax {
|
|
11
11
|
number: number;
|
|
12
12
|
attrib: Fn3<string, ShaderAttribSpec, GLSLDeclPrefixes, string>;
|
package/api/texture.d.ts
CHANGED
package/buffer.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TypedArray } from "@thi.ng/api/typedarray";
|
|
2
2
|
import type { AttribPool } from "@thi.ng/vector-pools";
|
|
3
|
-
import type { IndexBufferSpec, IWebGLBuffer } from "./api/buffers";
|
|
4
|
-
import { ModelAttributeSpecs, ModelSpec } from "./api/model";
|
|
3
|
+
import type { IndexBufferSpec, IWebGLBuffer } from "./api/buffers.js";
|
|
4
|
+
import { ModelAttributeSpecs, ModelSpec } from "./api/model.js";
|
|
5
5
|
export declare class WebGLArrayBuffer<T extends TypedArray> implements IWebGLBuffer<T> {
|
|
6
6
|
gl: WebGLRenderingContext;
|
|
7
7
|
buffer: WebGLBuffer;
|
package/buffer.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { asGLType } from "@thi.ng/api/typedarray";
|
|
2
|
-
import { DrawMode, } from "./api/model";
|
|
3
|
-
import { isGL2Context } from "./checks";
|
|
4
|
-
import { error } from "./error";
|
|
2
|
+
import { DrawMode, } from "./api/model.js";
|
|
3
|
+
import { isGL2Context } from "./checks.js";
|
|
4
|
+
import { error } from "./error.js";
|
|
5
5
|
export class WebGLArrayBuffer {
|
|
6
|
-
gl;
|
|
7
|
-
buffer;
|
|
8
|
-
target;
|
|
9
|
-
mode;
|
|
10
6
|
constructor(gl, data, target = gl.ARRAY_BUFFER, mode = gl.STATIC_DRAW) {
|
|
11
7
|
this.gl = gl;
|
|
12
8
|
this.buffer = gl.createBuffer() || error("error creating WebGL buffer");
|
package/canvas.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { WeblGLCanvasOpts } from "./api/canvas";
|
|
2
|
-
import type { WebGLExtensionMap } from "./api/ext";
|
|
1
|
+
import type { WeblGLCanvasOpts } from "./api/canvas.js";
|
|
2
|
+
import type { WebGLExtensionMap } from "./api/ext.js";
|
|
3
3
|
export declare const glCanvas: (opts?: Partial<WeblGLCanvasOpts>) => {
|
|
4
4
|
canvas: HTMLCanvasElement;
|
|
5
5
|
gl: WebGLRenderingContext;
|
package/canvas.js
CHANGED
package/checks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ITexture } from "./api/texture";
|
|
1
|
+
import { ITexture } from "./api/texture.js";
|
|
2
2
|
export declare const isGL2Context: (gl: WebGLRenderingContext | WebGL2RenderingContext) => gl is WebGL2RenderingContext;
|
|
3
3
|
export declare const isFloatTexture: (tex: ITexture) => boolean;
|
|
4
4
|
//# sourceMappingURL=checks.d.ts.map
|
package/checks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TextureType } from "./api/texture";
|
|
1
|
+
import { TextureType } from "./api/texture.js";
|
|
2
2
|
export const isGL2Context = (gl) => typeof WebGL2RenderingContext !== "undefined" &&
|
|
3
3
|
gl instanceof WebGL2RenderingContext;
|
|
4
4
|
export const isFloatTexture = (tex) => tex.type === TextureType.FLOAT ||
|
package/draw.d.ts
CHANGED
package/draw.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isArray } from "@thi.ng/checks/is-array";
|
|
2
|
-
import { isGL2Context } from "./checks";
|
|
3
|
-
import { error } from "./error";
|
|
4
|
-
import { bindTextures, unbindTextures } from "./texture";
|
|
2
|
+
import { isGL2Context } from "./checks.js";
|
|
3
|
+
import { error } from "./error.js";
|
|
4
|
+
import { bindTextures, unbindTextures } from "./texture.js";
|
|
5
5
|
export const draw = (specs, opts = {}) => {
|
|
6
6
|
const _specs = isArray(specs) ? specs : [specs];
|
|
7
7
|
for (let i = 0, n = _specs.length; i < n; i++) {
|
package/fbo.d.ts
CHANGED
package/fbo.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { assert } from "@thi.ng/errors/assert";
|
|
2
|
-
import { TEX_FORMATS } from "./api/texture";
|
|
3
|
-
import { isGL2Context } from "./checks";
|
|
4
|
-
import { error } from "./error";
|
|
5
|
-
import { RBO } from "./rbo";
|
|
2
|
+
import { TEX_FORMATS } from "./api/texture.js";
|
|
3
|
+
import { isGL2Context } from "./checks.js";
|
|
4
|
+
import { error } from "./error.js";
|
|
5
|
+
import { RBO } from "./rbo.js";
|
|
6
6
|
const GL_COLOR_ATTACHMENT0_WEBGL = 0x8ce0;
|
|
7
7
|
const GL_MAX_COLOR_ATTACHMENTS_WEBGL = 0x8cdf;
|
|
8
8
|
/**
|
|
@@ -21,10 +21,6 @@ const GL_MAX_COLOR_ATTACHMENTS_WEBGL = 0x8cdf;
|
|
|
21
21
|
* {@link https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_draw_buffers}
|
|
22
22
|
*/
|
|
23
23
|
export class FBO {
|
|
24
|
-
gl;
|
|
25
|
-
fbo;
|
|
26
|
-
ext;
|
|
27
|
-
maxAttachments;
|
|
28
24
|
constructor(gl, opts) {
|
|
29
25
|
this.gl = gl;
|
|
30
26
|
this.fbo = gl.createFramebuffer() || error("error creating FBO");
|
package/geo/cube.d.ts
CHANGED
package/geo/cube.js
CHANGED
package/geo/quad.d.ts
CHANGED
package/geo/quad.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
export * from "./api/blend";
|
|
2
|
-
export * from "./api/buffers";
|
|
3
|
-
export * from "./api/canvas";
|
|
4
|
-
export * from "./api/ext";
|
|
5
|
-
export * from "./api/glsl";
|
|
6
|
-
export * from "./api/material";
|
|
7
|
-
export * from "./api/model";
|
|
8
|
-
export * from "./api/shader";
|
|
9
|
-
export * from "./api/texture";
|
|
10
|
-
export * from "./buffer";
|
|
11
|
-
export * from "./canvas";
|
|
12
|
-
export * from "./checks";
|
|
13
|
-
export * from "./draw";
|
|
14
|
-
export * from "./error";
|
|
15
|
-
export * from "./fbo";
|
|
16
|
-
export * from "./logger";
|
|
17
|
-
export * from "./material";
|
|
18
|
-
export * from "./matrices";
|
|
19
|
-
export * from "./multipass";
|
|
20
|
-
export * from "./rbo";
|
|
21
|
-
export * from "./readpixels";
|
|
22
|
-
export * from "./shader";
|
|
23
|
-
export * from "./syntax";
|
|
24
|
-
export * from "./texture";
|
|
25
|
-
export * from "./utils";
|
|
26
|
-
export * from "./shaders/lambert";
|
|
27
|
-
export * from "./shaders/phong";
|
|
28
|
-
export * from "./shaders/pipeline";
|
|
29
|
-
export * from "./textures/checkerboard";
|
|
30
|
-
export * from "./textures/stripes";
|
|
31
|
-
export * from "./geo/cube";
|
|
32
|
-
export * from "./geo/quad";
|
|
1
|
+
export * from "./api/blend.js";
|
|
2
|
+
export * from "./api/buffers.js";
|
|
3
|
+
export * from "./api/canvas.js";
|
|
4
|
+
export * from "./api/ext.js";
|
|
5
|
+
export * from "./api/glsl.js";
|
|
6
|
+
export * from "./api/material.js";
|
|
7
|
+
export * from "./api/model.js";
|
|
8
|
+
export * from "./api/shader.js";
|
|
9
|
+
export * from "./api/texture.js";
|
|
10
|
+
export * from "./buffer.js";
|
|
11
|
+
export * from "./canvas.js";
|
|
12
|
+
export * from "./checks.js";
|
|
13
|
+
export * from "./draw.js";
|
|
14
|
+
export * from "./error.js";
|
|
15
|
+
export * from "./fbo.js";
|
|
16
|
+
export * from "./logger.js";
|
|
17
|
+
export * from "./material.js";
|
|
18
|
+
export * from "./matrices.js";
|
|
19
|
+
export * from "./multipass.js";
|
|
20
|
+
export * from "./rbo.js";
|
|
21
|
+
export * from "./readpixels.js";
|
|
22
|
+
export * from "./shader.js";
|
|
23
|
+
export * from "./syntax.js";
|
|
24
|
+
export * from "./texture.js";
|
|
25
|
+
export * from "./utils.js";
|
|
26
|
+
export * from "./shaders/lambert.js";
|
|
27
|
+
export * from "./shaders/phong.js";
|
|
28
|
+
export * from "./shaders/pipeline.js";
|
|
29
|
+
export * from "./textures/checkerboard.js";
|
|
30
|
+
export * from "./textures/stripes.js";
|
|
31
|
+
export * from "./geo/cube.js";
|
|
32
|
+
export * from "./geo/quad.js";
|
|
33
33
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
export * from "./api/blend";
|
|
2
|
-
export * from "./api/buffers";
|
|
3
|
-
export * from "./api/canvas";
|
|
4
|
-
export * from "./api/ext";
|
|
5
|
-
export * from "./api/glsl";
|
|
6
|
-
export * from "./api/material";
|
|
7
|
-
export * from "./api/model";
|
|
8
|
-
export * from "./api/shader";
|
|
9
|
-
export * from "./api/texture";
|
|
10
|
-
export * from "./buffer";
|
|
11
|
-
export * from "./canvas";
|
|
12
|
-
export * from "./checks";
|
|
13
|
-
export * from "./draw";
|
|
14
|
-
export * from "./error";
|
|
15
|
-
export * from "./fbo";
|
|
16
|
-
export * from "./logger";
|
|
17
|
-
export * from "./material";
|
|
18
|
-
export * from "./matrices";
|
|
19
|
-
export * from "./multipass";
|
|
20
|
-
export * from "./rbo";
|
|
21
|
-
export * from "./readpixels";
|
|
22
|
-
export * from "./shader";
|
|
23
|
-
export * from "./syntax";
|
|
24
|
-
export * from "./texture";
|
|
25
|
-
export * from "./utils";
|
|
26
|
-
export * from "./shaders/lambert";
|
|
27
|
-
export * from "./shaders/phong";
|
|
28
|
-
export * from "./shaders/pipeline";
|
|
29
|
-
export * from "./textures/checkerboard";
|
|
30
|
-
export * from "./textures/stripes";
|
|
31
|
-
export * from "./geo/cube";
|
|
32
|
-
export * from "./geo/quad";
|
|
1
|
+
export * from "./api/blend.js";
|
|
2
|
+
export * from "./api/buffers.js";
|
|
3
|
+
export * from "./api/canvas.js";
|
|
4
|
+
export * from "./api/ext.js";
|
|
5
|
+
export * from "./api/glsl.js";
|
|
6
|
+
export * from "./api/material.js";
|
|
7
|
+
export * from "./api/model.js";
|
|
8
|
+
export * from "./api/shader.js";
|
|
9
|
+
export * from "./api/texture.js";
|
|
10
|
+
export * from "./buffer.js";
|
|
11
|
+
export * from "./canvas.js";
|
|
12
|
+
export * from "./checks.js";
|
|
13
|
+
export * from "./draw.js";
|
|
14
|
+
export * from "./error.js";
|
|
15
|
+
export * from "./fbo.js";
|
|
16
|
+
export * from "./logger.js";
|
|
17
|
+
export * from "./material.js";
|
|
18
|
+
export * from "./matrices.js";
|
|
19
|
+
export * from "./multipass.js";
|
|
20
|
+
export * from "./rbo.js";
|
|
21
|
+
export * from "./readpixels.js";
|
|
22
|
+
export * from "./shader.js";
|
|
23
|
+
export * from "./syntax.js";
|
|
24
|
+
export * from "./texture.js";
|
|
25
|
+
export * from "./utils.js";
|
|
26
|
+
export * from "./shaders/lambert.js";
|
|
27
|
+
export * from "./shaders/phong.js";
|
|
28
|
+
export * from "./shaders/pipeline.js";
|
|
29
|
+
export * from "./textures/checkerboard.js";
|
|
30
|
+
export * from "./textures/stripes.js";
|
|
31
|
+
export * from "./geo/cube.js";
|
|
32
|
+
export * from "./geo/quad.js";
|
package/material.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Material } from "./api/material";
|
|
2
|
-
import type { ShaderUniformSpecs } from "./api/shader";
|
|
1
|
+
import type { Material } from "./api/material.js";
|
|
2
|
+
import type { ShaderUniformSpecs } from "./api/shader.js";
|
|
3
3
|
export declare const DEFAULT_MATERIAL: Material;
|
|
4
4
|
export declare const defMaterial: (mat?: Partial<Material>, flags?: Partial<Record<keyof Material, boolean>>, base?: Material) => ShaderUniformSpecs;
|
|
5
5
|
//# sourceMappingURL=material.d.ts.map
|
package/matrices.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IObjectOf } from "@thi.ng/api";
|
|
2
2
|
import type { ReadonlyVec } from "@thi.ng/vectors";
|
|
3
|
-
import type { GLMat4 } from "./api/glsl";
|
|
4
|
-
import type { ShaderUniforms } from "./api/shader";
|
|
3
|
+
import type { GLMat4 } from "./api/glsl.js";
|
|
4
|
+
import type { ShaderUniforms } from "./api/shader.js";
|
|
5
5
|
/**
|
|
6
6
|
* Computes the inverse transpose of given 4x4 matrix uniform, i.e.
|
|
7
7
|
* `transpose(invert(m))`.
|
package/multipass.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Multipass, MultipassOpts, PassOpts } from "./api/multipass";
|
|
1
|
+
import type { Multipass, MultipassOpts, PassOpts } from "./api/multipass.js";
|
|
2
2
|
export declare const defMultiPass: (opts: MultipassOpts) => Multipass;
|
|
3
3
|
/**
|
|
4
4
|
* Returns a dynamically generated single pass spec ({@link PassOpts}) for use
|
package/multipass.js
CHANGED
|
@@ -9,14 +9,14 @@ import { map } from "@thi.ng/transducers/map";
|
|
|
9
9
|
import { range } from "@thi.ng/transducers/range";
|
|
10
10
|
import { some } from "@thi.ng/transducers/some";
|
|
11
11
|
import { transduce } from "@thi.ng/transducers/transduce";
|
|
12
|
-
import { compileModel } from "./buffer";
|
|
13
|
-
import { isFloatTexture, isGL2Context } from "./checks";
|
|
14
|
-
import { draw } from "./draw";
|
|
15
|
-
import { defFBO } from "./fbo";
|
|
16
|
-
import { defQuadModel } from "./geo/quad";
|
|
17
|
-
import { defShader } from "./shader";
|
|
18
|
-
import { PASSTHROUGH_VS } from "./shaders/pipeline";
|
|
19
|
-
import { defTexture } from "./texture";
|
|
12
|
+
import { compileModel } from "./buffer.js";
|
|
13
|
+
import { isFloatTexture, isGL2Context } from "./checks.js";
|
|
14
|
+
import { draw } from "./draw.js";
|
|
15
|
+
import { defFBO } from "./fbo.js";
|
|
16
|
+
import { defQuadModel } from "./geo/quad.js";
|
|
17
|
+
import { defShader } from "./shader.js";
|
|
18
|
+
import { PASSTHROUGH_VS } from "./shaders/pipeline.js";
|
|
19
|
+
import { defTexture } from "./texture.js";
|
|
20
20
|
export const defMultiPass = (opts) => {
|
|
21
21
|
const gl = opts.gl;
|
|
22
22
|
const numPasses = opts.passes.length;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/webgl",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.5",
|
|
4
4
|
"description": "WebGL & GLSL abstraction layer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,25 +34,25 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/adapt-dpi": "^2.0.
|
|
38
|
-
"@thi.ng/api": "^8.0.
|
|
39
|
-
"@thi.ng/associative": "^6.0.
|
|
40
|
-
"@thi.ng/checks": "^3.0.
|
|
41
|
-
"@thi.ng/equiv": "^2.0.
|
|
42
|
-
"@thi.ng/errors": "^2.0.
|
|
43
|
-
"@thi.ng/logger": "^
|
|
44
|
-
"@thi.ng/matrices": "^2.0.
|
|
45
|
-
"@thi.ng/memoize": "^3.0.
|
|
46
|
-
"@thi.ng/pixel": "^2.
|
|
47
|
-
"@thi.ng/shader-ast": "^0.11.
|
|
48
|
-
"@thi.ng/shader-ast-glsl": "^0.3.
|
|
49
|
-
"@thi.ng/shader-ast-stdlib": "^0.10.
|
|
50
|
-
"@thi.ng/transducers": "^8.0.
|
|
51
|
-
"@thi.ng/vector-pools": "^3.0.
|
|
52
|
-
"@thi.ng/vectors": "^7.0.
|
|
37
|
+
"@thi.ng/adapt-dpi": "^2.0.4",
|
|
38
|
+
"@thi.ng/api": "^8.0.4",
|
|
39
|
+
"@thi.ng/associative": "^6.0.4",
|
|
40
|
+
"@thi.ng/checks": "^3.0.4",
|
|
41
|
+
"@thi.ng/equiv": "^2.0.4",
|
|
42
|
+
"@thi.ng/errors": "^2.0.4",
|
|
43
|
+
"@thi.ng/logger": "^1.0.4",
|
|
44
|
+
"@thi.ng/matrices": "^2.0.4",
|
|
45
|
+
"@thi.ng/memoize": "^3.0.4",
|
|
46
|
+
"@thi.ng/pixel": "^2.1.3",
|
|
47
|
+
"@thi.ng/shader-ast": "^0.11.4",
|
|
48
|
+
"@thi.ng/shader-ast-glsl": "^0.3.4",
|
|
49
|
+
"@thi.ng/shader-ast-stdlib": "^0.10.4",
|
|
50
|
+
"@thi.ng/transducers": "^8.0.4",
|
|
51
|
+
"@thi.ng/vector-pools": "^3.0.4",
|
|
52
|
+
"@thi.ng/vectors": "^7.0.4"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@thi.ng/testament": "^0.1.
|
|
55
|
+
"@thi.ng/testament": "^0.1.4"
|
|
56
56
|
},
|
|
57
57
|
"keywords": [
|
|
58
58
|
"2d",
|
|
@@ -76,6 +76,9 @@
|
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
},
|
|
79
|
+
"engines": {
|
|
80
|
+
"node": ">=12.7"
|
|
81
|
+
},
|
|
79
82
|
"files": [
|
|
80
83
|
"*.js",
|
|
81
84
|
"*.d.ts",
|
|
@@ -207,5 +210,5 @@
|
|
|
207
210
|
],
|
|
208
211
|
"year": 2014
|
|
209
212
|
},
|
|
210
|
-
"gitHead": "
|
|
213
|
+
"gitHead": "9ff00a103f76cc4917ef3f244132e218f2300a05"
|
|
211
214
|
}
|
package/rbo.d.ts
CHANGED
package/rbo.js
CHANGED
package/readpixels.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ITexture, ReadableTextureFormat, TextureType } from "./api/texture";
|
|
1
|
+
import type { ITexture, ReadableTextureFormat, TextureType } from "./api/texture.js";
|
|
2
2
|
export declare const readPixels: <T extends Uint8Array | Uint16Array | Uint32Array | Float32Array>(gl: WebGLRenderingContext, x: number, y: number, w: number, h: number, format: ReadableTextureFormat, type: TextureType, out: T) => T;
|
|
3
3
|
export declare const readTexture: <T extends Uint8Array | Uint16Array | Uint32Array | Float32Array>(gl: WebGLRenderingContext, tex: ITexture, format: ReadableTextureFormat, type: TextureType, out: T) => T;
|
|
4
4
|
//# sourceMappingURL=readpixels.d.ts.map
|
package/readpixels.js
CHANGED
package/shader.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IObjectOf } from "@thi.ng/api";
|
|
2
2
|
import { GLSLVersion } from "@thi.ng/shader-ast-glsl/api";
|
|
3
|
-
import type { ModelAttributeSpecs, ModelSpec } from "./api/model";
|
|
4
|
-
import { DefShaderOpts, IShader, ShaderAttrib, ShaderSpec, ShaderState, ShaderType, ShaderUniforms, UniformValues } from "./api/shader";
|
|
3
|
+
import type { ModelAttributeSpecs, ModelSpec } from "./api/model.js";
|
|
4
|
+
import { DefShaderOpts, IShader, ShaderAttrib, ShaderSpec, ShaderState, ShaderType, ShaderUniforms, UniformValues } from "./api/shader.js";
|
|
5
5
|
export declare class Shader implements IShader {
|
|
6
6
|
gl: WebGLRenderingContext;
|
|
7
7
|
program: WebGLProgram;
|
package/shader.js
CHANGED
|
@@ -11,24 +11,19 @@ import { targetGLSL } from "@thi.ng/shader-ast-glsl/target";
|
|
|
11
11
|
import { program } from "@thi.ng/shader-ast/ast/scope";
|
|
12
12
|
import { input, output, sym, uniform } from "@thi.ng/shader-ast/ast/sym";
|
|
13
13
|
import { vals } from "@thi.ng/transducers/vals";
|
|
14
|
-
import { GL_EXT_INFO, } from "./api/ext";
|
|
15
|
-
import { DEFAULT_OUTPUT, } from "./api/shader";
|
|
16
|
-
import { getExtensions } from "./canvas";
|
|
17
|
-
import { isGL2Context } from "./checks";
|
|
18
|
-
import { error } from "./error";
|
|
19
|
-
import { LOGGER } from "./logger";
|
|
20
|
-
import { GLSL_HEADER, NO_PREFIXES, SYNTAX } from "./syntax";
|
|
21
|
-
import { UNIFORM_SETTERS } from "./uniforms";
|
|
14
|
+
import { GL_EXT_INFO, } from "./api/ext.js";
|
|
15
|
+
import { DEFAULT_OUTPUT, } from "./api/shader.js";
|
|
16
|
+
import { getExtensions } from "./canvas.js";
|
|
17
|
+
import { isGL2Context } from "./checks.js";
|
|
18
|
+
import { error } from "./error.js";
|
|
19
|
+
import { LOGGER } from "./logger.js";
|
|
20
|
+
import { GLSL_HEADER, NO_PREFIXES, SYNTAX } from "./syntax.js";
|
|
21
|
+
import { UNIFORM_SETTERS } from "./uniforms.js";
|
|
22
22
|
const ERROR_REGEXP = /ERROR: \d+:(\d+): (.*)/;
|
|
23
23
|
export class Shader {
|
|
24
|
-
gl;
|
|
25
|
-
program;
|
|
26
|
-
attribs;
|
|
27
|
-
uniforms;
|
|
28
|
-
state;
|
|
29
|
-
warnAttrib = doOnce((id) => LOGGER.warn(`unknown attrib: ${id} (no further warnings will be shown...)`));
|
|
30
|
-
warnUni = doOnce((id) => LOGGER.warn(`unknown uniform: ${id} (no further warnings will be shown...)`));
|
|
31
24
|
constructor(gl, program, attribs, uniforms, state) {
|
|
25
|
+
this.warnAttrib = doOnce((id) => LOGGER.warn(`unknown attrib: ${id} (no further warnings will be shown...)`));
|
|
26
|
+
this.warnUni = doOnce((id) => LOGGER.warn(`unknown uniform: ${id} (no further warnings will be shown...)`));
|
|
32
27
|
this.gl = gl;
|
|
33
28
|
this.program = program;
|
|
34
29
|
this.attribs = attribs;
|
package/shaders/lambert.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Material } from "../api/material";
|
|
2
|
-
import type { ShaderPresetOpts, ShaderSpec } from "../api/shader";
|
|
1
|
+
import type { Material } from "../api/material.js";
|
|
2
|
+
import type { ShaderPresetOpts, ShaderSpec } from "../api/shader.js";
|
|
3
3
|
export interface LambertOpts extends ShaderPresetOpts<Pick<Material, "ambientCol" | "diffuseCol">> {
|
|
4
4
|
bidir: boolean;
|
|
5
5
|
}
|
package/shaders/lambert.js
CHANGED
|
@@ -8,9 +8,9 @@ import { mul } from "@thi.ng/shader-ast/ast/ops";
|
|
|
8
8
|
import { $ } from "@thi.ng/shader-ast/ast/swizzle";
|
|
9
9
|
import { normalize } from "@thi.ng/shader-ast/builtin/math";
|
|
10
10
|
import { texture } from "@thi.ng/shader-ast/builtin/texture";
|
|
11
|
-
import { defMaterial } from "../material";
|
|
12
|
-
import { autoNormalMatrix2 } from "../matrices";
|
|
13
|
-
import { colorAttrib, positionAttrib } from "../utils";
|
|
11
|
+
import { defMaterial } from "../material.js";
|
|
12
|
+
import { autoNormalMatrix2 } from "../matrices.js";
|
|
13
|
+
import { colorAttrib, positionAttrib } from "../utils.js";
|
|
14
14
|
export const LAMBERT = (opts = {}) => ({
|
|
15
15
|
vs: (gl, unis, ins, outs) => [
|
|
16
16
|
defMain(() => [
|
package/shaders/phong.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Material } from "../api/material";
|
|
2
|
-
import type { ShaderPresetOpts, ShaderSpec } from "../api/shader";
|
|
1
|
+
import type { Material } from "../api/material.js";
|
|
2
|
+
import type { ShaderPresetOpts, ShaderSpec } from "../api/shader.js";
|
|
3
3
|
export declare type PhongOpts = ShaderPresetOpts<Pick<Material, "ambientCol" | "diffuseCol" | "specularCol">>;
|
|
4
4
|
export declare const PHONG: (opts?: Partial<PhongOpts>) => ShaderSpec;
|
|
5
5
|
//# sourceMappingURL=phong.d.ts.map
|
package/shaders/phong.js
CHANGED
|
@@ -8,9 +8,9 @@ import { add, gt, mul, sub } from "@thi.ng/shader-ast/ast/ops";
|
|
|
8
8
|
import { $ } from "@thi.ng/shader-ast/ast/swizzle";
|
|
9
9
|
import { sym } from "@thi.ng/shader-ast/ast/sym";
|
|
10
10
|
import { dot, max, normalize, pow } from "@thi.ng/shader-ast/builtin/math";
|
|
11
|
-
import { defMaterial } from "../material";
|
|
12
|
-
import { autoNormalMatrix1 } from "../matrices";
|
|
13
|
-
import { colorAttrib, positionAttrib } from "../utils";
|
|
11
|
+
import { defMaterial } from "../material.js";
|
|
12
|
+
import { autoNormalMatrix1 } from "../matrices.js";
|
|
13
|
+
import { colorAttrib, positionAttrib } from "../utils.js";
|
|
14
14
|
export const PHONG = (opts = {}) => ({
|
|
15
15
|
vs: (gl, unis, ins, outs) => [
|
|
16
16
|
defMain(() => {
|
package/shaders/pipeline.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ShaderFn, ShaderSpec } from "../api/shader";
|
|
1
|
+
import type { ShaderFn, ShaderSpec } from "../api/shader.js";
|
|
2
2
|
export declare const PASSTHROUGH_VS: ShaderFn;
|
|
3
3
|
export declare const PASSTHROUGH_VS_UV: ShaderFn;
|
|
4
4
|
export declare const PASSTHROUGH_FS: ShaderFn;
|
package/syntax.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GLSLVersion } from "@thi.ng/shader-ast-glsl/api";
|
|
2
|
-
import type { GLSLDeclPrefixes, GLSLSyntax } from "./api/shader";
|
|
2
|
+
import type { GLSLDeclPrefixes, GLSLSyntax } from "./api/shader.js";
|
|
3
3
|
export declare const PREFIXES: GLSLDeclPrefixes;
|
|
4
4
|
export declare const NO_PREFIXES: GLSLDeclPrefixes;
|
|
5
5
|
/**
|
package/texture.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ITexture, TextureFilter, TextureFormat, TextureOpts, TextureRepeat, TextureTarget, TextureType } from "./api/texture";
|
|
1
|
+
import { ITexture, TextureFilter, TextureFormat, TextureOpts, TextureRepeat, TextureTarget, TextureType } from "./api/texture.js";
|
|
2
2
|
export declare const bindTextures: (textures?: ITexture[] | undefined) => void;
|
|
3
3
|
export declare const unbindTextures: (textures?: ITexture[] | undefined) => void;
|
|
4
4
|
export declare class Texture implements ITexture {
|
package/texture.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { withoutKeysObj } from "@thi.ng/associative/without-keys";
|
|
2
2
|
import { isArray } from "@thi.ng/checks/is-array";
|
|
3
|
-
import { TextureFilter, TextureFormat, TextureRepeat, TextureTarget, TEX_FORMATS, } from "./api/texture";
|
|
4
|
-
import { isGL2Context } from "./checks";
|
|
5
|
-
import { error } from "./error";
|
|
3
|
+
import { TextureFilter, TextureFormat, TextureRepeat, TextureTarget, TEX_FORMATS, } from "./api/texture.js";
|
|
4
|
+
import { isGL2Context } from "./checks.js";
|
|
5
|
+
import { error } from "./error.js";
|
|
6
6
|
const $bind = (op) => (textures) => {
|
|
7
7
|
if (!textures)
|
|
8
8
|
return;
|
|
@@ -13,14 +13,6 @@ const $bind = (op) => (textures) => {
|
|
|
13
13
|
export const bindTextures = $bind("bind");
|
|
14
14
|
export const unbindTextures = $bind("unbind");
|
|
15
15
|
export class Texture {
|
|
16
|
-
gl;
|
|
17
|
-
tex;
|
|
18
|
-
target;
|
|
19
|
-
format;
|
|
20
|
-
filter;
|
|
21
|
-
wrap;
|
|
22
|
-
type;
|
|
23
|
-
size;
|
|
24
16
|
constructor(gl, opts = {}) {
|
|
25
17
|
this.gl = gl;
|
|
26
18
|
this.tex = gl.createTexture() || error("error creating WebGL texture");
|
package/uniforms.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Fn, Fn3, IObjectOf } from "@thi.ng/api";
|
|
2
2
|
import { ReadonlyVec } from "@thi.ng/vectors/api";
|
|
3
|
-
import type { UniformValue } from "./api/shader";
|
|
3
|
+
import type { UniformValue } from "./api/shader.js";
|
|
4
4
|
export declare const UNIFORM_SETTERS: IObjectOf<Fn3<WebGLRenderingContext, WebGLUniformLocation, number | ReadonlyVec | undefined, Fn<UniformValue | undefined | null, void>>>;
|
|
5
5
|
//# sourceMappingURL=uniforms.d.ts.map
|
package/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IObjectOf } from "@thi.ng/api";
|
|
2
2
|
import type { Sym, Term } from "@thi.ng/shader-ast";
|
|
3
|
-
import type { ShaderPresetOpts } from "./api/shader";
|
|
3
|
+
import type { ShaderPresetOpts } from "./api/shader.js";
|
|
4
4
|
export declare const positionAttrib: (opts: Partial<ShaderPresetOpts<any>>, attribs: IObjectOf<Sym<any>>, pos?: string) => Sym<any> | import("@thi.ng/shader-ast").Op2<any>;
|
|
5
5
|
export declare const colorAttrib: (opts: Partial<ShaderPresetOpts<any>>, attribs: IObjectOf<Sym<any>>, fallback: Sym<"vec3">) => Term<"vec3">;
|
|
6
6
|
//# sourceMappingURL=utils.d.ts.map
|