@planara/core 1.2.2 → 1.2.3
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.
|
@@ -1 +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;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,8CAA8C;IAC9C,OAAO,CAAC,KAAK,CAAS;IAEtB;;;OAGG;IACH,SAAS,CAAC,IAAI;IAcd;;OAEG;IACH,SAAS,CAAC,MAAM;
|
|
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;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,8CAA8C;IAC9C,OAAO,CAAC,KAAK,CAAS;IAEtB;;;OAGG;IACH,SAAS,CAAC,IAAI;IAcd;;OAEG;IACH,SAAS,CAAC,MAAM;CAIjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview-renderer.d.ts","sourceRoot":"","sources":["../../src/core/preview-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;IAC3C,8CAA8C;IAC9C,OAAO,CAAC,KAAK,CAAS;IAEtB;;OAEG;IACH,SAAS,CAAC,IAAI;IAYd;;OAEG;IACH,SAAS,CAAC,MAAM;
|
|
1
|
+
{"version":3,"file":"preview-renderer.d.ts","sourceRoot":"","sources":["../../src/core/preview-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;IAC3C,8CAA8C;IAC9C,OAAO,CAAC,KAAK,CAAS;IAEtB;;OAEG;IACH,SAAS,CAAC,IAAI;IAYd;;OAEG;IACH,SAAS,CAAC,MAAM;CAIjB"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("ogl");class h{gl;scene;camera;canvas;constructor(e){this.canvas=e,this.gl=new r.Renderer({canvas:e}),this.gl.setSize(e.clientWidth,e.clientHeight),this.gl.gl.clearColor(1,1,1,1),this.scene=new r.Transform,this.camera=new r.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 u extends h{orbit;init(){const e=new r.GridHelper(this.gl.gl,{size:10,divisions:10});e.position.y=-.001,e.setParent(this.scene),new r.AxesHelper(this.gl.gl,{size:6,symmetric:!0}).setParent(this.scene),this.orbit=new r.Orbit(this.camera)}update(){this.orbit
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("ogl");class h{gl;scene;camera;canvas;constructor(e){this.canvas=e,this.gl=new r.Renderer({canvas:e}),this.gl.setSize(e.clientWidth,e.clientHeight),this.gl.gl.clearColor(1,1,1,1),this.scene=new r.Transform,this.camera=new r.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 u extends h{orbit;init(){const e=new r.GridHelper(this.gl.gl,{size:10,divisions:10});e.position.y=-.001,e.setParent(this.scene),new r.AxesHelper(this.gl.gl,{size:6,symmetric:!0}).setParent(this.scene),this.orbit=new r.Orbit(this.camera)}update(){this.orbit?.update()}}class v extends h{orbit;init(){this.orbit=new r.Orbit(this.camera,{target:new r.Vec3(0,0,0),minPolarAngle:Math.PI/2,maxPolarAngle:Math.PI/2,enableRotate:!0,enableZoom:!1,enablePan:!1})}update(){this.orbit?.update()}}class g{type;position;normal;uv;material;constructor(e){this.type=e.type,this.position=e.position,this.normal=e.normal??[],this.uv=e.uv??[],this.material=e.material}}var d=(s=>(s[s.Cube=0]="Cube",s[s.Sphere=1]="Sphere",s[s.Plane=2]="Plane",s[s.Cylinder=3]="Cylinder",s[s.Custom=4]="Custom",s))(d||{});class b{positions=[];normals=[];uvs=[];tmpPositions=[];tmpNormals=[];tmpUVs=[];parse(e){const n=e.split(`
|
|
2
2
|
`);for(const a of n){if(!a.trim()||a.startsWith("#"))continue;const t=a.trim().split(/\s+/);switch(t[0]){case"v":this.tmpPositions.push(t.slice(1).map(Number));break;case"vn":this.tmpNormals.push(t.slice(1).map(Number));break;case"vt":this.tmpUVs.push(t.slice(1).map(Number));break;case"f":this.processFaceLine(t);break}}const o={type:d.Custom,position:this.positions,...this.normals.length>0&&{normal:this.normals},...this.uvs.length>0&&{uv:this.uvs}};return new g(o)}processFaceLine(e){for(let n=1;n<e.length;n++){const o=e[n];if(!o)continue;const[a,t,l]=o.split("/"),c=a?parseInt(a,10):void 0,p=t?parseInt(t,10):void 0,m=l?parseInt(l,10):void 0;if(c!==void 0){const i=this.tmpPositions[c-1];i&&this.positions.push(...i)}if(p!==void 0){const i=this.tmpUVs[p-1];i&&this.uvs.push(...i)}if(m!==void 0){const i=this.tmpNormals[m-1];i&&this.normals.push(...i)}}}}exports.EditorRenderer=u;exports.ObjLoader=b;exports.PreviewRenderer=v;exports.Renderer=h;
|
package/dist/index.es.js
CHANGED
|
@@ -54,7 +54,7 @@ class I extends m {
|
|
|
54
54
|
* Обновление состояния рендерера.
|
|
55
55
|
*/
|
|
56
56
|
update() {
|
|
57
|
-
this.orbit
|
|
57
|
+
this.orbit?.update();
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
class C extends m {
|
|
@@ -77,7 +77,7 @@ class C extends m {
|
|
|
77
77
|
* Обновление состояния рендерера.
|
|
78
78
|
*/
|
|
79
79
|
update() {
|
|
80
|
-
this.orbit
|
|
80
|
+
this.orbit?.update();
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
class P {
|
package/dist/index.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(i,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("ogl")):typeof define=="function"&&define.amd?define(["exports","ogl"],s):(i=typeof globalThis<"u"?globalThis:i||self,s(i.PlanaraCore={},i.OGL))})(this,(function(i,s){"use strict";class c{gl;scene;camera;canvas;constructor(e){this.canvas=e,this.gl=new s.Renderer({canvas:e}),this.gl.setSize(e.clientWidth,e.clientHeight),this.gl.gl.clearColor(1,1,1,1),this.scene=new s.Transform,this.camera=new s.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 v extends c{orbit;init(){const e=new s.GridHelper(this.gl.gl,{size:10,divisions:10});e.position.y=-.001,e.setParent(this.scene),new s.AxesHelper(this.gl.gl,{size:6,symmetric:!0}).setParent(this.scene),this.orbit=new s.Orbit(this.camera)}update(){this.orbit
|
|
1
|
+
(function(i,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("ogl")):typeof define=="function"&&define.amd?define(["exports","ogl"],s):(i=typeof globalThis<"u"?globalThis:i||self,s(i.PlanaraCore={},i.OGL))})(this,(function(i,s){"use strict";class c{gl;scene;camera;canvas;constructor(e){this.canvas=e,this.gl=new s.Renderer({canvas:e}),this.gl.setSize(e.clientWidth,e.clientHeight),this.gl.gl.clearColor(1,1,1,1),this.scene=new s.Transform,this.camera=new s.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 v extends c{orbit;init(){const e=new s.GridHelper(this.gl.gl,{size:10,divisions:10});e.position.y=-.001,e.setParent(this.scene),new s.AxesHelper(this.gl.gl,{size:6,symmetric:!0}).setParent(this.scene),this.orbit=new s.Orbit(this.camera)}update(){this.orbit?.update()}}class f extends c{orbit;init(){this.orbit=new s.Orbit(this.camera,{target:new s.Vec3(0,0,0),minPolarAngle:Math.PI/2,maxPolarAngle:Math.PI/2,enableRotate:!0,enableZoom:!1,enablePan:!1})}update(){this.orbit?.update()}}class b{type;position;normal;uv;material;constructor(e){this.type=e.type,this.position=e.position,this.normal=e.normal??[],this.uv=e.uv??[],this.material=e.material}}var l=(t=>(t[t.Cube=0]="Cube",t[t.Sphere=1]="Sphere",t[t.Plane=2]="Plane",t[t.Cylinder=3]="Cylinder",t[t.Custom=4]="Custom",t))(l||{});class g{positions=[];normals=[];uvs=[];tmpPositions=[];tmpNormals=[];tmpUVs=[];parse(e){const a=e.split(`
|
|
2
2
|
`);for(const o of a){if(!o.trim()||o.startsWith("#"))continue;const n=o.trim().split(/\s+/);switch(n[0]){case"v":this.tmpPositions.push(n.slice(1).map(Number));break;case"vn":this.tmpNormals.push(n.slice(1).map(Number));break;case"vt":this.tmpUVs.push(n.slice(1).map(Number));break;case"f":this.processFaceLine(n);break}}const h={type:l.Custom,position:this.positions,...this.normals.length>0&&{normal:this.normals},...this.uvs.length>0&&{uv:this.uvs}};return new b(h)}processFaceLine(e){for(let a=1;a<e.length;a++){const h=e[a];if(!h)continue;const[o,n,p]=h.split("/"),m=o?parseInt(o,10):void 0,d=n?parseInt(n,10):void 0,u=p?parseInt(p,10):void 0;if(m!==void 0){const r=this.tmpPositions[m-1];r&&this.positions.push(...r)}if(d!==void 0){const r=this.tmpUVs[d-1];r&&this.uvs.push(...r)}if(u!==void 0){const r=this.tmpNormals[u-1];r&&this.normals.push(...r)}}}}i.EditorRenderer=v,i.ObjLoader=g,i.PreviewRenderer=f,i.Renderer=c,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
|