@miaoshangzuan/catsjs 0.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+
2
+ /**
3
+ * CatsJS
4
+ * beta_0.1.27
5
+ * 于2023年1月25日开始开发
6
+ * 于2023年4月9日发布第一个版本(下载地址已失效)
7
+ * @author MiaoShangZuan <3268208143@qq.com>
8
+ *
9
+ *
10
+ * /\_/\
11
+ * ( o.o )
12
+ * > ^ <
13
+ * / /\
14
+ * // 真 的 猫 //
15
+ * // 保 佑 代 码 //
16
+ * // 永 无 BUG //
17
+ */
18
+
19
+ const t=Math.abs,e=Math.sqrt;function s(t,e,s){if(t.line==e.line&&t.column==e.column){const i=[],n=t.line*t.column;let r;for(let o=0;o<n;o++)r=t.element[o]+s*e.element[o],i.push(r);return i}}function i(t,e){const s=[];let i;if("number"==typeof e)t.element.forEach(t=>{i=t*e,s.push(i)});else if(t.column==e.line)for(let n=0;n<t.line;n++)for(let r=0;r<e.column;r++){i=0;for(let s=0;s<t.column;s++)i+=t.element[n*t.column+s]*e.element[s*e.column+r];s.push(i)}return s}function n(t,e){let s=0;if(1==e)s=t[0];else if(2==e)s=t[0]*t[3]-t[1]*t[2];else if(3==e){const e=t[0],i=t[1],n=t[2],r=t[3],o=t[4],a=t[5],h=t[6],l=t[7],c=t[8];s=e*o*c-e*a*l+n*r*l-i*r*c+i*a*h-n*o*h}else if(4==e){const e=t[0],i=t[1],n=t[2],r=t[3],o=t[4],a=t[5],h=t[6],l=t[7],c=t[8],u=t[9],_=t[10],m=t[11];t[12];const p=t[13],f=t[14],d=t[15];s=e*a*_*d-e*a*m*f-e*h*u*d+e*l*u*f+e*h*m*p-e*l*_*p-i*o*_*d+i*o*m*f+n*o*u*d-r*o*u*f-n*o*m*p+r*o*_*p+i*h*c*d-i*l*c*f-n*a*c*d+r*a*c*f}else{let i;for(let n=0;n<e;n++)i=t[n]*r(t,e,0,n),s+=i}return s}function r(t,e,s,i){const r=[];let o;for(let n=0;n<e;n++)if(n!=s)for(let s=0;s<e;s++)s!=i&&(o=s+e*n,r.push(t[o]));return n(r,e-1)*function(t=0){return t%2==0?1:-1}(s+i)}function o(t){if(t.line==t.column&&t.line>1&&t.column>1){const e=[];let s;for(let i=0;i<t.line;i++)for(let n=0;n<t.column;n++)s=r(t.element,t.line,i,n),e.push(s);return e}}function a(t,e){let s,i=0;if(t.line==e.line&&1==t.column&&1==e.column)for(let n=0;n<t.element.length;n++)s=t.element[n]*e.element[n],i+=s;return i}function h(t){if(t.line>0&&1==t.column){let s=0;return t.element.forEach(t=>{s+=t*t}),e(s)}}function l(t,e=1){if(t.line>0&&1==t.column){const s=1/h(t),i=[];let n;return t.element.forEach(t=>{n=t*s*e,i.push(n)}),i}}class c{constructor(t=2,e=2,s=[1,0,0,1]){this.type="Matrix",this.line=t,this.column=e;const i=t*e;if(s.length==i)this.element=s;else{this.element=[];for(let t=0;t<i;t++)this.element.push(0)}}step(t=2,e=2){const s=t*e;if(this.line=t,this.column=e,this.element.length!=s){this.element=[];for(let t=0;t<s;t++)this.element.push(0)}}set(t=[1,0,0,1]){const e=this.line*this.column;t.length==e?this.element=t:console.error("参数错误!")}copy(t){if(this.line==t.line&&this.column==t.column){const e=[];t.element.forEach(t=>{e.push(t)}),this.element=e}}addition(t){this.line==t.line&&this.column==t.column?this.element=s(this,t,1):console.error("参数错误!")}subtract(t){this.line==t.line&&this.column==t.column?this.element=s(this,t,-1):console.error("参数错误!")}multiply(t){"number"==typeof t?this.element=i(this,t):this.column==t.line?(this.element=i(this,t),this.column=t.column):console.error("参数错误!")}premultiply(t){"number"==typeof t?this.element=i(this,t):t.column==this.line?(this.element=i(t,this),this.line=t.line):console.error("参数错误!")}det(){if(this.line==this.column&&this.line>1)return n(this.element,this.line);console.error("参数错误!")}cofactor(t=1,e=1){if(this.line==this.column&&this.line>1)return r(this.element,this.line,t-1,e-1);console.error("参数错误!")}adjoint(){if(this.line==this.column&&this.line>1)return new c(this.line,this.column,o(this));console.error("参数错误!")}inverse(){if(this.line==this.column&&this.line>1)return new c(this.line,this.column,function(e){if(e.line==e.column){let s=n(e.element,e.line);if(t(s)>1e-9){s=1/s;const t=[];let i;return o(e).forEach(e=>{i=e*s,t.push(i)}),t}console.error("此矩阵无逆矩阵")}}(this));console.error("参数错误!")}reduction(){this.line>1&&1==this.column?(this.element=function(t){if(t.line>1&&1==t.column){const e=[],s=t.line-1;let i;for(let n=0;n<s;n++)i=t.element[n]/t.element[s],e.push(i);return e}}(this),this.line-=1):console.error("参数错误!")}reverse(){const t=this.line,e=this.column;this.element=function(t){const e=[];let s;for(let i=0;i<t.column;i++)for(let n=0;n<t.line;n++)s=t.element[n*t.column+i],e.push(s);return e}(this),this.line=e,this.column=t}}class u extends c{constructor(t=[1,0,0,1]){super(2,2,t)}}class _ extends c{constructor(t=[1,0,0,0,1,0,0,0,1]){super(3,3,t)}}class m extends c{constructor(t=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]){super(4,4,t)}}class p{constructor(t=[0,0]){this.type="Vector",this.line=t.length,this.column=1,this.element=t}set(t=[0,0]){this.line=t.length,this.element=t}copy(t){if(this.line==t.line)for(let e=0;e<this.line;e++)this.element[e]=t.element[e];else console.error("参数错误!")}addition(t){this.line==t.line&&1==t.column?this.element=s(this,t,1):console.error("参数错误!")}subtract(t){this.line==t.line&&1==t.column?this.element=s(this,t,-1):console.error("参数错误!")}multiply(t){if("number"==typeof t)this.element=i(this,t);else{if(this.line==t.line&&1==t.column)return a(this,t);console.error("参数错误!")}}transform(t){"Matrix"==t.type&&t.column==this.line?this.element=i(t,this):console.error("参数错误!")}angle(t){if(this.line==t.line&&1==t.column)return function(t,e){if(t.line==e.line&&1==t.column&&1==e.column)return a(t,e)/(h(t)*h(e))}(this,t);console.error("参数错误!")}projection(t){if(this.line==t.line&&1==t.column)return function(t,e){if(t.line==e.line&&1==t.column&&1==e.column){const s=l(e,1);let i=0;for(let e=0;e<s.length;e++)i+=t.element[e]*s[e];return i}}(t,this);console.error("参数错误!")}norm(){return h(this)}scale(t=1){this.element=l(this,t)}unit(){const t=l(this,1);return new p(t)}reverse(){const t=this.line,e=this.column;this.line=e,this.column=t}}class f extends p{constructor(t=0,e=0){super([t,e])}get x(){return this.element[0]}set x(t=0){this.element[0]=t}get y(){return this.element[1]}set y(t=0){this.element[1]=t}set(t=0,e=0){this.element[0]=t,this.element[1]=e}unit(){const t=l(this,1);return new f(t[0],t[1])}}class d extends p{constructor(t=0,e=0,s=0){super([t,e,s])}get x(){return this.element[0]}set x(t=0){this.element[0]=t}get y(){return this.element[1]}set y(t=0){this.element[1]=t}get z(){return this.element[2]}set z(t=0){this.element[2]=t}set(t=0,e=0,s=0){this.element[0]=t,this.element[1]=e,this.element[2]=s}unit(){const t=l(this,1);return new d(t[0],t[1],t[2])}}class x extends p{constructor(t=0,e=0,s=0,i=0){super([t,e,s,i])}get x(){return this.element[0]}set x(t=0){this.element[0]=t}get y(){return this.element[1]}set y(t=0){this.element[1]=t}get z(){return this.element[2]}set z(t=0){this.element[2]=t}get w(){return this.element[3]}set w(t=0){this.element[3]=t}set(t=0,e=0,s=0,i=0){this.element[0]=t,this.element[1]=e,this.element[2]=s,this.element[3]=i}unit(){const t=l(this,1);return new x(t[0],t[1],t[2],t[3])}}class g{constructor(){this.width=300,this.height=300,this.naturalWidth=300,this.naturalHeight=300,this.domElement=document.createElement("canvas"),this.domElement.width=300,this.domElement.height=300,this.domElement.style.width="300px",this.domElement.style.height="300px",this.gl=this.domElement.getContext("webgl2"),this.TEXTURE_UNIT_BUFFER=[],this.PROGRAMS=[]}setSize(t=300,e=300){this.width=t,this.height=e,this.naturalWidth=t,this.naturalHeight=e,this.domElement.width=t,this.domElement.height=e,this.domElement.style.width=`${t}px`,this.domElement.style.height=`${e}px`,this.gl.viewport(0,0,t,e)}setPixelRatio(t){const e=this.width*t,s=this.height*t;this.naturalWidth=e,this.naturalHeight=s,this.domElement.width=e,this.domElement.height=s,this.gl.viewport(0,0,e,s)}createShader(t,e){const s=this.gl,i=s.createShader(t);return s.shaderSource(i,e),s.compileShader(i),i}createProgram(t,e){const s=this.gl,i=this.createShader(s.VERTEX_SHADER,t),n=this.createShader(s.FRAGMENT_SHADER,e),r=s.createProgram();return s.attachShader(r,i),s.attachShader(r,n),s.linkProgram(r),s.deleteShader(i),s.deleteShader(n),r}deleteBuffer(t){this.gl.deleteBuffer(t)}inBlankTextureUnit(t,e,s=0,i,n,r){const o=this.gl,a=o.createTexture();i||(i=o.RGBA8),n||(n=o.RGBA),r||(r=o.UNSIGNED_BYTE),o.activeTexture(o.TEXTURE0+s),o.bindTexture(o.TEXTURE_2D,a),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!0),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,i,t,e,0,n,r,null),this.TEXTURE_UNIT_BUFFER[s]=a}inTextureUnit(t,e=0){const s=this.gl,i=s.createTexture();s.activeTexture(s.TEXTURE0+e),s.bindTexture(s.TEXTURE_2D,i),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,!0),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,t),this.TEXTURE_UNIT_BUFFER[e]=i}getTextureUnit(t=0){return this.TEXTURE_UNIT_BUFFER[t]}deleteTextureUnit(t=0){this.gl.deleteTexture(this.TEXTURE_UNIT_BUFFER[t])}getUniformLocation(t,e){return this.PROGRAMS[t.sequence].uniformLocation[e]}addPass(t){let e;t.program?(e=t.program,e.sequence=this.PROGRAMS.length):t.vertexSource&&t.fragmentSource&&(e=this.createProgram(t.vertexSource,t.fragmentSource),e.sequence=this.PROGRAMS.length);const s={program:e,uniformLocation:{},drawFunc:t.drawFunc,drawStartFunc:t.drawStartFunc,drawEndFunc:t.drawEndFunc};if(e&&t.uniformarr)for(let i of t.uniformarr)s.uniformLocation[i]=this.gl.getUniformLocation(e,i);this.PROGRAMS.push(s)}renderPicture(){for(let t of this.PROGRAMS)t.drawFunc(this.gl,t.program,t.drawStartFunc,t.drawEndFunc)}outputAsync(){return new Promise(t=>{const e=new Image;e.src=this.domElement.toDataURL("image/png"),e.onload=()=>{t(e)}})}}const{trunc:y,pow:E}=Math;class v{constructor(){this._texture_pixel_unit_=450,this._texture_size_max_=9,this._texture_canvas_=document.createElement("canvas"),this._texture_canvas_.width=this._texture_canvas_.height=this._texture_pixel_unit_,this._texture_ctx_=this._texture_canvas_.getContext("2d")}setTexturePixelUnit(t){this._texture_pixel_unit_=t}getMaps(t){const e=[];let s;for(let i of t)s=i.getSizeValue(this._texture_pixel_unit_),s<=this._texture_size_max_&&(e[s-1]?-1==e[s-1].indexOf(i)&&e[s-1].push(i):e[s-1]=[i]);for(let t=0;t<e.length;t++)e[t]||(e[t]=[]);return e}processingMaps(t,e=0,s=0){if(s+1<this._texture_size_max_){const i=t[e],n=y(.25*i[s].length);if(n>0){let t;for(let e=0;e<n;e++){t={pixel_unit:s+2,element:[]};for(let e=0;e<4;e++)t.element.push(i[s][0]),i[s].splice(0,1);i[s+1]?i[s+1].push(t):i[s+1]=[t]}}i[++s]&&this.processingMaps(t,e,s)}else{const i=t[e],n=i[s].length;let r=4;for(let t=0;t<=s;t++)if(i[t].length>0){r=3;break}if(n>r){const o=[];for(let t=0;t<=s;t++)o.push([]);for(let t=r;t<n;t++)o[s].push(i[s][t]);i[s].splice(r,n-r),t.push(o),e++,this.processingMaps(t,e,s)}}}setSpriteSize(t){const e=t.length,s=t[e-1].length,i=E(2,e-1);let n=this._texture_pixel_unit_,r=this._texture_pixel_unit_,o=!1,a=0;for(;a<e-1;)t[a].length>0&&(o=!0,a=e),a++;o?s<3?(n*=(s+1)*i,r*=i):(n*=2*i,r*=2*i):s<4?(n*=s*i,r*=i):(n*=2*i,r*=2*i),this._texture_canvas_.width=n,this._texture_canvas_.height=r,this._texture_ctx_.imageSmoothingEnabled=!1}drawMap(t,e,s,i){if(e.pixel_unit){const n=E(2,e.pixel_unit-2)*this._texture_pixel_unit_;let r,o;for(let a=0;a<4;a++)r=s+a%2*n,o=i+y(a/2)*n,this.drawMap(t,e.element[a],r,o)}else{const n=this._texture_canvas_.width,r=this._texture_canvas_.height,o=this._texture_pixel_unit_*E(2,e.getSizeValue(this._texture_pixel_unit_)-1),a=o/n,h=o/r,l=s/n,c=(r-i)/r;this._texture_ctx_.beginPath(),this._texture_ctx_.drawImage(e.image,s,i,o,o),this._texture_ctx_.closePath(),e.activate=!0,e.mapUnit=t+2,e.uvmat.set([a,0,l,0,h,c-h,0,0,1])}}drawingMaps(t,e,s,i,n){if(s>0){const r=e[s-1].length,o=E(2,s-1)*this._texture_pixel_unit_;if(r>0){let a,h;for(let l=0;l<r;l++)a=i+l%2*o,h=n+y(l/2)*o,this.drawMap(t,e[s-1][l],a,h);i+=r%2*o,n+=y(r/2)*o}this.drawingMaps(t,e,s-1,i,n)}}render(t,e){this.setSpriteSize(e),this._texture_ctx_.clearRect(0,0,this._texture_canvas_.width,this._texture_canvas_.height);const s=e.length,i=e[s-1].length,n=E(2,s-1)*this._texture_pixel_unit_;let r,o;if(this._texture_canvas_.width==this._texture_canvas_.height)for(let a=0;a<i;a++)r=a%2*n,o=y(a/2)*n,this.drawMap(t,e[s-1][a],r,o);else for(let a=0;a<i;a++)r=a*n,o=0,this.drawMap(t,e[s-1][a],r,o);return r+=n,this.drawingMaps(t,e,s-1,r,o),new Promise(t=>{const e=new Image;e.src=this._texture_canvas_.toDataURL("image/png"),e.onload=()=>{t(e)}})}createSprite(t){const e=[this.getMaps(t)];this.processingMaps(e);const s=[];for(let t=0;t<e.length;t++)s.push(this.render(t,e[t]));return new Promise(t=>{(async function(t){const e=[];for await(let s of t)e.push(s);return e})(s).then(e=>t(e))})}}function T(t,e,s=1){const i=new Array,n=new Object,r=new Array;let o,a=0;return t.forEach(t=>{a=function(t,e){const s=JSON.parse('["'+e.replace(/\./g,'","')+'"]');let i=t;for(let t=0;t<s.length;t++)i=i[s[t]];return i}(t,e),i.push(a),null==n["key_"+a]?n["key_"+a]=[t]:n["key_"+a].push(t)}),i.sort((t,e)=>s*(t-e)).forEach(t=>{t!=o&&(n["key_"+t].forEach(t=>{r.push(t)}),o=t)}),r}class A extends g{constructor(){super(),this.type="Renderer",this.SpriteGenerator=new v,this._sprite_state_=!1,this._multi_pass_state_=!1,this.MAIN_VERTEX_SHADER_SOURCE="\nvoid main() {\n gl_Position = vertTransform();\n}\n",this.MAIN_FRAGMENT_SHADER_SOURCE="\nvoid main() {\n o_texture = fragOutput();\n o_depthtex = gl_FragCoord.z;\n}\n",this.POST_FX_SOURCE="\nvoid PostFX(out vec4 fragColor, in vec2 fragCoord) {\n // 芝士后处理函数\n // 在这里写后处理代码\n}\n",this.MAIN_PASS_DRAW_START=void 0,this.MAIN_PASS_DRAW_END=void 0,this.FINAL_PASS_DRAW_START=void 0,this.FINAL_PASS_DRAW_END=void 0,this.FRAMEBUFFER0=void 0}setMainDrawStart(t){this.MAIN_PASS_DRAW_START=t}setMainDrawEnd(t){this.MAIN_PASS_DRAW_END=t}setFinalDrawStart(t){this.FINAL_PASS_DRAW_START=t}setFinalDrawEnd(t){this.FINAL_PASS_DRAW_END=t}setVertSource(t){this.MAIN_VERTEX_SHADER_SOURCE=t}setFragSource(t){this.MAIN_FRAGMENT_SHADER_SOURCE=t}setPostFXSource(t){this.POST_FX_SOURCE=t}initMultiPass(){if(!this._multi_pass_state_){this.addPass({vertexSource:`#version 300 es\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec4 a_color;\nlayout(location = 2) in vec3 a_uv;\n\nuniform mat4 u_mvsmat;\nuniform int u_id;\n\nout vec4 v_color;\nout vec3 v_uv;\n\nvec4 vertTransform() {\n v_color = a_color;\n v_uv = a_uv;\n return u_mvsmat * vec4( a_position, 1.0 );\n}\n\n${this.MAIN_VERTEX_SHADER_SOURCE}`,fragmentSource:`#version 300 es\nprecision highp float;\nprecision highp int;\n\nlayout(location = 0) out vec4 o_texture;\nlayout(location = 1) out float o_depthtex;\n\nuniform sampler2D u_imagetex;\nuniform vec2 u_resolution;\nuniform mat3 u_uvmat;\nuniform int u_id;\n\nin vec4 v_color;\nin vec3 v_uv;\n\nvec4 fragOutput() {\n vec4 color = v_color;\n if( v_uv.p > 0.0 ) {\n vec3 uv = u_uvmat * v_uv;\n vec4 pixel = texture( u_imagetex, uv.st );\n color.rgb = pixel.rgb;\n color.a *= pixel.a;\n }\n return color;\n}\n\n${this.MAIN_FRAGMENT_SHADER_SOURCE}`,drawFunc:(t,e,s,i,n)=>{t.useProgram(e),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA),t.uniform1i(t.getUniformLocation(e,"u_imagetex"),2),t.uniform2f(t.getUniformLocation(e,"u_resolution"),this.naturalWidth,this.naturalHeight);const r=new m([n.unitX/this.width*2,0,0,0,0,n.unitY/this.height*2,0,0,0,0,1,0,0,0,0,1]);r.multiply(n.matrix()),this.MAIN_PASS_DRAW_START?.(t,e);const o=T(i.element,"position.z");this.updateMaps(o,(n,a)=>{if(n)for(let t=0;t<a.length;t++)this.TEXTURE_UNIT_BUFFER[t+2]&&this.deleteTextureUnit(t+2),this.inTextureUnit(a[t],t+2),i.setSpriteTexture(a[t]);t.bindFramebuffer(t.FRAMEBUFFER,this.FRAMEBUFFER0),t.clearBufferfv(t.COLOR,0,[0,0,0,0]),t.clearBufferfv(t.COLOR,1,[0,0,0,0]),o.forEach(s=>s.draw(t,e,r)),t.bindFramebuffer(t.FRAMEBUFFER,null),s?.(t,e,i)})},drawEndFunc:(t,e,s)=>{this.MAIN_PASS_DRAW_END?.(t,e);const i=this.PROGRAMS[1];i.drawFunc(t,i.program,s)}}),this.addPass({vertexSource:"#version 300 es\nvoid main() {\n float x = mod(floor(float(gl_VertexID+1) / 3.0), 2.0) * 2.0 - 1.0;\n float y = mod(floor(float(gl_VertexID+5) / 3.0), 2.0) * 2.0 - 1.0;\n gl_Position = vec4(x, y, 0.999999, 1.0);\n}",fragmentSource:`#version 300 es\nprecision highp float;\nprecision highp int;\n\nout vec4 fragColor;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_depthtex;\nuniform vec2 u_resolution;\nuniform vec4 u_background;\n\n/*\n * bcol 背景色\n * fcol 前景色\n */\nvec4 blendColor(vec4 bcol, vec4 fcol) {\n\tfloat a = bcol.a * (1. - fcol.a), alpha = fcol.a + a;\n\treturn vec4(\n \t(bcol.r * a + fcol.r * fcol.a) / alpha,\n (bcol.g * a + fcol.g * fcol.a) / alpha,\n (bcol.b * a + fcol.b * fcol.a) / alpha,\n alpha\n );\n}\n\n${this.POST_FX_SOURCE}\n\nvoid main() {\n vec4 color = u_background;\n vec2 uv = gl_FragCoord.xy / u_resolution;\n vec4 map = texture(u_texture, uv);\n map.rgb /= map.a;\n\n if(map.a > 1e-4) color = blendColor(color, map);\n \n fragColor = color;\n PostFX(fragColor, gl_FragCoord.xy);\n}`,drawFunc:(t,e,s)=>{t.useProgram(e),t.blendFunc(t.ONE,t.ZERO),t.uniform1i(t.getUniformLocation(e,"u_texture"),0),t.uniform1i(t.getUniformLocation(e,"u_depthtex"),1),t.uniform2f(t.getUniformLocation(e,"u_resolution"),this.naturalWidth,this.naturalHeight),t.uniform4f(t.getUniformLocation(e,"u_background"),s.color.r,s.color.g,s.color.b,s.color.a),this.FINAL_PASS_DRAW_START?.(t,e),t.drawArrays(t.TRIANGLES,0,6),this.FINAL_PASS_DRAW_END?.(t,e)}});const t=this.gl;t.enable(t.DEPTH_TEST),t.depthFunc(t.LEQUAL),t.enable(t.BLEND),t.depthMask(!1),this.inBlankTextureUnit(this.naturalWidth,this.naturalHeight,0),this.inBlankTextureUnit(this.naturalWidth,this.naturalHeight,1,t.R8,t.RED);const e=this.getTextureUnit(0),s=this.getTextureUnit(1),i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT1,t.TEXTURE_2D,s,0),t.drawBuffers([t.COLOR_ATTACHMENT0,t.color_attachment1]),t.bindFramebuffer(t.FRAMEBUFFER,null),this.FRAMEBUFFER0=i,this._multi_pass_state_=!0}}updateMaps(t,e){if(this._sprite_state_)e(!1);else{this._sprite_state_=!0;let s=!1;const i=[];for(let e of t)e.preprocess(t=>{if("Group"!=t.type||t.typeAddModelEvent||t.setAddModelEvent(()=>{this._sprite_state_=!1}),t.material&&t.material.maps)for(let e of t.material.maps)-1==i.indexOf(e)&&i.push(e)});for(let t of i)if(!t.activate){s=!0,this.SpriteGenerator.createSprite(i).then(t=>e(!0,t));break}s||e(!1)}}render(t,e){this._multi_pass_state_||(this.initMultiPass(),t.setAddModelEvent(()=>{this._sprite_state_=!1}),console.log("webgl渲染上下文已启用"));const s=this.gl;s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT);const i=this.PROGRAMS[0];i.drawFunc(s,i.program,i.drawEndFunc,t,e);const n=s.getError();0!=n&&console.error(n)}}function R(t="#000000"){let e,s,i,n;if("number"==typeof t)e=255,s=t>>16&255,i=t>>8&255,n=255&t;else{const r=t.replace(/^#/,"");6===r.length?(e="FF",s=r.slice(0,2),i=r.slice(2,4),n=r.slice(4,6)):8===r.length?(e=r.slice(0,2),s=r.slice(2,4),i=r.slice(4,6),n=r.slice(6,8)):(e="FF",s=i=n="00"),e=parseInt(e,16),s=parseInt(s,16),i=parseInt(i,16),n=parseInt(n,16)}return{r:s/255,g:i/255,b:n/255,a:e/255,value:t}}class w{constructor(t="#000000"){this.type="Scene",this.color=R(t),this.element=[],this.ADD_MODEL_FUNC=void 0,this.SPRITE_TEXTURE_ARRAY=[],this.typeAddModelEvent=!1,this.SPRITE_TEXTURE_LOAD_FUNC=void 0}setColor(t="#000000"){this.color=R(t)}setAddModelEvent(t){this.ADD_MODEL_FUNC=t,this.typeAddModelEvent=!0}setSpriteTexture(t){this.SPRITE_TEXTURE_ARRAY.push(t),this.SPRITE_TEXTURE_LOAD_FUNC?.(t)}getSpriteTexture(t){this.SPRITE_TEXTURE_LOAD_FUNC=t}add(t){-1==this.element.indexOf(t)&&(this.element.push(t),this.ADD_MODEL_FUNC?.())}remove(t){const e=this.element.indexOf(t);-1!=e&&this.element.splice(e,1)}}const{sin:b,cos:M}=Math;class S{constructor(t=.1,e=20){this.type="Camera",this.rotate=0,this.position=new d(0,0,10),this.near=t,this.far=e,this.unitX=70,this.unitY=70,this.model=void 0}matrix(){const t=1/(this.near-this.far),e=b(this.rotate),s=M(this.rotate);let i=1;return this.position.z>0&&(i=10/this.position.z),this.model&&(this.position.x=this.model.position.x,this.position.y=this.model.position.y),new m([i*s,-i*e,0,-this.position.x*i,i*e,i*s,0,-this.position.y*i,0,0,2*t,(this.near+this.far-2*this.position.z)*t,0,0,0,1])}}const F=Math.sin,$=Math.cos,U=Math.trunc,C=1/3;let P=1;class D{constructor(t,e){this.type="Mesh",this.geometry=t,this.material=e,this.scale=new d(1,1,1),this.rotation=new d,this.position=new d,this.id=P,P++}getFaceTexture(t=0){let e;if(this.material&&this.material.maps){const s=this.geometry.uvs[9*t+2];e=this.material.maps[s]}return e}matrix(){const t=F(this.rotation.z),e=$(this.rotation.z),s=$(this.rotation.x),i=$(this.rotation.y);return new m([i*e*this.scale.x*this.scale.z,s*t*this.scale.y*this.scale.z,0,this.position.x,-i*t*this.scale.x*this.scale.z,s*e*this.scale.y*this.scale.z,0,this.position.y,0,0,1,this.position.z,0,0,0,1])}vertices(){const t=[],e=this.geometry.vertices.length;let s,i=0,n=0;3==this.geometry.connect&&this.material.maps&&this.material.maps.length>0&&(i=1);for(let r=0;r<e;r+=3)s=this.material.getColor(n,this.geometry.connect),t.push(this.geometry.vertices[r],this.geometry.vertices[r+1],this.geometry.vertices[r+2],s.r,s.g,s.b,s.a,this.geometry.uvs[r],this.geometry.uvs[r+1],i),n++;return new Float32Array(t)}draw(t,e,s){const i=this.vertices(),n=i.BYTES_PER_ELEMENT,r=t.createVertexArray();t.bindVertexArray(r);const o=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,i,t.STATIC_DRAW);t.vertexAttribPointer(0,3,t.FLOAT,!1,10*n,0),t.enableVertexAttribArray(0);t.vertexAttribPointer(1,4,t.FLOAT,!1,10*n,3*n),t.enableVertexAttribArray(1);t.vertexAttribPointer(2,3,t.FLOAT,!1,10*n,7*n),t.enableVertexAttribArray(2);const a=i.length/10,h=this.matrix();if(h.premultiply(s),h.reverse(),t.uniformMatrix4fv(t.getUniformLocation(e,"u_mvsmat"),!1,h.element),t.uniform1i(t.getUniformLocation(e,"u_id"),this.id),3==this.geometry.connect){let s;for(let i=0;i<a;i+=3)s=this.getFaceTexture(U(i*C)),this.material&&this.material.maps&&this.material.maps.length>0&&(t.uniform1i(t.getUniformLocation(e,"u_imagetex"),s.mapUnit),t.uniformMatrix3fv(t.getUniformLocation(e,"u_uvmat"),!1,[s.uvmat.element[0],s.uvmat.element[3],s.uvmat.element[6],s.uvmat.element[1],s.uvmat.element[4],s.uvmat.element[7],s.uvmat.element[2],s.uvmat.element[5],s.uvmat.element[8]])),t.drawArrays(t.TRIANGLES,i,3)}else 2==this.geometry.connect&&t.drawArrays(t.LINES,0,a);t.bindVertexArray(null),t.bindBuffer(t.ARRAY_BUFFER,null),t.deleteVertexArray(r),t.deleteBuffer(o)}preprocess(t){t(this)}}class L{constructor(t,e,s=3){let i=[],n=[];5==arguments.length&&(i=arguments[2],n=arguments[3],s=arguments[4]),this.type="Geometry",this.connect=s,this.vertices=t,this.uvs=e,this.skinIndices=i,this.skinWeights=n}}const O=Math.round,N=Math.trunc,I=Math.sqrt,k=Math.log,B=Math.max,X=1/k(4);class z{constructor(t){this.image=t,this.ratio=t.height/t.width,this.activate=!1,this.mapUnit=0,this.uvmat=new _,this._kh=I(t.width/t.height),this._kw=1/this._kh}uvRatio(t=0,e=0,s=1,i=1){return this.ratio*(i-e)/(s-t)}getSizeValue(t){const e=this.image.width*this.image.height/(t*t),s=k(e)*X+1;return O(B(s,1))}}class G{constructor(t={opacity:1,color:"#7b68ee",maps:void 0}){null==t.opacity&&(t.opacity=1),null==t.color&&(t.color="#7b68ee"),this.type="Material",this.opacity=t.opacity,this.color=R(t.color),this.maps=t.maps}getColor(){return{r:this.color.r,g:this.color.g,b:this.color.b,a:this.color.a*this.opacity,value:this.color.value}}}class H{constructor(t=1,e=["#7b68ee","#7b68ee","#7b68ee"]){this.type="Material",this.opacity=t,this.color=[],e.forEach(t=>{this.color.push(R(t))})}getColor(t=0,e=3){t%=e;const s=this.color[t];return{r:s.r,g:s.g,b:s.b,a:s.a*this.opacity,value:s.value}}}class W{constructor(t=1,e=[]){this.type="Material",this.opacity=t,this.content=e}add(t){-1==this.content.indexOf(t)&&this.content.push(t)}remove(t){const e=this.content.indexOf(t);-1!=e&&this.content.splice(e,1)}getColor(t=0,e=3){const s=N(t/e)%this.content.length;t%=e;const i=this.content[s].getColor(t,e);return{r:i.r,g:i.g,b:i.b,a:i.a*this.opacity,value:i.value}}}const V=Math.sin,Y=Math.cos;class q{constructor(){this.type="Bone",this.element=[],this.position=new f,this.bind=void 0,this._frotate_=0,this._rotate_=0}set rotate(t){this._rotate_=t,this.element.forEach(t=>{t._frotate_=this._frotate_+this._rotate_,t.update()})}get rotate(){return this._rotate_}update(){this.element.forEach(t=>{t._frotate_=this._frotate_+this._rotate_,t.update()})}add(t){-1==this.element.indexOf(t)&&(this.element.push(t),t.bind=this,t._frotate_=this._frotate_+this._rotate_,t.update())}remove(t){const e=this.element.indexOf(t);-1!=e&&(this.element.splice(e,1),t.bind=void 0,t._frotate_=0,t.update())}trotate(){return this._frotate_+this._rotate_}tcoord(){const t={x:this.position.x,y:this.position.y};if(null!=this.bind){const e=this.bind.tcoord(),s=V(this._frotate_),i=Y(this._frotate_),n=t.x,r=t.y;t.x=n*i+r*s+e.x,t.y=r*i-n*s+e.y}return t}coord(){let t=this.position.x,e=this.position.y;if(null!=this.bind){const s=this.bind.coord();t+=s.x,e+=s.y}return{x:t,y:e}}matrix(t=1){const e=this._frotate_+t*this._rotate_,s=this.coord(),i=this.tcoord(),n=V(e),r=Y(e);return new m([r,n,0,i.x-s.x*r-s.y*n,-n,r,0,i.y+s.x*n-s.y*r,0,0,1,0,0,0,0,1])}}class j{constructor(t,e){this.type="Skeleton",this.mainBone=e,this.bones=t,this.vector=new x}vertices(t){const e=[],s=t.vertices.length/3;let i,n,r,o;for(let a=0;a<s;a++){this.vector.set(t.vertices[3*a],t.vertices[3*a+1],t.vertices[3*a+2],1),n=this.bones[t.skinIndices[a][0]],r=t.skinWeights[a][0],o=n.matrix(r),i=t.skinIndices[a].length;for(let e=1;e<i;e++)n=this.bones[t.skinIndices[a][e]],r=t.skinWeights[a][e],o.multiply(n.matrix(r));this.vector.transform(o),e.push(this.vector.x,this.vector.y,this.vector.z)}return e}}class J extends D{constructor(t,e){super(t,e),this.skeleton=void 0}bind(t){this.skeleton=t}vertices(){const t=[],e=this.skeleton.vertices(this.geometry),s=e.length;let i,n=0,r=0;3==this.geometry.connect&&null!=this.material.maps&&(n=1);for(let o=0;o<s;o+=3)i=this.material.getColor(r,this.geometry.connect),t.push(e[o],e[o+1],e[o+2],i.r,i.g,i.b,i.a,this.geometry.uvs[o],this.geometry.uvs[o+1],n),r++;return new Float32Array(t)}}function K(t,e,s=[]){if(null!=t)for(let i in e)if(null!=t[i])if("object"==typeof e[i]&&null==s||"object"==typeof e[i]&&-1==s.indexOf(i))if(Array.isArray(e[i]))for(let s=0;s<e[i].length;s++)null!=t[i][s]&&(e[i][s]=t[i][s]);else for(let s in e[i])null!=t[i][s]&&(e[i][s]=t[i][s]);else e[i]=t[i]}function Q(t,e,s,i){return t*i-s*e}function Z(t,e,s,i,n,r,o,a){let h=!1;const l={x:n-s,y:r-i},c={x:o-n,y:a-r},u={x:s-o,y:i-a},_={x:t-s,y:e-i},m={x:t-n,y:e-r},p={x:t-o,y:e-a},f=Q(l.x,l.y,_.x,_.y),d=Q(c.x,c.y,m.x,m.y),x=Q(u.x,u.y,p.x,p.y);return(f>0&&d>0&&x>0||!f&&d*x!=0||!d&&f*x!=0||!x&&f*d!=0||!f&&!d||!d&&!x||!x&&!f)&&(h=!0),h}function tt(t,e,s){const i=t.length;if(e>=i&&(e%=i),e+s<=i)t.splice(e,s);else{const n=i-e;t.splice(e,n),t.splice(0,s-n)}}const et=Math.PI,st=Math.sin,it=Math.cos,nt=Math.round;class rt extends D{constructor(){super(),this.type="Group",this.element=[],this.ADD_MODEL_FUNC=void 0,this.typeAddModelEvent=!1}setAddModelEvent(t){this.ADD_MODEL_FUNC=t,this.typeAddModelEvent=!0}add(t){-1==this.element.indexOf(t)&&(this.element.push(t),this.ADD_MODEL_FUNC?.())}remove(t){const e=this.element.indexOf(t);-1!=e&&this.element.splice(e,1)}draw(t,e,s,i){null==i&&(i=new m);const n=this.matrix();n.multiply(i);const r=new m;r.copy(s),r.multiply(n),this.element.forEach(i=>{"Mesh"==i.type?i.draw(t,e,r):"Group"==i.type&&i.draw(t,e,s,n)})}preprocess(t){t(this),this.element.forEach(e=>{e.preprocess(t)})}}class ot extends L{constructor(t=1,e=1){const s=.5*t,i=.5*e;super([-s,i,0,-s,-i,0,s,-i,0,-s,i,0,s,-i,0,s,i,0],[0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,1,1,0],3)}}class at extends L{constructor(t=.5,e=64){const s=[],i=[],n=2*et/e;let r,o,a,h;for(let l=0;l<e;l++)r=st(l*n),o=it(l*n),a=st((l+1)*n),h=it((l+1)*n),s.push(0,0,0,t*r,t*o,0,t*a,t*h,0),i.push(.5,.5,0,.5*(r+1),.5*(o+1),0,.5*(a+1),.5*(h+1),0);super(s,i,3)}}class ht extends L{constructor(t,e){super([...t.vertices,...e.vertices],new Array(t.vertices.length+e.vertices.length).fill(0),t.connect)}}class lt extends D{constructor(t,e="#ffffff"){"Mesh"==t.type&&3==t.geometry.connect&&(t=t.geometry);const s=[],i=[],n=t.vertices.length;for(let e=0;e<n;e+=9)s.push(t.vertices[e],t.vertices[e+1],t.vertices[e+2],t.vertices[e+3],t.vertices[e+4],t.vertices[e+5],t.vertices[e+3],t.vertices[e+4],t.vertices[e+5],t.vertices[e+6],t.vertices[e+7],t.vertices[e+8],t.vertices[e+6],t.vertices[e+7],t.vertices[e+8],t.vertices[e],t.vertices[e+1],t.vertices[e+2]),i.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1);super(new L(s,i,2),new G({color:e}))}}class ct extends D{constructor(t=10,e=10,s="#ffffff"){const i=.5*(t=nt(t)),n=.5*(e=nt(e)),r=[],o=new Array(6*(t+e+2)).fill(-1);for(let t=-n;t<=n;t++)r.push(-i,t,0,i,t,0);for(let t=-i;t<=i;t++)r.push(t,n,0,t,-n,0);super(new L(r,o,2),new G({color:s}))}}class ut extends D{constructor(t){const e={points:[new f(-2,0),new f(2,0),new f(-2,2),new f(2,2)],sub:40,color:"#7b68ee",opacity:1};K(t,e,["points"]);super(new L([],[],2),new G({opacity:e.opacity,color:e.color})),this.points=e.points,this.sub=e.sub}vertices(){const t=[],e=this.points.length;if(2==e){const e=this.material.getColor(0,2),s=this.material.getColor(1,2);t.push(this.points[0].x,this.points[0].y,0,e.r,e.g,e.b,e.a,0,0,-1,this.points[1].x,this.points[1].y,0,s.r,s.g,s.b,s.a,0,0,-1)}else if(3==e){const e={x:this.points[2].x-this.points[0].x,y:this.points[2].y-this.points[0].y},s={x:this.points[1].x-this.points[2].x,y:this.points[1].y-this.points[2].y},i={x:0,y:0},n={x:0,y:0},r={x:0,y:0};let o,a,h;for(let l=0;l<this.sub;l++)for(let c=0;c<2;c++)a=l+c,o=a/this.sub,h=this.material.getColor(a,2),i.x=this.points[0].x+e.x*o,i.y=this.points[0].y+e.y*o,n.x=this.points[2].x+s.x*o,n.y=this.points[2].y+s.y*o,r.x=i.x+(n.x-i.x)*o,r.y=i.y+(n.y-i.y)*o,t.push(r.x,r.y,0,h.r,h.g,h.b,h.a,0,0,-1)}else if(4==e){const e={x:this.points[2].x-this.points[0].x,y:this.points[2].y-this.points[0].y},s={x:this.points[3].x-this.points[2].x,y:this.points[3].y-this.points[2].y},i={x:this.points[1].x-this.points[3].x,y:this.points[1].y-this.points[3].y},n={x:0,y:0},r={x:0,y:0},o={x:0,y:0},a={x:0,y:0},h={x:0,y:0},l={x:0,y:0},c={x:0,y:0},u={x:0,y:0};let _,m,p;for(let f=0;f<this.sub;f++)for(let d=0;d<2;d++)m=f+d,_=m/this.sub,p=this.material.getColor(m,2),n.x=this.points[0].x+e.x*_,n.y=this.points[0].y+e.y*_,r.x=this.points[2].x+s.x*_,r.y=this.points[2].y+s.y*_,o.x=this.points[3].x+i.x*_,o.y=this.points[3].y+i.y*_,a.x=r.x-n.x,a.y=r.y-n.y,h.x=o.x-r.x,h.y=o.y-r.y,l.x=n.x+a.x*_,l.y=n.y+a.y*_,c.x=r.x+h.x*_,c.y=r.y+h.y*_,u.x=l.x+(c.x-l.x)*_,u.y=l.y+(c.y-l.y)*_,t.push(u.x,u.y,0,p.r,p.g,p.b,p.a,0,0,-1)}return new Float32Array(t)}getPoints(){const t=[];return this.points.forEach(e=>t.push(e.x,e.y)),t}}class _t extends D{constructor(t=1,e=1,s="#7b68ee"){const i=.5*t,n=.5*e,r=[-i,n,0,-i,-n,0,-i,-n,0,i,-n,0,i,-n,0,i,n,0,i,n,0,-i,n,0],o=new Array(18).fill(-1);super(new L(r,o,2),new G({color:s}))}}class mt extends D{constructor(t=.5,e="#7b68ee",s=64){const i=[],n=[],r=2*et/s;let o,a,h,l;for(let e=0;e<s;e++)o=st(e*r),a=it(e*r),h=st((e+1)*r),l=it((e+1)*r),i.push(t*o,t*a,0,t*h,t*l,0),n.push(0,0,-1,0,0,-1);super(new L(i,n,2),new G({color:e}))}}class pt extends D{constructor(t,e="#1e3a8a",s="#00ced1"){"Mesh"==t.type&&(t=t.skeleton);super(new L([],[],2),new H(1,[e,s])),this.skeleton=t}loadVertices(t,e,s){let i;t.element.forEach(t=>{i=t.tcoord(),s.push(e.x,e.y,0,i.x,i.y,0),this.loadVertices(t,i,s)})}vertices(){const t=[];this.loadVertices(this.skeleton.mainBone,this.skeleton.mainBone.tcoord(),t);const e=[],s=t.length;let i,n=0;for(let r=0;r<s;r+=3)i=this.material.getColor(n,this.geometry.connect),e.push(t[r],t[r+1],t[r+2],i.r,i.g,i.b,i.a,0,0,-1),n++;return new Float32Array(e)}}const ft=Math.PI,dt=Math.sin,xt=Math.cos,gt=Math.sqrt;function yt(t){const e=[],s=t.vertices(),i=s.length;for(let t=0;t<i;t+=10)e.push(s[t],s[t+1],s[t+2]);return e}function Et(t,e=0){const s=t.x,i=t.y,n=dt(e),r=xt(e);return{x:s*r-i*n,y:i*r+s*n}}function vt(t){return gt(t.x*t.x+t.y*t.y)}function Tt(t,e){const s=.5*t.length;return e>=s&&(e%=s),{x:t[2*e],y:t[2*e+1],index:e}}function At(t){const e=[];for(let s=0;s<t.length;s++)e.push(...t[s]);return e}function Rt(t){const e=dt(t),s=1/17;return{x:16*e*e*e*s,y:(13*xt(t)-5*xt(2*t)-2*xt(3*t)-xt(4*t))*s}}class wt extends D{constructor(t,e="#7b68ee"){let s;if("Group"==t.type){const e=[];let i,n;for(let s=0;s<t.element.length;s++)i=t.element[s],2==i.geometry.connect&&(n=i.geometry.vertices,0==n.length&&(n=yt(i)),e.push(n));s=At(e)}else 2==t.geometry.connect&&(s=t.geometry.vertices,0==s.length&&(s=yt(t)));const i=new Array(s.length).fill(-1);super(new L(s,i,2),new G({color:e}))}}class bt extends D{constructor(t,e=.4,s="#7b68ee",i=8){let n;if("Group"==t.type){const e=[];let s,i;for(let n=0;n<t.element.length;n++)s=t.element[n],2==s.geometry.connect&&(i=s.geometry.vertices,0==i.length&&(i=yt(s)),e.push(i));n=At(e)}else 2==t.geometry.connect&&(n=t.geometry.vertices,0==n.length&&(n=yt(t)));const r=[],o=[],a={x:0,y:0},h={x:0,y:0},l={x:0,y:0};let c,u,_,m,p,f,d,x;for(let t=0;t<n.length;t+=6){a.x=n[t],a.y=n[t+1],h.x=n[t+3],h.y=n[t+4],l.x=h.x-a.x,l.y=h.y-a.y,c=gt(l.x*l.x+l.y*l.y),c>0&&(u=.5*e/c,l.x*=u,l.y*=u),_=Et(l,.5*ft),m=Et(l,.5*-ft),r.push(a.x+_.x,a.y+_.y,0,a.x+m.x,a.y+m.y,0,h.x+m.x,h.y+m.y,0,a.x+_.x,a.y+_.y,0,h.x+m.x,h.y+m.y,0,h.x+_.x,h.y+_.y,0),o.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1);for(let t=0;t<i;t++)d=ft*(t+1)/i,x=ft*t/i,p=Et(_,d),f=Et(_,x),r.push(a.x+p.x,a.y+p.y,0,a.x,a.y,0,a.x+f.x,a.y+f.y,0);for(let t=0;t<i;t++)d=ft*(t+1)/i,x=ft*t/i,p=Et(m,d),f=Et(m,x),r.push(h.x+p.x,h.y+p.y,0,h.x,h.y,0,h.x+f.x,h.y+f.y,0)}super(new L(r,o,3),new G({color:s}))}}class Mt extends D{constructor(t,e="#7b68ee"){let s;if("Group"==t.type){const e=[];let i;for(let s=0;s<t.element.length;s++)i=t.element[s].geometry.vertices,0==i.length&&(i=yt(t.element[s])),e.push(i);s=At(e)}else 2==t.geometry.connect&&(s=t.geometry.vertices,0==s.length&&(s=yt(t)));let i=function(t){const e=[t[0],t[1]],s=t.length;let i,n,r,o=t[0],a=t[1];for(let h=3;h<s;h+=3)n=t[h],r=t[h+1],i=vt({x:n-o,y:r-a}),i>.001&&e.push(n,r),o=n,a=r;return i=vt({x:o-t[0],y:a-t[1]}),i<.001&&e.splice(s-2,2),e}(s);if(function(t){const e=[...t],s=t.length;e.push(t[0],t[1]);let i=0;for(let t=0;t<s;t+=2)i+=Q(e[t],e[t+1],e[t+2],e[t+3]);return i*=.5,i}(i)<0){const t=[];for(let e=i.length-1;e>0;e-=2)t.push(i[e-1],i[e]);i=t}s=[];let n,r,o,a,h,l=.5*i.length,c=0,u=!1;for(;l>3;)if(o=Tt(i,c),a=Tt(i,c+1),h=Tt(i,c+2),n=Q(a.x-o.x,a.y-o.y,a.x-h.x,a.y-h.y),n<0){r=[...i],tt(r,2*c,6);for(let t=0;t<r.length;t+=2)if(u=Z(r[t],r[t+1],o.x,o.y,a.x,a.y,h.x,h.y),u){c++;break}u||(s.push(o.x,o.y,0,a.x,a.y,0,h.x,h.y,0),tt(i,2*c+2,2),l--)}else c++;s.push(i[0],i[1],0,i[2],i[3],0,i[4],i[5],0);const _=new Array(s.length).fill(-1);super(new L(s,_,3),new G({color:e}))}}class St extends L{constructor(t){const e={a:1,b:.5,thickness:1,start:0,end:360,sub:64};K(t,e);const s=[],i=[],n=e.start/180*ft,r=(e.end/180*ft-n)/e.sub,o=1-e.thickness;let a,h,l,c,u,_;for(let t=0;t<e.sub;t++)u=n+t*r,_=n+(t+1)*r,a=dt(u),h=xt(u),l=dt(_),c=xt(_),e.thickness>0?(s.push(e.a*a,e.b*h,0,o*e.a*a,o*e.b*h,0,o*e.a*l,o*e.b*c,0,e.a*a,e.b*h,0,o*e.a*l,o*e.b*c,0,e.a*l,e.b*c,0),i.push(.5*a+.5,.5*h+.5,0,.5*o*a+.5,.5*o*h+.5,0,.5*o*l+.5,.5*o*c+.5,0,.5*a+.5,.5*h+.5,0,.5*o*l+.5,.5*o*c+.5,0,.5*l+.5,.5*c+.5,0)):(s.push(e.a*a,e.b*h,0,0,0,0,e.a*l,e.b*c,0),i.push(.5*a+.5,.5*h+.5,0,.5*o*l+.5,.5*o*c+.5,0,.5*l+.5,.5*c+.5,0));super(s,i,3)}}class Ft extends L{constructor(t=1,e=1,s=1,i=0){const n=[],r=[],o=.5*t,a=.5*e,h=.5*s,l=o-a,c=-s,u=a-o,_=i+1,m=1/_;let p,f,d,x,g,y,E,v,T,A,R,w,b,M,S,F;for(let t=0;t<_;t++)S=t*m,F=(t+1)*m,T=l*S,A=c*S,R=l*F,w=c*F,b=u*S,M=u*F,p=T-o,f=A+h,d=R-o,x=w+h,g=M+o,E=b+o,n.push(p,f,0,d,x,0,g,x,0,p,f,0,g,x,0,E,f,0),y=1-S,v=1-F,r.push(0,y,0,0,v,0,1,v,0,0,y,0,1,v,0,1,y,0);super(n,r,3)}}class $t extends L{constructor(t=1,e=.38196601125,s=5){const i=[],n=[],r=.5*e/t,o=2*s,a=2*ft/o;let h,l,c,u,_,m,p,f,d;for(let s=0;s<o;s+=2)p=s*a,f=(s+1)*a,d=(s+2)*a,h=dt(p),l=xt(p),c=dt(f),u=xt(f),_=dt(d),m=xt(d),i.push(t*h,t*l,0,0,0,0,e*c,e*u,0,e*c,e*u,0,0,0,0,t*_,t*m,0),n.push(.5*h+.5,.5*l+.5,0,.5,.5,0,r*c+.5,r*u+.5,0,r*c+.5,r*u+.5,0,.5,.5,0,.5*_+.5,.5*m+.5,0);super(i,n,3)}}class Ut extends L{constructor(t=1,e=64){const s=[],i=[],n=2*ft/e;let r,o,a,h;for(let l=0;l<e;l++)a=l*n,h=(l+1)*n,r=Rt(a),o=Rt(h),s.push(t*r.x,t*r.y,0,0,0,0,t*o.x,t*o.y,0),i.push(.5*r.x+.5,.5*r.y+.5,0,.5,.5,0,.5*o.x+.5,.5*o.y+.5,0);super(s,i,3)}}class Ct extends D{constructor(t,e="#ffffff"){super(new L([],[],2),new G({color:e})),this.bind=t}vertices(){const t=[],e=this.bind.vertices(),s=e.length;let i,n,r,o,a,h,l=0;for(let c=0;c<s;c+=30)i=this.material.getColor(l,this.geometry.connect),n=this.material.getColor(l+1,this.geometry.connect),r=this.material.getColor(l+2,this.geometry.connect),o=this.material.getColor(l+3,this.geometry.connect),a=this.material.getColor(l+4,this.geometry.connect),h=this.material.getColor(l+5,this.geometry.connect),t.push(e[c],e[c+1],e[c+2],i.r,i.g,i.b,i.a,0,0,-1,e[c+10],e[c+11],e[c+12],n.r,n.g,n.b,n.a,0,0,-1,e[c+10],e[c+11],e[c+12],r.r,r.g,r.b,r.a,0,0,-1,e[c+20],e[c+21],e[c+22],o.r,o.g,o.b,o.a,0,0,-1,e[c+20],e[c+21],e[c+22],a.r,a.g,a.b,a.a,0,0,-1,e[c],e[c+1],e[c+2],h.r,h.g,h.b,h.a,0,0,-1),l+=6;return new Float32Array(t)}}class Pt extends D{constructor(t=1,e=.5,s="#7b68ee",i=64){const n=[],r=[],o=2*ft/i;let a,h,l,c,u,_;for(let s=0;s<i;s++)u=s*o,_=(s+1)*o,a=t*dt(u),h=e*xt(u),l=t*dt(_),c=e*xt(_),n.push(a,h,0,l,c,0),r.push(0,0,-1,0,0,-1);super(new L(n,r,2),new G({color:s}))}}class Dt extends D{constructor(t=1,e=.38196601125,s=5,i="#ffff00"){const n=[],r=[],o=2*s,a=2*ft/o;let h,l,c,u,_,m,p,f,d;for(let s=0;s<o;s+=2)p=s*a,f=(s+1)*a,d=(s+2)*a,h=t*dt(p),l=t*xt(p),c=e*dt(f),u=e*xt(f),_=t*dt(d),m=t*xt(d),n.push(h,l,0,c,u,0,c,u,0,_,m,0),r.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1);super(new L(n,r,2),new G({color:i}))}}class Lt extends D{constructor(t=1,e="#ff0000",s=64){const i=[],n=[],r=2*ft/s;let o,a,h,l;for(let e=0;e<s;e++)h=e*r,l=(e+1)*r,o=Rt(h),a=Rt(l),i.push(t*o.x,t*o.y,0,t*a.x,t*a.y,0),n.push(0,0,-1,0,0,-1);super(new L(i,n,2),new G({color:e}))}}const Ot=Math.sqrt,Nt=Math.acos,It=Math.cos,kt=Math.sign,Bt=Math.pow,Xt=Math.abs,zt=Math.PI,Gt=1/3,Ht=1/27,Wt=2*zt*Gt,Vt=2*Wt;function Yt(t,e,s,i){const n=e/t,r=s/t,o=function(t,e){const s=e*e*.25+t*t*t*Ht;if(s>0){const t=Ot(s);return[Bt(.5*-e+t,Gt)+Bt(.5*-e-t,Gt)]}if(0==s){if(0==t&&0==e)return[0];if(0!=t&&0!=e){const t=Bt(.5*-e,Gt);return[2*t,-t]}}else if(s<0){const s=Xt(t)*Gt*Ot(-t*Gt),i=Gt*Nt(-e/s*.5),n=2*Bt(s,Gt);return[n*It(i),n*It(i+Wt),n*It(i+Vt)]}}(r-n*n*Gt,2*n*n*n*Ht-n*r*Gt+i/t),a=[];let h;return o.forEach(t=>{h=t-n*Gt,a.push(h)}),a}function qt(t,e,s){const i=e+s,n=[t[4]-t[0],t[5]-t[1]],r=[t[6]-t[4],t[7]-t[5]],o=[t[2]-t[6],t[3]-t[7]],a=o[0]-2*r[0]+n[0],h=3*(r[0]-n[0]),l=3*n[0],c=o[1]-2*r[1]+n[1],u=3*(r[1]-n[1]),_=3*n[1];return[new Jt(e,i,e=>a*(e/=s)*e*e+h*e*e+l*e+t[0]),new Jt(e,i,e=>c*(e/=s)*e*e+u*e*e+_*e+t[1]),new Jt(e,i,t=>{const e=3*c*(t/=s)*t+2*u*t+_,i=3*a*t*t+2*h*t+l,n=e/Ot(i*i+e*e);return function(t){if(0!=t)return kt(t)}(i)*Nt(n)})]}class jt{constructor(t=[]){this.type="BezierCure",8==t.length?this.points=t:this.points=[0,0,8,0,3,4,6,6]}value(t){const e=this.points[2]+3*(this.points[4]-this.points[6])-this.points[0],s=3*(this.points[6]-2*this.points[4]+this.points[0]),i=3*(this.points[4]-this.points[0]),n=this.points[0]-t;let r=[];if(0!=e&&0!=s&&0!=i?r=Yt(e,s,i,n):0!=s&&0!=i?r=function(t,e,s){const i=e*e-4*t*s,n=[];if(i>=0){const s=1/t*.5;if(i>0){const t=Ot(i),r=(-e+t)*s,o=(-e-t)*s;n.push(r),n.push(o)}else 0==i&&n.push(-e*s)}return n}(s,i,n):0!=i&&(r=function(t,e){return[-e/t]}(i,n)),r.length>0){const t=r.sort((t,e)=>t-e)[0];return(this.points[3]+3*(this.points[5]-this.points[7])-this.points[1])*t*t*t+3*(this.points[7]-2*this.points[5]+this.points[1])*t*t+3*(this.points[5]-this.points[1])*t+this.points[1]}return 0}}class Jt{constructor(t=0,e=1,s=t=>t){this.type="FuncCure",this.__func=s,this.__start_x=t,this.__end_x=e}value(t){return this.__func(t)}}class Kt{constructor(t=0,e=1,s=0,i=1){this.type="LerpCure",this.__start_x=t,this.__end_x=e,this.__a=s,this.__b=i,this.__c=e-t}value(t){return this.__a+function(t=0){return 6*t*t*t*t*t-15*t*t*t*t+10*t*t*t}(t/this.__c)*(this.__b-this.__a)}}class Qt{constructor(){this.type="Controller",this.content=[]}add(t){-1==this.content.indexOf(t)&&this.content.push(t)}remove(t){const e=this.content.indexOf(t);-1!=e&&this.content.splice(e,1)}value(t=0){let e=t;return this.content.forEach(s=>{"BezierCure"==s.type?t>s.points[0]&&t<s.points[2]?e=s.value(t):t==s.points[0]?e=s.points[1]:t==s.points[2]&&(e=s.points[3]):"FuncCure"==s.type&&t>=s.__start_x&&t<=s.__end_x?e=s.value(t-s.__start_x):"LerpCure"==s.type&&(t>s.__start_x&&t<s.__end_x?e=s.value(t-s.__start_x):t==s.__start_x?e=s.__a:t==s.__end_x&&(e=s.__b))}),e}}class Zt{constructor(t={}){this.type="Animation",this.keys=[],this.fps=25,this.time=2e3,this.t=0,this.state="end",this.cycle=!1,this.__binding=void 0,this.__attributes={},this.__controller={},Object.keys(t).forEach(e=>{"Controller"==t[e].type&&(this.__attributes[e]=t[e].value(0),this.__controller[e]=t[e],this.keys.push(e))}),this.__update=t=>{if("play"==t.state)if(t.t+=1e3/t.fps,t.t>t.time&&t.cycle&&(t.t=0),t.t<=t.time){const e=.001*t.t;t.keys.forEach(s=>{t.__attributes[s]=t.__controller[s].value(e)}),t.__binding?.(t.__attributes),setTimeout(()=>{t.__update(t)},1e3/t.fps)}else t.state="end"}}play(){if("play"!=this.state){"end"==this.state&&(this.t=0),this.state="play";const t=.001*this.t;this.keys.forEach(e=>{this.__attributes[e]=this.__controller[e].value(t)}),this.__binding?.(this.__attributes),setTimeout(()=>{this.__update(this)},1e3/this.fps)}}pause(){"play"==this.state&&(this.state="pause")}stop(){this.state="end"}binding(t){this.__binding=t}}const te=Math.PI,ee=Math.sin,se=Math.cos,ie=Math.floor,ne=Math.ceil,re=Math.trunc,oe=Math.random,ae=1/1.414214,he=1/1.7321;class le{constructor(t=()=>oe()){this.data=[{},{},{}],this.argument=0,this.structure=t}fade(t){return 6*t*t*t*t*t-15*t*t*t*t+10*t*t*t}lerp(t,e,s){return t+this.fade(s)*(e-t)}get1d(t=0){const e=ie(t),s=ne(t);null==this.data[0][`s${e}`]&&(this.data[0][`s${e}`]=this.structure(this.argument),this.argument++),null==this.data[0][`s${s}`]&&(this.data[0][`s${s}`]=this.structure(this.argument),this.argument++);const i=this.data[0][`s${e}`],n=this.data[0][`s${s}`],r=t-re(t);return this.lerp(i,n,r)}get2d(t=0,e=0){const s=ie(t),i=ne(t),n=ie(e),r=ne(e);if(null==this.data[1][`s${s}_${n}`]){const t=2*this.structure(this.argument)*te;this.data[1][`s${s}_${n}`]={x:se(t),y:ee(t)},this.argument++}if(null==this.data[1][`s${s}_${r}`]){const t=2*this.structure(this.argument)*te;this.data[1][`s${s}_${r}`]={x:se(t),y:ee(t)},this.argument++}if(null==this.data[1][`s${i}_${r}`]){const t=2*this.structure(this.argument)*te;this.data[1][`s${i}_${r}`]={x:se(t),y:ee(t)},this.argument++}if(null==this.data[1][`s${i}_${n}`]){const t=2*this.structure(this.argument)*te;this.data[1][`s${i}_${n}`]={x:se(t),y:ee(t)},this.argument++}const o=this.data[1][`s${s}_${n}`],a=this.data[1][`s${s}_${r}`],h=this.data[1][`s${i}_${r}`],l=this.data[1][`s${i}_${n}`],c=n-e,u=s-t,_=r-e,m=i-t,p=r-e,f=i-t,d=n-e,x=(s-t)*o.x+c*o.y,g=u*a.x+_*a.y,y=m*h.x+p*h.y,E=f*l.x+d*l.y,v=.5*(x*ae+1),T=.5*(g*ae+1),A=.5*(y*ae+1),R=.5*(E*ae+1),w=t-re(t),b=e-re(e),M=this.lerp(v,R,w),S=this.lerp(T,A,w);return this.lerp(M,S,b)}get3d(t=0,e=0,s=0){const i=ie(t),n=ne(t),r=ie(e),o=ne(e),a=ie(s),h=ne(s);if(null==this.data[2][`s${i}_${r}_${a}`]){const t=2*this.structure(this.argument)*te,e=2*this.structure(this.argument+1)*te,s=ee(t);this.data[2][`s${i}_${r}_${a}`]={x:s*se(e),y:s*ee(e),z:se(t)},this.argument+=2}if(null==this.data[2][`s${i}_${o}_${a}`]){const t=2*this.structure(this.argument)*te,e=2*this.structure(this.argument+1)*te,s=ee(t);this.data[2][`s${i}_${o}_${a}`]={x:s*se(e),y:s*ee(e),z:se(t)},this.argument+=2}if(null==this.data[2][`s${n}_${o}_${a}`]){const t=2*this.structure(this.argument)*te,e=2*this.structure(this.argument+1)*te,s=ee(t);this.data[2][`s${n}_${o}_${a}`]={x:s*se(e),y:s*ee(e),z:se(t)},this.argument+=2}if(null==this.data[2][`s${n}_${r}_${a}`]){const t=2*this.structure(this.argument)*te,e=2*this.structure(this.argument+1)*te,s=ee(t);this.data[2][`s${n}_${r}_${a}`]={x:s*se(e),y:s*ee(e),z:se(t)},this.argument+=2}if(null==this.data[2][`s${i}_${r}_${h}`]){const t=2*this.structure(this.argument)*te,e=2*this.structure(this.argument+1)*te,s=ee(t);this.data[2][`s${i}_${r}_${h}`]={x:s*se(e),y:s*ee(e),z:se(t)},this.argument+=2}if(null==this.data[2][`s${i}_${o}_${h}`]){const t=2*this.structure(this.argument)*te,e=2*this.structure(this.argument+1)*te,s=ee(t);this.data[2][`s${i}_${o}_${h}`]={x:s*se(e),y:s*ee(e),z:se(t)},this.argument+=2}if(null==this.data[2][`s${n}_${o}_${h}`]){const t=2*this.structure(this.argument)*te,e=2*this.structure(this.argument+1)*te,s=ee(t);this.data[2][`s${n}_${o}_${h}`]={x:s*se(e),y:s*ee(e),z:se(t)},this.argument+=2}if(null==this.data[2][`s${n}_${r}_${h}`]){const t=2*this.structure(this.argument)*te,e=2*this.structure(this.argument+1)*te,s=ee(t);this.data[2][`s${n}_${r}_${h}`]={x:s*se(e),y:s*ee(e),z:se(t)},this.argument+=2}const l=this.data[2][`s${i}_${r}_${a}`],c=this.data[2][`s${i}_${o}_${a}`],u=this.data[2][`s${n}_${o}_${a}`],_=this.data[2][`s${n}_${r}_${a}`],m=this.data[2][`s${i}_${r}_${h}`],p=this.data[2][`s${i}_${o}_${h}`],f=this.data[2][`s${n}_${o}_${h}`],d=this.data[2][`s${n}_${r}_${h}`],x=r-e,g=a-s,y=i-t,E=o-e,v=a-s,T=n-t,A=o-e,R=a-s,w=n-t,b=r-e,M=a-s,S=i-t,F=r-e,$=h-s,U=i-t,C=o-e,P=h-s,D=n-t,L=o-e,O=h-s,N=n-t,I=r-e,k=h-s,B=(i-t)*l.x+x*l.y+g*l.z,X=y*c.x+E*c.y+v*c.z,z=T*u.x+A*u.y+R*u.z,G=w*_.x+b*_.y+M*_.z,H=S*m.x+F*m.y+$*m.z,W=U*p.x+C*p.y+P*p.z,V=D*f.x+L*f.y+O*f.z,Y=N*d.x+I*d.y+k*d.z,q=.5*(B*he+1),j=.5*(X*he+1),J=.5*(z*he+1),K=.5*(G*he+1),Q=.5*(H*he+1),Z=.5*(W*he+1),tt=.5*(V*he+1),et=.5*(Y*he+1),st=t-re(t),it=e-re(e),nt=s-re(s),rt=this.lerp(q,K,st),ot=this.lerp(j,J,st),at=this.lerp(Q,et,st),ht=this.lerp(Z,tt,st),lt=this.lerp(rt,ot,it),ct=this.lerp(at,ht,it);return this.lerp(lt,ct,nt)}}class ce{constructor(){this.type="FileLoader"}loadFile(t,e){const s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType="arraybuffer",s.onload=()=>{if(200===s.status){const t=s.response;e(t)}},s.send()}loadFileAsync(t){return new Promise(e=>{const s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType="arraybuffer",s.onload=()=>{if(200===s.status){const t=s.response;e(t)}},s.send()})}}class ue extends ce{constructor(){super(),this.type="TextLoader",this.textDecoder=new TextDecoder("utf-8")}loadAsync(t){return new Promise(e=>{this.loadFile(t,t=>{const s=new Uint8Array(t);e(this.textDecoder.decode(s))})})}}class _e{constructor(){this.type="TextureLoader"}loadAsync(t){return new Promise(e=>{const s=new Image;s.src=t,s.onload=()=>{e(new z(s))}})}load(t){const e=new Image;return e.src=t,new z(e)}}const me=document.createElement("canvas"),pe=me.getContext("2d",{willReadFrequently:!0}),fe=Math.round;class de{constructor(){this.type="StringLoader",this.fonts=["sans-serif","Arial","Helvetica","Verdana","Tahoma","Trebuchet MS","serif","Times New Roman","Georgia","Palatino","monospace","Courier New","Lucida Console","Monaco","Consolas","cursive","Comic Sans MS","Brush Script MT","fantasy","Impact","Papyrus","FangSong","仿宋","Microsoft YaHei","微软雅黑"]}getFont(t){const e=t.toLowerCase();let s;for(let t of this.fonts)if(t.toLowerCase()==e){switch(t){case"Airal":s="Airal, sans-serif";break;case"Helvetica":s="Helvetica, sans-serif";break;case"Verdana":s="Verdana, sans-serif";break;case"Tahoma":s="Tahoma, sans-serif";break;case"Trebuchet MS":s='"Trebuchet MS", sans-serif';break;case"Times New Roman":s='"Times New Roman", serif';break;case"Georgia":s="Georgia, serif";break;case"Palatino":s="Palatino, serif";break;case"Courier New":s='"Courier New", monospace';break;case"Lucida Console":s='"Lucida Console", monospace';break;case"Monaco":s="Monaco, monospace";break;case"Consolas":s="Consolas, monospace";break;case"Comic Sans MS":s='"Comic Sans MS", cursive';break;case"Brush Script MT":s='"Brush Script MT", cursive';break;case"Impact":s="Impact, fantasy";break;case"Papyrus":s="Papyrus, fantasy";break;case"FangSong":s='"FangSong"';break;case"仿宋":s='"仿宋"';break;case"Microsoft YaHei":s='"Microsoft YaHei"';break;case"微软雅黑":s='"微软雅黑"';break;default:s=t}break}return s}queryFont(t){const e=t.toLowerCase();let s=!1;for(let t of this.fonts)if(t.toLowerCase()==e){s=!0;break}return s}addFont(t,e){if(!this.queryFont(t)){new FontFace(t,`url(${e})`).load().then(e=>{document.fonts.add(e),this.fonts.push(t)}).catch(t=>console.error("字体加载失败:",t))}}fontReady(t){document.fonts.ready.then(()=>{t?.()})}createAsync(t){const e={text:"Hello LiaoJS!",size:40,style:"normal",weight:"normal",variant:"normal",font:"sans-serif",color:"#7b68ee",paddingW:0,paddingH:0,shadow:!1,shadowColor:"rgba(0,0,0,0.8)",shadowOffsetX:6,shadowOffsetY:6,shadowBlur:8,outline:!1,outlines:[]};K(t,e,["outlines"]),this.queryFont(e.font)?e.font=this.getFont(e.font):e.font="sans-serif",pe.font=`${e.variant} ${e.style} ${e.weight} ${e.size}px ${e.font}`;const s=pe.measureText(e.text),i=fe(s.actualBoundingBoxRight-s.actualBoundingBoxLeft)+2*e.paddingW,n=fe(s.actualBoundingBoxAscent+s.actualBoundingBoxDescent)+2*e.paddingH;me.width=i,me.height=n,pe.clearRect(0,0,i,n),pe.textAlign="start",pe.textBaseline="top",pe.font=`${e.variant} ${e.style} ${e.weight} ${e.size}px ${e.font}`,e.shadow&&(pe.shadowColor=e.shadowColor,pe.shadowOffsetX=e.shadowOffsetX,pe.shadowOffsetY=e.shadowOffsetY,pe.shadowBlur=e.shadowBlur);const r=e.paddingW,o=e.paddingH;pe.fillStyle=e.color,pe.fillText(e.text,r,o),e.outline&&e.outlines.forEach(t=>{const s=[2,2],i=1,n="#868686";null==t.spacing&&(t.spacing=s),null==t.width&&(t.width=i),null==t.color&&(t.color=n),pe.setLineDash(t.spacing),pe.strokeStyle=t.color,pe.lineWidth=t.width,pe.strokeText(e.text,r,o),pe.setLineDash([])});const a=me.toDataURL("image/png");return new Promise(t=>{const e=new Image;e.src=a,e.onload=()=>t(new z(e))})}}const xe="beta 0.1.27";export{jt as AnBezier,Qt as AnCureController,Jt as AnFunc,qt as AnGetBezierFunc,Kt as AnLerp,Zt as Animation,W as ArrayMaterial,G as BasicMaterial,ut as BezierHelper,wt as BezierToCure,q as Bone,L as BufferGeometry,S as Camera2D,at as CircleGeometry,mt as CircleHelper,bt as CureToShape,St as EllipseGeometry,Pt as EllipseHelper,Mt as Extrusion,ce as FileLoader,ct as GridHelper,rt as Group,Ut as HeartGeometry,Lt as HeartHelper,Ft as IsoscelesGeometry,u as Matrix2,_ as Matrix3,m as Matrix4,c as MatrixNxM,ht as MergeGeometry,D as Mesh,lt as MeshHelper,Ct as MeshHelperX,le as PerlinNoise,z as RawTexture,ot as RectGeometry,_t as RectHelper,w as Scene,j as Skeleton,pt as SkeletonHelper,J as SkinnedMesh,$t as StarGeometry,Dt as StarHelper,de as StringLoader,ue as TextLoader,_e as TextureLoader,f as Vector2,d as Vector3,x as Vector4,p as VectorN,xe as Version,H as VertexMaterial,A as WebGLRenderer};
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@miaoshangzuan/catsjs",
3
+ "version": "0.1.27",
4
+ "description": "一个javascript渲染库。",
5
+ "main": "cats2d.module.min.js",
6
+ "module": "cats2d.module.min.js",
7
+ "files": ["cats2d.module.min.js"],
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "keywords": ["catsjs"],
12
+ "author": "miaoshangzuan",
13
+ "license": "MIT",
14
+ "type": "module"
15
+ }