@planara/core 1.5.0 → 1.6.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 +26 -39
- package/dist/core/editor-renderer.d.ts.map +1 -1
- package/dist/core/preview-renderer.d.ts +1 -1
- package/dist/core/preview-renderer.d.ts.map +1 -1
- package/dist/core/renderer.d.ts +38 -2
- package/dist/core/renderer.d.ts.map +1 -1
- package/dist/events/editor-events.d.ts +18 -0
- package/dist/events/editor-events.d.ts.map +1 -0
- package/dist/events/event-bus.d.ts +17 -0
- package/dist/events/event-bus.d.ts.map +1 -0
- package/dist/events/event-topics.d.ts +12 -0
- package/dist/events/event-topics.d.ts.map +1 -0
- package/dist/extensions/mesh-extension.d.ts +12 -0
- package/dist/extensions/mesh-extension.d.ts.map +1 -0
- package/dist/extensions/orbit-extension.d.ts +1 -1
- package/dist/extensions/orbit-extension.d.ts.map +1 -1
- package/dist/handlers/display/wireframe-handler.d.ts +6 -6
- package/dist/handlers/display/wireframe-handler.d.ts.map +1 -1
- package/dist/handlers/select/mesh-select-handler.d.ts +25 -0
- package/dist/handlers/select/mesh-select-handler.d.ts.map +1 -0
- package/dist/hub/app-hub.d.ts +1 -2
- package/dist/hub/app-hub.d.ts.map +1 -1
- package/dist/hub/editor-hub.d.ts +12 -4
- package/dist/hub/editor-hub.d.ts.map +1 -1
- package/dist/index.cjs.js +26 -9
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +1448 -1061
- package/dist/index.full.d.ts +150 -51
- package/dist/index.public.d.ts +114 -28
- package/dist/index.umd.js +26 -9
- package/dist/interfaces/{mesh-api.d.ts → api/mesh-api.d.ts} +1 -0
- package/dist/interfaces/api/mesh-api.d.ts.map +1 -0
- package/dist/interfaces/api/renderer-api.d.ts +27 -0
- package/dist/interfaces/api/renderer-api.d.ts.map +1 -0
- package/dist/interfaces/{display-handler.d.ts → handler/display-handler.d.ts} +1 -0
- package/dist/interfaces/handler/display-handler.d.ts.map +1 -0
- package/dist/interfaces/{handler.d.ts → handler/handler.d.ts} +2 -1
- package/dist/interfaces/handler/handler.d.ts.map +1 -0
- package/dist/interfaces/handler/select-handler.d.ts +13 -0
- package/dist/interfaces/handler/select-handler.d.ts.map +1 -0
- package/dist/interfaces/manager/display-manager.d.ts +8 -0
- package/dist/interfaces/manager/display-manager.d.ts.map +1 -0
- package/dist/interfaces/{manager.d.ts → manager/manager.d.ts} +0 -6
- package/dist/interfaces/manager/manager.d.ts.map +1 -0
- package/dist/interfaces/manager/select-manager.d.ts +8 -0
- package/dist/interfaces/manager/select-manager.d.ts.map +1 -0
- package/dist/ioc/container.d.ts +3 -2
- package/dist/ioc/container.d.ts.map +1 -1
- package/dist/loaders/obj-loader.d.ts +6 -6
- package/dist/loaders/obj-loader.d.ts.map +1 -1
- package/dist/managers/{display-manager.d.ts → display/display-manager.d.ts} +4 -4
- package/dist/managers/display/display-manager.d.ts.map +1 -0
- package/dist/managers/select/select-manager.d.ts +19 -0
- package/dist/managers/select/select-manager.d.ts.map +1 -0
- package/dist/types/camera/camera-position.d.ts +10 -0
- package/dist/types/camera/camera-position.d.ts.map +1 -0
- package/dist/types/event/select-event-type.d.ts +6 -0
- package/dist/types/event/select-event-type.d.ts.map +1 -0
- package/dist/utils/program-settings.d.ts.map +1 -1
- package/dist/utils/renderer-api.d.ts +7 -5
- package/dist/utils/renderer-api.d.ts.map +1 -1
- package/package.json +3 -2
- package/dist/interfaces/display-handler.d.ts.map +0 -1
- package/dist/interfaces/handler.d.ts.map +0 -1
- package/dist/interfaces/manager.d.ts.map +0 -1
- package/dist/interfaces/mesh-api.d.ts.map +0 -1
- package/dist/interfaces/renderer-api.d.ts +0 -14
- package/dist/interfaces/renderer-api.d.ts.map +0 -1
- package/dist/managers/display-manager.d.ts.map +0 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(T,j){typeof exports=="object"&&typeof module<"u"?j(exports,require("ogl")):typeof define=="function"&&define.amd?define(["exports","ogl"],j):(T=typeof globalThis<"u"?globalThis:T||self,j(T.PlanaraCore={},T.OGL))})(this,(function(T,j){"use strict";var je=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ke={};/*! *****************************************************************************
|
|
2
2
|
Copyright (C) Microsoft. All rights reserved.
|
|
3
3
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
4
|
this file except in compliance with the License. You may obtain a copy of the
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
13
|
and limitations under the License.
|
|
14
|
-
***************************************************************************** */var ve;function Le(){if(ve)return pe;ve=1;var t;return(function(e){(function(r){var i=typeof globalThis=="object"?globalThis:typeof de=="object"?de:typeof self=="object"?self:typeof this=="object"?this:w(),a=o(e);typeof i.Reflect<"u"&&(a=o(i.Reflect,a)),r(a,i),typeof i.Reflect>"u"&&(i.Reflect=e);function o(v,b){return function(A,G){Object.defineProperty(v,A,{configurable:!0,writable:!0,value:G}),b&&b(A,G)}}function f(){try{return Function("return this;")()}catch{}}function g(){try{return(0,eval)("(function() { return this; })()")}catch{}}function w(){return f()||g()}})(function(r,i){var a=Object.prototype.hasOwnProperty,o=typeof Symbol=="function",f=o&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",g=o&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",w=typeof Object.create=="function",v={__proto__:[]}instanceof Array,b=!w&&!v,A={create:w?function(){return he(Object.create(null))}:v?function(){return he({__proto__:null})}:function(){return he({})},has:b?function(n,s){return a.call(n,s)}:function(n,s){return s in n},get:b?function(n,s){return a.call(n,s)?n[s]:void 0}:function(n,s){return n[s]}},G=Object.getPrototypeOf(Function),V=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:$t(),oe=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:qt(),ue=typeof WeakMap=="function"?WeakMap:Bt(),H=o?Symbol.for("@reflect-metadata:registry"):void 0,Z=Wt(),be=zt(Z);function Ot(n,s,u,l){if(m(u)){if(!Ae(n))throw new TypeError;if(!De(s))throw new TypeError;return xt(n,s)}else{if(!Ae(n))throw new TypeError;if(!S(s))throw new TypeError;if(!S(l)&&!m(l)&&!N(l))throw new TypeError;return N(l)&&(l=void 0),u=k(u),jt(n,s,u,l)}}r("decorate",Ot);function Pt(n,s){function u(l,y){if(!S(l))throw new TypeError;if(!m(y)&&!Gt(y))throw new TypeError;Ee(n,s,l,y)}return u}r("metadata",Pt);function Et(n,s,u,l){if(!S(u))throw new TypeError;return m(l)||(l=k(l)),Ee(n,s,u,l)}r("defineMetadata",Et);function St(n,s,u){if(!S(s))throw new TypeError;return m(u)||(u=k(u)),Re(n,s,u)}r("hasMetadata",St);function Ct(n,s,u){if(!S(s))throw new TypeError;return m(u)||(u=k(u)),le(n,s,u)}r("hasOwnMetadata",Ct);function It(n,s,u){if(!S(s))throw new TypeError;return m(u)||(u=k(u)),Oe(n,s,u)}r("getMetadata",It);function Tt(n,s,u){if(!S(s))throw new TypeError;return m(u)||(u=k(u)),Pe(n,s,u)}r("getOwnMetadata",Tt);function At(n,s){if(!S(n))throw new TypeError;return m(s)||(s=k(s)),Se(n,s)}r("getMetadataKeys",At);function Dt(n,s){if(!S(n))throw new TypeError;return m(s)||(s=k(s)),Ce(n,s)}r("getOwnMetadataKeys",Dt);function kt(n,s,u){if(!S(s))throw new TypeError;if(m(u)||(u=k(u)),!S(s))throw new TypeError;m(u)||(u=k(u));var l=W(s,u,!1);return m(l)?!1:l.OrdinaryDeleteMetadata(n,s,u)}r("deleteMetadata",kt);function xt(n,s){for(var u=n.length-1;u>=0;--u){var l=n[u],y=l(s);if(!m(y)&&!N(y)){if(!De(y))throw new TypeError;s=y}}return s}function jt(n,s,u,l){for(var y=n.length-1;y>=0;--y){var O=n[y],C=O(s,u,l);if(!m(C)&&!N(C)){if(!S(C))throw new TypeError;l=C}}return l}function Re(n,s,u){var l=le(n,s,u);if(l)return!0;var y=ce(s);return N(y)?!1:Re(n,y,u)}function le(n,s,u){var l=W(s,u,!1);return m(l)?!1:Te(l.OrdinaryHasOwnMetadata(n,s,u))}function Oe(n,s,u){var l=le(n,s,u);if(l)return Pe(n,s,u);var y=ce(s);if(!N(y))return Oe(n,y,u)}function Pe(n,s,u){var l=W(s,u,!1);if(!m(l))return l.OrdinaryGetOwnMetadata(n,s,u)}function Ee(n,s,u,l){var y=W(u,l,!0);y.OrdinaryDefineOwnMetadata(n,s,u,l)}function Se(n,s){var u=Ce(n,s),l=ce(n);if(l===null)return u;var y=Se(l,s);if(y.length<=0)return u;if(u.length<=0)return y;for(var O=new oe,C=[],M=0,c=u;M<c.length;M++){var h=c[M],d=O.has(h);d||(O.add(h),C.push(h))}for(var p=0,_=y;p<_.length;p++){var h=_[p],d=O.has(h);d||(O.add(h),C.push(h))}return C}function Ce(n,s){var u=W(n,s,!1);return u?u.OrdinaryOwnMetadataKeys(n,s):[]}function Ie(n){if(n===null)return 1;switch(typeof n){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return n===null?1:6;default:return 6}}function m(n){return n===void 0}function N(n){return n===null}function Ht(n){return typeof n=="symbol"}function S(n){return typeof n=="object"?n!==null:typeof n=="function"}function Nt(n,s){switch(Ie(n)){case 0:return n;case 1:return n;case 2:return n;case 3:return n;case 4:return n;case 5:return n}var u="string",l=ke(n,f);if(l!==void 0){var y=l.call(n,u);if(S(y))throw new TypeError;return y}return Ft(n)}function Ft(n,s){var u,l,y;{var O=n.toString;if(J(O)){var l=O.call(n);if(!S(l))return l}var u=n.valueOf;if(J(u)){var l=u.call(n);if(!S(l))return l}}throw new TypeError}function Te(n){return!!n}function Lt(n){return""+n}function k(n){var s=Nt(n);return Ht(s)?s:Lt(s)}function Ae(n){return Array.isArray?Array.isArray(n):n instanceof Object?n instanceof Array:Object.prototype.toString.call(n)==="[object Array]"}function J(n){return typeof n=="function"}function De(n){return typeof n=="function"}function Gt(n){switch(Ie(n)){case 3:return!0;case 4:return!0;default:return!1}}function fe(n,s){return n===s||n!==n&&s!==s}function ke(n,s){var u=n[s];if(u!=null){if(!J(u))throw new TypeError;return u}}function xe(n){var s=ke(n,g);if(!J(s))throw new TypeError;var u=s.call(n);if(!S(u))throw new TypeError;return u}function je(n){return n.value}function He(n){var s=n.next();return s.done?!1:s}function Ne(n){var s=n.return;s&&s.call(n)}function ce(n){var s=Object.getPrototypeOf(n);if(typeof n!="function"||n===G||s!==G)return s;var u=n.prototype,l=u&&Object.getPrototypeOf(u);if(l==null||l===Object.prototype)return s;var y=l.constructor;return typeof y!="function"||y===n?s:y}function Vt(){var n;!m(H)&&typeof i.Reflect<"u"&&!(H in i.Reflect)&&typeof i.Reflect.defineMetadata=="function"&&(n=Ut(i.Reflect));var s,u,l,y=new ue,O={registerProvider:C,getProvider:c,setProvider:d};return O;function C(p){if(!Object.isExtensible(O))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case n===p:break;case m(s):s=p;break;case s===p:break;case m(u):u=p;break;case u===p:break;default:l===void 0&&(l=new oe),l.add(p);break}}function M(p,_){if(!m(s)){if(s.isProviderFor(p,_))return s;if(!m(u)){if(u.isProviderFor(p,_))return s;if(!m(l))for(var R=xe(l);;){var P=He(R);if(!P)return;var D=je(P);if(D.isProviderFor(p,_))return Ne(R),D}}}if(!m(n)&&n.isProviderFor(p,_))return n}function c(p,_){var R=y.get(p),P;return m(R)||(P=R.get(_)),m(P)&&(P=M(p,_),m(P)||(m(R)&&(R=new V,y.set(p,R)),R.set(_,P))),P}function h(p){if(m(p))throw new TypeError;return s===p||u===p||!m(l)&&l.has(p)}function d(p,_,R){if(!h(R))throw new Error("Metadata provider not registered.");var P=c(p,_);if(P!==R){if(!m(P))return!1;var D=y.get(p);m(D)&&(D=new V,y.set(p,D)),D.set(_,R)}return!0}}function Wt(){var n;return!m(H)&&S(i.Reflect)&&Object.isExtensible(i.Reflect)&&(n=i.Reflect[H]),m(n)&&(n=Vt()),!m(H)&&S(i.Reflect)&&Object.isExtensible(i.Reflect)&&Object.defineProperty(i.Reflect,H,{enumerable:!1,configurable:!1,writable:!1,value:n}),n}function zt(n){var s=new ue,u={isProviderFor:function(h,d){var p=s.get(h);return m(p)?!1:p.has(d)},OrdinaryDefineOwnMetadata:C,OrdinaryHasOwnMetadata:y,OrdinaryGetOwnMetadata:O,OrdinaryOwnMetadataKeys:M,OrdinaryDeleteMetadata:c};return Z.registerProvider(u),u;function l(h,d,p){var _=s.get(h),R=!1;if(m(_)){if(!p)return;_=new V,s.set(h,_),R=!0}var P=_.get(d);if(m(P)){if(!p)return;if(P=new V,_.set(d,P),!n.setProvider(h,d,u))throw _.delete(d),R&&s.delete(h),new Error("Wrong provider for target.")}return P}function y(h,d,p){var _=l(d,p,!1);return m(_)?!1:Te(_.has(h))}function O(h,d,p){var _=l(d,p,!1);if(!m(_))return _.get(h)}function C(h,d,p,_){var R=l(p,_,!0);R.set(h,d)}function M(h,d){var p=[],_=l(h,d,!1);if(m(_))return p;for(var R=_.keys(),P=xe(R),D=0;;){var Fe=He(P);if(!Fe)return p.length=D,p;var Zt=je(Fe);try{p[D]=Zt}catch(Jt){try{Ne(P)}finally{throw Jt}}D++}}function c(h,d,p){var _=l(d,p,!1);if(m(_)||!_.delete(h))return!1;if(_.size===0){var R=s.get(d);m(R)||(R.delete(p),R.size===0&&s.delete(R))}return!0}}function Ut(n){var s=n.defineMetadata,u=n.hasOwnMetadata,l=n.getOwnMetadata,y=n.getOwnMetadataKeys,O=n.deleteMetadata,C=new ue,M={isProviderFor:function(c,h){var d=C.get(c);return!m(d)&&d.has(h)?!0:y(c,h).length?(m(d)&&(d=new oe,C.set(c,d)),d.add(h),!0):!1},OrdinaryDefineOwnMetadata:s,OrdinaryHasOwnMetadata:u,OrdinaryGetOwnMetadata:l,OrdinaryOwnMetadataKeys:y,OrdinaryDeleteMetadata:O};return M}function W(n,s,u){var l=Z.getProvider(n,s);if(!m(l))return l;if(u){if(Z.setProvider(n,s,be))return be;throw new Error("Illegal state.")}}function $t(){var n={},s=[],u=(function(){function M(c,h,d){this._index=0,this._keys=c,this._values=h,this._selector=d}return M.prototype["@@iterator"]=function(){return this},M.prototype[g]=function(){return this},M.prototype.next=function(){var c=this._index;if(c>=0&&c<this._keys.length){var h=this._selector(this._keys[c],this._values[c]);return c+1>=this._keys.length?(this._index=-1,this._keys=s,this._values=s):this._index++,{value:h,done:!1}}return{value:void 0,done:!0}},M.prototype.throw=function(c){throw this._index>=0&&(this._index=-1,this._keys=s,this._values=s),c},M.prototype.return=function(c){return this._index>=0&&(this._index=-1,this._keys=s,this._values=s),{value:c,done:!0}},M})(),l=(function(){function M(){this._keys=[],this._values=[],this._cacheKey=n,this._cacheIndex=-2}return Object.defineProperty(M.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),M.prototype.has=function(c){return this._find(c,!1)>=0},M.prototype.get=function(c){var h=this._find(c,!1);return h>=0?this._values[h]:void 0},M.prototype.set=function(c,h){var d=this._find(c,!0);return this._values[d]=h,this},M.prototype.delete=function(c){var h=this._find(c,!1);if(h>=0){for(var d=this._keys.length,p=h+1;p<d;p++)this._keys[p-1]=this._keys[p],this._values[p-1]=this._values[p];return this._keys.length--,this._values.length--,fe(c,this._cacheKey)&&(this._cacheKey=n,this._cacheIndex=-2),!0}return!1},M.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=n,this._cacheIndex=-2},M.prototype.keys=function(){return new u(this._keys,this._values,y)},M.prototype.values=function(){return new u(this._keys,this._values,O)},M.prototype.entries=function(){return new u(this._keys,this._values,C)},M.prototype["@@iterator"]=function(){return this.entries()},M.prototype[g]=function(){return this.entries()},M.prototype._find=function(c,h){if(!fe(this._cacheKey,c)){this._cacheIndex=-1;for(var d=0;d<this._keys.length;d++)if(fe(this._keys[d],c)){this._cacheIndex=d;break}}return this._cacheIndex<0&&h&&(this._cacheIndex=this._keys.length,this._keys.push(c),this._values.push(void 0)),this._cacheIndex},M})();return l;function y(M,c){return M}function O(M,c){return c}function C(M,c){return[M,c]}}function qt(){var n=(function(){function s(){this._map=new V}return Object.defineProperty(s.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),s.prototype.has=function(u){return this._map.has(u)},s.prototype.add=function(u){return this._map.set(u,u),this},s.prototype.delete=function(u){return this._map.delete(u)},s.prototype.clear=function(){this._map.clear()},s.prototype.keys=function(){return this._map.keys()},s.prototype.values=function(){return this._map.keys()},s.prototype.entries=function(){return this._map.entries()},s.prototype["@@iterator"]=function(){return this.keys()},s.prototype[g]=function(){return this.keys()},s})();return n}function Bt(){var n=16,s=A.create(),u=l();return(function(){function c(){this._key=l()}return c.prototype.has=function(h){var d=y(h,!1);return d!==void 0?A.has(d,this._key):!1},c.prototype.get=function(h){var d=y(h,!1);return d!==void 0?A.get(d,this._key):void 0},c.prototype.set=function(h,d){var p=y(h,!0);return p[this._key]=d,this},c.prototype.delete=function(h){var d=y(h,!1);return d!==void 0?delete d[this._key]:!1},c.prototype.clear=function(){this._key=l()},c})();function l(){var c;do c="@@WeakMap@@"+M();while(A.has(s,c));return s[c]=!0,c}function y(c,h){if(!a.call(c,u)){if(!h)return;Object.defineProperty(c,u,{value:A.create()})}return c[u]}function O(c,h){for(var d=0;d<h;++d)c[d]=Math.random()*255|0;return c}function C(c){if(typeof Uint8Array=="function"){var h=new Uint8Array(c);return typeof crypto<"u"?crypto.getRandomValues(h):typeof msCrypto<"u"?msCrypto.getRandomValues(h):O(h,c),h}return O(new Array(c),c)}function M(){var c=C(n);c[6]=c[6]&79|64,c[8]=c[8]&191|128;for(var h="",d=0;d<n;++d){var p=c[d];(d===4||d===6||d===8)&&(h+="-"),p<16&&(h+="0"),h+=p.toString(16).toLowerCase()}return h}}function he(n){return n.__=void 0,delete n.__,n}})})(t||(t={})),pe}Le();function Ge(t){const e=`
|
|
14
|
+
***************************************************************************** */var De;function ct(){if(De)return ke;De=1;var t;return(function(e){(function(r){var i=typeof globalThis=="object"?globalThis:typeof je=="object"?je:typeof self=="object"?self:typeof this=="object"?this:E(),o=n(e);typeof i.Reflect<"u"&&(o=n(i.Reflect,o)),r(o,i),typeof i.Reflect>"u"&&(i.Reflect=e);function n(m,S){return function(H,z){Object.defineProperty(m,H,{configurable:!0,writable:!0,value:z}),S&&S(H,z)}}function l(){try{return Function("return this;")()}catch{}}function w(){try{return(0,eval)("(function() { return this; })()")}catch{}}function E(){return l()||w()}})(function(r,i){var o=Object.prototype.hasOwnProperty,n=typeof Symbol=="function",l=n&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",w=n&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",E=typeof Object.create=="function",m={__proto__:[]}instanceof Array,S=!E&&!m,H={create:E?function(){return Ae(Object.create(null))}:m?function(){return Ae({__proto__:null})}:function(){return Ae({})},has:S?function(s,a){return o.call(s,a)}:function(s,a){return a in s},get:S?function(s,a){return o.call(s,a)?s[a]:void 0}:function(s,a){return s[a]}},z=Object.getPrototypeOf(Function),U=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:hr(),X=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:dr(),re=typeof WeakMap=="function"?WeakMap:vr(),q=n?Symbol.for("@reflect-metadata:registry"):void 0,K=lr(),he=fr(K);function de(s,a,u,h){if(b(u)){if(!nt(s))throw new TypeError;if(!it(a))throw new TypeError;return ve(s,a)}else{if(!nt(s))throw new TypeError;if(!k(a))throw new TypeError;if(!k(h)&&!b(h)&&!ee(h))throw new TypeError;return ee(h)&&(h=void 0),u=W(u),Ie(s,a,u,h)}}r("decorate",de);function c(s,a){function u(h,M){if(!k(h))throw new TypeError;if(!b(M)&&!ar(M))throw new TypeError;Xe(s,a,h,M)}return u}r("metadata",c);function f(s,a,u,h){if(!k(u))throw new TypeError;return b(h)||(h=W(h)),Xe(s,a,u,h)}r("defineMetadata",f);function d(s,a,u){if(!k(a))throw new TypeError;return b(u)||(u=W(u)),Je(s,a,u)}r("hasMetadata",d);function g(s,a,u){if(!k(a))throw new TypeError;return b(u)||(u=W(u)),Le(s,a,u)}r("hasOwnMetadata",g);function O(s,a,u){if(!k(a))throw new TypeError;return b(u)||(u=W(u)),Ye(s,a,u)}r("getMetadata",O);function I(s,a,u){if(!k(a))throw new TypeError;return b(u)||(u=W(u)),Qe(s,a,u)}r("getOwnMetadata",I);function R(s,a){if(!k(s))throw new TypeError;return b(a)||(a=W(a)),Ke(s,a)}r("getMetadataKeys",R);function F(s,a){if(!k(s))throw new TypeError;return b(a)||(a=W(a)),et(s,a)}r("getOwnMetadataKeys",F);function Y(s,a,u){if(!k(a))throw new TypeError;if(b(u)||(u=W(u)),!k(a))throw new TypeError;b(u)||(u=W(u));var h=ne(a,u,!1);return b(h)?!1:h.OrdinaryDeleteMetadata(s,a,u)}r("deleteMetadata",Y);function ve(s,a){for(var u=s.length-1;u>=0;--u){var h=s[u],M=h(a);if(!b(M)&&!ee(M)){if(!it(M))throw new TypeError;a=M}}return a}function Ie(s,a,u,h){for(var M=s.length-1;M>=0;--M){var x=s[M],D=x(a,u,h);if(!b(D)&&!ee(D)){if(!k(D))throw new TypeError;h=D}}return h}function Je(s,a,u){var h=Le(s,a,u);if(h)return!0;var M=xe(a);return ee(M)?!1:Je(s,M,u)}function Le(s,a,u){var h=ne(a,u,!1);return b(h)?!1:rt(h.OrdinaryHasOwnMetadata(s,a,u))}function Ye(s,a,u){var h=Le(s,a,u);if(h)return Qe(s,a,u);var M=xe(a);if(!ee(M))return Ye(s,M,u)}function Qe(s,a,u){var h=ne(a,u,!1);if(!b(h))return h.OrdinaryGetOwnMetadata(s,a,u)}function Xe(s,a,u,h){var M=ne(u,h,!0);M.OrdinaryDefineOwnMetadata(s,a,u,h)}function Ke(s,a){var u=et(s,a),h=xe(s);if(h===null)return u;var M=Ke(h,a);if(M.length<=0)return u;if(u.length<=0)return M;for(var x=new X,D=[],P=0,v=u;P<v.length;P++){var p=v[P],y=x.has(p);y||(x.add(p),D.push(p))}for(var _=0,C=M;_<C.length;_++){var p=C[_],y=x.has(p);y||(x.add(p),D.push(p))}return D}function et(s,a){var u=ne(s,a,!1);return u?u.OrdinaryOwnMetadataKeys(s,a):[]}function tt(s){if(s===null)return 1;switch(typeof s){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return s===null?1:6;default:return 6}}function b(s){return s===void 0}function ee(s){return s===null}function nr(s){return typeof s=="symbol"}function k(s){return typeof s=="object"?s!==null:typeof s=="function"}function ir(s,a){switch(tt(s)){case 0:return s;case 1:return s;case 2:return s;case 3:return s;case 4:return s;case 5:return s}var u="string",h=st(s,l);if(h!==void 0){var M=h.call(s,u);if(k(M))throw new TypeError;return M}return sr(s)}function sr(s,a){var u,h,M;{var x=s.toString;if(pe(x)){var h=x.call(s);if(!k(h))return h}var u=s.valueOf;if(pe(u)){var h=u.call(s);if(!k(h))return h}}throw new TypeError}function rt(s){return!!s}function or(s){return""+s}function W(s){var a=ir(s);return nr(a)?a:or(a)}function nt(s){return Array.isArray?Array.isArray(s):s instanceof Object?s instanceof Array:Object.prototype.toString.call(s)==="[object Array]"}function pe(s){return typeof s=="function"}function it(s){return typeof s=="function"}function ar(s){switch(tt(s)){case 3:return!0;case 4:return!0;default:return!1}}function Te(s,a){return s===a||s!==s&&a!==a}function st(s,a){var u=s[a];if(u!=null){if(!pe(u))throw new TypeError;return u}}function ot(s){var a=st(s,w);if(!pe(a))throw new TypeError;var u=a.call(s);if(!k(u))throw new TypeError;return u}function at(s){return s.value}function ut(s){var a=s.next();return a.done?!1:a}function lt(s){var a=s.return;a&&a.call(s)}function xe(s){var a=Object.getPrototypeOf(s);if(typeof s!="function"||s===z||a!==z)return a;var u=s.prototype,h=u&&Object.getPrototypeOf(u);if(h==null||h===Object.prototype)return a;var M=h.constructor;return typeof M!="function"||M===s?a:M}function ur(){var s;!b(q)&&typeof i.Reflect<"u"&&!(q in i.Reflect)&&typeof i.Reflect.defineMetadata=="function"&&(s=cr(i.Reflect));var a,u,h,M=new re,x={registerProvider:D,getProvider:v,setProvider:y};return x;function D(_){if(!Object.isExtensible(x))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case s===_:break;case b(a):a=_;break;case a===_:break;case b(u):u=_;break;case u===_:break;default:h===void 0&&(h=new X),h.add(_);break}}function P(_,C){if(!b(a)){if(a.isProviderFor(_,C))return a;if(!b(u)){if(u.isProviderFor(_,C))return a;if(!b(h))for(var L=ot(h);;){var A=ut(L);if(!A)return;var $=at(A);if($.isProviderFor(_,C))return lt(L),$}}}if(!b(s)&&s.isProviderFor(_,C))return s}function v(_,C){var L=M.get(_),A;return b(L)||(A=L.get(C)),b(A)&&(A=P(_,C),b(A)||(b(L)&&(L=new U,M.set(_,L)),L.set(C,A))),A}function p(_){if(b(_))throw new TypeError;return a===_||u===_||!b(h)&&h.has(_)}function y(_,C,L){if(!p(L))throw new Error("Metadata provider not registered.");var A=v(_,C);if(A!==L){if(!b(A))return!1;var $=M.get(_);b($)&&($=new U,M.set(_,$)),$.set(C,L)}return!0}}function lr(){var s;return!b(q)&&k(i.Reflect)&&Object.isExtensible(i.Reflect)&&(s=i.Reflect[q]),b(s)&&(s=ur()),!b(q)&&k(i.Reflect)&&Object.isExtensible(i.Reflect)&&Object.defineProperty(i.Reflect,q,{enumerable:!1,configurable:!1,writable:!1,value:s}),s}function fr(s){var a=new re,u={isProviderFor:function(p,y){var _=a.get(p);return b(_)?!1:_.has(y)},OrdinaryDefineOwnMetadata:D,OrdinaryHasOwnMetadata:M,OrdinaryGetOwnMetadata:x,OrdinaryOwnMetadataKeys:P,OrdinaryDeleteMetadata:v};return K.registerProvider(u),u;function h(p,y,_){var C=a.get(p),L=!1;if(b(C)){if(!_)return;C=new U,a.set(p,C),L=!0}var A=C.get(y);if(b(A)){if(!_)return;if(A=new U,C.set(y,A),!s.setProvider(p,y,u))throw C.delete(y),L&&a.delete(p),new Error("Wrong provider for target.")}return A}function M(p,y,_){var C=h(y,_,!1);return b(C)?!1:rt(C.has(p))}function x(p,y,_){var C=h(y,_,!1);if(!b(C))return C.get(p)}function D(p,y,_,C){var L=h(_,C,!0);L.set(p,y)}function P(p,y){var _=[],C=h(p,y,!1);if(b(C))return _;for(var L=C.keys(),A=ot(L),$=0;;){var ft=ut(A);if(!ft)return _.length=$,_;var pr=at(ft);try{_[$]=pr}catch(yr){try{lt(A)}finally{throw yr}}$++}}function v(p,y,_){var C=h(y,_,!1);if(b(C)||!C.delete(p))return!1;if(C.size===0){var L=a.get(y);b(L)||(L.delete(_),L.size===0&&a.delete(L))}return!0}}function cr(s){var a=s.defineMetadata,u=s.hasOwnMetadata,h=s.getOwnMetadata,M=s.getOwnMetadataKeys,x=s.deleteMetadata,D=new re,P={isProviderFor:function(v,p){var y=D.get(v);return!b(y)&&y.has(p)?!0:M(v,p).length?(b(y)&&(y=new X,D.set(v,y)),y.add(p),!0):!1},OrdinaryDefineOwnMetadata:a,OrdinaryHasOwnMetadata:u,OrdinaryGetOwnMetadata:h,OrdinaryOwnMetadataKeys:M,OrdinaryDeleteMetadata:x};return P}function ne(s,a,u){var h=K.getProvider(s,a);if(!b(h))return h;if(u){if(K.setProvider(s,a,he))return he;throw new Error("Illegal state.")}}function hr(){var s={},a=[],u=(function(){function P(v,p,y){this._index=0,this._keys=v,this._values=p,this._selector=y}return P.prototype["@@iterator"]=function(){return this},P.prototype[w]=function(){return this},P.prototype.next=function(){var v=this._index;if(v>=0&&v<this._keys.length){var p=this._selector(this._keys[v],this._values[v]);return v+1>=this._keys.length?(this._index=-1,this._keys=a,this._values=a):this._index++,{value:p,done:!1}}return{value:void 0,done:!0}},P.prototype.throw=function(v){throw this._index>=0&&(this._index=-1,this._keys=a,this._values=a),v},P.prototype.return=function(v){return this._index>=0&&(this._index=-1,this._keys=a,this._values=a),{value:v,done:!0}},P})(),h=(function(){function P(){this._keys=[],this._values=[],this._cacheKey=s,this._cacheIndex=-2}return Object.defineProperty(P.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),P.prototype.has=function(v){return this._find(v,!1)>=0},P.prototype.get=function(v){var p=this._find(v,!1);return p>=0?this._values[p]:void 0},P.prototype.set=function(v,p){var y=this._find(v,!0);return this._values[y]=p,this},P.prototype.delete=function(v){var p=this._find(v,!1);if(p>=0){for(var y=this._keys.length,_=p+1;_<y;_++)this._keys[_-1]=this._keys[_],this._values[_-1]=this._values[_];return this._keys.length--,this._values.length--,Te(v,this._cacheKey)&&(this._cacheKey=s,this._cacheIndex=-2),!0}return!1},P.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=s,this._cacheIndex=-2},P.prototype.keys=function(){return new u(this._keys,this._values,M)},P.prototype.values=function(){return new u(this._keys,this._values,x)},P.prototype.entries=function(){return new u(this._keys,this._values,D)},P.prototype["@@iterator"]=function(){return this.entries()},P.prototype[w]=function(){return this.entries()},P.prototype._find=function(v,p){if(!Te(this._cacheKey,v)){this._cacheIndex=-1;for(var y=0;y<this._keys.length;y++)if(Te(this._keys[y],v)){this._cacheIndex=y;break}}return this._cacheIndex<0&&p&&(this._cacheIndex=this._keys.length,this._keys.push(v),this._values.push(void 0)),this._cacheIndex},P})();return h;function M(P,v){return P}function x(P,v){return v}function D(P,v){return[P,v]}}function dr(){var s=(function(){function a(){this._map=new U}return Object.defineProperty(a.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),a.prototype.has=function(u){return this._map.has(u)},a.prototype.add=function(u){return this._map.set(u,u),this},a.prototype.delete=function(u){return this._map.delete(u)},a.prototype.clear=function(){this._map.clear()},a.prototype.keys=function(){return this._map.keys()},a.prototype.values=function(){return this._map.keys()},a.prototype.entries=function(){return this._map.entries()},a.prototype["@@iterator"]=function(){return this.keys()},a.prototype[w]=function(){return this.keys()},a})();return s}function vr(){var s=16,a=H.create(),u=h();return(function(){function v(){this._key=h()}return v.prototype.has=function(p){var y=M(p,!1);return y!==void 0?H.has(y,this._key):!1},v.prototype.get=function(p){var y=M(p,!1);return y!==void 0?H.get(y,this._key):void 0},v.prototype.set=function(p,y){var _=M(p,!0);return _[this._key]=y,this},v.prototype.delete=function(p){var y=M(p,!1);return y!==void 0?delete y[this._key]:!1},v.prototype.clear=function(){this._key=h()},v})();function h(){var v;do v="@@WeakMap@@"+P();while(H.has(a,v));return a[v]=!0,v}function M(v,p){if(!o.call(v,u)){if(!p)return;Object.defineProperty(v,u,{value:H.create()})}return v[u]}function x(v,p){for(var y=0;y<p;++y)v[y]=Math.random()*255|0;return v}function D(v){if(typeof Uint8Array=="function"){var p=new Uint8Array(v);return typeof crypto<"u"?crypto.getRandomValues(p):typeof msCrypto<"u"?msCrypto.getRandomValues(p):x(p,v),p}return x(new Array(v),v)}function P(){var v=D(s);v[6]=v[6]&79|64,v[8]=v[8]&191|128;for(var p="",y=0;y<s;++y){var _=v[y];(y===4||y===6||y===8)&&(p+="-"),_<16&&(p+="0"),p+=_.toString(16).toLowerCase()}return p}}function Ae(s){return s.__=void 0,delete s.__,s}})})(t||(t={})),ke}ct();function ht(t){const e=`
|
|
15
15
|
attribute vec3 position;
|
|
16
16
|
attribute vec3 normal;
|
|
17
17
|
|
|
@@ -29,17 +29,34 @@
|
|
|
29
29
|
precision highp float;
|
|
30
30
|
|
|
31
31
|
uniform float uHit;
|
|
32
|
+
uniform float uSelected;
|
|
32
33
|
|
|
33
34
|
varying vec3 vNormal;
|
|
34
35
|
|
|
35
36
|
void main() {
|
|
36
37
|
vec3 normal = normalize(vNormal);
|
|
37
38
|
float lighting = dot(normal, normalize(vec3(-0.3, 0.8, 0.6)));
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
|
|
40
|
+
// Базовый цвет меша
|
|
41
|
+
vec3 baseColor = vec3(0.2, 0.8, 1.0);
|
|
42
|
+
|
|
43
|
+
// Цвет при наведении (hover)
|
|
44
|
+
vec3 hoverColor = vec3(1.0, 1.0, 0.1);
|
|
45
|
+
|
|
46
|
+
// Цвет при клике (selected)
|
|
47
|
+
vec3 selectedColor = vec3(1.0, 0.3, 0.3);
|
|
48
|
+
|
|
49
|
+
// Применяем логику подсветки:
|
|
50
|
+
// приоритет: выделение > hover > обычный цвет
|
|
51
|
+
vec3 color = mix(baseColor, hoverColor, uHit);
|
|
52
|
+
color = mix(color, selectedColor, uSelected);
|
|
53
|
+
|
|
54
|
+
// Немного света для объема
|
|
55
|
+
color += lighting * 0.1;
|
|
56
|
+
|
|
57
|
+
gl_FragColor = vec4(color, 1.0);
|
|
41
58
|
}
|
|
42
|
-
`;return new
|
|
59
|
+
`;return new j.Program(t,{vertex:e,fragment:r,cullFace:!1,uniforms:{uHit:{value:0},uSelected:{value:0}}})}class He extends j.Mesh{isHit;constructor(e,r){super(e,r),this.isHit=!1}}class ye{gl;scene;camera;canvas;program;meshes;constructor(e){this.canvas=e,this.gl=new j.Renderer({canvas:e,dpr:2}),this.gl.setSize(e.clientWidth,e.clientHeight),this.gl.gl.clearColor(.1,.1,.1,1),this.scene=new j.Transform,this.camera=new j.Camera(this.gl.gl,{fov:45}),this.camera.position.set(1,1,7),this.camera.lookAt([0,0,0]),this.program=ht(this.gl.gl),this.meshes=[]}resize(){this.gl.setSize(this.canvas.width,this.canvas.height),this.camera.perspective({aspect:this.canvas.width/this.canvas.height})}render(){this.gl.render({scene:this.scene,camera:this.camera})}update(){}loop(){this.update(),this.render(),requestAnimationFrame(this.loop.bind(this))}addFigure(e){const r=new j.Geometry(this.gl.gl,{position:{size:3,data:new Float32Array(e.position)},normal:{size:3,data:new Float32Array(e.normal??[])},uv:{size:2,data:new Float32Array(e.uv??[])}}),i=new He(this.gl.gl,{geometry:r,program:this.program});return i.setParent(this.scene),this.meshes.push(i),i}addMesh(e){this.scene.addChild(e)}getContext(){return this.gl.gl}removeMesh(e){this.scene.removeChild(e)}getMeshes(){return this.meshes}getProgram(){return this.program}destroy(){this.meshes&&(this.meshes.length=0,this.meshes=[]),this.scene=null,this.camera=null,this.program=null,this.gl=null,this.canvas=null}}class dt extends j.Orbit{isInteracting=!1;_element;constructor(e,r={}){super(e,r),this._element=r.element||document,this._element.addEventListener("mousedown",()=>this.isInteracting=!0),this._element.addEventListener("mouseup",()=>this.isInteracting=!1),this._element.addEventListener("touchstart",()=>this.isInteracting=!0),this._element.addEventListener("touchend",()=>this.isInteracting=!1)}destroy(){this._element.removeEventListener("mousedown",()=>this.isInteracting=!0),this._element.removeEventListener("mouseup",()=>this.isInteracting=!1),this._element.removeEventListener("touchstart",()=>this.isInteracting=!0),this._element.removeEventListener("touchend",()=>this.isInteracting=!1)}}var me;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(me||(me={}));const N=me;/*! *****************************************************************************
|
|
43
60
|
Copyright (c) Microsoft Corporation.
|
|
44
61
|
|
|
45
62
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -52,7 +69,7 @@
|
|
|
52
69
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
53
70
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
54
71
|
PERFORMANCE OF THIS SOFTWARE.
|
|
55
|
-
***************************************************************************** */var
|
|
72
|
+
***************************************************************************** */var _e=function(t,e){return _e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)i.hasOwnProperty(o)&&(r[o]=i[o])},_e(t,e)};function ge(t,e){_e(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function vt(t,e,r,i){function o(n){return n instanceof r?n:new r(function(l){l(n)})}return new(r||(r=Promise))(function(n,l){function w(S){try{m(i.next(S))}catch(H){l(H)}}function E(S){try{m(i.throw(S))}catch(H){l(H)}}function m(S){S.done?n(S.value):o(S.value).then(w,E)}m((i=i.apply(t,[])).next())})}function pt(t,e){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},i,o,n,l;return l={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function w(m){return function(S){return E([m,S])}}function E(m){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,o&&(n=m[0]&2?o.return:m[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,m[1])).done)return n;switch(o=0,n&&(m=[m[0]&2,n.value]),m[0]){case 0:case 1:n=m;break;case 4:return r.label++,{value:m[1],done:!1};case 5:r.label++,o=m[1],m=[0];continue;case 7:m=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n=n.length>0&&n[n.length-1])&&(m[0]===6||m[0]===2)){r=0;continue}if(m[0]===3&&(!n||m[1]>n[0]&&m[1]<n[3])){r.label=m[1];break}if(m[0]===6&&r.label<n[1]){r.label=n[1],n=m;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(m);break}n[2]&&r.ops.pop(),r.trys.pop();continue}m=e.call(t,r)}catch(S){m=[6,S],o=0}finally{i=n=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}}function ie(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function se(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),o,n=[],l;try{for(;(e===void 0||e-- >0)&&!(o=i.next()).done;)n.push(o.value)}catch(w){l={error:w}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(l)throw l.error}}return n}function Z(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(se(arguments[e]));return t}var we="injectionTokens";function yt(t){var e=Reflect.getMetadata("design:paramtypes",t)||[],r=Reflect.getOwnMetadata(we,t)||{};return Object.keys(r).forEach(function(i){e[+i]=r[i]}),e}function Ne(t,e){return function(r,i,o){var n=Reflect.getOwnMetadata(we,r)||{};n[o]=t,Reflect.defineMetadata(we,n,r)}}function Fe(t){return!!t.useClass}function Me(t){return!!t.useFactory}var Be=(function(){function t(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return t.prototype.createProxy=function(e){var r=this,i={},o=!1,n,l=function(){return o||(n=e(r.wrap()),o=!0),n};return new Proxy(i,this.createHandler(l))},t.prototype.createHandler=function(e){var r={},i=function(o){r[o]=function(){for(var n=[],l=0;l<arguments.length;l++)n[l]=arguments[l];n[0]=e();var w=Reflect[o];return w.apply(void 0,Z(n))}};return this.reflectMethods.forEach(i),r},t})();function Q(t){return typeof t=="string"||typeof t=="symbol"}function mt(t){return typeof t=="object"&&"token"in t&&"multiple"in t}function $e(t){return typeof t=="object"&&"token"in t&&"transform"in t}function _t(t){return typeof t=="function"||t instanceof Be}function oe(t){return!!t.useToken}function ae(t){return t.useValue!=null}function gt(t){return Fe(t)||ae(t)||oe(t)||Me(t)}var be=(function(){function t(){this._registryMap=new Map}return t.prototype.entries=function(){return this._registryMap.entries()},t.prototype.getAll=function(e){return this.ensure(e),this._registryMap.get(e)},t.prototype.get=function(e){this.ensure(e);var r=this._registryMap.get(e);return r[r.length-1]||null},t.prototype.set=function(e,r){this.ensure(e),this._registryMap.get(e).push(r)},t.prototype.setAll=function(e,r){this._registryMap.set(e,r)},t.prototype.has=function(e){return this.ensure(e),this._registryMap.get(e).length>0},t.prototype.clear=function(){this._registryMap.clear()},t.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},t})(),wt=(function(t){ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(be),ue=(function(){function t(){this.scopedResolutions=new Map}return t})();function Mt(t,e){if(t===null)return"at position #"+e;var r=t.split(",")[e].trim();return'"'+r+'" at position #'+e}function bt(t,e,r){return r===void 0&&(r=" "),Z([t],e.message.split(`
|
|
56
73
|
`).map(function(i){return r+i})).join(`
|
|
57
|
-
`)}function Qe(t,e,r){var i=U(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),a=i[1],o=a===void 0?null:a,f=Je(o,e);return Ye("Cannot inject the dependency "+f+' of "'+t.name+'" constructor. Reason:',r)}function Xe(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var Ke=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(re),et=(function(t){K(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(re),tt=(function(){function t(){this.preResolution=new Ke,this.postResolution=new et}return t})(),Me=new Map,rt=(function(){function t(e){this.parent=e,this._registry=new Ze,this.interceptors=new tt,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,r,i){i===void 0&&(i={lifecycle:T.Transient}),this.ensureNotDisposed();var a;if(Be(r)?a=r:a={useClass:r},$(a))for(var o=[e],f=a;f!=null;){var g=f.useToken;if(o.includes(g))throw new Error("Token registration cycle detected! "+x(o,[g]).join(" -> "));o.push(g);var w=this._registry.get(g);w&&$(w.provider)?f=w.provider:f=null}if((i.lifecycle===T.Singleton||i.lifecycle==T.ContainerScoped||i.lifecycle==T.ResolutionScoped)&&(q(a)||te(a)))throw new Error('Cannot use lifecycle "'+T[i.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:a,options:i}),this},t.prototype.registerType=function(e,r){return this.ensureNotDisposed(),j(r)?this.register(e,{useToken:r}):this.register(e,{useClass:r})},t.prototype.registerInstance=function(e,r){return this.ensureNotDisposed(),this.register(e,{useValue:r})},t.prototype.registerSingleton=function(e,r){if(this.ensureNotDisposed(),j(e)){if(j(r))return this.register(e,{useToken:r},{lifecycle:T.Singleton});if(r)return this.register(e,{useClass:r},{lifecycle:T.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var i=e;return r&&!j(r)&&(i=r),this.register(e,{useClass:i},{lifecycle:T.Singleton})},t.prototype.resolve=function(e,r,i){r===void 0&&(r=new B),i===void 0&&(i=!1),this.ensureNotDisposed();var a=this.getRegistration(e);if(!a&&j(e)){if(i)return;throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"Single"),a){var o=this.resolveRegistration(a,r);return this.executePostResolutionInterceptor(e,o,"Single"),o}if(qe(e)){var o=this.construct(e,r);return this.executePostResolutionInterceptor(e,o,"Single"),o}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.executePreResolutionInterceptor=function(e,r){var i,a;if(this.interceptors.preResolution.has(e)){var o=[];try{for(var f=z(this.interceptors.preResolution.getAll(e)),g=f.next();!g.done;g=f.next()){var w=g.value;w.options.frequency!="Once"&&o.push(w),w.callback(e,r)}}catch(v){i={error:v}}finally{try{g&&!g.done&&(a=f.return)&&a.call(f)}finally{if(i)throw i.error}}this.interceptors.preResolution.setAll(e,o)}},t.prototype.executePostResolutionInterceptor=function(e,r,i){var a,o;if(this.interceptors.postResolution.has(e)){var f=[];try{for(var g=z(this.interceptors.postResolution.getAll(e)),w=g.next();!w.done;w=g.next()){var v=w.value;v.options.frequency!="Once"&&f.push(v),v.callback(e,r,i)}}catch(b){a={error:b}}finally{try{w&&!w.done&&(o=g.return)&&o.call(g)}finally{if(a)throw a.error}}this.interceptors.postResolution.setAll(e,f)}},t.prototype.resolveRegistration=function(e,r){if(this.ensureNotDisposed(),e.options.lifecycle===T.ResolutionScoped&&r.scopedResolutions.has(e))return r.scopedResolutions.get(e);var i=e.options.lifecycle===T.Singleton,a=e.options.lifecycle===T.ContainerScoped,o=i||a,f;return q(e.provider)?f=e.provider.useValue:$(e.provider)?f=o?e.instance||(e.instance=this.resolve(e.provider.useToken,r)):this.resolve(e.provider.useToken,r):me(e.provider)?f=o?e.instance||(e.instance=this.construct(e.provider.useClass,r)):this.construct(e.provider.useClass,r):te(e.provider)?f=e.provider.useFactory(this):f=this.construct(e.provider,r),e.options.lifecycle===T.ResolutionScoped&&r.scopedResolutions.set(e,f),f},t.prototype.resolveAll=function(e,r,i){var a=this;r===void 0&&(r=new B),i===void 0&&(i=!1),this.ensureNotDisposed();var o=this.getAllRegistrations(e);if(!o&&j(e)){if(i)return[];throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"All"),o){var f=o.map(function(w){return a.resolveRegistration(w,r)});return this.executePostResolutionInterceptor(e,f,"All"),f}var g=[this.construct(e,r)];return this.executePostResolutionInterceptor(e,g,"All"),g},t.prototype.isRegistered=function(e,r){return r===void 0&&(r=!1),this.ensureNotDisposed(),this._registry.has(e)||r&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},t.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},t.prototype.clearInstances=function(){var e,r;this.ensureNotDisposed();try{for(var i=z(this._registry.entries()),a=i.next();!a.done;a=i.next()){var o=U(a.value,2),f=o[0],g=o[1];this._registry.setAll(f,g.filter(function(w){return!q(w.provider)}).map(function(w){return w.instance=void 0,w}))}}catch(w){e={error:w}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},t.prototype.createChildContainer=function(){var e,r;this.ensureNotDisposed();var i=new t(this);try{for(var a=z(this._registry.entries()),o=a.next();!o.done;o=a.next()){var f=U(o.value,2),g=f[0],w=f[1];w.some(function(v){var b=v.options;return b.lifecycle===T.ContainerScoped})&&i._registry.setAll(g,w.map(function(v){return v.options.lifecycle===T.ContainerScoped?{provider:v.provider,options:v.options}:v}))}}catch(v){e={error:v}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return i},t.prototype.beforeResolution=function(e,r,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:r,options:i})},t.prototype.afterResolution=function(e,r,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:r,options:i})},t.prototype.dispose=function(){return We(this,void 0,void 0,function(){var e;return ze(this,function(r){switch(r.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(i){var a=i.dispose();a&&e.push(a)}),[4,Promise.all(e)];case 1:return r.sent(),[2]}})})},t.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},t.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},t.prototype.construct=function(e,r){var i=this;if(e instanceof ge)return e.createProxy(function(o){return i.resolve(o,r)});var a=(function(){var o=Me.get(e);if(!o||o.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var f=o.map(i.resolveParams(r,e));return new(e.bind.apply(e,x([void 0],f)))})();return Xe(a)&&this.disposables.add(a),a},t.prototype.resolveParams=function(e,r){var i=this;return function(a,o){var f,g,w;try{return $e(a)?we(a)?a.multiple?(f=i.resolve(a.transform)).transform.apply(f,x([i.resolveAll(a.token,new B,a.isOptional)],a.transformArgs)):(g=i.resolve(a.transform)).transform.apply(g,x([i.resolve(a.token,e,a.isOptional)],a.transformArgs)):a.multiple?i.resolveAll(a.token,new B,a.isOptional):i.resolve(a.token,e,a.isOptional):we(a)?(w=i.resolve(a.transform,e)).transform.apply(w,x([i.resolve(a.token,e)],a.transformArgs)):i.resolve(a,e)}catch(v){throw new Error(Qe(r,o,v))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t})(),nt=new rt;function ne(t,e){var r={token:t,multiple:!1,isOptional:e};return ye(r)}function F(t){return function(e){Me.set(e,Ue(e))}}function it(t,e){var r={token:t,multiple:!0,isOptional:e};return ye(r)}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var st=Object.getOwnPropertyDescriptor,at=(t,e,r,i)=>{for(var a=i>1?void 0:i?st(e,r):e,o=t.length-1,f;o>=0;o--)(f=t[o])&&(a=f(a)||a);return a};I.EditorRenderer=class extends Y{orbit;raycast;mouse;isEventListenersAdded;constructor(e){super(e);const r=new E.GridHelper(this.gl.gl,{size:10,divisions:10});r.position.y=-.001,r.setParent(this.scene),new E.AxesHelper(this.gl.gl,{size:6,symmetric:!0}).setParent(this.scene),this.orbit=new Ve(this.camera,{element:this.canvas}),this.raycast=new E.Raycast,this.mouse=new E.Vec2,this.isEventListenersAdded=!1}addMesh(e){this.scene.addChild(e)}getContext(){return this.gl.gl}removeMesh(e){this.scene.removeChild(e)}getMeshes(){return this.meshes}update(){this.orbit?.update()}addFigure(e){const r=super.addFigure(e);if(r.geometry){const i=r.geometry.constructor.name;r.geometry.raycast=i.includes("Sphere")?"sphere":"box"}return r.isHit=!1,r.onBeforeRender(({mesh:i})=>{this.updateHitUniform(i)}),this.isEventListenersAdded||this.initMouseListeners(),r}updateHitUniform(e){this.program.uniforms.uHit.value=e.isHit?1:0}initMouseListeners(){document.addEventListener("mousemove",this.handleMouseMove,!1),this.isEventListenersAdded=!0}handleMouseMove=e=>{if(this.orbit.isInteracting)return;this.mouse.set(2*(e.x/this.gl.width)-1,2*(1-e.y/this.gl.height)-1),this.raycast.castMouse(this.camera,this.mouse),this.meshes.forEach(i=>i.isHit=!1),this.raycast.intersectBounds(this.meshes).forEach(i=>i.isHit=!0)};destroy(){this.isEventListenersAdded&&(window.removeEventListener("mousemove",this.handleMouseMove,!1),this.isEventListenersAdded=!1),this.orbit=null,this.raycast=null,this.mouse=null,super.destroy()}},I.EditorRenderer=at([F()],I.EditorRenderer);class ot extends Y{orbit;constructor(e){super(e),this.orbit=new E.Orbit(this.camera,{element:this.canvas,target:new E.Vec3(0,0,0),minPolarAngle:Math.PI/2,maxPolarAngle:Math.PI/2,enableRotate:!0,enableZoom:!1,enablePan:!1})}update(){this.orbit?.update()}}class ut{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 _e=(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))(_e||{}),L=(t=>(t.Plane="plane",t.Wireframe="wireframe",t.Texture="texture",t))(L||{});class lt{positions=[];normals=[];uvs=[];tmpPositions=[];tmpNormals=[];tmpUVs=[];load(e){const r=e.split(`
|
|
58
|
-
`);for(const
|
|
74
|
+
`)}function Ot(t,e,r){var i=se(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),o=i[1],n=o===void 0?null:o,l=Mt(n,e);return bt("Cannot inject the dependency "+l+' of "'+t.name+'" constructor. Reason:',r)}function Et(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var Rt=(function(t){ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(be),Pt=(function(t){ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(be),Ct=(function(){function t(){this.preResolution=new Rt,this.postResolution=new Pt}return t})(),We=new Map,St=(function(){function t(e){this.parent=e,this._registry=new wt,this.interceptors=new Ct,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,r,i){i===void 0&&(i={lifecycle:N.Transient}),this.ensureNotDisposed();var o;if(gt(r)?o=r:o={useClass:r},oe(o))for(var n=[e],l=o;l!=null;){var w=l.useToken;if(n.includes(w))throw new Error("Token registration cycle detected! "+Z(n,[w]).join(" -> "));n.push(w);var E=this._registry.get(w);E&&oe(E.provider)?l=E.provider:l=null}if((i.lifecycle===N.Singleton||i.lifecycle==N.ContainerScoped||i.lifecycle==N.ResolutionScoped)&&(ae(o)||Me(o)))throw new Error('Cannot use lifecycle "'+N[i.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:o,options:i}),this},t.prototype.registerType=function(e,r){return this.ensureNotDisposed(),Q(r)?this.register(e,{useToken:r}):this.register(e,{useClass:r})},t.prototype.registerInstance=function(e,r){return this.ensureNotDisposed(),this.register(e,{useValue:r})},t.prototype.registerSingleton=function(e,r){if(this.ensureNotDisposed(),Q(e)){if(Q(r))return this.register(e,{useToken:r},{lifecycle:N.Singleton});if(r)return this.register(e,{useClass:r},{lifecycle:N.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var i=e;return r&&!Q(r)&&(i=r),this.register(e,{useClass:i},{lifecycle:N.Singleton})},t.prototype.resolve=function(e,r,i){r===void 0&&(r=new ue),i===void 0&&(i=!1),this.ensureNotDisposed();var o=this.getRegistration(e);if(!o&&Q(e)){if(i)return;throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"Single"),o){var n=this.resolveRegistration(o,r);return this.executePostResolutionInterceptor(e,n,"Single"),n}if(_t(e)){var n=this.construct(e,r);return this.executePostResolutionInterceptor(e,n,"Single"),n}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.executePreResolutionInterceptor=function(e,r){var i,o;if(this.interceptors.preResolution.has(e)){var n=[];try{for(var l=ie(this.interceptors.preResolution.getAll(e)),w=l.next();!w.done;w=l.next()){var E=w.value;E.options.frequency!="Once"&&n.push(E),E.callback(e,r)}}catch(m){i={error:m}}finally{try{w&&!w.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}this.interceptors.preResolution.setAll(e,n)}},t.prototype.executePostResolutionInterceptor=function(e,r,i){var o,n;if(this.interceptors.postResolution.has(e)){var l=[];try{for(var w=ie(this.interceptors.postResolution.getAll(e)),E=w.next();!E.done;E=w.next()){var m=E.value;m.options.frequency!="Once"&&l.push(m),m.callback(e,r,i)}}catch(S){o={error:S}}finally{try{E&&!E.done&&(n=w.return)&&n.call(w)}finally{if(o)throw o.error}}this.interceptors.postResolution.setAll(e,l)}},t.prototype.resolveRegistration=function(e,r){if(this.ensureNotDisposed(),e.options.lifecycle===N.ResolutionScoped&&r.scopedResolutions.has(e))return r.scopedResolutions.get(e);var i=e.options.lifecycle===N.Singleton,o=e.options.lifecycle===N.ContainerScoped,n=i||o,l;return ae(e.provider)?l=e.provider.useValue:oe(e.provider)?l=n?e.instance||(e.instance=this.resolve(e.provider.useToken,r)):this.resolve(e.provider.useToken,r):Fe(e.provider)?l=n?e.instance||(e.instance=this.construct(e.provider.useClass,r)):this.construct(e.provider.useClass,r):Me(e.provider)?l=e.provider.useFactory(this):l=this.construct(e.provider,r),e.options.lifecycle===N.ResolutionScoped&&r.scopedResolutions.set(e,l),l},t.prototype.resolveAll=function(e,r,i){var o=this;r===void 0&&(r=new ue),i===void 0&&(i=!1),this.ensureNotDisposed();var n=this.getAllRegistrations(e);if(!n&&Q(e)){if(i)return[];throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"All"),n){var l=n.map(function(E){return o.resolveRegistration(E,r)});return this.executePostResolutionInterceptor(e,l,"All"),l}var w=[this.construct(e,r)];return this.executePostResolutionInterceptor(e,w,"All"),w},t.prototype.isRegistered=function(e,r){return r===void 0&&(r=!1),this.ensureNotDisposed(),this._registry.has(e)||r&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},t.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},t.prototype.clearInstances=function(){var e,r;this.ensureNotDisposed();try{for(var i=ie(this._registry.entries()),o=i.next();!o.done;o=i.next()){var n=se(o.value,2),l=n[0],w=n[1];this._registry.setAll(l,w.filter(function(E){return!ae(E.provider)}).map(function(E){return E.instance=void 0,E}))}}catch(E){e={error:E}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},t.prototype.createChildContainer=function(){var e,r;this.ensureNotDisposed();var i=new t(this);try{for(var o=ie(this._registry.entries()),n=o.next();!n.done;n=o.next()){var l=se(n.value,2),w=l[0],E=l[1];E.some(function(m){var S=m.options;return S.lifecycle===N.ContainerScoped})&&i._registry.setAll(w,E.map(function(m){return m.options.lifecycle===N.ContainerScoped?{provider:m.provider,options:m.options}:m}))}}catch(m){e={error:m}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return i},t.prototype.beforeResolution=function(e,r,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:r,options:i})},t.prototype.afterResolution=function(e,r,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:r,options:i})},t.prototype.dispose=function(){return vt(this,void 0,void 0,function(){var e;return pt(this,function(r){switch(r.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(i){var o=i.dispose();o&&e.push(o)}),[4,Promise.all(e)];case 1:return r.sent(),[2]}})})},t.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},t.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},t.prototype.construct=function(e,r){var i=this;if(e instanceof Be)return e.createProxy(function(n){return i.resolve(n,r)});var o=(function(){var n=We.get(e);if(!n||n.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var l=n.map(i.resolveParams(r,e));return new(e.bind.apply(e,Z([void 0],l)))})();return Et(o)&&this.disposables.add(o),o},t.prototype.resolveParams=function(e,r){var i=this;return function(o,n){var l,w,E;try{return mt(o)?$e(o)?o.multiple?(l=i.resolve(o.transform)).transform.apply(l,Z([i.resolveAll(o.token,new ue,o.isOptional)],o.transformArgs)):(w=i.resolve(o.transform)).transform.apply(w,Z([i.resolve(o.token,e,o.isOptional)],o.transformArgs)):o.multiple?i.resolveAll(o.token,new ue,o.isOptional):i.resolve(o.token,e,o.isOptional):$e(o)?(E=i.resolve(o.transform,e)).transform.apply(E,Z([i.resolve(o.token,e)],o.transformArgs)):i.resolve(o,e)}catch(m){throw new Error(Ot(r,n,m))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t})(),It=new St;function G(t,e){var r={token:t,multiple:!1,isOptional:e};return Ne(r)}function V(t){return function(e){We.set(e,yt(e))}}function Ge(t,e){var r={token:t,multiple:!0,isOptional:e};return Ne(r)}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var le={exports:{}},Ve;function Lt(){if(Ve)return le.exports;Ve=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(f,d,g){return Function.prototype.apply.call(f,d,g)},r;t&&typeof t.ownKeys=="function"?r=t.ownKeys:Object.getOwnPropertySymbols?r=function(f){return Object.getOwnPropertyNames(f).concat(Object.getOwnPropertySymbols(f))}:r=function(f){return Object.getOwnPropertyNames(f)};function i(c){console&&console.warn&&console.warn(c)}var o=Number.isNaN||function(f){return f!==f};function n(){n.init.call(this)}le.exports=n,le.exports.once=K,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._eventsCount=0,n.prototype._maxListeners=void 0;var l=10;function w(c){if(typeof c!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof c)}Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(c){if(typeof c!="number"||c<0||o(c))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+c+".");l=c}}),n.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},n.prototype.setMaxListeners=function(f){if(typeof f!="number"||f<0||o(f))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+f+".");return this._maxListeners=f,this};function E(c){return c._maxListeners===void 0?n.defaultMaxListeners:c._maxListeners}n.prototype.getMaxListeners=function(){return E(this)},n.prototype.emit=function(f){for(var d=[],g=1;g<arguments.length;g++)d.push(arguments[g]);var O=f==="error",I=this._events;if(I!==void 0)O=O&&I.error===void 0;else if(!O)return!1;if(O){var R;if(d.length>0&&(R=d[0]),R instanceof Error)throw R;var F=new Error("Unhandled error."+(R?" ("+R.message+")":""));throw F.context=R,F}var Y=I[f];if(Y===void 0)return!1;if(typeof Y=="function")e(Y,this,d);else for(var ve=Y.length,Ie=X(Y,ve),g=0;g<ve;++g)e(Ie[g],this,d);return!0};function m(c,f,d,g){var O,I,R;if(w(d),I=c._events,I===void 0?(I=c._events=Object.create(null),c._eventsCount=0):(I.newListener!==void 0&&(c.emit("newListener",f,d.listener?d.listener:d),I=c._events),R=I[f]),R===void 0)R=I[f]=d,++c._eventsCount;else if(typeof R=="function"?R=I[f]=g?[d,R]:[R,d]:g?R.unshift(d):R.push(d),O=E(c),O>0&&R.length>O&&!R.warned){R.warned=!0;var F=new Error("Possible EventEmitter memory leak detected. "+R.length+" "+String(f)+" listeners added. Use emitter.setMaxListeners() to increase limit");F.name="MaxListenersExceededWarning",F.emitter=c,F.type=f,F.count=R.length,i(F)}return c}n.prototype.addListener=function(f,d){return m(this,f,d,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(f,d){return m(this,f,d,!0)};function S(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function H(c,f,d){var g={fired:!1,wrapFn:void 0,target:c,type:f,listener:d},O=S.bind(g);return O.listener=d,g.wrapFn=O,O}n.prototype.once=function(f,d){return w(d),this.on(f,H(this,f,d)),this},n.prototype.prependOnceListener=function(f,d){return w(d),this.prependListener(f,H(this,f,d)),this},n.prototype.removeListener=function(f,d){var g,O,I,R,F;if(w(d),O=this._events,O===void 0)return this;if(g=O[f],g===void 0)return this;if(g===d||g.listener===d)--this._eventsCount===0?this._events=Object.create(null):(delete O[f],O.removeListener&&this.emit("removeListener",f,g.listener||d));else if(typeof g!="function"){for(I=-1,R=g.length-1;R>=0;R--)if(g[R]===d||g[R].listener===d){F=g[R].listener,I=R;break}if(I<0)return this;I===0?g.shift():re(g,I),g.length===1&&(O[f]=g[0]),O.removeListener!==void 0&&this.emit("removeListener",f,F||d)}return this},n.prototype.off=n.prototype.removeListener,n.prototype.removeAllListeners=function(f){var d,g,O;if(g=this._events,g===void 0)return this;if(g.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):g[f]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete g[f]),this;if(arguments.length===0){var I=Object.keys(g),R;for(O=0;O<I.length;++O)R=I[O],R!=="removeListener"&&this.removeAllListeners(R);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(d=g[f],typeof d=="function")this.removeListener(f,d);else if(d!==void 0)for(O=d.length-1;O>=0;O--)this.removeListener(f,d[O]);return this};function z(c,f,d){var g=c._events;if(g===void 0)return[];var O=g[f];return O===void 0?[]:typeof O=="function"?d?[O.listener||O]:[O]:d?q(O):X(O,O.length)}n.prototype.listeners=function(f){return z(this,f,!0)},n.prototype.rawListeners=function(f){return z(this,f,!1)},n.listenerCount=function(c,f){return typeof c.listenerCount=="function"?c.listenerCount(f):U.call(c,f)},n.prototype.listenerCount=U;function U(c){var f=this._events;if(f!==void 0){var d=f[c];if(typeof d=="function")return 1;if(d!==void 0)return d.length}return 0}n.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function X(c,f){for(var d=new Array(f),g=0;g<f;++g)d[g]=c[g];return d}function re(c,f){for(;f+1<c.length;f++)c[f]=c[f+1];c.pop()}function q(c){for(var f=new Array(c.length),d=0;d<f.length;++d)f[d]=c[d].listener||c[d];return f}function K(c,f){return new Promise(function(d,g){function O(R){c.removeListener(f,I),g(R)}function I(){typeof c.removeListener=="function"&&c.removeListener("error",O),d([].slice.call(arguments))}de(c,f,I,{once:!0}),f!=="error"&&he(c,O,{once:!0})})}function he(c,f,d){typeof c.on=="function"&&de(c,"error",f,d)}function de(c,f,d,g){if(typeof c.on=="function")g.once?c.once(f,d):c.on(f,d);else if(typeof c.addEventListener=="function")c.addEventListener(f,function O(I){g.once&&c.removeEventListener(f,O),d(I)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof c)}return le.exports}var Tt=Lt(),xt=Object.getOwnPropertyDescriptor,At=(t,e,r,i)=>{for(var o=i>1?void 0:i?xt(e,r):e,n=t.length-1,l;n>=0;n--)(l=t[n])&&(o=l(o)||o);return o};T.EventBus=class{_emitter;constructor(){this._emitter=new Tt.EventEmitter}emit(e,r){this._emitter.emit(e,r)}on(e,r){this._emitter.on(e,r)}off(e,r){this._emitter.off(e,r)}},T.EventBus=At([V()],T.EventBus);var J=(t=>(t.SelectHover="select.hover",t.SelectClick="select.click",t))(J||{}),jt=Object.getOwnPropertyDescriptor,kt=(t,e,r,i)=>{for(var o=i>1?void 0:i?jt(e,r):e,n=t.length-1,l;n>=0;n--)(l=t[n])&&(o=l(o)||o);return o},ze=(t,e)=>(r,i)=>e(r,i,t);T.EditorRenderer=class extends ye{constructor(e,r){super(e),this._canvas=e,this._bus=r;const i=new j.GridHelper(this.gl.gl,{size:10,divisions:10});i.position.y=-.001,i.setParent(this.scene),new j.AxesHelper(this.gl.gl,{size:6,symmetric:!0}).setParent(this.scene),this._orbit=new dt(this.camera,{element:this.canvas}),this._raycast=new j.Raycast,this._mouse=new j.Vec2,this._isEventListenersAdded=!1}_orbit;_raycast;_mouse;_isEventListenersAdded;update(){this._orbit?.update()}addFigure(e){const r=super.addFigure(e);if(r.geometry){const i=r.geometry.constructor.name;r.geometry.raycast=i.includes("Sphere")?"sphere":"box"}return this._isEventListenersAdded||this.initMouseListeners(),r}setMeshBeforeRender(e,r){e.onBeforeRender(r)}initMouseListeners(){document.addEventListener("mousemove",this._handleMouseMove,!1),document.addEventListener("click",this._handleMouseClick,!1),this._isEventListenersAdded=!0}_handleMouseMove=e=>{this._processRaycastEvent(e,J.SelectHover,!0)};_handleMouseClick=e=>{this._processRaycastEvent(e,J.SelectClick,!1)};_processRaycastEvent(e,r,i){if(this._orbit.isInteracting)return;this._mouse.set(2*(e.x/this.gl.width)-1,2*(1-e.y/this.gl.height)-1),this._raycast.castMouse(this.camera,this._mouse),i&&this.meshes.forEach(l=>l.isHit=!1);const o=this._raycast.intersectBounds(this.meshes),n=o.length?o[0]:null;this._bus.emit(r,n?{mesh:n}:null),i&&o.forEach(l=>l.isHit=!0)}destroy(){this._isEventListenersAdded&&(document.removeEventListener("mousemove",this._handleMouseMove,!1),document.removeEventListener("click",this._handleMouseClick,!1),this._isEventListenersAdded=!1),this._orbit.destroy(),this._orbit=null,this._raycast=null,this._mouse=null,super.destroy()}},T.EditorRenderer=kt([V(),ze(0,G("Canvas")),ze(1,G("EventBus"))],T.EditorRenderer);class Dt extends ye{_orbit;constructor(e){super(e),this._orbit=new j.Orbit(this.camera,{element:this.canvas,target:new j.Vec3(0,0,0),minPolarAngle:Math.PI/2,maxPolarAngle:Math.PI/2,enableRotate:!0,enableZoom:!1,enablePan:!1})}update(){this._orbit?.update()}}class Ht{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 Ue=(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))(Ue||{}),te=(t=>(t.Plane="plane",t.Wireframe="wireframe",t.Texture="texture",t))(te||{}),fe=(t=>(t.Mesh="mesh",t.Face="face",t.Edge="edge",t.Vertex="vertex",t))(fe||{});class Nt{_positions=[];_normals=[];_uvs=[];_tmpPositions=[];_tmpNormals=[];_tmpUVs=[];load(e){const r=e.split(`
|
|
75
|
+
`);for(const o of r){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 i={type:Ue.Custom,position:this._positions,...this._normals.length>0&&{normal:this._normals},...this._uvs.length>0&&{uv:this._uvs}};return new Ht(i)}processFaceLine(e){for(let r=1;r<e.length;r++){const i=e[r];if(!i)continue;const[o,n,l]=i.split("/"),w=o?parseInt(o,10):void 0,E=n?parseInt(n,10):void 0,m=l?parseInt(l,10):void 0;if(w!==void 0){const S=this._tmpPositions[w-1];S&&this._positions.push(...S)}if(E!==void 0){const S=this._tmpUVs[E-1];S&&this._uvs.push(...S)}if(m!==void 0){const S=this._tmpNormals[m-1];S&&this._normals.push(...S)}}}}var Ft=Object.getOwnPropertyDescriptor,Bt=(t,e,r,i)=>{for(var o=i>1?void 0:i?Ft(e,r):e,n=t.length-1,l;n>=0;n--)(l=t[n])&&(o=l(o)||o);return o},$t=(t,e)=>(r,i)=>e(r,i,t);let Oe=class{_currentMode=te.Plane;_handlers;constructor(t){this._handlers=new Map(t.map(e=>[e.mode,e]))}manage(t){t!==this._currentMode&&(this._handlers.get(this._currentMode)?.rollback(),t!==te.Plane&&this._handlers.get(t)?.handle(),this._currentMode=t)}destroy(){this._handlers&&this._handlers.clear(),this._currentMode=te.Plane}};Oe=Bt([V(),$t(0,Ge("IDisplayHandler"))],Oe);var ce=(t=>(t.Hover="hover",t.Click="click",t))(ce||{}),Wt=Object.getOwnPropertyDescriptor,Gt=(t,e,r,i)=>{for(var o=i>1?void 0:i?Wt(e,r):e,n=t.length-1,l;n>=0;n--)(l=t[n])&&(o=l(o)||o);return o},qe=(t,e)=>(r,i)=>e(r,i,t);let Ee=class{constructor(t,e){this._eventBus=t,this._handlers=new Map(e.map(r=>[r.mode,r])),this._eventBus.on(J.SelectHover,this._onHover),this._eventBus.on(J.SelectClick,this._onClick)}_currentMode=fe.Mesh;_handlers;manage(t){t!==this._currentMode&&(this._handlers.get(this._currentMode)?.rollback(),this._currentMode=t)}_onHover=t=>{if(!t)return;this._handlers.get(this._currentMode)?.handle(t,ce.Hover)};_onClick=t=>{if(!t)return;this._handlers.get(this._currentMode)?.handle(t,ce.Click)};destroy(){this._eventBus.off(J.SelectHover,this._onHover)}};Ee=Gt([V(),qe(0,G("EventBus")),qe(1,Ge("ISelectHandler"))],Ee);var Vt=Object.getOwnPropertyDescriptor,zt=(t,e,r,i)=>{for(var o=i>1?void 0:i?Vt(e,r):e,n=t.length-1,l;n>=0;n--)(l=t[n])&&(o=l(o)||o);return o},Ut=(t,e)=>(r,i)=>e(r,i,t);let Re=class{constructor(t){this._api=t,this._wireMeshes=[],this._context=this._api.getContext(),this._wireMeshProgram=new j.NormalProgram(this._context)}mode=te.Wireframe;_wireMeshes;_wireMeshProgram;_context;handle(){const t=this._api.getMeshes();this.createWireMeshes(t),this._api.removeMeshes(t),this._api.addMeshes(this._wireMeshes)}rollback(){const t=this._api.getMeshes();this._api.removeMeshes(this._wireMeshes),this._api.addMeshes(t)}destroy(){this._wireMeshes&&(this._wireMeshes.length=0,this._wireMeshes=[])}createWireMeshes(t){for(const e of t){const r=new j.WireMesh(this._context,{geometry:e.geometry,program:this._wireMeshProgram});this._wireMeshes.push(r)}}};Re=zt([V(),Ut(0,G("RendererApi"))],Re);var qt=Object.getOwnPropertyDescriptor,Zt=(t,e,r,i)=>{for(var o=i>1?void 0:i?qt(e,r):e,n=t.length-1,l;n>=0;n--)(l=t[n])&&(o=l(o)||o);return o},Jt=(t,e)=>(r,i)=>e(r,i,t);let Pe=class{constructor(t){this._api=t,this._program=t.getProgram(),this._selectedMesh=null}mode=fe.Mesh;_program;_selectedMesh;handle(t,e){if(!t)return;const{mesh:r}=t;e===ce.Hover?this._api.setMeshBeforeRender(r,()=>this._onHover(r)):this._api.setMeshBeforeRender(r,()=>this._onClick(r))}_onHover=t=>{t.program.uniforms.uHit.value=t.isHit?1:0};_onClick=t=>{this._selectedMesh&&this._selectedMesh.program?.uniforms.uSelected&&(this._selectedMesh.program.uniforms.uSelected.value=0),this._selectedMesh=t,t.program?.uniforms.uSelected&&(t.program.uniforms.uSelected.value=1),console.log(`Selected mesh: ${t.id}`)};rollback(){this._program.uniforms.uHit.value=0}destroy(){this.rollback()}};Pe=Zt([V(),Jt(0,G("RendererApi"))],Pe);var Yt=Object.getOwnPropertyDescriptor,Qt=(t,e,r,i)=>{for(var o=i>1?void 0:i?Yt(e,r):e,n=t.length-1,l;n>=0;n--)(l=t[n])&&(o=l(o)||o);return o},Xt=(t,e)=>(r,i)=>e(r,i,t);let Ce=class{constructor(t){this._renderer=t}addMesh(t){this._renderer.addMesh(t)}addMeshes(t){for(const e of t)this._renderer.addMesh(e)}removeMesh(t){this._renderer.removeMesh(t)}removeMeshes(t){for(const e of t)this._renderer.removeMesh(e)}getMeshes(){return this._renderer.getMeshes()}getContext(){return this._renderer.getContext()}getProgram(){return this._renderer.getProgram()}setMeshBeforeRender(t,e){this._renderer.setMeshBeforeRender(t,e)}};Ce=Qt([V(),Xt(0,G("EditorRenderer"))],Ce);var Kt=Object.getOwnPropertyDescriptor,er=(t,e,r,i)=>{for(var o=i>1?void 0:i?Kt(e,r):e,n=t.length-1,l;n>=0;n--)(l=t[n])&&(o=l(o)||o);return o},Se=(t,e)=>(r,i)=>e(r,i,t);T.EditorHub=class{constructor(e,r,i){this._displayManager=e,this._selectManager=r,this._renderer=i,r.manage(fe.Mesh)}setDisplayMode(e){this._displayManager.manage(e)}setSelectMode(e){this._selectManager.manage(e)}resizeRenderer(){this._renderer.resize()}updateRenderer(){this._renderer.loop()}addFigure(e){this._renderer.addFigure(e)}destroy(){this._displayManager.destroy(),this._selectManager.destroy(),this._renderer.destroy()}},T.EditorHub=er([V(),Se(0,G("IDisplayManager")),Se(1,G("ISelectManager")),Se(2,G("EditorRenderer"))],T.EditorHub);let Ze=!1;const B=It.createChildContainer();function tr(t){return Ze||(B.registerInstance("Canvas",t),B.registerSingleton("EventBus",T.EventBus),B.registerSingleton("EditorRenderer",T.EditorRenderer),B.registerSingleton("RendererApi",Ce),B.registerSingleton("IDisplayHandler",Re),B.registerSingleton("ISelectHandler",Pe),B.registerSingleton("IDisplayManager",Oe),B.registerSingleton("ISelectManager",Ee),B.registerSingleton("EditorHub",T.EditorHub),Ze=!0),B}function rr(t){return tr(t).resolve("EditorHub")}T.EditorMesh=He,T.EventTopics=J,T.ObjLoader=Nt,T.PreviewRenderer=Dt,T.Renderer=ye,T.createAppHub=rr,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mesh-api.d.ts","sourceRoot":"","sources":["../../../src/interfaces/api/mesh-api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEhC;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAE1B;;;;OAIG;IACH,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAEhC;;;;OAIG;IACH,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAE7B;;;;OAIG;IACH,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAEnC;;;;OAIG;IACH,SAAS,IAAI,IAAI,EAAE,CAAC;CACrB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Mesh, MeshRenderCallback, OGLRenderingContext, Program } from 'ogl';
|
|
2
|
+
/**
|
|
3
|
+
* Интерфейс API рендерера.
|
|
4
|
+
* Предоставляет доступ к базовым возможностям ядра рендерера
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export interface IRendererApi {
|
|
8
|
+
/**
|
|
9
|
+
* Возвращает WebGL контекст рендерера.
|
|
10
|
+
*
|
|
11
|
+
* @returns Контекст WebGL (OGLRenderingContext) текущей сцены.
|
|
12
|
+
*/
|
|
13
|
+
getContext(): OGLRenderingContext;
|
|
14
|
+
/**
|
|
15
|
+
* Возвращает настройку для рендеринга.
|
|
16
|
+
*
|
|
17
|
+
* @returns Program для настройки рендеринга моделей.
|
|
18
|
+
*/
|
|
19
|
+
getProgram(): Program;
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @param mesh
|
|
23
|
+
* @param f
|
|
24
|
+
*/
|
|
25
|
+
setMeshBeforeRender(mesh: Mesh, f: MeshRenderCallback): void;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=renderer-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer-api.d.ts","sourceRoot":"","sources":["../../../src/interfaces/api/renderer-api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAElF;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,UAAU,IAAI,mBAAmB,CAAC;IAElC;;;;OAIG;IACH,UAAU,IAAI,OAAO,CAAC;IAEtB;;;;OAIG;IACH,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display-handler.d.ts","sourceRoot":"","sources":["../../../src/interfaces/handler/display-handler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,IAAI,EAAE,WAAW,CAAC;CACnB"}
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
* Общий интерфейс для всех хендлеров.
|
|
3
3
|
* Хендлеры выполняют действия по настройке рендерера,
|
|
4
4
|
* управляют состоянием сцены или конкретных режимов отображения.
|
|
5
|
+
* @internal
|
|
5
6
|
*/
|
|
6
7
|
export interface IHandler {
|
|
7
8
|
/**
|
|
8
9
|
* Выполняет основное действие хендлера.
|
|
9
10
|
* Например, применяет конкретный режим отображения или модифицирует настройки рендерера.
|
|
10
11
|
*/
|
|
11
|
-
handle(): void;
|
|
12
|
+
handle(...args: unknown[]): void;
|
|
12
13
|
/**
|
|
13
14
|
* Откатывает изменения, внесённые методом handle().
|
|
14
15
|
* Используется для восстановления предыдущего состояния рендерера.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/interfaces/handler/handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB;;;OAGG;IACH,MAAM,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEjC;;;OAGG;IACH,QAAQ,IAAI,IAAI,CAAC;IAEjB;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IHandler } from './handler';
|
|
2
|
+
import { SelectMode } from '@planara/types';
|
|
3
|
+
/**
|
|
4
|
+
* Маркерный интерфейс для всех Select-хендлеров.
|
|
5
|
+
* Используется только для DI.
|
|
6
|
+
*
|
|
7
|
+
* Расширяет {@link IHandler} и добавляет поле `mode`
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export interface ISelectHandler extends IHandler {
|
|
11
|
+
mode: SelectMode;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=select-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-handler.d.ts","sourceRoot":"","sources":["../../../src/interfaces/handler/select-handler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,IAAI,EAAE,UAAU,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display-manager.d.ts","sourceRoot":"","sources":["../../../src/interfaces/manager/display-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,QAAQ;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/interfaces/manager/manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,MAAM,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-manager.d.ts","sourceRoot":"","sources":["../../../src/interfaces/manager/select-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,QAAQ;CAAG"}
|
package/dist/ioc/container.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DependencyContainer } from 'tsyringe';
|
|
2
|
-
|
|
3
|
-
export declare function createContainer(
|
|
2
|
+
declare const container: DependencyContainer;
|
|
3
|
+
export declare function createContainer(canvas: HTMLCanvasElement): DependencyContainer;
|
|
4
|
+
export { container };
|
|
4
5
|
//# sourceMappingURL=container.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/ioc/container.ts"],"names":[],"mappings":"AACA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAgC,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/ioc/container.ts"],"names":[],"mappings":"AACA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAgC,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAsBlF,QAAA,MAAM,SAAS,qBAAyC,CAAC;AAEzD,wBAAgB,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,mBAAmB,CA2B9E;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -2,14 +2,14 @@ import { Figure } from '@planara/types';
|
|
|
2
2
|
/** @public */
|
|
3
3
|
export declare class ObjLoader {
|
|
4
4
|
/** Позиции вершин */
|
|
5
|
-
private
|
|
5
|
+
private _positions;
|
|
6
6
|
/** Нормали вершин */
|
|
7
|
-
private
|
|
7
|
+
private _normals;
|
|
8
8
|
/** UV-координаты (опционально) */
|
|
9
|
-
private
|
|
10
|
-
private
|
|
11
|
-
private
|
|
12
|
-
private
|
|
9
|
+
private _uvs;
|
|
10
|
+
private _tmpPositions;
|
|
11
|
+
private _tmpNormals;
|
|
12
|
+
private _tmpUVs;
|
|
13
13
|
/**
|
|
14
14
|
* Загружает OBJ-модель в Figure
|
|
15
15
|
* @param objContent - Строка содержимого .obj файла
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"obj-loader.d.ts","sourceRoot":"","sources":["../../src/loaders/obj-loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAA+B,MAAM,gBAAgB,CAAC;AAErE,cAAc;AACd,qBAAa,SAAS;IACpB,qBAAqB;IACrB,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"obj-loader.d.ts","sourceRoot":"","sources":["../../src/loaders/obj-loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAA+B,MAAM,gBAAgB,CAAC;AAErE,cAAc;AACd,qBAAa,SAAS;IACpB,qBAAqB;IACrB,OAAO,CAAC,UAAU,CAAgB;IAElC,qBAAqB;IACrB,OAAO,CAAC,QAAQ,CAAgB;IAEhC,kCAAkC;IAClC,OAAO,CAAC,IAAI,CAAgB;IAG5B,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,OAAO,CAAkB;IAEjC;;;OAGG;IACI,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAmCvC;;OAEG;IACH,OAAO,CAAC,eAAe;CA2BxB"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { IDisplayManager } from '
|
|
1
|
+
import { IDisplayManager } from '../../interfaces/manager/display-manager';
|
|
2
2
|
import { DisplayMode } from '@planara/types';
|
|
3
|
-
import { IDisplayHandler } from '
|
|
3
|
+
import { IDisplayHandler } from '../../interfaces/handler/display-handler';
|
|
4
4
|
/**
|
|
5
5
|
* Менеджер для управления отображением
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
8
|
export declare class DisplayManager implements IDisplayManager {
|
|
9
9
|
/** Текущий режим отображения */
|
|
10
|
-
private
|
|
10
|
+
private _currentMode;
|
|
11
11
|
/** Хендлеры, которые управляют отображением */
|
|
12
|
-
private readonly
|
|
12
|
+
private readonly _handlers;
|
|
13
13
|
constructor(handlers: IDisplayHandler[]);
|
|
14
14
|
/** Установка режима отображения */
|
|
15
15
|
manage(mode: DisplayMode): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display-manager.d.ts","sourceRoot":"","sources":["../../../src/managers/display/display-manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAGhF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAEhF;;;GAGG;AACH,qBACa,cAAe,YAAW,eAAe;IACpD,gCAAgC;IAChC,OAAO,CAAC,YAAY,CAAkC;IAEtD,+CAA+C;IAC/C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA6B;gBAEb,QAAQ,EAAE,eAAe,EAAE;IAIrE,mCAAmC;IACnC,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAc/B,4BAA4B;IAC5B,OAAO,IAAI,IAAI;CAOhB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ISelectHandler } from '../../interfaces/handler/select-handler';
|
|
2
|
+
import { ISelectManager } from '../../interfaces/manager/select-manager';
|
|
3
|
+
import { EventBus } from '../../events/event-bus';
|
|
4
|
+
import { SelectMode } from '@planara/types';
|
|
5
|
+
export declare class SelectManager implements ISelectManager {
|
|
6
|
+
private _eventBus;
|
|
7
|
+
/** Текущий режим выборки */
|
|
8
|
+
private _currentMode;
|
|
9
|
+
/** Хендлеры, которые управляют выборкой */
|
|
10
|
+
private readonly _handlers;
|
|
11
|
+
constructor(_eventBus: EventBus, handlers: ISelectHandler[]);
|
|
12
|
+
manage(mode: SelectMode): void;
|
|
13
|
+
/** Обработчик события наведения на модель */
|
|
14
|
+
private _onHover;
|
|
15
|
+
/** Обработчик события клика на модель */
|
|
16
|
+
private _onClick;
|
|
17
|
+
destroy(): void;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=select-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-manager.d.ts","sourceRoot":"","sources":["../../../src/managers/select/select-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAK9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAKvD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,qBACa,aAAc,YAAW,cAAc;IAQ5B,OAAO,CAAC,SAAS;IAPvC,4BAA4B;IAC5B,OAAO,CAAC,YAAY,CAA+B;IAEnD,2CAA2C;IAC3C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA4B;gBAGxB,SAAS,EAAE,QAAQ,EAClB,QAAQ,EAAE,cAAc,EAAE;IAUzD,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAU9B,6CAA6C;IAC7C,OAAO,CAAC,QAAQ,CAQd;IAEF,yCAAyC;IACzC,OAAO,CAAC,QAAQ,CAQd;IAEF,OAAO,IAAI,IAAI;CAGhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camera-position.d.ts","sourceRoot":"","sources":["../../../src/types/camera/camera-position.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-event-type.d.ts","sourceRoot":"","sources":["../../../src/types/event/select-event-type.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,KAAK,UAAU;CAChB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program-settings.d.ts","sourceRoot":"","sources":["../../src/utils/program-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAExD;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,mBAAmB,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"program-settings.d.ts","sourceRoot":"","sources":["../../src/utils/program-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAExD;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,mBAAmB,GAAG,OAAO,CA2D/D"}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { IMeshApi } from '../interfaces/mesh-api';
|
|
2
|
-
import { IRendererApi } from '../interfaces/renderer-api';
|
|
3
|
-
import { Mesh, OGLRenderingContext } from 'ogl';
|
|
1
|
+
import { IMeshApi } from '../interfaces/api/mesh-api';
|
|
2
|
+
import { IRendererApi } from '../interfaces/api/renderer-api';
|
|
3
|
+
import { Mesh, MeshRenderCallback, OGLRenderingContext, Program } from 'ogl';
|
|
4
4
|
import { EditorRenderer } from '../core/editor-renderer';
|
|
5
5
|
/**
|
|
6
6
|
* API для EditorRenderer
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
9
|
export declare class RendererApi implements IMeshApi, IRendererApi {
|
|
10
|
-
private
|
|
11
|
-
constructor(
|
|
10
|
+
private _renderer;
|
|
11
|
+
constructor(_renderer: EditorRenderer);
|
|
12
12
|
addMesh(mesh: Mesh): void;
|
|
13
13
|
addMeshes(meshes: Mesh[]): void;
|
|
14
14
|
removeMesh(mesh: Mesh): void;
|
|
15
15
|
removeMeshes(meshes: Mesh[]): void;
|
|
16
16
|
getMeshes(): Mesh[];
|
|
17
17
|
getContext(): OGLRenderingContext;
|
|
18
|
+
getProgram(): Program;
|
|
19
|
+
setMeshBeforeRender(mesh: Mesh, f: MeshRenderCallback): void;
|
|
18
20
|
}
|
|
19
21
|
//# sourceMappingURL=renderer-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer-api.d.ts","sourceRoot":"","sources":["../../src/utils/renderer-api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"renderer-api.d.ts","sourceRoot":"","sources":["../../src/utils/renderer-api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAInE,OAAO,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;GAGG;AACH,qBACa,WAAY,YAAW,QAAQ,EAAE,YAAY;IAClB,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,cAAc;IAEhE,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAIzB,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI;IAM/B,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAI5B,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI;IAMlC,SAAS,IAAI,IAAI,EAAE;IAInB,UAAU,IAAI,mBAAmB;IAIjC,UAAU,IAAI,OAAO;IAIrB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,kBAAkB,GAAG,IAAI;CAGpE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planara/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -53,7 +53,8 @@
|
|
|
53
53
|
"vite-tsconfig-paths": "^5.1.4"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@planara/types": "^1.
|
|
56
|
+
"@planara/types": "^1.3.1",
|
|
57
|
+
"events": "^3.3.0",
|
|
57
58
|
"ogl": "^1.0.11",
|
|
58
59
|
"reflect-metadata": "^0.2.2",
|
|
59
60
|
"tsyringe": "^4.10.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"display-handler.d.ts","sourceRoot":"","sources":["../../src/interfaces/display-handler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,IAAI,EAAE,WAAW,CAAC;CACnB"}
|