@eva/plugin-renderer-render-texture 2.1.0-beta.2 → 2.1.0-beta.4
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.
|
@@ -42,6 +42,10 @@ var _EVA_IIFE_texture = function (exports, eva_js, pluginRenderer, pixi_js) {
|
|
|
42
42
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
46
|
+
var e = new Error(message);
|
|
47
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
48
|
+
};
|
|
45
49
|
function __rest(s, e) {
|
|
46
50
|
var t = {};
|
|
47
51
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_extends.apply(null,arguments)}globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{},globalThis.EVA.plugin.renderer=globalThis.EVA.plugin.renderer||{},globalThis.EVA.plugin.renderer.render=globalThis.EVA.plugin.renderer.render||{};var _EVA_IIFE_texture=function(e,t,r,n){"use strict";function o(e,t,r,n){var o,i=arguments.length,l=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(l=(i<3?o(l):i>3?o(t,r,l):o(t,r))||l);return i>3&&l&&Object.defineProperty(t,r,l),l}function i(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,r,n){return new(r||(r=Promise))(function(o,i){function l(e){try{d(n.next(e))}catch(e){i(e)}}function s(e){try{d(n.throw(e))}catch(e){i(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(l,s)}d((n=n.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;class s extends Error{constructor(){super("Symbol keys are not supported yet!"),Object.setPrototypeOf(this,new.target.prototype)}}const d="IDE_PROPERTY_METADATA";function a(e,t,r,n){let o=Reflect.getMetadata("design:type",e,t),i=o===Array;const l=function(e){return e===String?"string":e===Number?"number":e===Boolean?"boolean":"unknown"}(o);if("unknown"!==l&&(o=l),n){const e=n();Array.isArray(e)?(i=!0,o=e[0]):o=e}const s=Reflect.getMetadata(d,e.constructor)||{},a=_extends(_extends(_extends({},s[t]||{}),{type:o,isArray:i}),r);s[t]=a,Reflect.defineMetadata(d,s,e.constructor);!function(e,t,r){const n=e.constructor,o=n.IDEProps||{};o[t]=_extends(_extends({key:t},o[t]),r),n.IDEProps=o}(e,t,function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(a,["isArray"]))}function c(e){return t={type:e},(e,n)=>{if("symbol"==typeof n)throw new s;const{options:o,returnTypeFunc:i}=function(e,t){return"function"==typeof e?{returnTypeFunc:e,options:t||{}}:{options:e||{}}}(t,r);a(e,n,o,i)};var t,r}var u;!function(e){e[e.Edit=2]="Edit",e[e.Game=4]="Game",e[e.All=6]="All"}(u||(u={}));class h extends t.Component{constructor(){super(...arguments),this.width=256,this.height=256,this.ops=[],this.backgroundColor=-1,this.backgroundAlpha=1,this.append=!0,this.dirty=0}init(e){e&&_extends(this,e),Array.isArray(this.ops)||(this.ops=[])}addOp(e){this.ops=[...this.ops,e],this.dirty++}clearOps(){this.ops=[{type:"clear"}],this.dirty++}}h.componentName="RenderTexture",o([c("number"),i("design:type",Number)],h.prototype,"width",void 0),o([c("number"),i("design:type",Number)],h.prototype,"height",void 0),o([c("array"),i("design:type",Array)],h.prototype,"ops",void 0),o([c("number"),i("design:type",Number)],h.prototype,"backgroundColor",void 0),o([c("number"),i("design:type",Number)],h.prototype,"backgroundAlpha",void 0);let p=class extends r.Renderer{constructor(){super(...arguments),this.name="RenderTexture",this.records={}}init(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)}rendererUpdate(e){const t=this.records[e.id];t&&t.needsReplay&&(t.needsReplay=!1,this.replay(e.id))}componentChanged(e){var r,o,i,s;return l(this,void 0,void 0,function*(){if("RenderTexture"!==e.componentName)return;const l=e.component,d=e.gameObject.id;if(e.type===t.OBSERVER_TYPE.ADD){const e=n.RenderTexture.create({width:Math.max(1,l.width||1),height:Math.max(1,l.height||1),resolution:1}),t=new n.Sprite(e);t.width=l.width,t.height=l.height,this.containerManager.getContainer(d).addChildAt(t,0),this.records[d]={rt:e,sprite:t,component:l,lastSig:"",needsReplay:!0},this.maybeSave(d)}else if(e.type===t.OBSERVER_TYPE.CHANGE){const e=this.records[d];if(!e)return;if(e.component=l,e.rt.width!==l.width||e.rt.height!==l.height){try{null===(o=(r=e.rt).resize)||void 0===o||o.call(r,Math.max(1,l.width),Math.max(1,l.height))}catch(e){}e.sprite.width=l.width,e.sprite.height=l.height}e.needsReplay=!0,this.maybeSave(d)}else if(e.type===t.OBSERVER_TYPE.REMOVE){const e=this.records[d];if(!e)return;null===(s=null===(i=this.containerManager)||void 0===i?void 0:i.getContainer(d))||void 0===s||s.removeChild(e.sprite),e.sprite.destroy({children:!0}),e.rt.destroy(!0),delete this.records[d]}})}resolveTexture(e,r){return l(this,void 0,void 0,function*(){if(!e)return null;let o=e,i=r;if(!i&&e.includes("#")){const t=e.indexOf("#");o=e.slice(0,t),i=e.slice(t+1)}try{const{instance:e}=yield t.resource.getResource(o);if(!e)return null;if(i){if(e&&e[i]instanceof n.Texture)return e[i];const t=e.textures;if(t&&t[i]instanceof n.Texture)return t[i]}if(e instanceof n.Texture)return e;if(e.baseTexture)return e;if("object"==typeof e){const t=Object.keys(e);for(const r of t){const t=e[r];if(t instanceof n.Texture)return t}}return null}catch(e){return null}})}replay(e){var t,r,o,i,s,d;return l(this,void 0,void 0,function*(){const l=this.records[e];if(!l)return;const{rt:a,component:c}=l,u=`${c.dirty}|${null!==(r=null===(t=c.ops)||void 0===t?void 0:t.length)&&void 0!==r?r:0}|${c.width}|${c.height}`;l.lastSig===u&&c.append,l.lastSig=u;const h=null===(o=this.renderSystem.application)||void 0===o?void 0:o.renderer;if(!h)return;const p=new n.Container,y=c.backgroundColor,f=null!==(i=c.backgroundAlpha)&&void 0!==i?i:1;if(!c.append){const e=new n.Graphics;null!=y&&y>=0?e.rect(0,0,c.width,c.height).fill({color:y,alpha:f}):e.rect(0,0,c.width,c.height).fill({color:0,alpha:0}),p.addChild(e)}for(const e of c.ops||[]){const t=yield this.buildOpNode(e);t&&p.addChild(t)}try{h.render({container:p,target:a,clear:!c.append}),globalThis.__RT_DEBUG&&console.log("[RT] replayed",{ops:null===(s=c.ops)||void 0===s?void 0:s.length,w:a.width,h:a.height,stageChildren:null===(d=p.children)||void 0===d?void 0:d.length})}catch(e){try{h.render(p,{renderTexture:a,clear:!c.append})}catch(t){console.warn("[RenderTexture] renderer.render failed",e)}}finally{Promise.resolve().then(()=>{try{p.destroy({children:!0})}catch(e){}})}})}buildOpNode(e){var t,r,o,i,s,d,a,c,u,h,p,y,f,v,g,m,b,x,w,T,E,A,R,O,M,S,_,C,P,V,j,k,I,N,G,Y,D,F,X;return l(this,void 0,void 0,function*(){if("clear"===e.type){const e=new n.Graphics;return e.rect(0,0,1e6,1e6).fill({color:0,alpha:0}),e}if("fill"===e.type){const l=new n.Graphics,d=null!==(t=e.x)&&void 0!==t?t:0,a=null!==(r=e.y)&&void 0!==r?r:0,c=null!==(o=e.width)&&void 0!==o?o:1e6,u=null!==(i=e.height)&&void 0!==i?i:1e6;return l.rect(d,a,c,u).fill({color:e.color,alpha:null!==(s=e.alpha)&&void 0!==s?s:1}),l}if("draw"===e.type||"drawFrame"===e.type){const t=yield this.resolveTexture(e.resource,e.frame);if(!t)return null;const r=new n.Sprite(t);r.x=null!==(d=e.x)&&void 0!==d?d:0,r.y=null!==(a=e.y)&&void 0!==a?a:0;const o=e;if(r.alpha=null!==(c=o.alpha)&&void 0!==c?c:1,null!=o.tint&&(r.tint=o.tint),null!=o.width&&(r.width=o.width),null!=o.height&&(r.height=o.height),null!=o.rotation&&(r.rotation=o.rotation),null==o.anchorX&&null==o.anchorY||r.anchor.set(null!==(u=o.anchorX)&&void 0!==u?u:0,null!==(h=o.anchorY)&&void 0!==h?h:0),null==o.scaleX&&null==o.scaleY||r.scale.set(null!==(p=o.scaleX)&&void 0!==p?p:1,null!==(y=o.scaleY)&&void 0!==y?y:1),o.blendMode)try{r.blendMode=o.blendMode}catch(e){}return r}if("erase"===e.type){const t=new n.Graphics,r=null!==(f=e.width)&&void 0!==f?f:16,o=null!==(v=e.height)&&void 0!==v?v:16,i=null!==(g=e.anchorX)&&void 0!==g?g:0,l=null!==(m=e.anchorY)&&void 0!==m?m:0,s=(null!==(b=e.x)&&void 0!==b?b:0)-r*i,d=(null!==(x=e.y)&&void 0!==x?x:0)-o*l;t.rect(s,d,r,o).fill({color:16777215,alpha:1});try{t.blendMode="erase"}catch(e){}return t}if("drawText"===e.type){const t=new n.Text({text:e.text,style:{fontFamily:null!==(T=null===(w=e.style)||void 0===w?void 0:w.fontFamily)&&void 0!==T?T:"Arial",fontSize:null!==(A=null===(E=e.style)||void 0===E?void 0:E.fontSize)&&void 0!==A?A:32,fontWeight:null!==(O=null===(R=e.style)||void 0===R?void 0:R.fontWeight)&&void 0!==O?O:"normal",fill:null!==(S=null===(M=e.style)||void 0===M?void 0:M.fill)&&void 0!==S?S:16777215,stroke:null===(_=e.style)||void 0===_?void 0:_.stroke,align:null!==(P=null===(C=e.style)||void 0===C?void 0:C.align)&&void 0!==P?P:"left"}});return t.x=null!==(V=e.x)&&void 0!==V?V:0,t.y=null!==(j=e.y)&&void 0!==j?j:0,null!=e.alpha&&(t.alpha=e.alpha),null!=e.tint&&(t.tint=e.tint),t}if("paint"===e.type){const t=yield this.resolveTexture(e.resource,e.frame);if(!t)return null;const r=new n.Container,o=Math.max(1,null!==(k=e.times)&&void 0!==k?k:1),i=null!==(N=null===(I=e.step)||void 0===I?void 0:I.x)&&void 0!==N?N:0,l=null!==(Y=null===(G=e.step)||void 0===G?void 0:G.y)&&void 0!==Y?Y:0;for(let s=0;s<o;s++){const o=new n.Sprite(t);o.x=(null!==(D=e.x)&&void 0!==D?D:0)+i*s,o.y=(null!==(F=e.y)&&void 0!==F?F:0)+l*s,o.anchor.set(.5,.5),o.alpha=null!==(X=e.alpha)&&void 0!==X?X:1,e.tintCycle&&e.tintCycle.length>0?o.tint=e.tintCycle[s%e.tintCycle.length]:null!=e.tint&&(o.tint=e.tint),r.addChild(o)}return r}return null})}maybeSave(e){var r;const n=this.records[e];if(!n)return;const o=n.component.saveAs;if(o)try{const e=null===(r=t.resource.resourcesMap)||void 0===r?void 0:r[o];if(e){e.complete=!0,e.instance=n.rt;const r=t.resource.promiseMap;return void(r&&(r[o]=Promise.resolve({instance:n.rt,name:o})))}t.resource.resourcesMap=t.resource.resourcesMap||{},t.resource.resourcesMap[o]={name:o,type:"IMAGE",complete:!0,instance:n.rt,data:{}};const i=t.resource.promiseMap;i&&(i[o]=Promise.resolve({instance:n.rt,name:o}))}catch(e){console.warn("[RenderTexture] saveAs failed",e)}}destroy(){var e,t;for(const r in this.records){const n=parseInt(r),o=this.records[n];null===(t=null===(e=this.containerManager)||void 0===e?void 0:e.getContainer(n))||void 0===t||t.removeChild(o.sprite),o.sprite.destroy({children:!0}),o.rt.destroy(!0),delete this.records[n]}}};p.systemName="RenderTexture",p=o([t.decorators.componentObserver({RenderTexture:[{prop:["width"],deep:!1},{prop:["height"],deep:!1},{prop:["ops"],deep:!0},{prop:["dirty"],deep:!1},{prop:["backgroundColor"],deep:!1},{prop:["backgroundAlpha"],deep:!1}]})],p);var y=p;return e.RenderTexture=h,e.RenderTextureSystem=y,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,PIXI);globalThis.EVA.plugin.renderer.render.texture=globalThis.EVA.plugin.renderer.render.texture||_EVA_IIFE_texture;
|
|
1
|
+
function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_extends.apply(null,arguments)}globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{},globalThis.EVA.plugin.renderer=globalThis.EVA.plugin.renderer||{},globalThis.EVA.plugin.renderer.render=globalThis.EVA.plugin.renderer.render||{};var _EVA_IIFE_texture=function(e,t,r,n){"use strict";function o(e,t,r,n){var o,i=arguments.length,l=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(l=(i<3?o(l):i>3?o(t,r,l):o(t,r))||l);return i>3&&l&&Object.defineProperty(t,r,l),l}function i(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,r,n){return new(r||(r=Promise))(function(o,i){function l(e){try{d(n.next(e))}catch(e){i(e)}}function s(e){try{d(n.throw(e))}catch(e){i(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(l,s)}d((n=n.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError,"function"==typeof SuppressedError&&SuppressedError;class s extends Error{constructor(){super("Symbol keys are not supported yet!"),Object.setPrototypeOf(this,new.target.prototype)}}const d="IDE_PROPERTY_METADATA";function a(e,t,r,n){let o=Reflect.getMetadata("design:type",e,t),i=o===Array;const l=function(e){return e===String?"string":e===Number?"number":e===Boolean?"boolean":"unknown"}(o);if("unknown"!==l&&(o=l),n){const e=n();Array.isArray(e)?(i=!0,o=e[0]):o=e}const s=Reflect.getMetadata(d,e.constructor)||{},a=_extends(_extends(_extends({},s[t]||{}),{type:o,isArray:i}),r);s[t]=a,Reflect.defineMetadata(d,s,e.constructor);!function(e,t,r){const n=e.constructor,o=n.IDEProps||{};o[t]=_extends(_extends({key:t},o[t]),r),n.IDEProps=o}(e,t,function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(a,["isArray"]))}function c(e){return t={type:e},(e,n)=>{if("symbol"==typeof n)throw new s;const{options:o,returnTypeFunc:i}=function(e,t){return"function"==typeof e?{returnTypeFunc:e,options:t||{}}:{options:e||{}}}(t,r);a(e,n,o,i)};var t,r}var u;!function(e){e[e.Edit=2]="Edit",e[e.Game=4]="Game",e[e.All=6]="All"}(u||(u={}));class p extends t.Component{constructor(){super(...arguments),this.width=256,this.height=256,this.ops=[],this.backgroundColor=-1,this.backgroundAlpha=1,this.append=!0,this.dirty=0}init(e){e&&_extends(this,e),Array.isArray(this.ops)||(this.ops=[])}addOp(e){this.ops=[...this.ops,e],this.dirty++}clearOps(){this.ops=[{type:"clear"}],this.dirty++}}p.componentName="RenderTexture",o([c("number"),i("design:type",Number)],p.prototype,"width",void 0),o([c("number"),i("design:type",Number)],p.prototype,"height",void 0),o([c("array"),i("design:type",Array)],p.prototype,"ops",void 0),o([c("number"),i("design:type",Number)],p.prototype,"backgroundColor",void 0),o([c("number"),i("design:type",Number)],p.prototype,"backgroundAlpha",void 0);let h=class extends r.Renderer{constructor(){super(...arguments),this.name="RenderTexture",this.records={}}init(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)}rendererUpdate(e){const t=this.records[e.id];t&&t.needsReplay&&(t.needsReplay=!1,this.replay(e.id))}componentChanged(e){var r,o,i,s;return l(this,void 0,void 0,function*(){if("RenderTexture"!==e.componentName)return;const l=e.component,d=e.gameObject.id;if(e.type===t.OBSERVER_TYPE.ADD){const e=n.RenderTexture.create({width:Math.max(1,l.width||1),height:Math.max(1,l.height||1),resolution:1}),t=new n.Sprite(e);t.width=l.width,t.height=l.height,this.containerManager.getContainer(d).addChildAt(t,0),this.records[d]={rt:e,sprite:t,component:l,lastSig:"",needsReplay:!0},this.maybeSave(d)}else if(e.type===t.OBSERVER_TYPE.CHANGE){const e=this.records[d];if(!e)return;if(e.component=l,e.rt.width!==l.width||e.rt.height!==l.height){try{null===(o=(r=e.rt).resize)||void 0===o||o.call(r,Math.max(1,l.width),Math.max(1,l.height))}catch(e){}e.sprite.width=l.width,e.sprite.height=l.height}e.needsReplay=!0,this.maybeSave(d)}else if(e.type===t.OBSERVER_TYPE.REMOVE){const e=this.records[d];if(!e)return;null===(s=null===(i=this.containerManager)||void 0===i?void 0:i.getContainer(d))||void 0===s||s.removeChild(e.sprite),e.sprite.destroy({children:!0}),e.rt.destroy(!0),delete this.records[d]}})}resolveTexture(e,r){return l(this,void 0,void 0,function*(){if(!e)return null;let o=e,i=r;if(!i&&e.includes("#")){const t=e.indexOf("#");o=e.slice(0,t),i=e.slice(t+1)}try{const{instance:e}=yield t.resource.getResource(o);if(!e)return null;if(i){if(e&&e[i]instanceof n.Texture)return e[i];const t=e.textures;if(t&&t[i]instanceof n.Texture)return t[i]}if(e instanceof n.Texture)return e;if(e.baseTexture)return e;if("object"==typeof e){const t=Object.keys(e);for(const r of t){const t=e[r];if(t instanceof n.Texture)return t}}return null}catch(e){return null}})}replay(e){var t,r,o,i,s,d;return l(this,void 0,void 0,function*(){const l=this.records[e];if(!l)return;const{rt:a,component:c}=l,u=`${c.dirty}|${null!==(r=null===(t=c.ops)||void 0===t?void 0:t.length)&&void 0!==r?r:0}|${c.width}|${c.height}`;l.lastSig===u&&c.append,l.lastSig=u;const p=null===(o=this.renderSystem.application)||void 0===o?void 0:o.renderer;if(!p)return;const h=new n.Container,y=c.backgroundColor,f=null!==(i=c.backgroundAlpha)&&void 0!==i?i:1;if(!c.append){const e=new n.Graphics;null!=y&&y>=0?e.rect(0,0,c.width,c.height).fill({color:y,alpha:f}):e.rect(0,0,c.width,c.height).fill({color:0,alpha:0}),h.addChild(e)}for(const e of c.ops||[]){const t=yield this.buildOpNode(e);t&&h.addChild(t)}try{p.render({container:h,target:a,clear:!c.append}),globalThis.__RT_DEBUG&&console.log("[RT] replayed",{ops:null===(s=c.ops)||void 0===s?void 0:s.length,w:a.width,h:a.height,stageChildren:null===(d=h.children)||void 0===d?void 0:d.length})}catch(e){try{p.render(h,{renderTexture:a,clear:!c.append})}catch(t){console.warn("[RenderTexture] renderer.render failed",e)}}finally{Promise.resolve().then(()=>{try{h.destroy({children:!0})}catch(e){}})}})}buildOpNode(e){var t,r,o,i,s,d,a,c,u,p,h,y,f,v,g,m,b,x,w,E,T,A,R,O,S,M,_,C,P,V,j,k,I,N,G,Y,D,F,X;return l(this,void 0,void 0,function*(){if("clear"===e.type){const e=new n.Graphics;return e.rect(0,0,1e6,1e6).fill({color:0,alpha:0}),e}if("fill"===e.type){const l=new n.Graphics,d=null!==(t=e.x)&&void 0!==t?t:0,a=null!==(r=e.y)&&void 0!==r?r:0,c=null!==(o=e.width)&&void 0!==o?o:1e6,u=null!==(i=e.height)&&void 0!==i?i:1e6;return l.rect(d,a,c,u).fill({color:e.color,alpha:null!==(s=e.alpha)&&void 0!==s?s:1}),l}if("draw"===e.type||"drawFrame"===e.type){const t=yield this.resolveTexture(e.resource,e.frame);if(!t)return null;const r=new n.Sprite(t);r.x=null!==(d=e.x)&&void 0!==d?d:0,r.y=null!==(a=e.y)&&void 0!==a?a:0;const o=e;if(r.alpha=null!==(c=o.alpha)&&void 0!==c?c:1,null!=o.tint&&(r.tint=o.tint),null!=o.width&&(r.width=o.width),null!=o.height&&(r.height=o.height),null!=o.rotation&&(r.rotation=o.rotation),null==o.anchorX&&null==o.anchorY||r.anchor.set(null!==(u=o.anchorX)&&void 0!==u?u:0,null!==(p=o.anchorY)&&void 0!==p?p:0),null==o.scaleX&&null==o.scaleY||r.scale.set(null!==(h=o.scaleX)&&void 0!==h?h:1,null!==(y=o.scaleY)&&void 0!==y?y:1),o.blendMode)try{r.blendMode=o.blendMode}catch(e){}return r}if("erase"===e.type){const t=new n.Graphics,r=null!==(f=e.width)&&void 0!==f?f:16,o=null!==(v=e.height)&&void 0!==v?v:16,i=null!==(g=e.anchorX)&&void 0!==g?g:0,l=null!==(m=e.anchorY)&&void 0!==m?m:0,s=(null!==(b=e.x)&&void 0!==b?b:0)-r*i,d=(null!==(x=e.y)&&void 0!==x?x:0)-o*l;t.rect(s,d,r,o).fill({color:16777215,alpha:1});try{t.blendMode="erase"}catch(e){}return t}if("drawText"===e.type){const t=new n.Text({text:e.text,style:{fontFamily:null!==(E=null===(w=e.style)||void 0===w?void 0:w.fontFamily)&&void 0!==E?E:"Arial",fontSize:null!==(A=null===(T=e.style)||void 0===T?void 0:T.fontSize)&&void 0!==A?A:32,fontWeight:null!==(O=null===(R=e.style)||void 0===R?void 0:R.fontWeight)&&void 0!==O?O:"normal",fill:null!==(M=null===(S=e.style)||void 0===S?void 0:S.fill)&&void 0!==M?M:16777215,stroke:null===(_=e.style)||void 0===_?void 0:_.stroke,align:null!==(P=null===(C=e.style)||void 0===C?void 0:C.align)&&void 0!==P?P:"left"}});return t.x=null!==(V=e.x)&&void 0!==V?V:0,t.y=null!==(j=e.y)&&void 0!==j?j:0,null!=e.alpha&&(t.alpha=e.alpha),null!=e.tint&&(t.tint=e.tint),t}if("paint"===e.type){const t=yield this.resolveTexture(e.resource,e.frame);if(!t)return null;const r=new n.Container,o=Math.max(1,null!==(k=e.times)&&void 0!==k?k:1),i=null!==(N=null===(I=e.step)||void 0===I?void 0:I.x)&&void 0!==N?N:0,l=null!==(Y=null===(G=e.step)||void 0===G?void 0:G.y)&&void 0!==Y?Y:0;for(let s=0;s<o;s++){const o=new n.Sprite(t);o.x=(null!==(D=e.x)&&void 0!==D?D:0)+i*s,o.y=(null!==(F=e.y)&&void 0!==F?F:0)+l*s,o.anchor.set(.5,.5),o.alpha=null!==(X=e.alpha)&&void 0!==X?X:1,e.tintCycle&&e.tintCycle.length>0?o.tint=e.tintCycle[s%e.tintCycle.length]:null!=e.tint&&(o.tint=e.tint),r.addChild(o)}return r}return null})}maybeSave(e){var r;const n=this.records[e];if(!n)return;const o=n.component.saveAs;if(o)try{const e=null===(r=t.resource.resourcesMap)||void 0===r?void 0:r[o];if(e){e.complete=!0,e.instance=n.rt;const r=t.resource.promiseMap;return void(r&&(r[o]=Promise.resolve({instance:n.rt,name:o})))}t.resource.resourcesMap=t.resource.resourcesMap||{},t.resource.resourcesMap[o]={name:o,type:"IMAGE",complete:!0,instance:n.rt,data:{}};const i=t.resource.promiseMap;i&&(i[o]=Promise.resolve({instance:n.rt,name:o}))}catch(e){console.warn("[RenderTexture] saveAs failed",e)}}destroy(){var e,t;for(const r in this.records){const n=parseInt(r),o=this.records[n];null===(t=null===(e=this.containerManager)||void 0===e?void 0:e.getContainer(n))||void 0===t||t.removeChild(o.sprite),o.sprite.destroy({children:!0}),o.rt.destroy(!0),delete this.records[n]}}};h.systemName="RenderTexture",h=o([t.decorators.componentObserver({RenderTexture:[{prop:["width"],deep:!1},{prop:["height"],deep:!1},{prop:["ops"],deep:!0},{prop:["dirty"],deep:!1},{prop:["backgroundColor"],deep:!1},{prop:["backgroundAlpha"],deep:!1}]})],h);var y=h;return e.RenderTexture=p,e.RenderTextureSystem=y,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,PIXI);globalThis.EVA.plugin.renderer.render.texture=globalThis.EVA.plugin.renderer.render.texture||_EVA_IIFE_texture;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-render-texture",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.4",
|
|
4
4
|
"description": "@eva/plugin-renderer-render-texture",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-render-texture.esm.js",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"homepage": "https://eva.js.org",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@eva/inspector-decorator": "^2.0.0-beta.0",
|
|
23
|
-
"@eva/eva.js": "2.1.0-beta.
|
|
24
|
-
"@eva/plugin-renderer": "2.1.0-beta.
|
|
23
|
+
"@eva/eva.js": "2.1.0-beta.4",
|
|
24
|
+
"@eva/plugin-renderer": "2.1.0-beta.4",
|
|
25
25
|
"pixi.js": "^8.6.3"
|
|
26
26
|
}
|
|
27
27
|
}
|