enable React Compiler, add linter

This commit is contained in:
Brian Beck 2025-12-29 20:02:54 -08:00
parent f0e34caa25
commit 0c6aa3b4dd
59 changed files with 5802 additions and 1831 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,75 +0,0 @@
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,63724,e=>{"use strict";var r=e.i(43476),o=e.i(71645),t=e.i(47071),a=e.i(49774),l=e.i(90072),i=e.i(62395),n=e.i(12979),u=e.i(79123),s=e.i(6112);let c=`
#include <fog_pars_vertex>
varying vec2 vUv;
void main() {
vUv = uv;
vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
gl_Position = projectionMatrix * mvPosition;
#include <fog_vertex>
}
`,f=`
#include <fog_pars_fragment>
uniform sampler2D frame0;
uniform sampler2D frame1;
uniform sampler2D frame2;
uniform sampler2D frame3;
uniform sampler2D frame4;
uniform int currentFrame;
uniform float vScroll;
uniform vec2 uvScale;
uniform vec3 tintColor;
uniform float opacity;
uniform float opacityFactor;
varying vec2 vUv;
void main() {
// Scale and scroll UVs
vec2 scrolledUv = vec2(vUv.x * uvScale.x, vUv.y * uvScale.y + vScroll);
// Sample the current frame
vec4 texColor;
if (currentFrame == 0) {
texColor = texture2D(frame0, scrolledUv);
} else if (currentFrame == 1) {
texColor = texture2D(frame1, scrolledUv);
} else if (currentFrame == 2) {
texColor = texture2D(frame2, scrolledUv);
} else if (currentFrame == 3) {
texColor = texture2D(frame3, scrolledUv);
} else {
texColor = texture2D(frame4, scrolledUv);
}
// Tribes 2 GL_MODULATE: output = texture * vertexColor
// No gamma correction - textures use NoColorSpace and values pass through
// directly to display, matching how WaterBlock handles sRGB textures.
vec3 modulatedColor = texColor.rgb * tintColor;
float adjustedOpacity = opacity * opacityFactor;
gl_FragColor = vec4(modulatedColor, adjustedOpacity);
// Custom fog for additive blending: fade out rather than blend to fog color.
// Standard fog (mix toward fogColor) doesn't work with additive blending
// because we'd still be adding fogColor to the framebuffer.
// Uses Torque's quadratic haze formula for consistency.
#ifdef USE_FOG
float dist = vFogDepth;
float fogFactor = 0.0;
if (dist > fogNear) {
if (dist >= fogFar) {
fogFactor = 1.0;
} else {
float fogScale = 1.0 / (fogFar - fogNear);
float distFactor = (dist - fogNear) * fogScale - 1.0;
fogFactor = 1.0 - distFactor * distFactor;
}
}
gl_FragColor.a *= 1.0 - fogFactor;
#endif
}
`;function m(e){let r=(0,o.useMemo)(()=>{let[r,o,t]=e,a=new l.BoxGeometry(r,o,t);return a.translate(r/2,o/2,t/2),a},[e]);return(0,o.useEffect)(()=>()=>r.dispose(),[r]),r}function d({scale:e,color:i,baseTranslucency:n,textureUrls:s,numFrames:d,framesPerSec:p,scrollSpeed:v,umapping:g,vmapping:F}){let{animationEnabled:x}=(0,u.useSettings)(),y=m(e),S=(0,t.useTexture)(s,e=>{e.forEach(e=>{e.wrapS=e.wrapT=l.RepeatWrapping,e.colorSpace=l.NoColorSpace,e.flipY=!1,e.needsUpdate=!0})}),h=(0,o.useMemo)(()=>(function({textures:e,scale:r,umapping:o,vmapping:t,color:a,baseTranslucency:i}){let n=[...r].sort((e,r)=>r-e),u=new l.Vector2(n[0]*o,n[1]*t),s=e[0];return new l.ShaderMaterial({uniforms:{frame0:{value:s},frame1:{value:e[1]??s},frame2:{value:e[2]??s},frame3:{value:e[3]??s},frame4:{value:e[4]??s},currentFrame:{value:0},vScroll:{value:0},uvScale:{value:u},tintColor:{value:new l.Color(...a)},opacity:{value:i},opacityFactor:{value:1},fogColor:{value:new l.Color},fogNear:{value:1},fogFar:{value:2e3}},vertexShader:c,fragmentShader:f,transparent:!0,blending:l.AdditiveBlending,side:l.DoubleSide,depthWrite:!1,fog:!0})})({textures:S,scale:e,umapping:g,vmapping:F,color:i,baseTranslucency:n}),[S,e,g,F,i,n]);(0,o.useEffect)(()=>()=>h.dispose(),[h]);let C=(0,o.useRef)(0);return(0,a.useFrame)((e,r)=>{if(!x){C.current=0,h.uniforms.currentFrame.value=0,h.uniforms.vScroll.value=0;return}C.current+=r,h.uniforms.currentFrame.value=Math.floor(C.current*p)%d,h.uniforms.vScroll.value=C.current*v}),(0,r.jsx)("mesh",{geometry:y,material:h,renderOrder:1})}function p({scale:e,color:t,baseTranslucency:a}){let i=m(e),n=(0,o.useMemo)(()=>new l.Color(t[0],t[1],t[2]),[t]);return(0,r.jsx)("mesh",{geometry:i,renderOrder:1,children:(0,r.jsx)("meshBasicMaterial",{color:n,transparent:!0,opacity:+a,blending:l.AdditiveBlending,side:l.DoubleSide,depthWrite:!1,fog:!1})})}let v=(0,o.memo)(function({object:e}){let t=(0,o.useMemo)(()=>(0,i.getPosition)(e),[e]),a=(0,o.useMemo)(()=>(0,i.getRotation)(e),[e]),l=(0,o.useMemo)(()=>(0,i.getScale)(e),[e]),u=(0,s.useDatablock)((0,i.getProperty)(e,"dataBlock")),c=(0,i.getProperty)(u,"color"),f=(0,o.useMemo)(()=>{let e;return c?[(e=c.split(" ").map(e=>parseFloat(e)))[0]??0,e[1]??0,e[2]??0]:[1,1,1]},[c]),m=parseFloat((0,i.getProperty)(u,"baseTranslucency"))||1,v=parseInt((0,i.getProperty)(u,"numFrames"),10)||1,g=parseFloat((0,i.getProperty)(u,"framesPerSec"))||1,F=parseFloat((0,i.getProperty)(u,"scrollSpeed"))||0,x=parseFloat((0,i.getProperty)(u,"umapping"))||1,y=parseFloat((0,i.getProperty)(u,"vmapping"))||1,S=(0,o.useMemo)(()=>(function(e,r){let o=[];for(let t=0;t<r;t++){let r=(0,i.getProperty)(e,`texture${t}`);r&&o.push((0,n.textureToUrl)(r))}return o})(u,v),[u,v]);return 0===S.length?null:(0,r.jsx)("group",{position:t,quaternion:a,children:(0,r.jsx)(o.Suspense,{fallback:(0,r.jsx)(p,{scale:l,color:f,baseTranslucency:m}),children:(0,r.jsx)(d,{scale:l,color:f,baseTranslucency:m,textureUrls:S,numFrames:v,framesPerSec:g,scrollSpeed:F,umapping:x,vmapping:y})})})});e.s(["ForceFieldBare",0,v],63724)}]);

