@gjsify/webgl 0.0.4 → 0.1.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/README.md +78 -6
- package/lib/esm/canvas-webgl-widget.js +116 -0
- package/lib/esm/html-canvas-element.js +31 -50
- package/lib/esm/index.js +7 -0
- package/lib/esm/index.spec.js +629 -120
- package/lib/esm/test-utils.js +87 -0
- package/lib/esm/test.js +5 -1
- package/lib/esm/utils.js +1 -1
- package/lib/esm/webgl-active-info.js +2 -2
- package/lib/esm/webgl-buffer.js +2 -3
- package/lib/esm/webgl-context-attributes.js +2 -3
- package/lib/esm/webgl-framebuffer.js +3 -4
- package/lib/esm/webgl-program.js +2 -3
- package/lib/esm/webgl-query.js +15 -0
- package/lib/esm/webgl-renderbuffer.js +2 -3
- package/lib/esm/webgl-rendering-context.js +105 -101
- package/lib/esm/webgl-sampler.js +15 -0
- package/lib/esm/webgl-shader-precision-format.js +2 -3
- package/lib/esm/webgl-shader.js +2 -3
- package/lib/esm/webgl-sync.js +15 -0
- package/lib/esm/webgl-texture.js +2 -3
- package/lib/esm/webgl-transform-feedback.js +15 -0
- package/lib/esm/webgl-uniform-location.js +2 -3
- package/lib/esm/webgl-vertex-array-object.js +21 -0
- package/lib/esm/webgl2-rendering-context.js +591 -0
- package/lib/esm/webgl2.spec.js +578 -0
- package/lib/types/canvas-webgl-widget.d.ts +509 -0
- package/lib/types/extensions/ext-blend-minmax.d.ts +2 -2
- package/lib/types/extensions/ext-texture-filter-anisotropic.d.ts +2 -2
- package/lib/types/extensions/oes-element-index-unit.d.ts +2 -2
- package/lib/types/extensions/oes-standard-derivatives.d.ts +2 -2
- package/lib/types/extensions/oes-texture-float-linear.d.ts +2 -2
- package/lib/types/extensions/oes-texture-float.d.ts +2 -2
- package/lib/types/extensions/stackgl-destroy-context.d.ts +3 -3
- package/lib/types/extensions/stackgl-resize-drawing-buffer.d.ts +3 -3
- package/lib/types/html-canvas-element.d.ts +19 -31
- package/lib/types/index.d.ts +7 -0
- package/lib/types/test-utils.d.ts +45 -0
- package/lib/types/types/extension.d.ts +2 -2
- package/lib/types/utils.d.ts +14 -15
- package/lib/types/webgl-active-info.d.ts +1 -2
- package/lib/types/webgl-buffer.d.ts +5 -6
- package/lib/types/webgl-context-attributes.d.ts +1 -2
- package/lib/types/webgl-framebuffer.d.ts +4 -5
- package/lib/types/webgl-program.d.ts +4 -5
- package/lib/types/webgl-query.d.ts +7 -0
- package/lib/types/webgl-renderbuffer.d.ts +4 -5
- package/lib/types/webgl-rendering-context.d.ts +15 -13
- package/lib/types/webgl-sampler.d.ts +7 -0
- package/lib/types/webgl-shader-precision-format.d.ts +1 -2
- package/lib/types/webgl-shader.d.ts +4 -5
- package/lib/types/webgl-sync.d.ts +7 -0
- package/lib/types/webgl-texture-unit.d.ts +3 -3
- package/lib/types/webgl-texture.d.ts +6 -7
- package/lib/types/webgl-transform-feedback.d.ts +7 -0
- package/lib/types/webgl-uniform-location.d.ts +3 -4
- package/lib/types/webgl-vertex-array-object.d.ts +9 -0
- package/lib/types/webgl-vertex-attribute.d.ts +5 -5
- package/lib/types/webgl2-rendering-context.d.ts +124 -0
- package/package.json +27 -26
- package/prebuilds/linux-aarch64/Gwebgl-0.1.typelib +0 -0
- package/prebuilds/linux-aarch64/libgwebgl.so +0 -0
- package/prebuilds/linux-x86_64/Gwebgl-0.1.typelib +0 -0
- package/prebuilds/linux-x86_64/libgwebgl.so +0 -0
- package/lib/cjs/@types/glsl-tokenizer/index.d.js +0 -0
- package/lib/cjs/extensions/ext-blend-minmax.js +0 -18
- package/lib/cjs/extensions/ext-texture-filter-anisotropic.js +0 -18
- package/lib/cjs/extensions/oes-element-index-unit.js +0 -14
- package/lib/cjs/extensions/oes-standard-derivatives.js +0 -17
- package/lib/cjs/extensions/oes-texture-float-linear.js +0 -14
- package/lib/cjs/extensions/oes-texture-float.js +0 -14
- package/lib/cjs/extensions/stackgl-destroy-context.js +0 -12
- package/lib/cjs/extensions/stackgl-resize-drawing-buffer.js +0 -12
- package/lib/cjs/html-canvas-element.js +0 -70
- package/lib/cjs/index.js +0 -18
- package/lib/cjs/index.spec.js +0 -146
- package/lib/cjs/linkable.js +0 -50
- package/lib/cjs/test.js +0 -3
- package/lib/cjs/types/constructor.js +0 -0
- package/lib/cjs/types/extension.js +0 -0
- package/lib/cjs/types/index.js +0 -5
- package/lib/cjs/types/typed-array.js +0 -0
- package/lib/cjs/types/webgl-constants.js +0 -0
- package/lib/cjs/types/webgl-context-attribute-options.js +0 -0
- package/lib/cjs/utils.js +0 -212
- package/lib/cjs/webgl-active-info.js +0 -10
- package/lib/cjs/webgl-buffer.js +0 -18
- package/lib/cjs/webgl-context-attributes.js +0 -24
- package/lib/cjs/webgl-drawing-buffer-wrapper.js +0 -10
- package/lib/cjs/webgl-framebuffer.js +0 -109
- package/lib/cjs/webgl-program.js +0 -26
- package/lib/cjs/webgl-renderbuffer.js +0 -24
- package/lib/cjs/webgl-rendering-context.js +0 -3343
- package/lib/cjs/webgl-shader-precision-format.js +0 -11
- package/lib/cjs/webgl-shader.js +0 -23
- package/lib/cjs/webgl-texture-unit.js +0 -12
- package/lib/cjs/webgl-texture.js +0 -22
- package/lib/cjs/webgl-uniform-location.js +0 -15
- package/lib/cjs/webgl-vertex-attribute.js +0 -147
- package/meson.build +0 -39
- package/src/test/app.vala +0 -60
- package/src/ts/@types/glsl-tokenizer/index.d.ts +0 -18
- package/src/ts/extensions/angle-instanced-arrays.ts.off +0 -232
- package/src/ts/extensions/ext-blend-minmax.ts +0 -18
- package/src/ts/extensions/ext-texture-filter-anisotropic.ts +0 -18
- package/src/ts/extensions/oes-element-index-unit.ts +0 -14
- package/src/ts/extensions/oes-standard-derivatives.ts +0 -17
- package/src/ts/extensions/oes-texture-float-linear.ts +0 -14
- package/src/ts/extensions/oes-texture-float.ts +0 -14
- package/src/ts/extensions/oes-vertex-array-object.ts.off +0 -128
- package/src/ts/extensions/stackgl-destroy-context.ts +0 -12
- package/src/ts/extensions/stackgl-resize-drawing-buffer.ts +0 -14
- package/src/ts/extensions/webgl-draw-buffers.ts.off +0 -107
- package/src/ts/html-canvas-element.ts +0 -98
- package/src/ts/index.spec.ts +0 -186
- package/src/ts/index.ts +0 -21
- package/src/ts/linkable.ts +0 -55
- package/src/ts/test.ts +0 -6
- package/src/ts/types/constructor.ts +0 -3
- package/src/ts/types/extension.ts +0 -3
- package/src/ts/types/index.ts +0 -26
- package/src/ts/types/typed-array.ts +0 -1
- package/src/ts/types/webgl-constants.ts +0 -300
- package/src/ts/types/webgl-context-attribute-options.ts +0 -12
- package/src/ts/utils.ts +0 -266
- package/src/ts/webgl-active-info.ts +0 -13
- package/src/ts/webgl-buffer.ts +0 -21
- package/src/ts/webgl-context-attributes.ts +0 -24
- package/src/ts/webgl-drawing-buffer-wrapper.ts +0 -10
- package/src/ts/webgl-framebuffer.ts +0 -133
- package/src/ts/webgl-program.ts +0 -30
- package/src/ts/webgl-renderbuffer.ts +0 -28
- package/src/ts/webgl-rendering-context.ts +0 -4050
- package/src/ts/webgl-shader-precision-format.ts +0 -12
- package/src/ts/webgl-shader.ts +0 -29
- package/src/ts/webgl-texture-unit.ts +0 -16
- package/src/ts/webgl-texture.ts +0 -27
- package/src/ts/webgl-uniform-location.ts +0 -18
- package/src/ts/webgl-vertex-attribute.ts +0 -169
- package/src/vala/handle-types.vala +0 -23
- package/src/vala/webgl-rendering-context-base.vala +0 -1265
- package/src/vala/webgl-rendering-context.vala +0 -265
- package/src/vapi/epoxy.vapi +0 -14558
- package/src/vapi/glesv2.vapi +0 -670
- package/test.gjs.js +0 -39937
- package/test.gjs.js.meta.json +0 -1
- package/tmp/.tsbuildinfo +0 -1
- package/tsconfig.json +0 -38
- package/tsconfig.types.json +0 -7
package/lib/cjs/utils.js
DELETED
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { WebGLUniformLocation } from "./webgl-uniform-location.js";
|
|
2
|
-
import GLib from "@girs/glib-2.0";
|
|
3
|
-
function bindPublics(props, wrapper, privateInstance, privateMethods) {
|
|
4
|
-
for (let i = 0; i < props.length; i++) {
|
|
5
|
-
const prop = props[i];
|
|
6
|
-
const value = privateInstance[prop];
|
|
7
|
-
if (typeof value === "function") {
|
|
8
|
-
if (privateMethods.indexOf(prop) === -1) {
|
|
9
|
-
wrapper[prop] = value.bind(privateInstance);
|
|
10
|
-
}
|
|
11
|
-
} else {
|
|
12
|
-
if (prop[0] === "_" || prop[0] === "0" || prop[0] === "1") {
|
|
13
|
-
continue;
|
|
14
|
-
}
|
|
15
|
-
wrapper[prop] = value;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function checkObject(object) {
|
|
20
|
-
return typeof object === "object" || object === void 0;
|
|
21
|
-
}
|
|
22
|
-
function checkUniform(program, location) {
|
|
23
|
-
return location instanceof WebGLUniformLocation && location._program === program && location._linkCount === program._linkCount;
|
|
24
|
-
}
|
|
25
|
-
function isTypedArray(data) {
|
|
26
|
-
return data instanceof Uint8Array || data instanceof Uint8ClampedArray || data instanceof Int8Array || data instanceof Uint16Array || data instanceof Int16Array || data instanceof Uint32Array || data instanceof Int32Array || data instanceof Float32Array || data instanceof Float64Array;
|
|
27
|
-
}
|
|
28
|
-
function isValidString(str) {
|
|
29
|
-
const c = str.replace(/(?:\/\*(?:[\s\S]*?)\*\/)|(?:([\s;])+\/\/(?:.*)$)/gm, "");
|
|
30
|
-
return !/["$`@\\'\0]/.test(c);
|
|
31
|
-
}
|
|
32
|
-
function vertexCount(gl, primitive, count) {
|
|
33
|
-
switch (primitive) {
|
|
34
|
-
case gl.TRIANGLES:
|
|
35
|
-
return count - count % 3;
|
|
36
|
-
case gl.LINES:
|
|
37
|
-
return count - count % 2;
|
|
38
|
-
case gl.LINE_LOOP:
|
|
39
|
-
case gl.POINTS:
|
|
40
|
-
return count;
|
|
41
|
-
case gl.TRIANGLE_FAN:
|
|
42
|
-
case gl.LINE_STRIP:
|
|
43
|
-
if (count < 2) {
|
|
44
|
-
return 0;
|
|
45
|
-
}
|
|
46
|
-
return count;
|
|
47
|
-
case gl.TRIANGLE_STRIP:
|
|
48
|
-
if (count < 3) {
|
|
49
|
-
return 0;
|
|
50
|
-
}
|
|
51
|
-
return count;
|
|
52
|
-
default:
|
|
53
|
-
return -1;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function typeSize(gl, type) {
|
|
57
|
-
switch (type) {
|
|
58
|
-
case gl.UNSIGNED_BYTE:
|
|
59
|
-
case gl.BYTE:
|
|
60
|
-
return 1;
|
|
61
|
-
case gl.UNSIGNED_SHORT:
|
|
62
|
-
case gl.SHORT:
|
|
63
|
-
return 2;
|
|
64
|
-
case gl.UNSIGNED_INT:
|
|
65
|
-
case gl.INT:
|
|
66
|
-
case gl.FLOAT:
|
|
67
|
-
return 4;
|
|
68
|
-
}
|
|
69
|
-
return 0;
|
|
70
|
-
}
|
|
71
|
-
function uniformTypeSize(gl, type) {
|
|
72
|
-
switch (type) {
|
|
73
|
-
case gl.BOOL_VEC4:
|
|
74
|
-
case gl.INT_VEC4:
|
|
75
|
-
case gl.FLOAT_VEC4:
|
|
76
|
-
return 4;
|
|
77
|
-
case gl.BOOL_VEC3:
|
|
78
|
-
case gl.INT_VEC3:
|
|
79
|
-
case gl.FLOAT_VEC3:
|
|
80
|
-
return 3;
|
|
81
|
-
case gl.BOOL_VEC2:
|
|
82
|
-
case gl.INT_VEC2:
|
|
83
|
-
case gl.FLOAT_VEC2:
|
|
84
|
-
return 2;
|
|
85
|
-
case gl.BOOL:
|
|
86
|
-
case gl.INT:
|
|
87
|
-
case gl.FLOAT:
|
|
88
|
-
case gl.SAMPLER_2D:
|
|
89
|
-
case gl.SAMPLER_CUBE:
|
|
90
|
-
return 1;
|
|
91
|
-
default:
|
|
92
|
-
return 0;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
const listToArray = (values) => {
|
|
96
|
-
const array = [];
|
|
97
|
-
for (const value of values.values()) {
|
|
98
|
-
array.push(value);
|
|
99
|
-
}
|
|
100
|
-
return array;
|
|
101
|
-
};
|
|
102
|
-
function arrayToUint8Array(array) {
|
|
103
|
-
if (isTypedArray(array)) {
|
|
104
|
-
return new Uint8Array(array.buffer).subarray(
|
|
105
|
-
array.byteOffset,
|
|
106
|
-
array.byteLength + array.byteOffset
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
if (Array.isArray(array) || array instanceof ArrayBuffer) {
|
|
110
|
-
return new Uint8Array(array);
|
|
111
|
-
}
|
|
112
|
-
if (typeof array.values === "function") {
|
|
113
|
-
return new Uint8Array(listToArray(array));
|
|
114
|
-
}
|
|
115
|
-
throw new Error("Can't unpack typed array!");
|
|
116
|
-
}
|
|
117
|
-
function Uint8ArrayToVariant(array) {
|
|
118
|
-
const variant = new GLib.Variant("ay", Array.from(array || []));
|
|
119
|
-
return variant;
|
|
120
|
-
}
|
|
121
|
-
function boolArray(array) {
|
|
122
|
-
return Array.from(new Int32Array(array.buffer)).map(
|
|
123
|
-
(a) => a ? true : false
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
const extractImageData = (pixels) => {
|
|
127
|
-
const width = pixels.width;
|
|
128
|
-
const height = pixels.height;
|
|
129
|
-
if (typeof pixels === "object" && typeof width !== "undefined" && typeof height !== "undefined") {
|
|
130
|
-
if (typeof pixels.data !== "undefined") {
|
|
131
|
-
return pixels;
|
|
132
|
-
}
|
|
133
|
-
let context = null;
|
|
134
|
-
if (typeof pixels.getContext === "function") {
|
|
135
|
-
context = pixels.getContext("2d");
|
|
136
|
-
} else if (typeof pixels.isPixbuf()) {
|
|
137
|
-
return pixels.getImageData();
|
|
138
|
-
} else if (typeof pixels.src !== "undefined" && typeof document === "object" && typeof document.createElement === "function") {
|
|
139
|
-
const canvas = document.createElement("canvas");
|
|
140
|
-
if (typeof canvas === "object" && typeof canvas.getContext === "function") {
|
|
141
|
-
canvas.width = width;
|
|
142
|
-
canvas.height = height;
|
|
143
|
-
context = canvas.getContext("2d");
|
|
144
|
-
if (context !== null) {
|
|
145
|
-
context.drawImage(pixels, 0, 0);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (context !== null) {
|
|
150
|
-
return context.getImageData(0, 0, width, height);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return null;
|
|
154
|
-
};
|
|
155
|
-
function formatSize(gl, internalFormat) {
|
|
156
|
-
switch (internalFormat) {
|
|
157
|
-
case gl.ALPHA:
|
|
158
|
-
case gl.LUMINANCE:
|
|
159
|
-
return 1;
|
|
160
|
-
case gl.LUMINANCE_ALPHA:
|
|
161
|
-
return 2;
|
|
162
|
-
case gl.RGB:
|
|
163
|
-
return 3;
|
|
164
|
-
case gl.RGBA:
|
|
165
|
-
return 4;
|
|
166
|
-
}
|
|
167
|
-
return 0;
|
|
168
|
-
}
|
|
169
|
-
function convertPixels(pixels) {
|
|
170
|
-
if (typeof pixels === "object" && pixels !== null) {
|
|
171
|
-
if (pixels instanceof ArrayBuffer) {
|
|
172
|
-
return new Uint8Array(pixels);
|
|
173
|
-
} else if (pixels instanceof Uint8Array || pixels instanceof Uint16Array || pixels instanceof Uint8ClampedArray || pixels instanceof Float32Array) {
|
|
174
|
-
return arrayToUint8Array(pixels);
|
|
175
|
-
} else if (pixels instanceof Buffer) {
|
|
176
|
-
return new Uint8Array(pixels);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
function checkFormat(gl, format) {
|
|
182
|
-
return format === gl.ALPHA || format === gl.LUMINANCE_ALPHA || format === gl.LUMINANCE || format === gl.RGB || format === gl.RGBA;
|
|
183
|
-
}
|
|
184
|
-
function validCubeTarget(gl, target) {
|
|
185
|
-
return target === gl.TEXTURE_CUBE_MAP_POSITIVE_X || target === gl.TEXTURE_CUBE_MAP_NEGATIVE_X || target === gl.TEXTURE_CUBE_MAP_POSITIVE_Y || target === gl.TEXTURE_CUBE_MAP_NEGATIVE_Y || target === gl.TEXTURE_CUBE_MAP_POSITIVE_Z || target === gl.TEXTURE_CUBE_MAP_NEGATIVE_Z;
|
|
186
|
-
}
|
|
187
|
-
function flag(options, name, dflt) {
|
|
188
|
-
if (!options || !(typeof options === "object") || !(name in options)) {
|
|
189
|
-
return dflt;
|
|
190
|
-
}
|
|
191
|
-
return !!options[name];
|
|
192
|
-
}
|
|
193
|
-
export {
|
|
194
|
-
Uint8ArrayToVariant,
|
|
195
|
-
arrayToUint8Array,
|
|
196
|
-
bindPublics,
|
|
197
|
-
boolArray,
|
|
198
|
-
checkFormat,
|
|
199
|
-
checkObject,
|
|
200
|
-
checkUniform,
|
|
201
|
-
convertPixels,
|
|
202
|
-
extractImageData,
|
|
203
|
-
flag,
|
|
204
|
-
formatSize,
|
|
205
|
-
isTypedArray,
|
|
206
|
-
isValidString,
|
|
207
|
-
listToArray,
|
|
208
|
-
typeSize,
|
|
209
|
-
uniformTypeSize,
|
|
210
|
-
validCubeTarget,
|
|
211
|
-
vertexCount
|
|
212
|
-
};
|
package/lib/cjs/webgl-buffer.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Linkable } from "./linkable.js";
|
|
2
|
-
class GjsifyWebGLBuffer extends Linkable {
|
|
3
|
-
constructor(_, ctx) {
|
|
4
|
-
super(_);
|
|
5
|
-
this._size = 0;
|
|
6
|
-
this._elements = new Uint8Array(0);
|
|
7
|
-
this._ctx = ctx;
|
|
8
|
-
}
|
|
9
|
-
_performDelete() {
|
|
10
|
-
const ctx = this._ctx;
|
|
11
|
-
delete ctx._buffers[this._ | 0];
|
|
12
|
-
ctx._native.deleteBuffer(this._);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export {
|
|
16
|
-
GjsifyWebGLBuffer,
|
|
17
|
-
GjsifyWebGLBuffer as WebGLBuffer
|
|
18
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
class GjsifyWebGLContextAttributes {
|
|
2
|
-
constructor(alpha, depth, stencil, antialias, premultipliedAlpha, preserveDrawingBuffer, preferLowPowerToHighPerformance, failIfMajorPerformanceCaveat) {
|
|
3
|
-
this.alpha = alpha;
|
|
4
|
-
this.depth = depth;
|
|
5
|
-
this.stencil = stencil;
|
|
6
|
-
this.antialias = antialias;
|
|
7
|
-
this.premultipliedAlpha = premultipliedAlpha;
|
|
8
|
-
this.preserveDrawingBuffer = preserveDrawingBuffer;
|
|
9
|
-
this.preferLowPowerToHighPerformance = preferLowPowerToHighPerformance;
|
|
10
|
-
this.failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveat;
|
|
11
|
-
this.alpha = alpha;
|
|
12
|
-
this.depth = depth;
|
|
13
|
-
this.stencil = stencil;
|
|
14
|
-
this.antialias = antialias;
|
|
15
|
-
this.premultipliedAlpha = premultipliedAlpha;
|
|
16
|
-
this.preserveDrawingBuffer = preserveDrawingBuffer;
|
|
17
|
-
this.preferLowPowerToHighPerformance = preferLowPowerToHighPerformance;
|
|
18
|
-
this.failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveat;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
GjsifyWebGLContextAttributes,
|
|
23
|
-
GjsifyWebGLContextAttributes as WebGLContextAttributes
|
|
24
|
-
};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { Linkable } from "./linkable.js";
|
|
2
|
-
class GjsifyWebGLFramebuffer extends Linkable {
|
|
3
|
-
constructor(_, ctx) {
|
|
4
|
-
super(_);
|
|
5
|
-
this._binding = 0;
|
|
6
|
-
this._width = 0;
|
|
7
|
-
this._height = 0;
|
|
8
|
-
this._status = null;
|
|
9
|
-
this._ctx = ctx;
|
|
10
|
-
this._attachments = {};
|
|
11
|
-
this._attachments[ctx.COLOR_ATTACHMENT0] = null;
|
|
12
|
-
this._attachments[ctx.DEPTH_ATTACHMENT] = null;
|
|
13
|
-
this._attachments[ctx.STENCIL_ATTACHMENT] = null;
|
|
14
|
-
this._attachments[ctx.DEPTH_STENCIL_ATTACHMENT] = null;
|
|
15
|
-
this._attachmentLevel = {};
|
|
16
|
-
this._attachmentLevel[ctx.COLOR_ATTACHMENT0] = 0;
|
|
17
|
-
this._attachmentLevel[ctx.DEPTH_ATTACHMENT] = 0;
|
|
18
|
-
this._attachmentLevel[ctx.STENCIL_ATTACHMENT] = 0;
|
|
19
|
-
this._attachmentLevel[ctx.DEPTH_STENCIL_ATTACHMENT] = 0;
|
|
20
|
-
this._attachmentFace = {};
|
|
21
|
-
this._attachmentFace[ctx.COLOR_ATTACHMENT0] = 0;
|
|
22
|
-
this._attachmentFace[ctx.DEPTH_ATTACHMENT] = 0;
|
|
23
|
-
this._attachmentFace[ctx.STENCIL_ATTACHMENT] = 0;
|
|
24
|
-
this._attachmentFace[ctx.DEPTH_STENCIL_ATTACHMENT] = 0;
|
|
25
|
-
if (ctx._extensions.webgl_draw_buffers) {
|
|
26
|
-
const webGLDrawBuffers = ctx._extensions.webgl_draw_buffers;
|
|
27
|
-
this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT1_WEBGL] = null;
|
|
28
|
-
this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT2_WEBGL] = null;
|
|
29
|
-
this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT3_WEBGL] = null;
|
|
30
|
-
this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT4_WEBGL] = null;
|
|
31
|
-
this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT5_WEBGL] = null;
|
|
32
|
-
this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT6_WEBGL] = null;
|
|
33
|
-
this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT7_WEBGL] = null;
|
|
34
|
-
this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT8_WEBGL] = null;
|
|
35
|
-
this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT9_WEBGL] = null;
|
|
36
|
-
this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT10_WEBGL] = null;
|
|
37
|
-
this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT11_WEBGL] = null;
|
|
38
|
-
this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT12_WEBGL] = null;
|
|
39
|
-
this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT13_WEBGL] = null;
|
|
40
|
-
this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT14_WEBGL] = null;
|
|
41
|
-
this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT15_WEBGL] = null;
|
|
42
|
-
this._attachments[ctx.NONE] = null;
|
|
43
|
-
this._attachments[ctx.BACK] = null;
|
|
44
|
-
this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT1_WEBGL] = 0;
|
|
45
|
-
this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT2_WEBGL] = 0;
|
|
46
|
-
this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT3_WEBGL] = 0;
|
|
47
|
-
this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT4_WEBGL] = 0;
|
|
48
|
-
this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT5_WEBGL] = 0;
|
|
49
|
-
this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT6_WEBGL] = 0;
|
|
50
|
-
this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT7_WEBGL] = 0;
|
|
51
|
-
this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT8_WEBGL] = 0;
|
|
52
|
-
this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT9_WEBGL] = 0;
|
|
53
|
-
this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT10_WEBGL] = 0;
|
|
54
|
-
this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT11_WEBGL] = 0;
|
|
55
|
-
this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT12_WEBGL] = 0;
|
|
56
|
-
this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT13_WEBGL] = 0;
|
|
57
|
-
this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT14_WEBGL] = 0;
|
|
58
|
-
this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT15_WEBGL] = 0;
|
|
59
|
-
this._attachmentLevel[ctx.NONE] = null;
|
|
60
|
-
this._attachmentLevel[ctx.BACK] = null;
|
|
61
|
-
this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT1_WEBGL] = 0;
|
|
62
|
-
this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT2_WEBGL] = 0;
|
|
63
|
-
this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT3_WEBGL] = 0;
|
|
64
|
-
this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT4_WEBGL] = 0;
|
|
65
|
-
this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT5_WEBGL] = 0;
|
|
66
|
-
this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT6_WEBGL] = 0;
|
|
67
|
-
this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT7_WEBGL] = 0;
|
|
68
|
-
this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT8_WEBGL] = 0;
|
|
69
|
-
this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT9_WEBGL] = 0;
|
|
70
|
-
this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT10_WEBGL] = 0;
|
|
71
|
-
this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT11_WEBGL] = 0;
|
|
72
|
-
this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT12_WEBGL] = 0;
|
|
73
|
-
this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT13_WEBGL] = 0;
|
|
74
|
-
this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT14_WEBGL] = 0;
|
|
75
|
-
this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT15_WEBGL] = 0;
|
|
76
|
-
this._attachmentFace[ctx.NONE] = null;
|
|
77
|
-
this._attachmentFace[ctx.BACK] = null;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
_clearAttachment(attachment) {
|
|
81
|
-
const object = this._attachments[attachment];
|
|
82
|
-
if (!object) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
this._attachments[attachment] = null;
|
|
86
|
-
this._unlink(object);
|
|
87
|
-
}
|
|
88
|
-
_setAttachment(object, attachment) {
|
|
89
|
-
const prevObject = this._attachments[attachment];
|
|
90
|
-
if (prevObject === object) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
this._clearAttachment(attachment);
|
|
94
|
-
if (!object) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
this._attachments[attachment] = object;
|
|
98
|
-
this._link(object);
|
|
99
|
-
}
|
|
100
|
-
_performDelete() {
|
|
101
|
-
const ctx = this._ctx;
|
|
102
|
-
delete ctx._framebuffers[this._ | 0];
|
|
103
|
-
ctx.deleteFramebuffer.call(ctx, this);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
export {
|
|
107
|
-
GjsifyWebGLFramebuffer,
|
|
108
|
-
GjsifyWebGLFramebuffer as WebGLFramebuffer
|
|
109
|
-
};
|
package/lib/cjs/webgl-program.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Linkable } from "./linkable.js";
|
|
2
|
-
class GjsifyWebGLProgram extends Linkable {
|
|
3
|
-
constructor(_, ctx) {
|
|
4
|
-
super(_);
|
|
5
|
-
this._linkCount = 0;
|
|
6
|
-
this._linkStatus = false;
|
|
7
|
-
this._linkInfoLog = "not linked";
|
|
8
|
-
this._attributes = [];
|
|
9
|
-
this._uniforms = [];
|
|
10
|
-
this._ctx = ctx;
|
|
11
|
-
this._linkCount = 0;
|
|
12
|
-
this._linkStatus = false;
|
|
13
|
-
this._linkInfoLog = "not linked";
|
|
14
|
-
this._attributes = [];
|
|
15
|
-
this._uniforms = [];
|
|
16
|
-
}
|
|
17
|
-
_performDelete() {
|
|
18
|
-
const ctx = this._ctx;
|
|
19
|
-
delete ctx._programs[this._ | 0];
|
|
20
|
-
ctx._native.deleteProgram(this._ | 0);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
GjsifyWebGLProgram,
|
|
25
|
-
GjsifyWebGLProgram as WebGLProgram
|
|
26
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Linkable } from "./linkable.js";
|
|
2
|
-
class GjsifyWebGLRenderbuffer extends Linkable {
|
|
3
|
-
constructor(_, ctx) {
|
|
4
|
-
super(_);
|
|
5
|
-
this._binding = 0;
|
|
6
|
-
this._width = 0;
|
|
7
|
-
this._height = 0;
|
|
8
|
-
this._format = 0;
|
|
9
|
-
this._ctx = ctx;
|
|
10
|
-
this._binding = 0;
|
|
11
|
-
this._width = 0;
|
|
12
|
-
this._height = 0;
|
|
13
|
-
this._format = 0;
|
|
14
|
-
}
|
|
15
|
-
_performDelete() {
|
|
16
|
-
const ctx = this._ctx;
|
|
17
|
-
delete ctx._renderbuffers[this._ | 0];
|
|
18
|
-
ctx._native.deleteRenderbuffer(this._);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
GjsifyWebGLRenderbuffer,
|
|
23
|
-
GjsifyWebGLRenderbuffer as WebGLRenderbuffer
|
|
24
|
-
};
|