@thi.ng/webgl 6.6.35 → 6.7.0
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 +11 -1
- package/README.md +1 -1
- package/api/multipass.d.ts +3 -0
- package/fbo.d.ts +4 -2
- package/multipass.js +24 -10
- package/package.json +12 -12
- package/syntax.d.ts +1 -1
- package/syntax.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-03-
|
|
3
|
+
- **Last updated**: 2024-03-06T08:50:42Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,16 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [6.7.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/webgl@6.7.0) (2024-03-06)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- update shader prelude, add sampler3D default precision ([73d7818](https://github.com/thi-ng/umbrella/commit/73d7818))
|
|
17
|
+
- add `precision lowp sampler3D` to prelude (WebGL2 only)
|
|
18
|
+
- update defMultipass(), add sampler3D support ([3f924cf](https://github.com/thi-ng/umbrella/commit/3f924cf))
|
|
19
|
+
- update texture & shader init
|
|
20
|
+
- update MultipassOpts
|
|
21
|
+
|
|
12
22
|
### [6.6.32](https://github.com/thi-ng/umbrella/tree/@thi.ng/webgl@6.6.32) (2024-02-22)
|
|
13
23
|
|
|
14
24
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
package/api/multipass.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { IObjectOf } from "@thi.ng/api";
|
|
2
2
|
import type { AttribPool } from "@thi.ng/vector-pools";
|
|
3
3
|
import type { IFbo, IndexBufferSpec } from "./buffers.js";
|
|
4
|
+
import type { ExtensionBehaviors } from "./ext.js";
|
|
4
5
|
import type { InstancingSpec, ModelAttributeSpecs, ModelSpec } from "./model.js";
|
|
5
6
|
import type { ShaderAttribSpecs, ShaderFn, ShaderState, ShaderVaryingSpecs, UniformDecl, UniformValues } from "./shader.js";
|
|
6
7
|
import type { ITexture, TextureOpts } from "./texture.js";
|
|
@@ -26,6 +27,7 @@ export interface MultipassOpts {
|
|
|
26
27
|
passes: PassOpts[];
|
|
27
28
|
width: number;
|
|
28
29
|
height: number;
|
|
30
|
+
depth?: number;
|
|
29
31
|
uniforms?: Partial<PassUniforms>;
|
|
30
32
|
uniformVals?: UniformValues;
|
|
31
33
|
}
|
|
@@ -44,6 +46,7 @@ export interface PassOpts {
|
|
|
44
46
|
replacePrelude?: boolean;
|
|
45
47
|
generateDecls?: boolean;
|
|
46
48
|
state?: Partial<ShaderState>;
|
|
49
|
+
ext?: ExtensionBehaviors;
|
|
47
50
|
}
|
|
48
51
|
export interface PassUniforms {
|
|
49
52
|
inputs: never;
|
package/fbo.d.ts
CHANGED
|
@@ -6,9 +6,11 @@ import type { FboOpts, IFbo } from "./api/buffers.js";
|
|
|
6
6
|
* available. The max. number of attachments can be obtained via the
|
|
7
7
|
* `maxAttachments` property of the FBO instance.
|
|
8
8
|
*
|
|
9
|
-
* ```
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { defFBO } from "@thi.ng/webgl";
|
|
11
|
+
*
|
|
10
12
|
* // create FBO w/ 2 render targets
|
|
11
|
-
* fbo =
|
|
13
|
+
* fbo = defFBO(gl, { tex: [tex1, tex2] });
|
|
12
14
|
* ```
|
|
13
15
|
*
|
|
14
16
|
* https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_draw_buffers
|
package/multipass.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { assert } from "@thi.ng/errors/assert";
|
|
2
|
-
import { S2D, V2, V4 } from "@thi.ng/shader-ast/api/types";
|
|
2
|
+
import { S2D, S3D, V2, V4 } from "@thi.ng/shader-ast/api/types";
|
|
3
3
|
import { assign } from "@thi.ng/shader-ast/ast/assign";
|
|
4
4
|
import { defMain } from "@thi.ng/shader-ast/ast/function";
|
|
5
5
|
import { INT0, ivec2 } from "@thi.ng/shader-ast/ast/lit";
|
|
6
6
|
import { $xy } from "@thi.ng/shader-ast/ast/swizzle";
|
|
7
7
|
import { texelFetch } from "@thi.ng/shader-ast/builtin/texture";
|
|
8
|
+
import { mapIndexed } from "@thi.ng/transducers";
|
|
8
9
|
import { assocObj } from "@thi.ng/transducers/assoc-obj";
|
|
9
10
|
import { map } from "@thi.ng/transducers/map";
|
|
10
11
|
import { range } from "@thi.ng/transducers/range";
|
|
11
12
|
import { some } from "@thi.ng/transducers/some";
|
|
12
13
|
import { transduce } from "@thi.ng/transducers/transduce";
|
|
14
|
+
import {
|
|
15
|
+
TextureFilter,
|
|
16
|
+
TextureRepeat,
|
|
17
|
+
TextureTarget
|
|
18
|
+
} from "./api/texture.js";
|
|
13
19
|
import { compileModel } from "./buffer.js";
|
|
14
20
|
import { isFloatTexture, isGL2Context } from "./checks.js";
|
|
15
21
|
import { draw } from "./draw.js";
|
|
@@ -87,24 +93,31 @@ const initPasses = (opts, textures) => {
|
|
|
87
93
|
return m;
|
|
88
94
|
});
|
|
89
95
|
};
|
|
96
|
+
const TEX_TYPE_MAP = {
|
|
97
|
+
[TextureTarget.TEXTURE_2D]: S2D,
|
|
98
|
+
[TextureTarget.TEXTURE_3D]: S3D,
|
|
99
|
+
[TextureTarget.TEXTURE_CUBE_MAP]: "samplerCube"
|
|
100
|
+
};
|
|
90
101
|
const initShader = (gl, pass, textures) => {
|
|
91
102
|
const isGL2 = isGL2Context(gl);
|
|
92
|
-
const numIns = pass.inputs.length;
|
|
93
103
|
const numOuts = pass.outputs.length;
|
|
94
|
-
const ext = {};
|
|
104
|
+
const ext = { ...pass.ext };
|
|
95
105
|
const spec = {
|
|
96
106
|
vs: pass.vs || PASSTHROUGH_VS,
|
|
97
107
|
fs: pass.fs,
|
|
98
|
-
attribs: pass.attribs || {
|
|
99
|
-
position: V2
|
|
100
|
-
},
|
|
108
|
+
attribs: pass.attribs || { position: V2 },
|
|
101
109
|
varying: pass.varying,
|
|
102
110
|
uniforms: {
|
|
103
111
|
...pass.uniforms,
|
|
104
112
|
...transduce(
|
|
105
|
-
|
|
113
|
+
mapIndexed(
|
|
114
|
+
(i, id) => [
|
|
115
|
+
`input${i}`,
|
|
116
|
+
[TEX_TYPE_MAP[textures[id].target], i]
|
|
117
|
+
]
|
|
118
|
+
),
|
|
106
119
|
assocObj(),
|
|
107
|
-
|
|
120
|
+
pass.inputs
|
|
108
121
|
)
|
|
109
122
|
},
|
|
110
123
|
outputs: numOuts ? transduce(
|
|
@@ -137,8 +150,9 @@ const initTextures = (opts) => Object.keys(opts.textures).reduce((acc, id) => {
|
|
|
137
150
|
acc[id] = defTexture(opts.gl, {
|
|
138
151
|
width: opts.width,
|
|
139
152
|
height: opts.height,
|
|
140
|
-
|
|
141
|
-
|
|
153
|
+
depth: opts.depth,
|
|
154
|
+
filter: TextureFilter.NEAREST,
|
|
155
|
+
wrap: TextureRepeat.CLAMP,
|
|
142
156
|
image: null,
|
|
143
157
|
...opts.textures[id]
|
|
144
158
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/webgl",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.0",
|
|
4
4
|
"description": "WebGL & GLSL abstraction layer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -40,21 +40,21 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@thi.ng/api": "^8.9.27",
|
|
43
|
-
"@thi.ng/associative": "^6.3.
|
|
43
|
+
"@thi.ng/associative": "^6.3.45",
|
|
44
44
|
"@thi.ng/canvas": "^0.2.8",
|
|
45
45
|
"@thi.ng/checks": "^3.5.1",
|
|
46
46
|
"@thi.ng/equiv": "^2.1.50",
|
|
47
47
|
"@thi.ng/errors": "^2.4.19",
|
|
48
48
|
"@thi.ng/logger": "^3.0.4",
|
|
49
|
-
"@thi.ng/matrices": "^2.3.
|
|
50
|
-
"@thi.ng/memoize": "^3.1.
|
|
51
|
-
"@thi.ng/pixel": "^6.1.
|
|
52
|
-
"@thi.ng/shader-ast": "^0.
|
|
53
|
-
"@thi.ng/shader-ast-glsl": "^0.4.
|
|
54
|
-
"@thi.ng/shader-ast-stdlib": "^0.
|
|
55
|
-
"@thi.ng/transducers": "^8.9.
|
|
56
|
-
"@thi.ng/vector-pools": "^3.1.
|
|
57
|
-
"@thi.ng/vectors": "^7.10.
|
|
49
|
+
"@thi.ng/matrices": "^2.3.21",
|
|
50
|
+
"@thi.ng/memoize": "^3.1.62",
|
|
51
|
+
"@thi.ng/pixel": "^6.1.15",
|
|
52
|
+
"@thi.ng/shader-ast": "^0.14.0",
|
|
53
|
+
"@thi.ng/shader-ast-glsl": "^0.4.107",
|
|
54
|
+
"@thi.ng/shader-ast-stdlib": "^0.17.0",
|
|
55
|
+
"@thi.ng/transducers": "^8.9.9",
|
|
56
|
+
"@thi.ng/vector-pools": "^3.1.113",
|
|
57
|
+
"@thi.ng/vectors": "^7.10.15"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@microsoft/api-extractor": "^7.40.1",
|
|
@@ -219,5 +219,5 @@
|
|
|
219
219
|
],
|
|
220
220
|
"year": 2014
|
|
221
221
|
},
|
|
222
|
-
"gitHead": "
|
|
222
|
+
"gitHead": "f6bb0e172c5dcb574b961f5155a50040d5569685\n"
|
|
223
223
|
}
|
package/syntax.d.ts
CHANGED
|
@@ -26,5 +26,5 @@ export declare const EXPORT_FRAGCOL: (body?: string, out?: string) => string;
|
|
|
26
26
|
/**
|
|
27
27
|
* Default GLSL prelude.
|
|
28
28
|
*/
|
|
29
|
-
export declare const GLSL_HEADER
|
|
29
|
+
export declare const GLSL_HEADER: string;
|
|
30
30
|
//# sourceMappingURL=syntax.d.ts.map
|