View file

@ -0,0 +1,75 @@
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,63724,e=>{"use strict";var r=e.i(43476),t=e.i(932),o=e.i(71645),a=e.i(47071),l=e.i(49774),i=e.i(90072),n=e.i(62395),c=e.i(12979),s=e.i(79123),u=e.i(6112);let f=`
#include <fog_pars_vertex>
varying vec2 vUv;
void main() {
vUv = uv;
vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
gl_Position = projectionMatrix * mvPosition;
#include <fog_vertex>
}
`,m=`
#include <fog_pars_fragment>
uniform sampler2D frame0;
uniform sampler2D frame1;
uniform sampler2D frame2;
uniform sampler2D frame3;
uniform sampler2D frame4;
uniform int currentFrame;
uniform float vScroll;
uniform vec2 uvScale;
uniform vec3 tintColor;
uniform float opacity;
uniform float opacityFactor;
varying vec2 vUv;
void main() {
// Scale and scroll UVs
vec2 scrolledUv = vec2(vUv.x * uvScale.x, vUv.y * uvScale.y + vScroll);
// Sample the current frame
vec4 texColor;
if (currentFrame == 0) {
texColor = texture2D(frame0, scrolledUv);
} else if (currentFrame == 1) {
texColor = texture2D(frame1, scrolledUv);
} else if (currentFrame == 2) {
texColor = texture2D(frame2, scrolledUv);
} else if (currentFrame == 3) {
texColor = texture2D(frame3, scrolledUv);
} else {
texColor = texture2D(frame4, scrolledUv);
}
// Tribes 2 GL_MODULATE: output = texture * vertexColor
// No gamma correction - textures use NoColorSpace and values pass through
// directly to display, matching how WaterBlock handles sRGB textures.
vec3 modulatedColor = texColor.rgb * tintColor;
float adjustedOpacity = opacity * opacityFactor;
gl_FragColor = vec4(modulatedColor, adjustedOpacity);
// Custom fog for additive blending: fade out rather than blend to fog color.
// Standard fog (mix toward fogColor) doesn't work with additive blending
// because we'd still be adding fogColor to the framebuffer.
// Uses Torque's quadratic haze formula for consistency.
#ifdef USE_FOG
float dist = vFogDepth;
float fogFactor = 0.0;
if (dist > fogNear) {
if (dist >= fogFar) {
fogFactor = 1.0;
} else {
float fogScale = 1.0 / (fogFar - fogNear);
float distFactor = (dist - fogNear) * fogScale - 1.0;
fogFactor = 1.0 - distFactor * distFactor;
}
}
gl_FragColor.a *= 1.0 - fogFactor;
#endif
}
`;function d(e){let r,a,l,n=(0,t.c)(7),[c,s,u]=e;n[0]!==c||n[1]!==s||n[2]!==u?((r=new i.BoxGeometry(c,s,u)).translate(c/2,s/2,u/2),n[0]=c,n[1]=s,n[2]=u,n[3]=r):r=n[3];let f=r;return n[4]!==f?(a=()=>()=>f.dispose(),l=[f],n[4]=f,n[5]=a,n[6]=l):(a=n[5],l=n[6]),(0,o.useEffect)(a,l),f}function p({scale:e,color:t,baseTranslucency:n,textureUrls:c,numFrames:u,framesPerSec:p,scrollSpeed:v,umapping:g,vmapping:x}){let{animationEnabled:F}=(0,s.useSettings)(),y=d(e),S=(0,a.useTexture)(c,e=>{e.forEach(e=>{e.wrapS=e.wrapT=i.RepeatWrapping,e.colorSpace=i.NoColorSpace,e.flipY=!1,e.needsUpdate=!0})}),h=(0,o.useMemo)(()=>(function({textures:e,scale:r,umapping:t,vmapping:o,color:a,baseTranslucency:l}){let n=[...r].sort((e,r)=>r-e),c=new i.Vector2(n[0]*t,n[1]*o),s=e[0];return new i.ShaderMaterial({uniforms:{frame0:{value:s},frame1:{value:e[1]??s},frame2:{value:e[2]??s},frame3:{value:e[3]??s},frame4:{value:e[4]??s},currentFrame:{value:0},vScroll:{value:0},uvScale:{value:c},tintColor:{value:new i.Color(...a)},opacity:{value:l},opacityFactor:{value:1},fogColor:{value:new i.Color},fogNear:{value:1},fogFar:{value:2e3}},vertexShader:f,fragmentShader:m,transparent:!0,blending:i.AdditiveBlending,side:i.DoubleSide,depthWrite:!1,fog:!0})})({textures:S,scale:e,umapping:g,vmapping:x,color:t,baseTranslucency:n}),[S,e,g,x,t,n]);(0,o.useEffect)(()=>()=>h.dispose(),[h]);let C=(0,o.useRef)(0);return(0,l.useFrame)((e,r)=>{if(!F){C.current=0,h.uniforms.currentFrame.value=0,h.uniforms.vScroll.value=0;return}C.current+=r,h.uniforms.currentFrame.value=Math.floor(C.current*p)%u,h.uniforms.vScroll.value=C.current*v}),(0,r.jsx)("mesh",{geometry:y,material:h,renderOrder:1})}function v(e){let o,a,l,n=(0,t.c)(10),{scale:c,color:s,baseTranslucency:u}=e,f=d(c);n[0]!==s[0]||n[1]!==s[1]||n[2]!==s[2]?(o=new i.Color(s[0],s[1],s[2]),n[0]=s[0],n[1]=s[1],n[2]=s[2],n[3]=o):o=n[3];let m=o,p=+u;return n[4]!==m||n[5]!==p?(a=(0,r.jsx)("meshBasicMaterial",{color:m,transparent:!0,opacity:p,blending:i.AdditiveBlending,side:i.DoubleSide,depthWrite:!1,fog:!1}),n[4]=m,n[5]=p,n[6]=a):a=n[6],n[7]!==f||n[8]!==a?(l=(0,r.jsx)("mesh",{geometry:f,renderOrder:1,children:a}),n[7]=f,n[8]=a,n[9]=l):l=n[9],l}let g=(0,o.memo)(function(e){let a,l,i,s,f,m,d,g,x,F,y,S,h,C,b,U,P,D=(0,t.c)(48),{object:w}=e;D[0]!==w?(a=(0,n.getPosition)(w),D[0]=w,D[1]=a):a=D[1];let T=a;D[2]!==w?(l=(0,n.getRotation)(w),D[2]=w,D[3]=l):l=D[3];let j=l;D[4]!==w?(i=(0,n.getScale)(w),D[4]=w,D[5]=i):i=D[5];let B=i;D[6]!==w?(s=(0,n.getProperty)(w,"dataBlock"),D[6]=w,D[7]=s):s=D[7];let _=(0,u.useDatablock)(s);D[8]!==_?(f=(0,n.getProperty)(_,"color"),D[8]=_,D[9]=f):f=D[9];let O=f;if(D[10]!==O){let e;m=O?[(e=O.split(" ").map(e=>parseFloat(e)))[0]??0,e[1]??0,e[2]??0]:[1,1,1],D[10]=O,D[11]=m}else m=D[11];let M=m;D[12]!==_?(d=parseFloat((0,n.getProperty)(_,"baseTranslucency"))||1,D[12]=_,D[13]=d):d=D[13];let N=d;D[14]!==_?(g=parseInt((0,n.getProperty)(_,"numFrames"),10)||1,D[14]=_,D[15]=g):g=D[15];let R=g;D[16]!==_?(x=parseFloat((0,n.getProperty)(_,"framesPerSec"))||1,D[16]=_,D[17]=x):x=D[17];let k=x;D[18]!==_?(F=parseFloat((0,n.getProperty)(_,"scrollSpeed"))||0,D[18]=_,D[19]=F):F=D[19];let A=F;D[20]!==_?(y=parseFloat((0,n.getProperty)(_,"umapping"))||1,D[20]=_,D[21]=y):y=D[21];let E=y;D[22]!==_?(S=parseFloat((0,n.getProperty)(_,"vmapping"))||1,D[22]=_,D[23]=S):S=D[23];let G=S;D[24]!==_||D[25]!==R?(h=function(e,r){let t=[];for(let o=0;o<r;o++){let r=(0,n.getProperty)(e,`texture${o}`);r&&t.push((0,c.textureToUrl)(r))}return t}(_,R),D[24]=_,D[25]=R,D[26]=h):h=D[26];let W=h;return 0===W.length?null:(D[27]!==N||D[28]!==M||D[29]!==B?(C=(0,r.jsx)(v,{scale:B,color:M,baseTranslucency:N}),D[27]=N,D[28]=M,D[29]=B,D[30]=C):C=D[30],D[31]!==N||D[32]!==M||D[33]!==k||D[34]!==R||D[35]!==B||D[36]!==A||D[37]!==W||D[38]!==E||D[39]!==G?(b=(0,r.jsx)(p,{scale:B,color:M,baseTranslucency:N,textureUrls:W,numFrames:R,framesPerSec:k,scrollSpeed:A,umapping:E,vmapping:G}),D[31]=N,D[32]=M,D[33]=k,D[34]=R,D[35]=B,D[36]=A,D[37]=W,D[38]=E,D[39]=G,D[40]=b):b=D[40],D[41]!==C||D[42]!==b?(U=(0,r.jsx)(o.Suspense,{fallback:C,children:b}),D[41]=C,D[42]=b,D[43]=U):U=D[43],D[44]!==T||D[45]!==j||D[46]!==U?(P=(0,r.jsx)("group",{position:T,quaternion:j,children:U}),D[44]=T,D[45]=j,D[46]=U,D[47]=P):P=D[47],P)});e.s(["ForceFieldBare",0,g],63724)}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,166 +0,0 @@
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,42585,e=>{"use strict";var t=e.i(43476),a=e.i(71645),r=e.i(31067),o=e.i(90072);let i=a.forwardRef(({args:e,children:t,...o},i)=>{let n=a.useRef(null);return a.useImperativeHandle(i,()=>n.current),a.useLayoutEffect(()=>void 0),a.createElement("mesh",(0,r.default)({ref:n},o),a.createElement("boxGeometry",{attach:"geometry",args:e}),t)});var n=e.i(47071),l=e.i(49774),s=e.i(73949),u=e.i(12979),c=e.i(62395),f=e.i(75567),v=e.i(48066),d=e.i(47021);let m=`
#include <fog_pars_vertex>
#ifdef USE_FOG
#define USE_FOG_WORLD_POSITION
varying vec3 vFogWorldPosition;
#endif
uniform float uTime;
uniform float uWaveMagnitude;
varying vec3 vWorldPosition;
varying vec3 vViewVector;
varying float vDistance;
// Wave function matching Tribes 2 engine
// Z = surfaceZ + (sin(X*0.05 + time) + sin(Y*0.05 + time)) * waveFactor
// waveFactor = waveAmplitude * 0.25
// Note: Using xz for Three.js Y-up (Torque uses XY with Z-up)
float getWaveHeight(vec3 worldPos) {
float waveFactor = uWaveMagnitude * 0.25;
return (sin(worldPos.x * 0.05 + uTime) + sin(worldPos.z * 0.05 + uTime)) * waveFactor;
}
void main() {
// Get world position for wave calculation
vec4 worldPos = modelMatrix * vec4(position, 1.0);
vWorldPosition = worldPos.xyz;
// Apply wave displacement to Y (vertical axis in Three.js)
vec3 displaced = position;
displaced.y += getWaveHeight(worldPos.xyz);
// Calculate final world position after displacement for fog
#ifdef USE_FOG
vec4 displacedWorldPos = modelMatrix * vec4(displaced, 1.0);
vFogWorldPosition = displacedWorldPos.xyz;
#endif
// Calculate view vector for environment mapping
vViewVector = cameraPosition - worldPos.xyz;
vDistance = length(vViewVector);
vec4 mvPosition = viewMatrix * modelMatrix * vec4(displaced, 1.0);
gl_Position = projectionMatrix * mvPosition;
// Set fog depth (distance from camera) - normally done by fog_vertex include
// but we can't use that include because it references 'transformed' which we don't have
#ifdef USE_FOG
vFogDepth = length(mvPosition.xyz);
#endif
}
`,p=`
#include <fog_pars_fragment>
// Enable volumetric fog (must be defined before fog uniforms)
#ifdef USE_FOG
#define USE_VOLUMETRIC_FOG
#define USE_FOG_WORLD_POSITION
#endif
uniform float uTime;
uniform float uOpacity;
uniform float uEnvMapIntensity;
uniform sampler2D uBaseTexture;
uniform sampler2D uEnvMapTexture;
// Volumetric fog uniforms
#ifdef USE_FOG
uniform float fogVolumeData[12];
uniform float cameraHeight;
uniform bool fogEnabled;
varying vec3 vFogWorldPosition;
#endif
varying vec3 vWorldPosition;
varying vec3 vViewVector;
varying float vDistance;
#define TWO_PI 6.283185307179586
// Constants from Tribes 2 engine
#define BASE_DRIFT_CYCLE_TIME 8.0
#define BASE_DRIFT_RATE 0.02
#define BASE_DRIFT_SCALAR 0.03
#define TEXTURE_SCALE (1.0 / 48.0)
// Environment map UV wobble constants
#define Q1 150.0
#define Q2 2.0
#define Q3 0.01
// Rotate UV coordinates
vec2 rotateUV(vec2 uv, float angle) {
float c = cos(angle);
float s = sin(angle);
return vec2(
uv.x * c - uv.y * s,
uv.x * s + uv.y * c
);
}
void main() {
// Calculate base texture UVs using world position (1/48 tiling)
vec2 baseUV = vWorldPosition.xz * TEXTURE_SCALE;
// Phase (time in radians for drift cycle)
float phase = mod(uTime * (TWO_PI / BASE_DRIFT_CYCLE_TIME), TWO_PI);
// Base texture drift
float baseDriftX = uTime * BASE_DRIFT_RATE;
float baseDriftY = cos(phase) * BASE_DRIFT_SCALAR;
// === Phase 1a: First base texture pass (rotated 30 degrees) ===
vec2 uv1a = rotateUV(baseUV, radians(30.0));
// === Phase 1b: Second base texture pass (rotated 60 degrees total, with drift) ===
vec2 uv1b = rotateUV(baseUV + vec2(baseDriftX, baseDriftY), radians(60.0));
// Calculate cross-fade swing value
float A1 = cos(((vWorldPosition.x / Q1) + (uTime / Q2)) * 6.0);
float A2 = sin(((vWorldPosition.z / Q1) + (uTime / Q2)) * TWO_PI);
float swing = (A1 + A2) * 0.15 + 0.5;
// Cross-fade alpha calculation from engine
float alpha1a = ((1.0 - swing) * uOpacity) / max(1.0 - (swing * uOpacity), 0.001);
float alpha1b = swing * uOpacity;
// Sample base texture for both passes
vec4 texColor1a = texture2D(uBaseTexture, uv1a);
vec4 texColor1b = texture2D(uBaseTexture, uv1b);
// Combined alpha and color
float combinedAlpha = 1.0 - (1.0 - alpha1a) * (1.0 - alpha1b);
vec3 baseColor = (texColor1a.rgb * alpha1a * (1.0 - alpha1b) + texColor1b.rgb * alpha1b) / max(combinedAlpha, 0.001);
// === Phase 3: Environment map / specular ===
vec3 reflectVec = -vViewVector;
reflectVec.y = abs(reflectVec.y);
if (reflectVec.y < 0.001) reflectVec.y = 0.001;
vec2 envUV;
if (vDistance < 0.001) {
envUV = vec2(0.0);
} else {
float value = (vDistance - reflectVec.y) / (vDistance * vDistance);
envUV.x = reflectVec.x * value;
envUV.y = reflectVec.z * value;
}
envUV = envUV * 0.5 + 0.5;
envUV.x += A1 * Q3;
envUV.y += A2 * Q3;
vec4 envColor = texture2D(uEnvMapTexture, envUV);
vec3 finalColor = baseColor + envColor.rgb * envColor.a * uEnvMapIntensity;
// Note: Tribes 2 water does NOT use lighting - Phase 2 (lightmap) is disabled
// in the original engine. Water colors come directly from textures.
gl_FragColor = vec4(finalColor, combinedAlpha);
// Apply volumetric fog using shared Torque-style fog shader
${d.fogFragmentShader}
}
`;var g=e.i(79123);function h({surfaceTexture:e,attach:a}){let r=(0,u.textureToUrl)(e),i=(0,n.useTexture)(r,e=>(0,f.setupTexture)(e));return(0,t.jsx)("meshStandardMaterial",{attach:a,map:i,transparent:!0,opacity:.8,side:o.DoubleSide})}let x=(0,a.memo)(function({object:e}){let r,{debugMode:n}=(0,g.useDebug)(),u=(0,a.useMemo)(()=>(0,c.getRotation)(e),[e]),f=(0,a.useMemo)(()=>(0,c.getPosition)(e),[e]),v=(0,a.useMemo)(()=>(0,c.getScale)(e),[e]),[d,m,p]=v,h=(0,s.useThree)(e=>e.camera),x=(r=(0,a.useRef)(null),(0,a.useCallback)(e=>{if(!r.current)return r.current=e.clone(),!0;let t=r.current.x===e.x&&r.current.y===e.y&&r.current.z===e.z;return t||r.current.copy(e),t},[])),b=(0,c.getFloat)(e,"waveMagnitude")??1,y=(0,a.useMemo)(()=>{let[e,t,a]=f,r=Math.round((e+1024)/8),o=Math.round((a+1024)/8);return[8*(r=Math.max(0,Math.min(2040,r))),t,8*(o=Math.max(0,Math.min(2040,o)))]},[f]),M=(e,t)=>{let a=e+1024,r=t+1024,o=Math.trunc(a/2048),i=Math.trunc(r/2048);a<0&&o--,r<0&&i--;let n=[];for(let e=i-1;e<=i+1;e++)for(let t=o-1;t<=o+1;t++)n.push([t,e]);return n},[w,E]=(0,a.useState)(()=>M(h.position.x,h.position.z));(0,l.useFrame)(()=>{if(!x(h.position))return;let e=M(h.position.x,h.position.z);E(t=>JSON.stringify(t)===JSON.stringify(e)?t:e)});let P=(0,c.getProperty)(e,"surfaceTexture")??"liquidTiles/BlueWater",V=(0,c.getProperty)(e,"envMapTexture"),_=(0,c.getFloat)(e,"surfaceOpacity")??.75,S=(0,c.getFloat)(e,"envMapIntensity")??1,U=(0,a.useMemo)(()=>{let e,[t,a]=(e=d<=1024&&p<=1024?8:16,[Math.max(4,Math.ceil(d/e)),Math.max(4,Math.ceil(p/e))]),r=new o.PlaneGeometry(d,p,t,a);return r.rotateX(-Math.PI/2),r.translate(d/2,m,p/2),r},[d,m,p]);return(0,a.useEffect)(()=>()=>{U.dispose()},[U]),(0,t.jsxs)("group",{quaternion:u,children:[n&&(0,t.jsx)(i,{args:v,position:[f[0]+d/2,f[1]+m/2,f[2]+p/2],children:(0,t.jsx)("meshBasicMaterial",{color:"#00fbff",wireframe:!0})}),(0,t.jsx)(a.Suspense,{fallback:w.map(([e,a])=>{let r=y[0]+2048*e-1024,i=y[2]+2048*a-1024;return(0,t.jsx)("mesh",{geometry:U,position:[r,y[1],i],children:(0,t.jsx)("meshStandardMaterial",{color:"#00fbff",transparent:!0,opacity:.4,wireframe:!0,side:o.DoubleSide})},`${e},${a}`)}),children:(0,t.jsx)(T,{reps:w,basePosition:y,surfaceGeometry:U,surfaceTexture:P,envMapTexture:V,opacity:_,waveMagnitude:b,envMapIntensity:S})})]})}),T=(0,a.memo)(function({reps:e,basePosition:r,surfaceGeometry:i,surfaceTexture:s,envMapTexture:c,opacity:d,waveMagnitude:h,envMapIntensity:x}){let T=(0,u.textureToUrl)(s),b=(0,u.textureToUrl)(c??"special/lush_env"),[y,M]=(0,n.useTexture)([T,b],e=>{(Array.isArray(e)?e:[e]).forEach(e=>{(0,f.setupTexture)(e),e.colorSpace=o.NoColorSpace,e.wrapS=o.RepeatWrapping,e.wrapT=o.RepeatWrapping})}),{animationEnabled:w}=(0,g.useSettings)(),E=(0,a.useMemo)(()=>{var e;return e={opacity:d,waveMagnitude:h,envMapIntensity:x,baseTexture:y,envMapTexture:M},new o.ShaderMaterial({uniforms:{uTime:{value:0},uOpacity:{value:e?.opacity??.75},uWaveMagnitude:{value:e?.waveMagnitude??1},uEnvMapIntensity:{value:e?.envMapIntensity??1},uBaseTexture:{value:e?.baseTexture??null},uEnvMapTexture:{value:e?.envMapTexture??null},fogColor:{value:new o.Color},fogNear:{value:1},fogFar:{value:2e3},fogVolumeData:v.globalFogUniforms.fogVolumeData,cameraHeight:v.globalFogUniforms.cameraHeight,fogEnabled:v.globalFogUniforms.fogEnabled},vertexShader:m,fragmentShader:p,transparent:!0,side:o.DoubleSide,depthWrite:!0,fog:!0})},[d,h,x,y,M]),P=(0,a.useRef)(0);return(0,l.useFrame)((e,t)=>{w?(P.current+=t,E.uniforms.uTime.value=P.current):(P.current=0,E.uniforms.uTime.value=0)}),(0,a.useEffect)(()=>()=>{E.dispose()},[E]),(0,t.jsx)(t.Fragment,{children:e.map(([e,a])=>{let o=r[0]+2048*e-1024,n=r[2]+2048*a-1024;return(0,t.jsx)("mesh",{geometry:i,material:E,position:[o,r[1],n]},`${e},${a}`)})})});e.s(["WaterBlock",0,x,"WaterMaterial",()=>h],42585)}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,29055,e=>{"use strict";var t=e.i(43476),r=e.i(71645),i=e.i(73949),o=e.i(49774),n=e.i(90072),u=e.i(62395),c=e.i(12979),s=e.i(51434),a=e.i(79123),l=e.i(89887);let f=new Map,m=(0,r.memo)(function({object:e}){let{debugMode:m}=(0,a.useDebug)(),p=(0,u.getProperty)(e,"fileName")??"",d=(0,u.getFloat)(e,"volume")??1,h=(0,u.getFloat)(e,"minDistance")??1,g=(0,u.getFloat)(e,"maxDistance")??1,y=(0,u.getFloat)(e,"minLoopGap")??0,T=(0,u.getFloat)(e,"maxLoopGap")??0,x=(0,u.getInt)(e,"is3D")??0,[D,M,R]=(0,u.getPosition)(e),{scene:A,camera:F}=(0,i.useThree)(),{audioLoader:P,audioListener:b}=(0,s.useAudio)(),{audioEnabled:v}=(0,a.useSettings)(),j=(0,r.useRef)(null),w=(0,r.useRef)(null),B=(0,r.useRef)(null),E=(0,r.useRef)(!1),L=(0,r.useRef)(!1),G=(0,r.useRef)(new n.Vector3(D,M,R));(0,r.useEffect)(()=>{if(!P||!b)return;let e=new n.PositionalAudio(b);return e.position.copy(G.current),x?(e.setDistanceModel("exponential"),e.setRefDistance(h/20),e.setMaxDistance(g/25),e.setVolume(d)):(e.setDistanceModel("linear"),e.setRefDistance(1),e.setMaxDistance(2e6),e.setVolume(d/15)),j.current=e,A.add(e),()=>{w.current&&clearTimeout(w.current),B.current&&clearTimeout(B.current);try{e.stop()}catch(e){}e.disconnect(),A.remove(e),E.current=!1,L.current=!1}},[P,b,x,h,g,d,A]);let U=e=>{if(y>0||T>0){let t=Math.max(0,y),r=Math.max(t,T),i=t===r?t:Math.random()*(r-t)+t;e.loop=!1;let o=()=>{!1===e.isPlaying?w.current=setTimeout(()=>{try{e.play(),U(e)}catch(e){}},i):B.current=setTimeout(o,100)};B.current=setTimeout(o,100)}else e.setLoop(!0)};return(0,o.useFrame)(()=>{let e=j.current;if(!e||!v||!p)return;let t=F.position,r=G.current,i=t.distanceTo(r),o=L.current,n=i<=g;if(n&&!o)if(L.current=!0,E.current)try{e.isPlaying||(e.play(),U(e))}catch(e){}else{var u,s;u=(0,c.audioToUrl)(p),s=t=>{if(!e.buffer){e.setBuffer(t),E.current=!0;try{e.play(),U(e)}catch(e){}}},f.has(u)?s(f.get(u)):P.load(u,e=>{f.set(u,e),s(e)},void 0,e=>{console.error("AudioEmitter: Audio load error",u,e)})}else if(!n&&o){L.current=!1,w.current&&clearTimeout(w.current),B.current&&clearTimeout(B.current);try{e.stop()}catch(e){}}}),(0,r.useEffect)(()=>{let e=j.current;if(e&&!v){w.current&&clearTimeout(w.current),B.current&&clearTimeout(B.current);try{e.stop()}catch(e){}}},[v]),m?(0,t.jsxs)("mesh",{position:G.current,children:[(0,t.jsx)("sphereGeometry",{args:[h,12,12]}),(0,t.jsx)("meshBasicMaterial",{color:"#00ff00",wireframe:!0,opacity:.05,transparent:!0,toneMapped:!1}),(0,t.jsx)(l.FloatingLabel,{color:"#00ff00",position:[0,h+1,0],children:p})]}):null});e.s(["AudioEmitter",0,m])}]);
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,29055,e=>{"use strict";var t=e.i(43476),r=e.i(71645),i=e.i(73949),o=e.i(49774),n=e.i(90072),u=e.i(62395),c=e.i(12979),s=e.i(51434),a=e.i(79123),l=e.i(89887);let f=new Map,m=(0,r.memo)(function({object:e}){let{debugMode:m}=(0,a.useDebug)(),p=(0,u.getProperty)(e,"fileName")??"",d=(0,u.getFloat)(e,"volume")??1,h=(0,u.getFloat)(e,"minDistance")??1,g=(0,u.getFloat)(e,"maxDistance")??1,y=(0,u.getFloat)(e,"minLoopGap")??0,T=(0,u.getFloat)(e,"maxLoopGap")??0,x=(0,u.getInt)(e,"is3D")??0,[D,M,R]=(0,u.getPosition)(e),{scene:A,camera:F}=(0,i.useThree)(),{audioLoader:P,audioListener:b}=(0,s.useAudio)(),{audioEnabled:v}=(0,a.useSettings)(),j=(0,r.useRef)(null),w=(0,r.useRef)(null),B=(0,r.useRef)(null),E=(0,r.useRef)(!1),L=(0,r.useRef)(!1),_=(0,r.useRef)(new n.Vector3(D,M,R));(0,r.useEffect)(()=>{if(!P||!b)return;let e=new n.PositionalAudio(b);return e.position.copy(_.current),x?(e.setDistanceModel("exponential"),e.setRefDistance(h/20),e.setMaxDistance(g/25),e.setVolume(d)):(e.setDistanceModel("linear"),e.setRefDistance(1),e.setMaxDistance(2e6),e.setVolume(d/15)),j.current=e,A.add(e),()=>{w.current&&clearTimeout(w.current),B.current&&clearTimeout(B.current);try{e.stop()}catch(e){}e.disconnect(),A.remove(e),E.current=!1,L.current=!1}},[P,b,x,h,g,d,A]);let G=e=>{if(y>0||T>0){let t=Math.max(0,y),r=Math.max(t,T),i=t===r?t:Math.random()*(r-t)+t;e.loop=!1;let o=()=>{!1===e.isPlaying?w.current=setTimeout(()=>{try{e.play(),G(e)}catch(e){}},i):B.current=setTimeout(o,100)};B.current=setTimeout(o,100)}else e.setLoop(!0)};return(0,o.useFrame)(()=>{let e=j.current;if(!e||!v||!p)return;let t=F.position,r=_.current,i=t.distanceTo(r),o=L.current,n=i<=g;if(n&&!o)if(L.current=!0,E.current)try{e.isPlaying||(e.play(),G(e))}catch(e){}else{var u,s;u=(0,c.audioToUrl)(p),s=t=>{if(!e.buffer){e.setBuffer(t),E.current=!0;try{e.play(),G(e)}catch(e){}}},f.has(u)?s(f.get(u)):P.load(u,e=>{f.set(u,e),s(e)},void 0,e=>{console.error("AudioEmitter: Audio load error",u,e)})}else if(!n&&o){L.current=!1,w.current&&clearTimeout(w.current),B.current&&clearTimeout(B.current);try{e.stop()}catch(e){}}}),(0,r.useEffect)(()=>{let e=j.current;if(e&&!v){w.current&&clearTimeout(w.current),B.current&&clearTimeout(B.current);try{e.stop()}catch(e){}}},[v]),m?(0,t.jsxs)("mesh",{position:_.current,children:[(0,t.jsx)("sphereGeometry",{args:[h,12,12]}),(0,t.jsx)("meshBasicMaterial",{color:"#00ff00",wireframe:!0,opacity:.05,transparent:!0,toneMapped:!1}),(0,t.jsx)(l.FloatingLabel,{color:"#00ff00",position:[0,h+1,0],children:p})]}):null});e.s(["AudioEmitter",0,m])}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long