@gjsify/webgl 0.1.12 → 0.1.15
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/README.md +3 -3
- package/lib/esm/conformance/setup.js +2 -2
- package/lib/esm/index.js +1 -1
- package/lib/esm/{canvas-webgl-widget.js → webgl-bridge.js} +4 -4
- package/lib/esm/webgl1.spec.js +2 -2
- package/lib/esm/webgl2.spec.js +2 -2
- package/lib/types/conformance/setup.d.ts +3 -3
- package/lib/types/index.d.ts +1 -1
- package/lib/types/{canvas-webgl-widget.d.ts → webgl-bridge.d.ts} +3 -3
- package/package.json +7 -7
- package/prebuilds/linux-aarch64/Gwebgl-0.1.typelib +0 -0
- package/prebuilds/linux-aarch64/libgwebgl.so +0 -0
- package/prebuilds/linux-x86_64/libgwebgl.so +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @gjsify/webgl
|
|
2
2
|
|
|
3
|
-
GJS implementation of WebGL 1.0/2.0 using a custom Vala extension (gwebgl). Provides
|
|
3
|
+
GJS implementation of WebGL 1.0/2.0 using a custom Vala extension (gwebgl). Provides WebGLBridge extending Gtk.GLArea.
|
|
4
4
|
|
|
5
5
|
Part of the [gjsify](https://github.com/gjsify/gjsify) project — Node.js and Web APIs for GJS (GNOME JavaScript).
|
|
6
6
|
|
|
@@ -15,9 +15,9 @@ yarn add @gjsify/webgl
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
17
|
```typescript
|
|
18
|
-
import {
|
|
18
|
+
import { WebGLBridge } from '@gjsify/webgl';
|
|
19
19
|
|
|
20
|
-
const widget = new
|
|
20
|
+
const widget = new WebGLBridge();
|
|
21
21
|
widget.installGlobals();
|
|
22
22
|
|
|
23
23
|
widget.onReady((canvas, gl) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WebGLBridge } from "@gjsify/webgl";
|
|
2
2
|
import GLib from "@girs/glib-2.0";
|
|
3
3
|
import Gtk from "@girs/gtk-4.0";
|
|
4
4
|
function createGLSetup() {
|
|
@@ -7,7 +7,7 @@ function createGLSetup() {
|
|
|
7
7
|
const readyLoop = new GLib.MainLoop(null, false);
|
|
8
8
|
const win = new Gtk.Window({});
|
|
9
9
|
win.set_default_size(200, 200);
|
|
10
|
-
const glArea = new
|
|
10
|
+
const glArea = new WebGLBridge();
|
|
11
11
|
glArea.onReady((canvas, g) => {
|
|
12
12
|
try {
|
|
13
13
|
const gl = g;
|
package/lib/esm/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { WebGL2RenderingContext } from "./webgl2-rendering-context.js";
|
|
|
6
6
|
globalThis.WebGLRenderingContext = WebGLRenderingContext;
|
|
7
7
|
globalThis.WebGL2RenderingContext = WebGL2RenderingContext;
|
|
8
8
|
export * from "./html-canvas-element.js";
|
|
9
|
-
export * from "./
|
|
9
|
+
export * from "./webgl-bridge.js";
|
|
10
10
|
export * from "./webgl-active-info.js";
|
|
11
11
|
export * from "./webgl-buffer.js";
|
|
12
12
|
export * from "./webgl-context-attributes.js";
|
|
@@ -4,9 +4,9 @@ import Gtk from "gi://Gtk?version=4.0";
|
|
|
4
4
|
import { HTMLCanvasElement as OurHTMLCanvasElement } from "./html-canvas-element.js";
|
|
5
5
|
import { attachEventControllers } from "@gjsify/event-bridge";
|
|
6
6
|
import { Event } from "@gjsify/dom-events";
|
|
7
|
-
const
|
|
8
|
-
{ GTypeName: "
|
|
9
|
-
class
|
|
7
|
+
const WebGLBridge = GObject.registerClass(
|
|
8
|
+
{ GTypeName: "GjsifyWebGLBridge" },
|
|
9
|
+
class WebGLBridge2 extends Gtk.GLArea {
|
|
10
10
|
constructor(params) {
|
|
11
11
|
super(params);
|
|
12
12
|
this._canvas = null;
|
|
@@ -147,5 +147,5 @@ const CanvasWebGLWidget = GObject.registerClass(
|
|
|
147
147
|
}
|
|
148
148
|
);
|
|
149
149
|
export {
|
|
150
|
-
|
|
150
|
+
WebGLBridge
|
|
151
151
|
};
|
package/lib/esm/webgl1.spec.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, on } from "@gjsify/unit";
|
|
2
|
-
import {
|
|
2
|
+
import { WebGLBridge } from "@gjsify/webgl";
|
|
3
3
|
import {
|
|
4
4
|
makeProgram,
|
|
5
5
|
drawTriangle,
|
|
@@ -21,7 +21,7 @@ var webgl1_spec_default = async () => {
|
|
|
21
21
|
const readyLoop = new GLib.MainLoop(null, false);
|
|
22
22
|
const win = new Gtk.Window({});
|
|
23
23
|
win.set_default_size(200, 200);
|
|
24
|
-
glArea = new
|
|
24
|
+
glArea = new WebGLBridge();
|
|
25
25
|
glArea.onReady((_c, g) => {
|
|
26
26
|
gl = g;
|
|
27
27
|
readyLoop.quit();
|
package/lib/esm/webgl2.spec.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, on } from "@gjsify/unit";
|
|
2
|
-
import { WebGL2RenderingContext as OurWebGL2RenderingContext,
|
|
2
|
+
import { WebGL2RenderingContext as OurWebGL2RenderingContext, WebGLBridge } from "@gjsify/webgl";
|
|
3
3
|
import {
|
|
4
4
|
makeProgram,
|
|
5
5
|
drawTriangle,
|
|
@@ -21,7 +21,7 @@ var webgl2_spec_default = async () => {
|
|
|
21
21
|
const readyLoop = new GLib.MainLoop(null, false);
|
|
22
22
|
const win = new Gtk.Window({});
|
|
23
23
|
win.set_default_size(200, 200);
|
|
24
|
-
glArea = new
|
|
24
|
+
glArea = new WebGLBridge();
|
|
25
25
|
glArea.onReady((c, _g) => {
|
|
26
26
|
gl2 = c.getContext("webgl2");
|
|
27
27
|
readyLoop.quit();
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WebGLBridge } from '@gjsify/webgl';
|
|
2
2
|
import Gtk from '@girs/gtk-4.0';
|
|
3
3
|
export interface GLSetup {
|
|
4
4
|
gl: WebGLRenderingContext;
|
|
5
5
|
gl2: WebGL2RenderingContext | null;
|
|
6
|
-
glArea:
|
|
6
|
+
glArea: WebGLBridge;
|
|
7
7
|
win: Gtk.Window;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* Synchronously initialises a GTK window +
|
|
10
|
+
* Synchronously initialises a GTK window + WebGLBridge and blocks until
|
|
11
11
|
* the GL context is ready (or 10 s timeout).
|
|
12
12
|
* Returns null when no display is available.
|
|
13
13
|
*/
|
package/lib/types/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import '@girs/gjs';
|
|
|
2
2
|
import '@girs/gio-2.0';
|
|
3
3
|
import '@girs/gtk-4.0';
|
|
4
4
|
export * from './html-canvas-element.js';
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './webgl-bridge.js';
|
|
6
6
|
export * from './webgl-active-info.js';
|
|
7
7
|
export * from './webgl-buffer.js';
|
|
8
8
|
export * from './webgl-context-attributes.js';
|
|
@@ -14,7 +14,7 @@ type WebGLReadyCallback = (canvas: globalThis.HTMLCanvasElement, gl: globalThis.
|
|
|
14
14
|
*
|
|
15
15
|
* Usage:
|
|
16
16
|
* ```ts
|
|
17
|
-
* const widget = new
|
|
17
|
+
* const widget = new WebGLBridge();
|
|
18
18
|
* widget.installGlobals(); // sets globalThis.requestAnimationFrame
|
|
19
19
|
* widget.onReady((canvas, gl) => {
|
|
20
20
|
* gl.clearColor(0, 0, 0, 1);
|
|
@@ -23,7 +23,7 @@ type WebGLReadyCallback = (canvas: globalThis.HTMLCanvasElement, gl: globalThis.
|
|
|
23
23
|
* window.set_child(widget);
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
export declare const
|
|
26
|
+
export declare const WebGLBridge: {
|
|
27
27
|
new (params?: Partial<Gtk.GLArea.ConstructorProps>): {
|
|
28
28
|
_canvas: OurHTMLCanvasElement | null;
|
|
29
29
|
_readyCallbacks: WebGLReadyCallback[];
|
|
@@ -514,5 +514,5 @@ export declare const CanvasWebGLWidget: {
|
|
|
514
514
|
override_property(property_id: number, name: string): void;
|
|
515
515
|
_classInit(klass: any): any;
|
|
516
516
|
};
|
|
517
|
-
export type
|
|
517
|
+
export type WebGLBridge = InstanceType<typeof WebGLBridge>;
|
|
518
518
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/webgl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "WebGL module for Gjs",
|
|
5
5
|
"module": "lib/esm/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"check": "tsc --noEmit",
|
|
24
24
|
"init:meson": "meson setup build .",
|
|
25
25
|
"init:meson:wipe": "yarn init:meson --wipe",
|
|
26
|
-
"build": "yarn build:
|
|
26
|
+
"build": "yarn build:gjsify && yarn build:types",
|
|
27
27
|
"build:gjsify": "gjsify build --library 'src/ts/**/*.{ts,js}'",
|
|
28
28
|
"build:meson": "yarn init:meson && meson compile -C build",
|
|
29
29
|
"build:types": "tsc",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"WebGL"
|
|
40
40
|
],
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@gjsify/cli": "^0.1.
|
|
43
|
-
"@gjsify/unit": "^0.1.
|
|
42
|
+
"@gjsify/cli": "^0.1.15",
|
|
43
|
+
"@gjsify/unit": "^0.1.15",
|
|
44
44
|
"@types/bit-twiddle": "^1.0.3",
|
|
45
45
|
"@types/node": "^25.6.0",
|
|
46
46
|
"typescript": "^6.0.2"
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"@girs/gjs": "^4.0.0-rc.3",
|
|
50
50
|
"@girs/gtk-4.0": "^4.23.0-4.0.0-rc.3",
|
|
51
51
|
"@girs/gwebgl-0.1": "^0.1.0-4.0.0-rc.3",
|
|
52
|
-
"@gjsify/dom-elements": "^0.1.
|
|
53
|
-
"@gjsify/event-bridge": "^0.1.
|
|
54
|
-
"@gjsify/utils": "^0.1.
|
|
52
|
+
"@gjsify/dom-elements": "^0.1.15",
|
|
53
|
+
"@gjsify/event-bridge": "^0.1.15",
|
|
54
|
+
"@gjsify/utils": "^0.1.15",
|
|
55
55
|
"bit-twiddle": "^1.0.2",
|
|
56
56
|
"glsl-tokenizer": "^2.1.5"
|
|
57
57
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|