/*! * @pixi/graphics-smooth - v1.1.0 * Compiled Sat, 25 Mar 2023 18:46:44 UTC * * @pixi/graphics-smooth is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license * * Copyright 2023, Ivan Popelyshev, All Rights Reserved */import{BatchTextureArray as Et,BLEND_MODES as ct,BaseTexture as It,Matrix as j,Texture as V,SHAPES as P,Point as q,utils as ut,Geometry as St,Buffer as dt,TYPES as C,WRAP_MODES as Nt,Color as B,Shader as Pt,Program as At,State as Ot,Polygon as it,PI_2 as pt,Rectangle as Dt,RoundedRectangle as wt,Circle as Ct,Ellipse as Mt,MSAA_QUALITY as Bt,DRAW_MODES as Rt}from"@pixi/core";import{LINE_CAP as $,LINE_JOIN as R,Graphics as Ut,graphicsUtils as Ft,curves as kt}from"@pixi/graphics";import{Bounds as ft,Container as zt}from"@pixi/display";function st(n,t,s=.001){return this===t||Math.abs(n.a-t.a)=l.maxStyles?-1:(a[u]=t,c[u]=s,p[u*2]=e,p[u*2+1]=r,this.count++,u)}}class nt{constructor(){this.texArray=new Et,this.styleArray=new yt,this.shader=null,this.blend=ct.NORMAL,this.start=0,this.size=0,this.TICK=0,this.settings=null,this.data=null}clear(){this.texArray.clear(),this.styleArray.clear(),this.settings=null,this.data=null,this.shader=null}begin(t,s){this.TICK=++It._globalBatch,this.settings=t,this.shader=s,this.start=0,this.size=0,this.data=null,s&&s.settings&&(this.settings=s.settings)}check(t){return this.size===0?(this.shader=t,!0):this.shader===t}add(t,s,e,r,i){const{texArray:l,TICK:a,styleArray:c,settings:p}=this,{baseTexture:u}=t;if(u._batchEnabled!==a&&l.count===p.maxTextures)return-1;const o=u._batchEnabled!==a?l.count:u._batchLocation,h=c.add(o,s||j.IDENTITY,e,r,i,p);return h>=0&&u._batchEnabled!==a&&(u._batchEnabled=a,u._batchLocation=l.count,l.elements[l.count++]=u),h}}class xt{constructor(){this.reset()}begin(t,s,e){this.reset(),this.style=t,this.start=s,this.attribStart=e,this.jointEnd=0}end(t,s){this.attribSize=s-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0,this.styleId=-1,this.rgba=0,this.jointEnd=0}}class Y{constructor(){this.reset()}toJSON(){return this.copyTo({})}clone(){return this.copyTo(new Y)}copyTo(t){return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.shader=this.shader,t.visible=this.visible,t.smooth=this.smooth,t.matrixTex=null,t}packLineScale(){return 0}reset(){this.color=16777215,this.alpha=1,this.texture=V.WHITE,this.matrix=null,this.shader=null,this.visible=!1,this.smooth=!1,this.matrixTex=null}destroy(){this.texture=null,this.matrix=null,this.matrixTex=null}getTextureMatrix(){const t=this.texture;return this.matrix?t.frame.width===t.baseTexture.width&&t.frame.height===t.baseTexture.height?this.matrix:(this.matrixTex?this.matrixTex.copyFrom(this.matrix):this.matrixTex=this.matrix.clone(),this.matrixTex.translate(Number(t.frame.x),Number(t.frame.y)),this.matrixTex):null}}var M=(n=>(n.NONE="none",n.NORMAL="normal",n.HORIZONTAL="horizontal",n.VERTICAL="vertical",n))(M||{});class et extends Y{clone(){return this.copyTo(new et)}copyTo(t){return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.shader=this.shader,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t.scaleMode=this.scaleMode,t}packLineScale(){switch(this.scaleMode){case"normal":return 1;case"horizontal":return 2;case"vertical":return 3;default:return 0}}reset(){super.reset(),this.smooth=!0,this.color=0,this.width=0,this.alignment=.5,this.cap=$.BUTT,this.join=R.MITER,this.miterLimit=10,this.scaleMode="normal"}}class vt{constructor(){this.verts=[],this.joints=[],this.vertexSize=0,this.indexSize=0,this.closePointEps=1e-4}clear(){this.verts.length=0,this.joints.length=0,this.vertexSize=0,this.indexSize=0}destroy(){this.verts.length=0,this.joints.length=0}}var f=(n=>(n[n.NONE=0]="NONE",n[n.FILL=1]="FILL",n[n.JOINT_BEVEL=4]="JOINT_BEVEL",n[n.JOINT_MITER=8]="JOINT_MITER",n[n.JOINT_ROUND=12]="JOINT_ROUND",n[n.JOINT_CAP_BUTT=16]="JOINT_CAP_BUTT",n[n.JOINT_CAP_SQUARE=18]="JOINT_CAP_SQUARE",n[n.JOINT_CAP_ROUND=20]="JOINT_CAP_ROUND",n[n.FILL_EXPAND=24]="FILL_EXPAND",n[n.CAP_BUTT=32]="CAP_BUTT",n[n.CAP_SQUARE=64]="CAP_SQUARE",n[n.CAP_ROUND=96]="CAP_ROUND",n[n.CAP_BUTT2=128]="CAP_BUTT2",n))(f||{});const U=class{constructor(){this.strideFloats=12,this.bufferPos=0,this.indexPos=0}updateBufferSize(n,t,s,e){const{joints:r}=e;let i=!1,l=0,a=0;for(let c=n;c=f.FILL_EXPAND){l+=3,a+=3;continue}const o=U.vertsByJoint[u]+U.vertsByJoint[p];o>=4&&(l+=o,a+=6+3*Math.max(o-6,0))}i&&(a+=s),e.vertexSize+=l,e.indexSize+=a}beginPack(n,t,s,e,r=0,i=0){this.buildData=n,this.bufFloat=t,this.bufUint=s,this.indices=e,this.bufferPos=r,this.indexPos=i}endPack(){this.buildData=null,this.bufFloat=null,this.bufUint=null,this.indices=null}packInterleavedGeometry(n,t,s,e,r){const{bufFloat:i,bufUint:l,indices:a,buildData:c,strideFloats:p}=this,{joints:u,verts:o}=c;let h=this.bufferPos,d=this.indexPos,x=this.bufferPos/this.strideFloats,v,y,g,b,L,E,I,_,m=!1,N=0;for(let T=n;T=f.FILL_EXPAND){L=o[T*2],E=o[T*2+1],v=o[T*2+2],y=o[T*2+3],g=o[T*2+4],b=o[T*2+5];const O=T+3;for(let X=0;X<3;X++)i[h]=L,i[h+1]=E,i[h+2]=v,i[h+3]=y,i[h+4]=g,i[h+5]=b,i[h+6]=o[(O+X)*2],i[h+7]=o[(O+X)*2+1],i[h+8]=N,i[h+9]=16*w+X,i[h+10]=e,l[h+11]=r,h+=p;a[d]=x,a[d+1]=x+1,a[d+2]=x+2,d+=3,x+=3;continue}const D=U.vertsByJoint[A]+U.vertsByJoint[Q];if(D===0)continue;v=o[T*2],y=o[T*2+1],g=o[T*2+2],b=o[T*2+3],L=o[T*2-2],E=o[T*2-1];const J=Math.sqrt((g-v)*(g-v)+(b-y)*(b-y));U.vertsByJoint[A]===0&&(N-=J),(A&-3)!==f.JOINT_CAP_BUTT?(I=o[T*2+4],_=o[T*2+5]):(I=v,_=y);for(let O=0;O=0&&p>=0&&l>=0&&a>=0)){e.length=0;return}const u=Math.ceil(2.3*Math.sqrt(c+p)),o=u*8+(l?4:0)+(a?4:0);if(e.length=o,o===0)return;if(u===0){e.length=8,e[0]=e[6]=r+l,e[1]=e[3]=i+a,e[2]=e[4]=r-l,e[5]=e[7]=i-a;return}let h=0,d=u*4+(l?2:0)+2,x=d,v=o;{const y=l+c,g=a,b=r+y,L=r-y,E=i+g;if(e[h++]=b,e[h++]=E,e[--d]=E,e[--d]=L,a){const I=i-g;e[x++]=L,e[x++]=I,e[--v]=I,e[--v]=b}}for(let y=1;y0?(e.push(A),e.push(D)):(E=A,I=D),e.push(u),e.push(o),e.push(v),e.push(y),e.push(m),e.push(N),e.push(0),e.push(0),e.push(A),e.push(D),r.push(f.FILL_EXPAND+2),r.push(f.NONE),r.push(f.NONE),r.push(f.NONE),r.push(f.NONE),r.push(f.NONE),v=m,y=N,g=T,b=w}e.push(E),e.push(I)}line(t,s){const{verts:e,joints:r}=s,{points:i}=t,l=i.length===8?t.goodJointType():f.JOINT_MITER+3,a=i.length;if(a!==0){e.push(i[a-2],i[a-1]),r.push(f.NONE);for(let c=0;c0||t&&e<=0){const r=s/2;for(let i=r+r%2;i=i?e||(y=f.NONE):d+4>=i&&(e||(p===f.CAP_ROUND&&(y=f.JOINT_CAP_ROUND),p===f.CAP_BUTT&&(y=f.JOINT_CAP_BUTT),p===f.CAP_SQUARE&&(y=f.JOINT_CAP_SQUARE))),y+=u,u=0,l.push(x,v),a.push(y),o=x,h=v}e?(l.push(r[0],r[1]),a.push(f.NONE),l.push(r[2],r[3]),a.push(f.NONE)):(l.push(r[i-4],r[i-3]),a.push(f.NONE))}fill(t,s){let e=t.points;const r=t.holes,i=s.closePointEps,{verts:l,joints:a}=s;if(e.length<6)return;const c=[];let p=e.length;mt(e,!1);for(let d=0;d0&&(d>1),u[o*2]=x-1,u[(x-1)*2+1]=o;for(let v=o;v+10&&(I=2);for(let _=0;_<3;_++){const m=h[d+_*I%3];l.push(e[m*2],e[m*2+1])}for(let _=0;_<3;_++){const m=h[d+_*I%3];l.push(u[m*2],u[m*2+1])}}}}class gt{constructor(){this._polyBuilder=new rt}path(t,s){const e=t.shape,r=e.x,i=e.y,l=e.width,a=e.height,c=t.points;c.length=0,c.push(r,i,r+l,i,r+l,i+a,r,i+a)}line(t,s){const{verts:e,joints:r}=s,{points:i}=t,l=t.goodJointType(),a=i.length;e.push(i[a-2],i[a-1]),r.push(f.NONE);for(let c=0;c0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,s=null,e=null,r=null){const i=new G(t,s,e,r);return this.graphicsData.push(i),this.dirty++,this}drawHole(t,s=null){if(!this.graphicsData.length)return null;const e=new G(t,null,null,s),r=this.graphicsData[this.graphicsData.length-1];return e.lineStyle=r.lineStyle,r.holes.push(e),this.dirty++,this}destroy(){super.destroy();for(let t=0;t=.99&&i.lineStyle.width*Math.min(i.lineStyle.alignment,1-i.lineStyle.alignment)>=.495),i.fillStart=s.joints.length,c.length?H[P.POLY].fill(i,s):p.fill(i,s),i.fillLen=s.joints.length-i.fillStart),a.visible)){i.strokeStart=s.joints.length,p.line(i,s);for(let u=0;u0&&(i=this.batches[this.batches.length-1],l=i.style);for(let a=this.shapeBatchIndex;a65535&&this.pack32index?c.data=new Uint32Array(s):c.data=new Uint16Array(s)),r.beginPack(i,this._bufferFloats,this._bufferUint,c.data);let u=0;for(let o=0;o 0.5) { if (len < len2) { if (abs(dy * (bisect.x * norm.y - bisect.y * norm.x)) > len) { return dy * norm; } } else { if (abs(dy * (bisect.x * norm2.y - bisect.y * norm2.x)) > len2) { return dy * norm; } } } return dy * bisect; } void main(void){ vec2 pointA = (translationMatrix * vec3(aPoint1, 1.0)).xy; vec2 pointB = (translationMatrix * vec3(aPoint2, 1.0)).xy; vec2 xBasis = pointB - pointA; float len = length(xBasis); vec2 forward = xBasis / len; vec2 norm = vec2(forward.y, -forward.x); float type = floor(aVertexJoint / 16.0); float vertexNum = aVertexJoint - type * 16.0; float dx = 0.0, dy = 1.0; float capType = floor(type / 32.0); type -= capType * 32.0; int styleId = int(aStyleId + 0.5); float lineWidth = styleLine[styleId].x; vTextureId = floor(styleTextureId[styleId] / 4.0); float scaleMode = styleTextureId[styleId] - vTextureId * 4.0; float avgScale = 1.0; if (scaleMode > 2.5) { avgScale = length(translationMatrix * vec3(1.0, 0.0, 0.0)); } else if (scaleMode > 1.5) { avgScale = length(translationMatrix * vec3(0.0, 1.0, 0.0)); } else if (scaleMode > 0.5) { vec2 avgDiag = (translationMatrix * vec3(1.0, 1.0, 0.0)).xy; avgScale = sqrt(dot(avgDiag, avgDiag) * 0.5); } lineWidth *= 0.5 * avgScale; float lineAlignment = 2.0 * styleLine[styleId].y - 1.0; vTextureCoord = vec2(0.0); vec2 pos; if (capType == CAP_ROUND) { vertexNum += 4.0; type = JOINT_CAP_ROUND; capType = 0.0; lineAlignment = -lineAlignment; } vLine1 = vec4(0.0, 10.0, 1.0, 0.0); vLine2 = vec4(0.0, 10.0, 1.0, 0.0); vArc = vec4(0.0); if (type == FILL) { pos = pointA; vType = 0.0; vLine2 = vec4(-2.0, -2.0, -2.0, 0.0); vec2 vTexturePixel; vTexturePixel.x = dot(vec3(aPoint1, 1.0), styleMatrix[styleId * 2]); vTexturePixel.y = dot(vec3(aPoint1, 1.0), styleMatrix[styleId * 2 + 1]); vTextureCoord = vTexturePixel / samplerSize[int(vTextureId)]; } else if (type >= FILL_EXPAND && type < FILL_EXPAND + 7.5) { // expand vertices float flags = type - FILL_EXPAND; float flag3 = floor(flags / 4.0); float flag2 = floor((flags - flag3 * 4.0) / 2.0); float flag1 = flags - flag3 * 4.0 - flag2 * 2.0; vec2 prev = (translationMatrix * vec3(aPrev, 1.0)).xy; if (vertexNum < 0.5) { pos = prev; } else if (vertexNum < 1.5) { pos = pointA; } else { pos = pointB; } float len2 = length(aNext); vec2 bisect = (translationMatrix * vec3(aNext, 0.0)).xy; if (len2 > 0.01) { bisect = normalize(bisect) * len2; } vec2 n1 = normalize(vec2(pointA.y - prev.y, -(pointA.x - prev.x))); vec2 n2 = normalize(vec2(pointB.y - pointA.y, -(pointB.x - pointA.x))); vec2 n3 = normalize(vec2(prev.y - pointB.y, -(prev.x - pointB.x))); if (n1.x * n2.y - n1.y * n2.x < 0.0) { n1 = -n1; n2 = -n2; n3 = -n3; } pos += bisect * expand; vLine1 = vec4(16.0, 16.0, 16.0, -1.0); if (flag1 > 0.5) { vLine1.x = -dot(pos - prev, n1); } if (flag2 > 0.5) { vLine1.y = -dot(pos - pointA, n2); } if (flag3 > 0.5) { vLine1.z = -dot(pos - pointB, n3); } vLine1.xyz *= resolution; vType = 2.0; } else if (type >= BEVEL) { float dy = lineWidth + expand; float shift = lineWidth * lineAlignment; float inner = 0.0; if (vertexNum >= 1.5) { dy = -dy; inner = 1.0; } vec2 base, next, xBasis2, bisect; float flag = 0.0; float side2 = 1.0; if (vertexNum < 0.5 || vertexNum > 2.5 && vertexNum < 3.5) { next = (translationMatrix * vec3(aPrev, 1.0)).xy; base = pointA; flag = type - floor(type / 2.0) * 2.0; side2 = -1.0; } else { next = (translationMatrix * vec3(aNext, 1.0)).xy; base = pointB; if (type >= MITER && type < MITER + 3.5) { flag = step(MITER + 1.5, type); // check miter limit here? } } xBasis2 = next - base; float len2 = length(xBasis2); vec2 norm2 = vec2(xBasis2.y, -xBasis2.x) / len2; float D = norm.x * norm2.y - norm.y * norm2.x; if (D < 0.0) { inner = 1.0 - inner; } norm2 *= side2; float collinear = step(0.0, dot(norm, norm2)); vType = 0.0; float dy2 = -1000.0; if (abs(D) < 0.01 && collinear < 0.5) { if (type >= ROUND && type < ROUND + 1.5) { type = JOINT_CAP_ROUND; } //TODO: BUTT here too } vLine1 = vec4(0.0, lineWidth, max(abs(norm.x), abs(norm.y)), min(abs(norm.x), abs(norm.y))); vLine2 = vec4(0.0, lineWidth, max(abs(norm2.x), abs(norm2.y)), min(abs(norm2.x), abs(norm2.y))); if (vertexNum < 3.5) { if (abs(D) < 0.01 && collinear < 0.5) { pos = (shift + dy) * norm; } else { if (flag < 0.5 && inner < 0.5) { pos = (shift + dy) * norm; } else { pos = doBisect(norm, len, norm2, len2, shift + dy, inner); } } vLine2.y = -1000.0; if (capType >= CAP_BUTT && capType < CAP_ROUND) { float extra = step(CAP_SQUARE, capType) * lineWidth; vec2 back = -forward; if (vertexNum < 0.5 || vertexNum > 2.5) { pos += back * (expand + extra); dy2 = expand; } else { dy2 = dot(pos + base - pointA, back) - extra; } } if (type >= JOINT_CAP_BUTT && type < JOINT_CAP_SQUARE + 0.5) { float extra = step(JOINT_CAP_SQUARE, type) * lineWidth; if (vertexNum < 0.5 || vertexNum > 2.5) { vLine2.y = dot(pos + base - pointB, forward) - extra; } else { pos += forward * (expand + extra); vLine2.y = expand; if (capType >= CAP_BUTT) { dy2 -= expand + extra; } } } } else if (type >= JOINT_CAP_ROUND && type < JOINT_CAP_ROUND + 1.5) { base += shift * norm; if (inner > 0.5) { dy = -dy; inner = 0.0; } vec2 d2 = abs(dy) * forward; if (vertexNum < 4.5) { dy = -dy; pos = dy * norm; } else if (vertexNum < 5.5) { pos = dy * norm; } else if (vertexNum < 6.5) { pos = dy * norm + d2; vArc.x = abs(dy); } else { dy = -dy; pos = dy * norm + d2; vArc.x = abs(dy); } vLine2 = vec4(0.0, lineWidth * 2.0 + 10.0, 1.0 , 0.0); // forget about line2 with type=3 vArc.y = dy; vArc.z = 0.0; vArc.w = lineWidth; vType = 3.0; } else if (abs(D) < 0.01 && collinear < 0.5) { pos = dy * norm; } else { if (inner > 0.5) { dy = -dy; inner = 0.0; } float side = sign(dy); vec2 norm3 = normalize(norm + norm2); if (type >= MITER && type < MITER + 3.5) { vec2 farVertex = doBisect(norm, len, norm2, len2, shift + dy, 0.0); if (length(farVertex) > abs(shift + dy) * MITER_LIMIT) { type = BEVEL; } } if (vertexNum < 4.5) { pos = doBisect(norm, len, norm2, len2, shift - dy, 1.0); } else if (vertexNum < 5.5) { pos = (shift + dy) * norm; } else if (vertexNum > 7.5) { pos = (shift + dy) * norm2; } else { if (type >= ROUND && type < ROUND + 1.5) { pos = doBisect(norm, len, norm2, len2, shift + dy, 0.0); float d2 = abs(shift + dy); if (length(pos) > abs(shift + dy) * 1.5) { if (vertexNum < 6.5) { pos.x = (shift + dy) * norm.x - d2 * norm.y; pos.y = (shift + dy) * norm.y + d2 * norm.x; } else { pos.x = (shift + dy) * norm2.x + d2 * norm2.y; pos.y = (shift + dy) * norm2.y - d2 * norm2.x; } } } else if (type >= MITER && type < MITER + 3.5) { pos = doBisect(norm, len, norm2, len2, shift + dy, 0.0); //farVertex } else if (type >= BEVEL && type < BEVEL + 1.5) { float d2 = side / resolution; if (vertexNum < 6.5) { pos = (shift + dy) * norm + d2 * norm3; } else { pos = (shift + dy) * norm2 + d2 * norm3; } } } if (type >= ROUND && type < ROUND + 1.5) { vArc.x = side * dot(pos, norm3); vArc.y = pos.x * norm3.y - pos.y * norm3.x; vArc.z = dot(norm, norm3) * (lineWidth + side * shift); vArc.w = lineWidth + side * shift; vType = 3.0; } else if (type >= MITER && type < MITER + 3.5) { vType = 1.0; } else if (type >= BEVEL && type < BEVEL + 1.5) { vType = 4.0; vArc.z = dot(norm, norm3) * (lineWidth + side * shift) - side * dot(pos, norm3); } dy = side * (dot(pos, norm) - shift); dy2 = side * (dot(pos, norm2) - shift); } pos += base; vLine1.xy = vec2(dy, vLine1.y) * resolution; vLine2.xy = vec2(dy2, vLine2.y) * resolution; vArc = vArc * resolution; vTravel = vec2(aTravel * avgScale + dot(pos - pointA, vec2(-norm.y, norm.x)), avgScale); } gl_Position = vec4((projectionMatrix * vec3(pos, 1.0)).xy, 0.0, 1.0); vColor = aColor * tint; }`,jt=`#version 100 #ifdef GL_FRAGMENT_PRECISION_HIGH precision highp float; #else precision mediump float; #endif `,Tt=`%PRECISION% varying vec4 vColor; varying vec4 vLine1; varying vec4 vLine2; varying vec4 vArc; varying float vType; varying float vTextureId; varying vec2 vTextureCoord; varying vec2 vTravel; uniform sampler2D uSamplers[%MAX_TEXTURES%]; %PIXEL_LINE% void main(void){ %PIXEL_COVERAGE% vec4 texColor; float textureId = floor(vTextureId+0.5); %FOR_LOOP% gl_FragColor = vColor * texColor * alpha; } `,Vt=[` float pixelLine(float x, float A, float B) { return clamp(x + 0.5, 0.0, 1.0); } `,` float pixelLine(float x, float A, float B) { float y = abs(x), s = sign(x); if (y * 2.0 < A - B) { return 0.5 + s * y / A; } y -= (A - B) * 0.5; y = max(1.0 - y / B, 0.0); return (1.0 + s * (1.0 - y * y)) * 0.5; //return clamp(x + 0.5, 0.0, 1.0); } `],Ht=`float alpha = 1.0; if (vType < 0.5) { float left = pixelLine(-vLine1.y - vLine1.x, vLine1.z, vLine1.w); float right = pixelLine(vLine1.y - vLine1.x, vLine1.z, vLine1.w); float near = vLine2.x - 0.5; float far = min(vLine2.x + 0.5, 0.0); float top = vLine2.y - 0.5; float bottom = min(vLine2.y + 0.5, 0.0); alpha = (right - left) * max(bottom - top, 0.0) * max(far - near, 0.0); } else if (vType < 1.5) { float a1 = pixelLine(- vLine1.y - vLine1.x, vLine1.z, vLine1.w); float a2 = pixelLine(vLine1.y - vLine1.x, vLine1.z, vLine1.w); float b1 = pixelLine(- vLine2.y - vLine2.x, vLine2.z, vLine2.w); float b2 = pixelLine(vLine2.y - vLine2.x, vLine2.z, vLine2.w); alpha = a2 * b2 - a1 * b1; } else if (vType < 2.5) { alpha *= max(min(vLine1.x + 0.5, 1.0), 0.0); alpha *= max(min(vLine1.y + 0.5, 1.0), 0.0); alpha *= max(min(vLine1.z + 0.5, 1.0), 0.0); } else if (vType < 3.5) { float a1 = pixelLine(- vLine1.y - vLine1.x, vLine1.z, vLine1.w); float a2 = pixelLine(vLine1.y - vLine1.x, vLine1.z, vLine1.w); float b1 = pixelLine(- vLine2.y - vLine2.x, vLine2.z, vLine2.w); float b2 = pixelLine(vLine2.y - vLine2.x, vLine2.z, vLine2.w); float alpha_miter = a2 * b2 - a1 * b1; float alpha_plane = clamp(vArc.z - vArc.x + 0.5, 0.0, 1.0); float d = length(vArc.xy); float circle_hor = max(min(vArc.w, d + 0.5) - max(-vArc.w, d - 0.5), 0.0); float circle_vert = min(vArc.w * 2.0, 1.0); float alpha_circle = circle_hor * circle_vert; alpha = min(alpha_miter, max(alpha_circle, alpha_plane)); } else { float a1 = pixelLine(- vLine1.y - vLine1.x, vLine1.z, vLine1.w); float a2 = pixelLine(vLine1.y - vLine1.x, vLine1.z, vLine1.w); float b1 = pixelLine(- vLine2.y - vLine2.x, vLine2.z, vLine2.w); float b2 = pixelLine(vLine2.y - vLine2.x, vLine2.z, vLine2.w); alpha = a2 * b2 - a1 * b1; alpha *= clamp(vArc.z + 0.5, 0.0, 1.0); } `;class z extends Pt{constructor(t,s=_t,e=Tt,r={}){s=z.generateVertexSrc(t,s),e=z.generateFragmentSrc(t,e);const{maxStyles:i,maxTextures:l}=t,a=new Int32Array(l);for(let c=0;c0&&(s+=` else `),e0&&n.alpha>0;return t?(n.matrix&&(n.matrix=n.matrix.clone(),n.matrix.invert()),Object.assign(this._lineStyle,{visible:t},n)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const n=this.currentPath.points,t=this.currentPath.points.length;t>2&&(this.drawShape(this.currentPath),this.currentPath=new it,this.currentPath.closeStroke=!1,this.currentPath.points.push(n[t-2],n[t-1]))}else this.currentPath=new it,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(n,t){return this.startPoly(),this.currentPath.points[0]=n,this.currentPath.points[1]=t,this}lineTo(n,t){this.currentPath||this.moveTo(0,0);const s=this.currentPath.points,e=s[s.length-2],r=s[s.length-1];return(e!==n||r!==t)&&s.push(n,t),this}_initCurve(n=0,t=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[n,t]):this.moveTo(n,t)}quadraticCurveTo(n,t,s,e){this._initCurve();const r=this.currentPath.points;return r.length===0&&this.moveTo(0,0),Gt.curveTo(n,t,s,e,r),this}bezierCurveTo(n,t,s,e,r,i){return this._initCurve(),Yt.curveTo(n,t,s,e,r,i,this.currentPath.points),this}arcTo(n,t,s,e,r){this._initCurve(n,t);const i=this.currentPath.points,l=Lt.curveTo(n,t,s,e,r,i);if(l){const{cx:a,cy:c,radius:p,startAngle:u,endAngle:o,anticlockwise:h}=l;this.arc(a,c,p,u,o,h)}return this}arc(n,t,s,e,r,i=!1){if(e===r)return this;if(!i&&r<=e?r+=pt:i&&e<=r&&(e+=pt),r-e===0)return this;const l=n+Math.cos(e)*s,a=t+Math.sin(e)*s,c=this._geometry.closePointEps;let p=this.currentPath?this.currentPath.points:null;if(p){const u=Math.abs(p[p.length-2]-l),o=Math.abs(p[p.length-1]-a);u0;return t?(n.matrix&&(n.matrix=n.matrix.clone(),n.matrix.invert()),Object.assign(this._fillStyle,{visible:t},n)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(n,t,s,e){return this.drawShape(new Dt(n,t,s,e))}drawRoundedRect(n,t,s,e,r){return this.drawShape(new wt(n,t,s,e,r))}drawCircle(n,t,s){return this.drawShape(new Ct(n,t,s))}drawEllipse(n,t,s,e){return this.drawShape(new Mt(n,t,s,e))}drawPolygon(...n){let t,s=!0;const e=n[0];e.points?(s=e.closeStroke,t=e.points):Array.isArray(n[0])?t=n[0]:t=n;const r=new it(t);return r.closeStroke=s,this.drawShape(r),this}drawShape(n){return this._holeMode?this._geometry.drawHole(n,this._matrix):this._geometry.drawShape(n,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const n=this._geometry.graphicsData;return n.length===1&&n[0].shape.type===P.RECT&&!n[0].matrix&&!n[0].holes.length&&!(n[0].lineStyle.visible&&n[0].lineStyle.width)}_renderCanvas(n){Wt.prototype._renderCanvas.call(this,n)}_render(n){this.finishPoly();const t=this._geometry,s=n.context.supports.uint32Indices;t.checkInstancing(n.geometry.hasInstance,s),t.updateBatches(this.shaderSettings),t.batchable?(this.batchDirty!==t.batchDirty&&this._populateBatches(),this._renderBatched(n)):(n.batch.flush(),this._renderDirect(n))}_populateBatches(){const n=this._geometry,t=this.blendMode,s=n.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=n.batchDirty,this.batches.length=s,this.vertexData=new Float32Array(n.points);for(let e=0;e 0.0) { float g = gap * vTravel.y; if (g > 0.0) { float t = mod(vTravel.x, d + g); alpha *= mix( min(0.5 * d + 0.5 - abs(t - 0.5 * d), 1.0), max(abs(t - 0.5 * g - d) - 0.5 * g + 0.5, 0.0), step(d, t) ); } } else { alpha = 0.0; } vec4 texColor; float textureId = floor(vTextureId+0.5); %FOR_LOOP% gl_FragColor = vColor * texColor * alpha; } `;class qt extends z{constructor(t){const s={maxStyles:16,maxTextures:1,pixelLine:1};super(s,void 0,Qt,t||{dash:8,gap:5})}}export{at as BATCH_POOL,nt as BatchDrawCall,xt as BatchPart,yt as BatchStyleArray,vt as BuildData,Z as CircleBuilder,W as DRAW_CALL_POOL,qt as DashLineShader,H as FILL_COMMANDS,Y as FillStyle,f as JOINT_TYPE,M as LINE_SCALE_MODE,et as LineStyle,rt as PolyBuilder,gt as RectangleBuilder,bt as RoundedRectangleBuilder,K as SegmentPacker,ht as SmoothGraphics,G as SmoothGraphicsData,lt as SmoothGraphicsGeometry,z as SmoothGraphicsShader,st as matrixEquals,k as settings}; //# sourceMappingURL=pixi-graphics-smooth.mjs.map