@dunes/render 0.9.2

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 ADDED
@@ -0,0 +1,8 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## 0.9.56 (2023-10-04)
7
+
8
+ **Note:** Version bump only for package @dunes/dollar
@@ -0,0 +1,12 @@
1
+ export declare abstract class Engine {
2
+ #private;
3
+ private CANVAS;
4
+ protected GL: WebGLRenderingContext;
5
+ constructor(CANVAS: HTMLCanvasElement);
6
+ run(): void;
7
+ protected abstract init(): void;
8
+ protected abstract render(): void;
9
+ protected abstract update(width: number, height: number): void;
10
+ protected abstract conclude(): void;
11
+ }
12
+ //# sourceMappingURL=Engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Engine.d.ts","sourceRoot":"","sources":["../../src/engine/Engine.ts"],"names":[],"mappings":"AACA,8BAAsB,MAAM;;IAId,OAAO,CAAC,MAAM;IAD1B,SAAS,CAAC,EAAE,EAAE,qBAAqB,CAAC;gBAChB,MAAM,EAAE,iBAAiB;IAOtC,GAAG;IAUV,SAAS,CAAC,QAAQ,CAAC,IAAI,IAAI,IAAI;IAC/B,SAAS,CAAC,QAAQ,CAAC,MAAM,IAAI,IAAI;IACjC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAC9D,SAAS,CAAC,QAAQ,CAAC,QAAQ,IAAI,IAAI;CACpC"}
@@ -0,0 +1,17 @@
1
+ export class Engine {
2
+ CANVAS;
3
+ GL;
4
+ constructor(CANVAS) {
5
+ this.CANVAS = CANVAS;
6
+ this.GL = CANVAS.getContext("webgl");
7
+ }
8
+ #running = true;
9
+ run() {
10
+ this.init();
11
+ while (this.#running) {
12
+ this.render();
13
+ this.update(this.CANVAS.width, this.CANVAS.height);
14
+ }
15
+ }
16
+ }
17
+ //# sourceMappingURL=Engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Engine.js","sourceRoot":"","sources":["../../src/engine/Engine.ts"],"names":[],"mappings":"AACA,MAAM,OAAgB,MAAM;IAIN;IADV,EAAE,CAAwB;IACpC,YAAoB,MAAyB;QAAzB,WAAM,GAAN,MAAM,CAAmB;QAE3C,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAE,CAAC;IACxC,CAAC;IAED,QAAQ,GAAG,IAAI,CAAC;IAET,GAAG;QAER,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,OAAM,IAAI,CAAC,QAAQ,EACnB;YACE,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SACpD;IACH,CAAC;CAMF"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./engine/Engine.js";
2
+ export * from "./program/Program.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA"}
package/lib/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./engine/Engine.js";
2
+ export * from "./program/Program.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA"}
@@ -0,0 +1,11 @@
1
+ export declare class Program {
2
+ #private;
3
+ private GL;
4
+ constructor(GL: WebGLRenderingContext);
5
+ onVertex(source: string): void;
6
+ onFragment(source: string): void;
7
+ link(): void;
8
+ use(): void;
9
+ private static createShader;
10
+ }
11
+ //# sourceMappingURL=Program.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Program.d.ts","sourceRoot":"","sources":["../../src/program/Program.ts"],"names":[],"mappings":"AACA,qBAAa,OAAO;;IAIN,OAAO,CAAC,EAAE;gBAAF,EAAE,EAAE,qBAAqB;IAStC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAM9B,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAMhC,IAAI,IAAI,IAAI;IAUZ,GAAG,IAAI,IAAI;IAKlB,OAAO,CAAC,MAAM,CAAC,YAAY;CAe5B"}
@@ -0,0 +1,40 @@
1
+ export class Program {
2
+ GL;
3
+ #program;
4
+ constructor(GL) {
5
+ this.GL = GL;
6
+ this.#program = GL.createProgram();
7
+ if (!this.#program) {
8
+ console.log("Failed to create program");
9
+ }
10
+ }
11
+ onVertex(source) {
12
+ const shader = Program.createShader(this.GL, source, this.GL.VERTEX_SHADER);
13
+ this.GL.attachShader(this.#program, shader);
14
+ }
15
+ onFragment(source) {
16
+ const shader = Program.createShader(this.GL, source, this.GL.FRAGMENT_SHADER);
17
+ this.GL.attachShader(this.#program, shader);
18
+ }
19
+ link() {
20
+ this.GL.linkProgram(this.#program);
21
+ if (!this.GL.getProgramParameter(this.#program, this.GL.LINK_STATUS)) {
22
+ const info = this.GL.getProgramInfoLog(this.#program);
23
+ throw `Could not compile WebGL program. \n\n${info}`;
24
+ }
25
+ }
26
+ use() {
27
+ this.GL.useProgram(this.#program);
28
+ }
29
+ static createShader(GL, source, type) {
30
+ const shader = GL.createShader(type);
31
+ GL.shaderSource(shader, source);
32
+ GL.compileShader(shader);
33
+ if (!GL.getShaderParameter(shader, GL.COMPILE_STATUS)) {
34
+ const info = GL.getShaderInfoLog(shader);
35
+ throw `Could not compile ${type == GL.VERTEX_SHADER ? "vertex" : "fragment"} shader. \n\n${info}`;
36
+ }
37
+ return shader;
38
+ }
39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CAAC;SACtD;IACH,CAAC;IAEM,GAAG;QAER,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IAEO,MAAM,CAAC,YAAY,CAAC,EAAyB,EAAE,MAAc,EAAE,IAAY;QAEjF,MAAM,MAAM,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAE,CAAC;QACtC,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAEzB,IAAI,CAAC,EAAE,CAAC,kBAAkB,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE;YACrD,MAAM,IAAI,GAAG,EAAE,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;YACzC,MAAM,qBACJ,IAAI,IAAI,EAAE,CAAC,aAAa,CAAA,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UACvC,gBAAgB,IAAI,EAAE,CAAC;SACxB;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@dunes/render",
3
+ "version": "0.9.2",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "main": "./lib/index.js",
7
+ "types": "./lib/index.d.ts",
8
+ "scripts": {
9
+ "build": "rm -rf lib && tsc && npm version patch"
10
+ },
11
+ "keywords": [
12
+ "javascript",
13
+ "dom",
14
+ "query",
15
+ "typescript"
16
+ ],
17
+ "author": "Omar <omarfkuri@gmail.com>",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git://github.com/omarfkuri/dunes.git"
21
+ }
22
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+
4
+ "compilerOptions": {
5
+ "outDir": "lib",
6
+ "declaration": true,
7
+
8
+ "lib": [
9
+ "ES2020", "DOM", "DOM.Iterable"
10
+ ],
11
+
12
+ "sourceMap": true,
13
+ "declarationMap": true,
14
+ }
15
+ }