@planara/core 1.0.0 → 1.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/dist/core/editor-renderer.d.ts +7 -0
- package/dist/core/editor-renderer.d.ts.map +1 -0
- package/dist/core/renderer.d.ts +5 -4
- package/dist/core/renderer.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -9
- package/dist/index.umd.cjs +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-renderer.d.ts","sourceRoot":"","sources":["../../src/core/editor-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,OAAO,CAAC,KAAK,CAAS;IAEtB,SAAS,CAAC,IAAI;IAcd,SAAS,CAAC,MAAM;CAGjB"}
|
package/dist/core/renderer.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { Renderer as OGLRenderer, Camera, Transform
|
|
2
|
-
export declare class Renderer {
|
|
1
|
+
import { Renderer as OGLRenderer, Camera, Transform } from 'ogl';
|
|
2
|
+
export declare abstract class Renderer {
|
|
3
3
|
gl: OGLRenderer;
|
|
4
4
|
scene: Transform;
|
|
5
5
|
camera: Camera;
|
|
6
|
-
|
|
7
|
-
private canvas;
|
|
6
|
+
protected canvas: HTMLCanvasElement;
|
|
8
7
|
constructor(canvas: HTMLCanvasElement);
|
|
8
|
+
protected abstract init(): void;
|
|
9
9
|
resize(): void;
|
|
10
10
|
render(): void;
|
|
11
11
|
loop(): void;
|
|
12
|
+
protected update(): void;
|
|
12
13
|
}
|
|
13
14
|
//# sourceMappingURL=renderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/core/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/core/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAEjE,8BAAsB,QAAQ;IACrB,EAAE,EAAE,WAAW,CAAC;IAChB,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,MAAM,EAAE,iBAAiB,CAAC;gBAExB,MAAM,EAAE,iBAAiB;IAerC,SAAS,CAAC,QAAQ,CAAC,IAAI,IAAI,IAAI;IAE/B,MAAM;IAKN,MAAM;IAIN,IAAI;IAMJ,SAAS,CAAC,MAAM,IAAI,IAAI;CACzB"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("ogl");class i{gl;scene;camera;canvas;constructor(e){this.canvas=e,this.gl=new t.Renderer({canvas:e}),this.gl.setSize(e.clientWidth,e.clientHeight),this.gl.gl.clearColor(1,1,1,1),this.scene=new t.Transform,this.camera=new t.Camera(this.gl.gl,{fov:45}),this.camera.position.set(1,1,7),this.camera.lookAt([0,0,0]),this.init()}resize(){this.gl.setSize(this.canvas.clientWidth,this.canvas.clientHeight),this.camera.perspective({aspect:this.canvas.width/this.canvas.height})}render(){this.gl.render({scene:this.scene,camera:this.camera})}loop(){this.update(),this.render(),requestAnimationFrame(this.loop.bind(this))}update(){}}class r extends i{orbit;init(){const e=new t.GridHelper(this.gl.gl,{size:10,divisions:10});e.position.y=-.001,e.setParent(this.scene),new t.AxesHelper(this.gl.gl,{size:6,symmetric:!0}).setParent(this.scene),this.orbit=new t.Orbit(this.camera)}update(){this.orbit.update()}}exports.EditorRenderer=r;exports.Renderer=i;
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,35 @@
|
|
|
1
|
-
import { Renderer as
|
|
2
|
-
class
|
|
1
|
+
import { Renderer as i, Transform as s, Camera as r, GridHelper as n, AxesHelper as a, Orbit as h } from "ogl";
|
|
2
|
+
class c {
|
|
3
3
|
gl;
|
|
4
4
|
scene;
|
|
5
5
|
camera;
|
|
6
|
-
orbit;
|
|
7
6
|
canvas;
|
|
8
7
|
constructor(e) {
|
|
9
|
-
this.canvas = e, this.gl = new
|
|
10
|
-
const i = new n(this.gl.gl, { size: 10, divisions: 10 });
|
|
11
|
-
i.position.y = -1e-3, i.setParent(this.scene), this.orbit = new h(this.camera), new a(this.gl.gl, { size: 6, symmetric: !0 }).setParent(this.scene);
|
|
8
|
+
this.canvas = e, this.gl = new i({ canvas: e }), this.gl.setSize(e.clientWidth, e.clientHeight), this.gl.gl.clearColor(1, 1, 1, 1), this.scene = new s(), this.camera = new r(this.gl.gl, { fov: 45 }), this.camera.position.set(1, 1, 7), this.camera.lookAt([0, 0, 0]), this.init();
|
|
12
9
|
}
|
|
13
10
|
resize() {
|
|
14
|
-
this.gl.setSize(
|
|
11
|
+
this.gl.setSize(this.canvas.clientWidth, this.canvas.clientHeight), this.camera.perspective({ aspect: this.canvas.width / this.canvas.height });
|
|
15
12
|
}
|
|
16
13
|
render() {
|
|
17
14
|
this.gl.render({ scene: this.scene, camera: this.camera });
|
|
18
15
|
}
|
|
19
16
|
loop() {
|
|
20
|
-
this.
|
|
17
|
+
this.update(), this.render(), requestAnimationFrame(this.loop.bind(this));
|
|
18
|
+
}
|
|
19
|
+
update() {
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
class d extends c {
|
|
23
|
+
orbit;
|
|
24
|
+
init() {
|
|
25
|
+
const e = new n(this.gl.gl, { size: 10, divisions: 10 });
|
|
26
|
+
e.position.y = -1e-3, e.setParent(this.scene), new a(this.gl.gl, { size: 6, symmetric: !0 }).setParent(this.scene), this.orbit = new h(this.camera);
|
|
27
|
+
}
|
|
28
|
+
update() {
|
|
29
|
+
this.orbit.update();
|
|
21
30
|
}
|
|
22
31
|
}
|
|
23
32
|
export {
|
|
24
|
-
|
|
33
|
+
d as EditorRenderer,
|
|
34
|
+
c as Renderer
|
|
25
35
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("ogl")):typeof define=="function"&&define.amd?define(["exports","ogl"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.PlanaraCore={},t.OGL))})(this,(function(t,e){"use strict";class s{gl;scene;camera;canvas;constructor(i){this.canvas=i,this.gl=new e.Renderer({canvas:i}),this.gl.setSize(i.clientWidth,i.clientHeight),this.gl.gl.clearColor(1,1,1,1),this.scene=new e.Transform,this.camera=new e.Camera(this.gl.gl,{fov:45}),this.camera.position.set(1,1,7),this.camera.lookAt([0,0,0]),this.init()}resize(){this.gl.setSize(this.canvas.clientWidth,this.canvas.clientHeight),this.camera.perspective({aspect:this.canvas.width/this.canvas.height})}render(){this.gl.render({scene:this.scene,camera:this.camera})}loop(){this.update(),this.render(),requestAnimationFrame(this.loop.bind(this))}update(){}}class n extends s{orbit;init(){const i=new e.GridHelper(this.gl.gl,{size:10,divisions:10});i.position.y=-.001,i.setParent(this.scene),new e.AxesHelper(this.gl.gl,{size:6,symmetric:!0}).setParent(this.scene),this.orbit=new e.Orbit(this.camera)}update(){this.orbit.update()}}t.EditorRenderer=n,t.Renderer=s,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED