Your IP : 18.217.142.228


Current Path : /usr/local/mgr5/skins/dragon/
Upload File :
Current File : //usr/local/mgr5/skins/dragon/chunk-GPVRX5F6.js

import{b as l,d as v,f as h,h as p,j as d,k as f,m as g,n as w,o as y,q as t,s as S}from"./chunk-QEZ4NZOC.js";import"./chunk-O3MRBEHJ.js";import"./chunk-ERDNNTNA.js";var z=`varying vec2 vUv;

uniform vec3 uColor;
uniform float uProgress;

void main() {
  float progress = smoothstep(0.0, 1.0, uProgress + 0.25);

  float strength = vUv.x;
  float squeeze = 40.0;

  strength *= squeeze;
  progress *= squeeze;

  float alpha = clamp(progress - strength, 0.0, 1.0);
  alpha *= smoothstep(1.0, 0.09, vUv.x);
  alpha *= 0.7;

  gl_FragColor = vec4(uColor.rgb, alpha);

  #include <colorspace_fragment>
}
`;var A=`varying vec2 vUv;

uniform float uTime;

uniform float uNoiseSpeedX;
uniform float uNoiseSpeedZ;
uniform vec2 uNoiseScale;
uniform float uNoiseAmplitude;

//
// Description : Array and textureless GLSL 2D simplex noise function.
//      Author : Ian McEwan, Ashima Arts.
//  Maintainer : stegu
//     Lastmod : 20110822 (ijm)
//     License : Copyright (C) 2011 Ashima Arts. All rights reserved.
//               Distributed under the MIT License. See LICENSE file.
//               https://github.com/ashima/webgl-noise
//               https://github.com/stegu/webgl-noise
//

vec3 mod289(vec3 x) {
  return x - floor(x * (1.0 / 289.0)) * 289.0;
}

vec2 mod289(vec2 x) {
  return x - floor(x * (1.0 / 289.0)) * 289.0;
}

vec3 permute(vec3 x) {
  return mod289(((x*34.0)+10.0)*x);
}

float snoise(vec2 v)
  {
  const vec4 C = vec4(0.211324865405187,  // (3.0-sqrt(3.0))/6.0
                      0.366025403784439,  // 0.5*(sqrt(3.0)-1.0)
                     -0.577350269189626,  // -1.0 + 2.0 * C.x
                      0.024390243902439); // 1.0 / 41.0
// First corner
  vec2 i  = floor(v + dot(v, C.yy) );
  vec2 x0 = v -   i + dot(i, C.xx);

// Other corners
  vec2 i1;
  //i1.x = step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0
  //i1.y = 1.0 - i1.x;
  i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
  // x0 = x0 - 0.0 + 0.0 * C.xx ;
  // x1 = x0 - i1 + 1.0 * C.xx ;
  // x2 = x0 - 1.0 + 2.0 * C.xx ;
  vec4 x12 = x0.xyxy + C.xxzz;
  x12.xy -= i1;

// Permutations
  i = mod289(i); // Avoid truncation effects in permutation
  vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 ))
		+ i.x + vec3(0.0, i1.x, 1.0 ));

  vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);
  m = m*m ;
  m = m*m ;

// Gradients: 41 points uniformly over a line, mapped onto a diamond.
// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)

  vec3 x = 2.0 * fract(p * C.www) - 1.0;
  vec3 h = abs(x) - 0.5;
  vec3 ox = floor(x + 0.5);
  vec3 a0 = x - ox;

// Normalise gradients implicitly by scaling m
// Approximation of: m *= inversesqrt( a0*a0 + h*h );
  m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );

// Compute final noise value at P
  vec3 g;
  g.x  = a0.x  * x0.x  + h.x  * x0.y;
  g.yz = a0.yz * x12.xz + h.yz * x12.yw;
  return 130.0 * dot(m, g);
}

void main() {
  vUv = uv;

  vec3 newPosition = position;

  vec2 coord = uv * uNoiseScale + vec2(X_OFFSET, Z_OFFSET) + uTime * vec2(uNoiseSpeedX, uNoiseSpeedZ);

  newPosition.y += snoise(coord) * uNoiseAmplitude;

  gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(newPosition, 1.0);
}
`;var C=class extends S{constructor(e,r,s){super(e,r,s);let{width:n,height:a,pixelRatio:o}=this.sizes;this.renderer=new g({canvas:this.canvas,antialias:!0,alpha:!0}),this.renderer.setSize(n,a),this.renderer.setPixelRatio(o),this.scene=new w,this.camera=new f(20,n/a,1,5e3),this.camera.position.set(-580,141,281),this.camera.rotation.set(-.57,-1.06,-.51),this.init()}init(){this.initMaterial(),this.initLines(),this.animateProgress(e=>e),this.playing?this.playAnimation():this.renderImage()}initMaterial(){this.material=new d({transparent:!0,defines:{X_OFFSET:Math.random()*10,Z_OFFSET:Math.random()*10},uniforms:{uTime:new t(0),uProgress:new t(1),uColor:new t(new v("#80A6FF")),uNoiseSpeedX:new t(.0241),uNoiseSpeedZ:new t(.0098),uNoiseScale:new t(new l(3.5,1.6)),uNoiseAmplitude:new t(50)},vertexShader:A,fragmentShader:z})}initLines(){this.scene.clear();let{width:e,height:r}=this.sizes,s=Math.sqrt(e*e+r*r),n=100,a=1.5,o=150;for(let c=0;c<n;c++){let m=new Float32Array(o*3),x=new Float32Array(o*2),P=c*a;for(let i=0;i<o;i++)m[i*3+0]=s/o*i-s/2,m[i*3+1]=0,m[i*3+2]=P,x[i*2+0]=i/(o-1),x[i*2+1]=c/(n-1);let u=new p;u.setAttribute("position",new h(m,3)),u.setAttribute("uv",new h(x,2)),this.scene.add(new y(u,this.material))}}resize(){let{width:e,height:r,pixelRatio:s}=this.sizes;this.camera.aspect=e/r,this.camera.updateProjectionMatrix(),this.renderer.setSize(e,r),this.renderer.setPixelRatio(s)}progress(e){this.material.uniforms.uProgress.value=e}tick(e){this.material.uniforms.uTime.value=e,this.renderer.render(this.scene,this.camera)}changeScheme(){}};export{C as LinesRenderer};