@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.
@@ -0,0 +1,7 @@
1
+ import { Renderer } from './renderer';
2
+ export declare class EditorRenderer extends Renderer {
3
+ private orbit;
4
+ protected init(): void;
5
+ protected update(): void;
6
+ }
7
+ //# sourceMappingURL=editor-renderer.d.ts.map
@@ -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"}
@@ -1,13 +1,14 @@
1
- import { Renderer as OGLRenderer, Camera, Transform, Orbit } from 'ogl';
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
- orbit: Orbit;
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,EAAc,KAAK,EAAc,MAAM,KAAK,CAAC;AAEhG,qBAAa,QAAQ;IACZ,EAAE,EAAE,WAAW,CAAC;IAChB,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACpB,OAAO,CAAC,MAAM,CAAoB;gBAEtB,MAAM,EAAE,iBAAiB;IA0BrC,MAAM;IAKN,MAAM;IAIN,IAAI;CAKL"}
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 e=require("ogl");class s{gl;scene;camera;orbit;canvas;constructor(t){this.canvas=t,this.gl=new e.Renderer({canvas:t}),this.gl.setSize(t.clientWidth,t.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]);const i=new e.GridHelper(this.gl.gl,{size:10,divisions:10});i.position.y=-.001,i.setParent(this.scene),this.orbit=new e.Orbit(this.camera),new e.AxesHelper(this.gl.gl,{size:6,symmetric:!0}).setParent(this.scene)}resize(){this.gl.setSize(window.innerWidth,window.innerHeight),this.camera.perspective({aspect:this.canvas.width/this.canvas.height})}render(){this.gl.render({scene:this.scene,camera:this.camera})}loop(){this.orbit.update(),this.render(),requestAnimationFrame(this.loop.bind(this))}}exports.Renderer=s;
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
@@ -1,2 +1,3 @@
1
1
  export * from './core/renderer';
2
+ export * from './core/editor-renderer';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -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 t, Transform as s, Camera as r, GridHelper as n, Orbit as h, AxesHelper as a } from "ogl";
2
- class g {
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 t({ 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]);
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(window.innerWidth, window.innerHeight), this.camera.perspective({ aspect: this.canvas.width / this.canvas.height });
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.orbit.update(), this.render(), requestAnimationFrame(this.loop.bind(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
- g as Renderer
33
+ d as EditorRenderer,
34
+ c as Renderer
25
35
  };
@@ -1 +1 @@
1
- (function(i,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("ogl")):typeof define=="function"&&define.amd?define(["exports","ogl"],e):(i=typeof globalThis<"u"?globalThis:i||self,e(i.PlanaraCore={},i.OGL))})(this,(function(i,e){"use strict";class n{gl;scene;camera;orbit;canvas;constructor(t){this.canvas=t,this.gl=new e.Renderer({canvas:t}),this.gl.setSize(t.clientWidth,t.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]);const s=new e.GridHelper(this.gl.gl,{size:10,divisions:10});s.position.y=-.001,s.setParent(this.scene),this.orbit=new e.Orbit(this.camera),new e.AxesHelper(this.gl.gl,{size:6,symmetric:!0}).setParent(this.scene)}resize(){this.gl.setSize(window.innerWidth,window.innerHeight),this.camera.perspective({aspect:this.canvas.width/this.canvas.height})}render(){this.gl.render({scene:this.scene,camera:this.camera})}loop(){this.orbit.update(),this.render(),requestAnimationFrame(this.loop.bind(this))}}i.Renderer=n,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
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
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@planara/core",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "publishConfig": {
5
- "access": "public"
5
+ "access": "public",
6
+ "registry": "https://registry.npmjs.org/"
6
7
  },
7
8
  "type": "module",
8
9
  "main": "dist/index.cjs.js",