1/*! © 2011â2026 Georg Luif · georgluif.at · All rights reserved. */ 2import*as a from"./three.module.min.js";const f=64,et=.05,nt=.2,ot=.7;let G=null;function rt(){if(G)return G;const o=new a.MeshBasicMaterial({color:16777215,vertexColors:!0,transparent:!0,depthWrite:!1,side:a.DoubleSide});return o.onBeforeCompile=function(g){g.vertexShader=g.vertexShader.replace("#include <common>",["#include <common>","attribute vec3 aTangent;","attribute float aSide;","attribute float aWidth;","varying float vSide;"].join(` 3`)).replace("#include <project_vertex>",["vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );","vec3 tv = ( modelViewMatrix * vec4( aTangent, 0.0 ) ).xyz;","vec3 sd = cross( tv, mvPosition.xyz );","float sl = length( sd );","sd = sl > 1e-6 ? sd / sl : vec3( 0.0, 1.0, 0.0 );","mvPosition.xyz += sd * ( aSide * aWidth * 0.5 );","vSide = aSide;","gl_Position = projectionMatrix * mvPosition;"].join(` 4`)),g.fragmentShader=g.fragmentShader.replace("#include <common>",`#include <common> 5varying float vSide;`).replace("#include <color_fragment>",`#include <color_fragment> 6diffuseColor.a *= 1.0 - smoothstep( 0.55, 1.0, abs( vSide ) );`)},o.customProgramCacheKey=function(){return"wind-trail-1"},G=o,o}export function createWindTrail(o){o=o||{};const g=Math.max(1,Math.min(4,o.lines||2)),N=o.life||.6,q=o.width||.2,J=o.radius!=null?o.radius:.08,Q=o.grow!=null?o.grow:.55,Y=o.twist!=null?o.twist:2.2,Z=o.opacity!=null?o.opacity:.95,$=o.phase||0,H=new a.Color(o.color||"#ffffff"),T=new Float32Array(f),_=new Float32Array(f),W=new Float32Array(f),j=new Float32Array(f),C=new Float32Array(f),E=new Float32Array(f),D=new Float32Array(f),F=new Float32Array(f);let e=0,U=0;const V=f*2,P=g*V,z=new Float32Array(P*3),R=new Float32Array(P*3),X=new Float32Array(P),k=new Float32Array(P),I=new Float32Array(P*4);for(let n=0;n<P;n++)X[n]=n%2?1:-1;const M=new Uint16Array(g*(f-1)*6),l=new a.BufferGeometry;l.setAttribute("position",new a.BufferAttribute(z,3).setUsage(a.DynamicDrawUsage)),l.setAttribute("aTangent",new a.BufferAttribute(R,3).setUsage(a.DynamicDrawUsage)),l.setAttribute("aSide",new a.BufferAttribute(X,1)),l.setAttribute("aWidth",new a.BufferAttribute(k,1).setUsage(a.DynamicDrawUsage)),l.setAttribute("color",new a.BufferAttribute(I,4).setUsage(a.DynamicDrawUsage)),l.setIndex(new a.BufferAttribute(M,1).setUsage(a.DynamicDrawUsage)),l.setDrawRange(0,0);const L=new a.Mesh(l,rt());L.frustumCulled=!1,L.renderOrder=2;function K(n){if(!(n<=0)){if(n>=e){e=0;return}for(const m of[T,_,W,j,C,E,D,F])m.copyWithin(0,n,e);e-=n}}function O(n,m,s,d,p,A,t){e===f&&K(1);const r=Math.hypot(d,p,A)||1;T[e]=n,_[e]=m,W[e]=s,j[e]=d/r,C[e]=p/r,E[e]=A/r,D[e]=e?D[e-1]+Math.hypot(n-T[e-1],m-_[e-1],s-W[e-1]):0,F[e]=t,e+=1}const u=new Float32Array(f*3);function tt(){let n=0;for(;n<e&&U-F[n]>=N;)n++;if(K(n),e<2){l.setDrawRange(0,0);return}const m=D[e-1];let s=0;for(let d=0;d<g;d++){const p=$+d*Math.PI*2/g;for(let t=0;t<e;t++){const r=U-F[t],y=J+Q*r;let w=E[t],h=-j[t];const v=Math.hypot(w,h);v<1e-4?(w=1,h=0):(w/=v,h/=v);const x=C[t]*h,S=E[t]*w-j[t]*h,B=-C[t]*w,b=p+Y*D[t],c=Math.cos(b)*y,i=Math.sin(b)*y;u[t*3]=T[t]+w*c+x*i,u[t*3+1]=_[t]+S*i,u[t*3+2]=W[t]+h*c+B*i}const A=d*V;for(let t=0;t<e;t++){const r=t>0?t-1:t,y=t<e-1?t+1:t,w=u[y*3]-u[r*3],h=u[y*3+1]-u[r*3+1],v=u[y*3+2]-u[r*3+2],x=Math.min(1,(U-F[t])/N),S=Math.min(1,(m-D[t])/ot),B=Math.pow(1-x,1.4),b=q*Math.pow(1-x,.6)*(.25+.75*S);for(let c=0;c<2;c++){const i=A+t*2+c;z[i*3]=u[t*3],z[i*3+1]=u[t*3+1],z[i*3+2]=u[t*3+2],R[i*3]=w,R[i*3+1]=h,R[i*3+2]=v,k[i]=b,I[i*4]=H.r,I[i*4+1]=H.g,I[i*4+2]=H.b,I[i*4+3]=Z*B*S}}for(let t=0;t<e-1;t++){const r=A+t*2;M[s++]=r,M[s++]=r+1,M[s++]=r+2,M[s++]=r+1,M[s++]=r+3,M[s++]=r+2}}for(const d of["position","aTangent","aWidth","color"])l.attributes[d].needsUpdate=!0;l.index.needsUpdate=!0,l.setDrawRange(0,s)}return{object:L,push:function(n,m,s,d,p,A){if(!e){O(n,m,s,d,p,A,U);return}const t=T[e-1],r=_[e-1],y=W[e-1],w=Math.hypot(n-t,m-r,s-y);if(w<et)return;const h=Math.min(f,Math.ceil(w/nt)),v=F[e-1],x=j[e-1],S=C[e-1],B=E[e-1];for(let b=1;b<=h;b++){const c=b/h;O(t+(n-t)*c,r+(m-r)*c,y+(s-y)*c,x+(d-x)*c,S+(p-S)*c,B+(A-B)*c,v+(U-v)*c)}},update:function(n){U+=n,tt()}
6,alive:function(){return e>0},dispose:function(){l.dispose()}}}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.