@eva/plugin-renderer-mesh 2.0.1 → 2.0.2-beta.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{},globalThis.EVA.plugin.renderer=globalThis.EVA.plugin.renderer||{};var _EVA_IIFE_mesh=function(e,r,s,t){"use strict";class n extends r.Component{constructor(){super(...arguments),this.verticesX=10,this.verticesY=10,this._forceUpdate=0}init(e){e&&e.resource&&(this.resource=e.resource),e&&e.verticesX&&(this.verticesX=e.verticesX),e&&e.verticesY&&(this.verticesY=e.verticesY)}setCorners(e,r,s,t,n,i,o,c){const a=this.corners||{};a.x0=e,a.y0=r,a.x1=s,a.y1=t,a.x2=n,a.y2=i,a.x3=o,a.y3=c,this.corners=a,this._forceUpdate+=1}}function i(e,r,s,t){return new(s||(s=Promise))(
|
|
1
|
+
globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{},globalThis.EVA.plugin.renderer=globalThis.EVA.plugin.renderer||{};var _EVA_IIFE_mesh=function(e,r,s,t){"use strict";class n extends r.Component{constructor(){super(...arguments),this.verticesX=10,this.verticesY=10,this._forceUpdate=0}init(e){e&&e.resource&&(this.resource=e.resource),e&&e.verticesX&&(this.verticesX=e.verticesX),e&&e.verticesY&&(this.verticesY=e.verticesY)}setCorners(e,r,s,t,n,i,o,c){const a=this.corners||{};a.x0=e,a.y0=r,a.x1=s,a.y1=t,a.x2=n,a.y2=i,a.x3=o,a.y3=c,this.corners=a,this._forceUpdate+=1}}function i(e,r,s,t){return new(s||(s=Promise))(function(n,i){function o(e){try{a(t.next(e))}catch(e){i(e)}}function c(e){try{a(t.throw(e))}catch(e){i(e)}}function a(e){var r;e.done?n(e.value):(r=e.value,r instanceof s?r:new s(function(e){e(r)})).then(o,c)}a((t=t.apply(e,r||[])).next())})}n.componentName="PerspectiveMesh";let o=class extends s.Renderer{constructor(){super(...arguments),this.name="MeshSystem",this.meshes={}}init(){this.renderSystem=this.game.getSystem(s.RendererSystem),this.renderSystem.rendererManager.register(this)}componentChanged(e){var s,n;return i(this,void 0,void 0,function*(){if("PerspectiveMesh"===e.componentName){const i=e.gameObject.id,o=e.component;if(e.type===r.OBSERVER_TYPE.ADD){const n=new t.PerspectiveMesh({texture:new t.Texture,verticesX:o.verticesX,verticesY:o.verticesY});this.meshes[e.gameObject.id]=n,this.containerManager.getContainer(e.gameObject.id).addChildAt(n,0);const c=this.increaseAsyncId(i),a=yield r.resource.getResource(o.resource),h=null===(s=a.data)||void 0===s?void 0:s.image;if(!this.validateAsyncId(i,c))return;if(!h)return void console.error(`GameObject:${e.gameObject.name}'s Mesh resource load error`);n.texture=h,o.corners?this.meshes[e.gameObject.id].setCorners(o.corners.x0,o.corners.y0,o.corners.x1,o.corners.y1,o.corners.x2,o.corners.y2,o.corners.x3,o.corners.y3):n.setCorners(0,0,h.width,0,h.width,h.height,0,h.height)}else if(e.type===r.OBSERVER_TYPE.CHANGE){const s=this.increaseAsyncId(i),t=yield r.resource.getResource(o.resource),c=null===(n=t.data)||void 0===n?void 0:n.image;if(!this.validateAsyncId(i,s))return;if(!c)return void console.error(`GameObject:${e.gameObject.name}'s Mesh resource load error`);this.meshes[e.gameObject.id].texture=c,o.corners&&this.meshes[e.gameObject.id].setCorners(o.corners.x0,o.corners.y0,o.corners.x1,o.corners.y1,o.corners.x2,o.corners.y2,o.corners.x3,o.corners.y3)}else if(e.type===r.OBSERVER_TYPE.REMOVE){this.increaseAsyncId(i);const r=this.meshes[e.gameObject.id];this.containerManager.getContainer(e.gameObject.id).removeChild(r),r.destroy(),delete this.meshes[e.gameObject.id]}}})}destroy(){var e,r;for(const s in this.meshes){const t=this.meshes[s];null===(r=null===(e=this.containerManager)||void 0===e?void 0:e.getContainer(parseInt(s)))||void 0===r||r.removeChild(t),t.destroy(),delete this.meshes[s]}}};o.systemName="MeshSystem",o=function(e,r,s,t){var n,i=arguments.length,o=i<3?r:null===t?t=Object.getOwnPropertyDescriptor(r,s):t;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,r,s,t);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(o=(i<3?n(o):i>3?n(r,s,o):n(r,s))||o);return i>3&&o&&Object.defineProperty(r,s,o),o}([r.decorators.componentObserver({PerspectiveMesh:["resource","_forceUpdate"]})],o);var c=o;return e.MeshSystem=c,e.PerspectiveMesh=n,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,PIXI);globalThis.EVA.plugin.renderer.mesh=globalThis.EVA.plugin.renderer.mesh||_EVA_IIFE_mesh;
|
|
@@ -111,19 +111,19 @@ class PerspectiveMesh extends eva_js.Component {
|
|
|
111
111
|
/** 组件名称 */
|
|
112
112
|
PerspectiveMesh.componentName = 'PerspectiveMesh';
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
Copyright (c) Microsoft Corporation.
|
|
116
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
117
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
118
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
114
|
+
/******************************************************************************
|
|
115
|
+
Copyright (c) Microsoft Corporation.
|
|
119
116
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
123
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
117
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
118
|
+
purpose with or without fee is hereby granted.
|
|
124
119
|
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
121
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
122
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
123
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
124
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
125
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
126
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
127
127
|
***************************************************************************** */
|
|
128
128
|
|
|
129
129
|
function __decorate(decorators, target, key, desc) {
|
|
@@ -134,13 +134,19 @@ function __decorate(decorators, target, key, desc) {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
137
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
137
138
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
138
139
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
139
140
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
140
|
-
function step(result) { result.done ? resolve(result.value) :
|
|
141
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
141
142
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
142
143
|
});
|
|
143
|
-
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
147
|
+
var e = new Error(message);
|
|
148
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
149
|
+
};
|
|
144
150
|
|
|
145
151
|
let MeshSystem = class MeshSystem extends pluginRenderer.Renderer {
|
|
146
152
|
constructor() {
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),r=require("@eva/plugin-renderer"),t=require("pixi.js");class s extends e.Component{constructor(){super(...arguments),this.verticesX=10,this.verticesY=10,this._forceUpdate=0}init(e){e&&e.resource&&(this.resource=e.resource),e&&e.verticesX&&(this.verticesX=e.verticesX),e&&e.verticesY&&(this.verticesY=e.verticesY)}setCorners(e,r,t,s,n,i,o,c){const a=this.corners||{};a.x0=e,a.y0=r,a.x1=t,a.y1=s,a.x2=n,a.y2=i,a.x3=o,a.y3=c,this.corners=a,this._forceUpdate+=1}}s.componentName="PerspectiveMesh";let
|
|
2
|
-
/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
5
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
6
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
|
|
8
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
9
|
-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
10
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
11
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
12
|
-
|
|
13
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
14
|
-
and limitations under the License.
|
|
15
|
-
***************************************************************************** */
|
|
16
|
-
function(e,r,t,s){var n,i=arguments.length,o=i<3?r:null===s?s=Object.getOwnPropertyDescriptor(r,t):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,r,t,s);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(o=(i<3?n(o):i>3?n(r,t,o):n(r,t))||o);return i>3&&o&&Object.defineProperty(r,t,o),o}([e.decorators.componentObserver({PerspectiveMesh:["resource","_forceUpdate"]})],n);var i=n;exports.MeshSystem=i,exports.PerspectiveMesh=s;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),r=require("@eva/plugin-renderer"),t=require("pixi.js");class s extends e.Component{constructor(){super(...arguments),this.verticesX=10,this.verticesY=10,this._forceUpdate=0}init(e){e&&e.resource&&(this.resource=e.resource),e&&e.verticesX&&(this.verticesX=e.verticesX),e&&e.verticesY&&(this.verticesY=e.verticesY)}setCorners(e,r,t,s,n,i,o,c){const a=this.corners||{};a.x0=e,a.y0=r,a.x1=t,a.y1=s,a.x2=n,a.y2=i,a.x3=o,a.y3=c,this.corners=a,this._forceUpdate+=1}}function n(e,r,t,s){return new(t||(t=Promise))(function(n,i){function o(e){try{a(s.next(e))}catch(e){i(e)}}function c(e){try{a(s.throw(e))}catch(e){i(e)}}function a(e){var r;e.done?n(e.value):(r=e.value,r instanceof t?r:new t(function(e){e(r)})).then(o,c)}a((s=s.apply(e,r||[])).next())})}s.componentName="PerspectiveMesh","function"==typeof SuppressedError&&SuppressedError;let i=class extends r.Renderer{constructor(){super(...arguments),this.name="MeshSystem",this.meshes={}}init(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)}componentChanged(r){var s,i;return n(this,void 0,void 0,function*(){if("PerspectiveMesh"===r.componentName){const n=r.gameObject.id,o=r.component;if(r.type===e.OBSERVER_TYPE.ADD){const i=new t.PerspectiveMesh({texture:new t.Texture,verticesX:o.verticesX,verticesY:o.verticesY});this.meshes[r.gameObject.id]=i,this.containerManager.getContainer(r.gameObject.id).addChildAt(i,0);const c=this.increaseAsyncId(n),a=yield e.resource.getResource(o.resource),h=null===(s=a.data)||void 0===s?void 0:s.image;if(!this.validateAsyncId(n,c))return;if(!h)return void console.error(`GameObject:${r.gameObject.name}'s Mesh resource load error`);i.texture=h,o.corners?this.meshes[r.gameObject.id].setCorners(o.corners.x0,o.corners.y0,o.corners.x1,o.corners.y1,o.corners.x2,o.corners.y2,o.corners.x3,o.corners.y3):i.setCorners(0,0,h.width,0,h.width,h.height,0,h.height)}else if(r.type===e.OBSERVER_TYPE.CHANGE){const t=this.increaseAsyncId(n),s=yield e.resource.getResource(o.resource),c=null===(i=s.data)||void 0===i?void 0:i.image;if(!this.validateAsyncId(n,t))return;if(!c)return void console.error(`GameObject:${r.gameObject.name}'s Mesh resource load error`);this.meshes[r.gameObject.id].texture=c,o.corners&&this.meshes[r.gameObject.id].setCorners(o.corners.x0,o.corners.y0,o.corners.x1,o.corners.y1,o.corners.x2,o.corners.y2,o.corners.x3,o.corners.y3)}else if(r.type===e.OBSERVER_TYPE.REMOVE){this.increaseAsyncId(n);const e=this.meshes[r.gameObject.id];this.containerManager.getContainer(r.gameObject.id).removeChild(e),e.destroy(),delete this.meshes[r.gameObject.id]}}})}destroy(){var e,r;for(const t in this.meshes){const s=this.meshes[t];null===(r=null===(e=this.containerManager)||void 0===e?void 0:e.getContainer(parseInt(t)))||void 0===r||r.removeChild(s),s.destroy(),delete this.meshes[t]}}};i.systemName="MeshSystem",i=function(e,r,t,s){var n,i=arguments.length,o=i<3?r:null===s?s=Object.getOwnPropertyDescriptor(r,t):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,r,t,s);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(o=(i<3?n(o):i>3?n(r,t,o):n(r,t))||o);return i>3&&o&&Object.defineProperty(r,t,o),o}([e.decorators.componentObserver({PerspectiveMesh:["resource","_forceUpdate"]})],i);var o=i;exports.MeshSystem=o,exports.PerspectiveMesh=s;
|
|
@@ -107,19 +107,19 @@ class PerspectiveMesh extends Component {
|
|
|
107
107
|
/** 组件名称 */
|
|
108
108
|
PerspectiveMesh.componentName = 'PerspectiveMesh';
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
Copyright (c) Microsoft Corporation.
|
|
112
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
113
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
114
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
110
|
+
/******************************************************************************
|
|
111
|
+
Copyright (c) Microsoft Corporation.
|
|
115
112
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
119
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
113
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
114
|
+
purpose with or without fee is hereby granted.
|
|
120
115
|
|
|
121
|
-
|
|
122
|
-
|
|
116
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
117
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
118
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
119
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
120
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
121
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
122
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
123
123
|
***************************************************************************** */
|
|
124
124
|
|
|
125
125
|
function __decorate(decorators, target, key, desc) {
|
|
@@ -130,13 +130,19 @@ function __decorate(decorators, target, key, desc) {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
133
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
133
134
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
134
135
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
135
136
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
136
|
-
function step(result) { result.done ? resolve(result.value) :
|
|
137
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
137
138
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
138
139
|
});
|
|
139
|
-
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
143
|
+
var e = new Error(message);
|
|
144
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
145
|
+
};
|
|
140
146
|
|
|
141
147
|
let MeshSystem = class MeshSystem extends Renderer {
|
|
142
148
|
constructor() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-mesh",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2-beta.0",
|
|
4
4
|
"description": "@eva/plugin-renderer-mesh",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-mesh.esm.js",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@eva/inspector-decorator": "^0.0.5",
|
|
22
|
-
"@eva/plugin-renderer": "2.0.
|
|
23
|
-
"@eva/eva.js": "2.0.
|
|
22
|
+
"@eva/plugin-renderer": "2.0.2-beta.0",
|
|
23
|
+
"@eva/eva.js": "2.0.2-beta.0",
|
|
24
24
|
"pixi.js": "^8.17.0"
|
|
25
25
|
}
|
|
26
26
|
}
|