1import{e as y,m as ze,S as be,W as Pe,G as Se,H as De,f as Re,R as T,b as ie,p as Ve,M as Ce,r as _e,s as B}from"./vendor-3d-BkmMqKqO.js";import{d as Me,w as Te,o as Be,f as Ue,t as qe,v as Fe,P as ne,x as Le,ah as He,c as h,r as O}from"./vendor-core-CUMhuV44.js";import{_ as Ae}from"./_plugin-vue_export-helper-DlAUqK2U.js";const Ie={class:"fixed inset-0 z-0 pointer-events-none overflow-hidden"},P=32,R=800,Ee=` 2 uniform float time; 3 uniform float delta; 4 5 void main() { 6 vec2 uv = gl_FragCoord.xy / resolution.xy; 7 vec4 tmpPos = texture2D( texturePosition, uv ); 8 vec3 position = tmpPos.xyz; 9 vec3 velocity = texture2D( textureVelocity, uv ).xyz; 10 11 float phase = tmpPos.w; 12 phase = mod( ( phase + delta + length( velocity.xz ) * delta * 3. + max( velocity.y, 0.0 ) * delta * 6. ), 62.83 ); 13 14 gl_FragColor = vec4( position + velocity * delta * 15. , phase ); 15 } 16`,ke=` 17 uniform float time; 18 uniform float testing; 19 uniform float delta; 20 uniform float separationDistance; 21 uniform float alignmentDistance; 22 uniform float cohesionDistance; 23 uniform float speedLimit; 24 uniform float freedomFactor; 25 uniform vec3 predator; 26 27 const float width = resolution.x; 28 const float height = resolution.y; 29 const float PI = 3.141592653589793; 30 const float PI_2 = PI * 2.0; 31 32 float zoneRadius = 40.0; 33 float zoneRadiusSquared = 1600.0; 34 float separationThresh = 0.45; 35 float alignmentThresh = 0.65; 36 37 const float UPPER_BOUNDS = BOUNDS; 38 const float LOWER_BOUNDS = -UPPER_BOUNDS; 39 40 float rand(vec2 co) { 41 return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); 42 } 43 44 void main() { 45 zoneRadius = separationDistance + alignmentDistance + cohesionDistance; 46 separationThresh = separationDistance / zoneRadius; 47 alignmentThresh = ( separationDistance + alignmentDistance ) / zoneRadius; 48 zoneRadiusSquared = zoneRadius * zoneRadius; 49 50 vec2 uv = gl_FragCoord.xy / resolution.xy; 51 vec3 birdPosition, birdVelocity; 52 53 vec3 selfPosition = texture2D( texturePosition, uv ).xyz; 54 vec3 selfVelocity = texture2D( textureVelocity, uv ).xyz; 55 56 float dist; 57 vec3 dir; 58 float distSquared; 59 60 float separationSquared = separationDistance * separationDistance; 61 float cohesionSquared = cohesionDistance * cohesionDistance; 62 63 float f; 64 float percent; 65 66 vec3 velocity = selfVelocity; 67 float limit = speedLimit; 68 69 dir = predator * UPPER_BOUNDS - selfPosition; 70 dir.z = 0.; 71 dist = length( dir ); 72 distSquared = dist * dist; 73 74 float preyRadius = 150.0; 75 float preyRadiusSq = preyRadius * preyRadius; 76 77 if (dist < preyRadius) { 78 f = ( distSquared / preyRadiusSq - 1.0 ) * delta * 100.; 79 velocity += normalize( dir ) * f; 80 limit += 5.0; 81 } 82 83 vec3 central = vec3( 0., 0., 0. ); 84 dir = selfPosition - central; 85 dist = length( dir ); 86 dir.y *= 2.5; 87 velocity -= normalize( dir ) * delta * 5.; 88 89 for (float y = 0.0; y < height; y++) { 90 for (float x = 0.0; x < width; x++) { 91 vec2 ref = vec2( x + 0.5, y + 0.5 ) / resolution.xy; 92 birdPosition = texture2D( texturePosition, ref ).xyz; 93 94 dir = birdPosition - selfPosition; 95 dist = length(dir); 96 97 if (dist < 0.0001) continue; 98 99 distSquared = dist * dist; 100 101 if (distSquared > zoneRadiusSquared ) continue; 102 103 percent = distSquared / zoneRadiusSquared; 104 105 if ( percent < separationThresh ) { 106 f = (separationThresh / percent - 1.0) * delta; 107 velocity -= normalize(dir) * f; 108 } else if ( percent < alignmentThresh ) { 109 float threshDelta = alignmentThresh - separationThresh; 110 float adjustedPercent = ( percent - separationThresh ) / threshDelta; 111 birdVelocity = texture2D( textureVelocity, ref ).xyz; 112 f = ( 0.5 - cos( adjustedPercent * PI_2 ) * 0.5 + 0.5 ) * delta; 113 velocity += normalize(birdVelocity) * f; 114 } else { 115 float threshDelta = 1.0 - alignmentThresh; 116 float adjustedPercent = ( percent - alignmentThresh ) / threshDelta; 117 f = ( 0.5 - ( cos( adjustedPercent * PI_2 ) * -0.5 + 0.5 ) ) * delta; 118 velocity += normalize(dir) * f; 119 } 120 } 121 } 122 123 if ( length( velocity ) > limit ) { 124 velocity = normalize( velocity ) * limit; 125 } 126 127 gl_FragColor = vec4( velocity, 1.0 ); 128 } 129`,We=` 130 attribute vec2 reference; 131 attribute float birdVertex; 132 attribute vec3 birdColor; 133 134 uniform sampler2D texturePosition; 135 uniform sampler2D textureVelocity; 136 137 varying vec4 vColor; 138 varying float z; 139 140 uniform float time; 141 uniform float birdSize; 142 143 void main() { 144 vec4 tmpPos = texture2D( texturePosition, reference ); 145 vec3 pos = tmpPos.xyz; 146 vec3 velocity = normalize(texture2D( textureVelocity, reference ).xyz); 147 148 vec3 newPosition = position; 149 150 if ( birdVertex == 4.0 || birdVertex == 7.0 ) { 151 newPosition.y = sin( tmpPos.w ) * 5. * birdSize; 152 } 153 154 newPosition = mat3( modelMatrix ) * newPosition; 155 156 velocity.z *= -1.; 157 float xz = length( velocity.xz ); 158 float xyz = 1.; 159 float x = sqrt( 1. - velocity.y * velocity.y ); 160 161 float cosry = velocity.x / xz; 162 float sinry = velocity.z / xz; 163 164 float cosrz = x / xyz; 165 float sinrz = velocity.y / xyz; 166 167 mat3 maty = mat3( 168 cosry, 0, -sinry, 169 0 , 1, 0 , 170 sinry, 0, cosry 171 ); 172 173 mat3 matz = mat3( 174 cosrz , sinrz, 0,
175 -sinrz, cosrz, 0, 176 0 , 0 , 1 177 ); 178 179 newPosition = maty * matz * newPosition; 180 newPosition += pos; 181 z = newPosition.z; 182 183 vColor = vec4( birdColor, 1.0 ); 184 gl_Position = projectionMatrix * viewMatrix * vec4( newPosition, 1.0 ); 185 } 186`,Ge=` 187 varying vec4 vColor; 188 varying float z; 189 190 void main() { 191 gl_FragColor = vec4( vColor.rgb, 1. ); 192 } 193`,Ne=Me({__name:"SkyBirdsBackground",props:{color1:{},color2:{},color3:{},birdCount:{}},setup(re){const S=re,U=h(()=>S.color1||"#39b5e8"),V=h(()=>S.color2||"#dba0c8"),j=h(()=>S.color3||"#c87080"),$=h(()=>{const t=S.birdCount??200;return Math.max(0,Math.min(500,t))}),ae=h(()=>{const t=new y(U.value),e=new y(V.value);return"#"+t.clone().lerp(e,.25).getHexString()}),le=h(()=>{const t=new y(U.value),e=new y(V.value);return"#"+t.clone().lerp(e,.5).getHexString()}),se=h(()=>{const t=new y(V.value),e=new y(j.value);return"#"+t.clone().lerp(e,.5).getHexString()}),C=O(null);let u=null,f=null,r=null,n=null,c=null,v=null,D=null,a=null,w=null,l=null,_=null,X=performance.now();const q=O(1e4),F=O(1e4);let L=window.innerWidth/2,H=window.innerHeight/2;const A=R/2;let I=S.birdCount??200;const s={color1:"turquoise",color2:"#aaaaaa",colorMode:"lerpGradient",separation:21,alignment:20,cohesion:20,freedom:.75,speedLimit:10,birdSize:1,wingSpan:20};class de extends _e{constructor(e){super();const o=3,g=e*o,m=g*3,z=new B(new Float32Array(m*3),3),p=new B(new Float32Array(m*3),3),E=new B(new Float32Array(m*2),2),Z=new B(new Float32Array(m),1);this.setAttribute("position",z),this.setAttribute("birdColor",p),this.setAttribute("reference",E),this.setAttribute("birdVertex",Z);let pe=0;const ee=s.wingSpan,d=s.birdSize;function k(...i){for(let M=0;M<i.length;M++)z.array[pe++]=i[M]}for(let i=0;i<e;i++)k(0,0,-20*d,0,4*d,-20*d,0,0,30*d),k(0,0,-15*d,-ee*d,0,0,0,0,15*d),k(0,0,15*d,ee*d,0,0,0,0,-15*d);const ye=new y(s.color1),he=new y(s.color2),W={};for(let i=0;i<g*3;i++){const te=~~(~~(i/3)/o),we=te%P/P,xe=~~(te/P)/P,oe=~~(i/9)/e,G=oe.toString(),N=s.colorMode.indexOf("Gradient")!==-1;let b;const ge=N?Math.random():oe;!N&&W[G]?b=W[G]:(b=ye.clone().lerp(he,ge),N||(W[G]=b)),p.array[i*3+0]=b.r,p.array[i*3+1]=b.g,p.array[i*3+2]=b.b,E.array[i*2]=we,E.array[i*2+1]=xe,Z.array[i]=i%9}this.scale(.2,.2,.2)}}function ce(t){const e=t.image.data;for(let o=0,g=e.length;o<g;o+=4){const m=Math.random()*R-A,z=Math.random()*R-A,p=Math.random()*R-A;e[o+0]=m,e[o+1]=z,e[o+2]=p,e[o+3]=1}}function ue(t){const e=t.image.data;for(let o=0,g=e.length;o<g;o+=4){const m=Math.random()-.5,z=Math.random()-.5,p=Math.random()-.5;e[o+0]=m*10,e[o+1]=z*10,e[o+2]=p*10,e[o+3]=1}}function fe(){if(!r)return;n=new Se(P,P,r),r.capabilities.isWebGL2||n.setDataType(De);const t=n.createTexture(),e=n.createTexture();ce(t),ue(e),c=n.addVariable("textureVelocity",ke,e),v=n.addVariable("texturePosition",Ee,t),n.setVariableDependencies(c,[v,c]),n.setVariableDependencies(v,[v,c]),D=v.material.uniforms,a=c.material.uniforms,D.time={value:0},D.delta={value:0},a.time={value:1},a.delta={value:0},a.testing={value:1},a.separationDistance={value:s.separation},a.alignmentDistance={value:s.alignment},a.cohesionDistance={value:s.cohesion},a.freedomFactor={value:s.freedom},a.speedLimit={value:s.speedLimit},a.predator={value:new Re},c.material.defines.BOUNDS=R.toFixed(2),c.wrapS=T,c.wrapT=T,v.wrapS=T,v.wrapT=T;const o=n.init();o!==null&&console.error("GPUComputationRenderer error:",o)}function ve(){if(!f)return;const t=new de(I);w={birdSize:{value:s.birdSize},texturePosition:{value:null},textureVelocity:{value:null},time:{value:1},delta:{value:0}};const e=new ie({uniforms:w,vertexShader:We,fragmentShader:Ge,side:Ve});l=new Ce(t,e),l.rotation.y=Math.PI/2,l.matrixAutoUpdate=!1,l.updateMatrix(),f.add(l)}function Y(){_&&(cancelAnimationFrame(_),_=null),l&&f&&(f.remove(l),l.geometry.dispose(),l.material instanceof ie&&l.material.dispose(),l=null),n&&(n.dispose(),n=null),r&&(r.dispose(),r=null),f=null,u=null}function K(){C.value&&(I=$.value,I!==0&&(u=new ze(75,window.innerWidth/window.innerHeight,1,3e3),u.position.z=350,f=new be,r=new Pe({canvas:C.value,alpha:!0,antialias:!0}),r.setPixelRatio(Math.min(window.devicePixelRatio,2)),r.setSize(window.innerWidth,window.innerHeight),fe(),ve(),J()))}function J(){_=requestAnimationFrame(J),me()}function me(){if(!r||!f||!u||!n)return;const t=performance.now();let e=(t-X)/1e3;e>1&&(e=1),X=t,D.time.value=t,D.delta.value=e,a.time.value=t,a.delta.value=e,w.time.value=t,w.delta.value=e,a.predator.value.set(.5*q.value/L,-.5*F.value/H,0),q.value=1e4,F.value=1e4,n.compute(),w.texturePosition.value=n.getCurrentRenderTarget(v).texture,w.textureVelocity.value=n.getCurrentRenderTarget(c).texture,r.render(f,u)}
193function Q(){!r||!u||(L=window.innerWidth/2,H=window.innerHeight/2,u.aspect=window.innerWidth/window.innerHeight,u.updateProjectionMatrix(),r.setSize(window.innerWidth,window.innerHeight))}function x(t){let e,o;if("touches"in t){if(!t.touches[0])return;e=t.touches[0].clientX,o=t.touches[0].clientY}else{if(t.isPrimary===!1)return;e=t.clientX,o=t.clientY}q.value=e-L,F.value=o-H}return Te($,()=>{C.value&&(Y(),K())}),Be(()=>{K(),window.addEventListener("resize",Q),window.addEventListener("pointermove",x),window.addEventListener("pointerdown",x),window.addEventListener("touchmove",x,{passive:!0})}),Ue(()=>{window.removeEventListener("resize",Q),window.removeEventListener("pointermove",x),window.removeEventListener("pointerdown",x),window.removeEventListener("touchmove",x),Y()}),(t,e)=>(qe(),Fe("div",Ie,[ne("div",{class:"absolute inset-0 sky-gradient",style:Le({background:`linear-gradient(to bottom, ${U.value} 0%, ${ae.value} 20%, ${le.value} 40%, ${se.value} 60%, ${V.value} 80%, ${j.value} 100%)`})},null,4),e[0]||(e[0]=He('<div class="cloud-container" data-v-ad3e08d4><div id="cloud_layer1" class="cloud-layer-wrap" data-v-ad3e08d4><div class="cloud-pseudo cloud-before" data-v-ad3e08d4></div><div class="cloud-pseudo cloud-after" data-v-ad3e08d4></div></div><div id="cloud_layer2" class="cloud-layer-wrap" data-v-ad3e08d4><div class="cloud-pseudo cloud-before cloud-alt" data-v-ad3e08d4></div><div class="cloud-pseudo cloud-after cloud-alt" data-v-ad3e08d4></div></div></div>',1)),ne("canvas",{ref_key:"canvasRef",ref:C,class:"absolute inset-0 w-full h-full"},null,512)]))}}),Xe=Ae(Ne,[["__scopeId","data-v-ad3e08d4"]]);export{Xe as default};
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.