@thi.ng/webgl 6.4.23 → 6.5.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2023-08-31T10:05:26Z
3
+ - **Last updated**: 2023-09-25T07:43:28Z
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,12 @@ 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.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/webgl@6.5.0) (2023-09-19)
13
+
14
+ #### 🚀 Features
15
+
16
+ - update clearCanvas(), add defaultViewport() ([a7b47a2](https://github.com/thi-ng/umbrella/commit/a7b47a2))
17
+
12
18
  ### [6.4.20](https://github.com/thi-ng/umbrella/tree/@thi.ng/webgl@6.4.20) (2023-08-31)
13
19
 
14
20
  #### ♻️ Refactoring
package/README.md CHANGED
@@ -96,7 +96,7 @@ For Node.js REPL:
96
96
  const webgl = await import("@thi.ng/webgl");
97
97
  ```
98
98
 
99
- Package sizes (brotli'd, pre-treeshake): ESM: 11.39 KB
99
+ Package sizes (brotli'd, pre-treeshake): ESM: 11.44 KB
100
100
 
101
101
  ## Dependencies
102
102
 
package/canvas.d.ts CHANGED
@@ -9,12 +9,22 @@ export declare const glCanvas: (opts?: Partial<WeblGLCanvasOpts>) => {
9
9
  };
10
10
  export declare const getExtensions: <K extends keyof WebGLExtensionMap>(gl: WebGLRenderingContext, ids: K[], required?: boolean) => Pick<WebGLExtensionMap, K>;
11
11
  /**
12
- * Sets clear color to given RGBA `color` and clears viewport's
12
+ * Sets clear color to given RGB(A) `color` and clears viewport's
13
13
  * `COLOR_BUFFER_BIT` and (by default) also `DEPTH_BUFFER_BIT`.
14
14
  *
15
+ * @remarks
16
+ * If the given color vector only contains RGB values, alpha will default to
17
+ * 1.0.
18
+ *
15
19
  * @param gl
16
20
  * @param color
17
21
  * @param depth
18
22
  */
19
23
  export declare const clearCanvas: (gl: WebGLRenderingContext, [r, g, b, a]: ReadonlyVec, depth?: boolean) => void;
24
+ /**
25
+ * Resets viewport to full drawing buffer size.
26
+ *
27
+ * @param gl
28
+ */
29
+ export declare const defaultViewport: (gl: WebGLRenderingContext) => void;
20
30
  //# sourceMappingURL=canvas.d.ts.map
package/canvas.js CHANGED
@@ -49,14 +49,24 @@ export const getExtensions = (gl, ids, required = true) => {
49
49
  return ext;
50
50
  };
51
51
  /**
52
- * Sets clear color to given RGBA `color` and clears viewport's
52
+ * Sets clear color to given RGB(A) `color` and clears viewport's
53
53
  * `COLOR_BUFFER_BIT` and (by default) also `DEPTH_BUFFER_BIT`.
54
54
  *
55
+ * @remarks
56
+ * If the given color vector only contains RGB values, alpha will default to
57
+ * 1.0.
58
+ *
55
59
  * @param gl
56
60
  * @param color
57
61
  * @param depth
58
62
  */
59
63
  export const clearCanvas = (gl, [r, g, b, a], depth = true) => {
60
- gl.clearColor(r, g, b, a);
64
+ gl.clearColor(r, g, b, a != null ? a : 1);
61
65
  gl.clear(gl.COLOR_BUFFER_BIT | (depth ? gl.DEPTH_BUFFER_BIT : 0));
62
66
  };
67
+ /**
68
+ * Resets viewport to full drawing buffer size.
69
+ *
70
+ * @param gl
71
+ */
72
+ export const defaultViewport = (gl) => gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/webgl",
3
- "version": "6.4.23",
3
+ "version": "6.5.1",
4
4
  "description": "WebGL & GLSL abstraction layer",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -45,7 +45,7 @@
45
45
  "@thi.ng/equiv": "^2.1.30",
46
46
  "@thi.ng/errors": "^2.3.5",
47
47
  "@thi.ng/logger": "^1.4.21",
48
- "@thi.ng/matrices": "^2.1.72",
48
+ "@thi.ng/matrices": "^2.1.73",
49
49
  "@thi.ng/memoize": "^3.1.38",
50
50
  "@thi.ng/pixel": "^4.2.22",
51
51
  "@thi.ng/shader-ast": "^0.12.68",
@@ -219,5 +219,5 @@
219
219
  ],
220
220
  "year": 2014
221
221
  },
222
- "gitHead": "c22e8996cee284ebe8ea88582beb1ab5fc6ee503\n"
222
+ "gitHead": "fb2697579b193b609ec52237ea0d99c7295b6d3c\n"
223
223
  }