1import{w as e}from"./index-BrAQnho4.js";const o="helperFunctions",t=`const float PI=3.1415926535897932384626433832795;const float TWO_PI=6.283185307179586;const float HALF_PI=1.5707963267948966;const float RECIPROCAL_PI=0.3183098861837907;const float RECIPROCAL_PI2=0.15915494309189535;const float RECIPROCAL_PI4=0.07957747154594767;const float HALF_MIN=5.96046448e-08; 2const float LinearEncodePowerApprox=2.2;const float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;const vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);const float Epsilon=0.0000001; 3#define saturate(x) clamp(x,0.0,1.0) 4#define absEps(x) abs(x)+Epsilon 5#define maxEps(x) max(x,Epsilon) 6#define saturateEps(x) clamp(x,Epsilon,1.0) 7mat3 transposeMat3(mat3 inMatrix) {vec3 i0=inMatrix[0];vec3 i1=inMatrix[1];vec3 i2=inMatrix[2];mat3 outMatrix=mat3( 8vec3(i0.x,i1.x,i2.x), 9vec3(i0.y,i1.y,i2.y), 10vec3(i0.z,i1.z,i2.z) 11);return outMatrix;} 12mat3 inverseMat3(mat3 inMatrix) {float a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];float a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];float a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];float b01=a22*a11-a12*a21;float b11=-a22*a10+a12*a20;float b21=a21*a10-a11*a20;float det=a00*b01+a01*b11+a02*b21;return mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11), 13b11,(a22*a00-a02*a20),(-a12*a00+a02*a10), 14b21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;} 15#if USE_EXACT_SRGB_CONVERSIONS 16vec3 toLinearSpaceExact(vec3 color) 17{vec3 nearZeroSection=0.0773993808*color;vec3 remainingSection=pow(0.947867299*(color+vec3(0.055)),vec3(2.4)); 18#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE) 19return mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.04045))); 20#else 21return 22vec3( 23color.r<=0.04045 ? nearZeroSection.r : remainingSection.r, 24color.g<=0.04045 ? nearZeroSection.g : remainingSection.g, 25color.b<=0.04045 ? nearZeroSection.b : remainingSection.b); 26#endif 27} 28vec3 toGammaSpaceExact(vec3 color) 29{vec3 nearZeroSection=12.92*color;vec3 remainingSection=1.055*pow(color,vec3(0.41666))-vec3(0.055); 30#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE) 31return mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.0031308))); 32#else 33return 34vec3( 35color.r<=0.0031308 ? nearZeroSection.r : remainingSection.r, 36color.g<=0.0031308 ? nearZeroSection.g : remainingSection.g, 37color.b<=0.0031308 ? nearZeroSection.b : remainingSection.b); 38#endif 39} 40#endif 41float toLinearSpace(float color) 42{ 43#if USE_EXACT_SRGB_CONVERSIONS 44float nearZeroSection=0.0773993808*color;float remainingSection=pow(0.947867299*(color+0.055),2.4);return color<=0.04045 ? nearZeroSection : remainingSection; 45#else 46return pow(color,LinearEncodePowerApprox); 47#endif 48} 49vec3 toLinearSpace(vec3 color) 50{ 51#if USE_EXACT_SRGB_CONVERSIONS 52return toLinearSpaceExact(color); 53#else 54return pow(color,vec3(LinearEncodePowerApprox)); 55#endif 56} 57vec4 toLinearSpace(vec4 color) 58{ 59#if USE_EXACT_SRGB_CONVERSIONS 60return vec4(toLinearSpaceExact(color.rgb),color.a); 61#else 62return vec4(pow(color.rgb,vec3(LinearEncodePowerApprox)),color.a); 63#endif 64} 65float toGammaSpace(float color) 66{ 67#if USE_EXACT_SRGB_CONVERSIONS 68float nearZeroSection=12.92*color;float remainingSection=1.055*pow(color,0.41666)-0.055;return color<=0.0031308 ? nearZeroSection : remainingSection; 69#else 70return pow(color,GammaEncodePowerApprox); 71#endif 72} 73vec3 toGammaSpace(vec3 color) 74{ 75#if USE_EXACT_SRGB_CONVERSIONS 76return toGammaSpaceExact(color); 77#else 78return pow(color,vec3(GammaEncodePowerApprox)); 79#endif 80} 81vec4 toGammaSpace(vec4 color) 82{ 83#if USE_EXACT_SRGB_CONVERSIONS 84return vec4(toGammaSpaceExact(color.rgb),color.a); 85#else 86return vec4(pow(color.rgb,vec3(GammaEncodePowerApprox)),color.a); 87#endif 88} 89float square(float value) 90{return value*value;} 91vec3 square(vec3 value) 92{return value*value;} 93float pow5(float value) {float sq=value*value;return sq*sq*value;} 94vec3 double_refract(vec3 I,vec3 N,float eta) {vec3 Tfront=refract(I,N,1.0/eta);vec3 Nback=normalize(reflect(N,Tfront));return refract(Tfront,-Nback,eta);} 95float getLuminanceUnclamped(vec3 color) 96{return dot(color,LuminanceEncodeApprox);} 97float getLuminance(vec3 color) 98{return saturate(getLuminanceUnclamped(color));} 99float getRand(vec2 seed) {return fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);} 100float dither(vec2 seed,float varianceAmount) {float rand=getRand(seed);float normVariance=varianceAmount/255.0;
100float dither=mix(-normVariance,normVariance,rand);return dither;} 101const float rgbdMaxRange=255.;vec4 toRGBD(vec3 color) {float maxRGB=maxEps(max(color.r,max(color.g,color.b)));float D =max(rgbdMaxRange/maxRGB,1.);D =saturate(floor(D)/255.);vec3 rgb=color.rgb*D;rgb=toGammaSpace(rgb);return vec4(saturate(rgb),D);} 102vec3 fromRGBD(vec4 rgbd) {rgbd.rgb=toLinearSpace(rgbd.rgb);return rgbd.rgb/rgbd.a;} 103vec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {vec3 invOrigVec=vec3(1.)/origVec;vec3 halfSize=cubeSize*0.5;vec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;vec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;vec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);float distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);vec3 intersectPositionWS=vertexPos+origVec*distance;return intersectPositionWS-cubePos;} 104vec3 equirectangularToCubemapDirection(vec2 uv) {float longitude=uv.x*TWO_PI-PI;float latitude=HALF_PI-uv.y*PI;vec3 direction;direction.x=cos(latitude)*sin(longitude);direction.y=sin(latitude);direction.z=cos(latitude)*cos(longitude);return direction;} 105float sqrtClamped(float value) {return sqrt(max(value,0.));} 106float avg(vec3 value) {return dot(value,vec3(0.333333333));} 107#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE) 108uint extractBits(uint value,int offset,int width) {return (value>>offset) & ((1u<<width)-1u);} 109int onlyBitPosition(uint value) {return (floatBitsToInt(float(value))>>23)-0x7f;} 110vec3 singleScatterToMultiScatterAlbedo(vec3 rho_ss) {vec3 s=sqrt(max(vec3(1.0)-rho_ss,vec3(0.0)));return (vec3(1.0)-s)*(vec3(1.0)-vec3(0.139)*s)/(vec3(1.0)+vec3(1.17)*s);} 111vec3 multiScatterToSingleScatterAlbedo(vec3 rho_ms) {vec3 s=4.09712+4.20863*rho_ms-sqrt(9.59217+41.6808*rho_ms+17.7126*rho_ms*rho_ms);return 1.0-s*s;} 112vec3 multiScatterToSingleScatterAlbedo(vec3 rho_ms,float aniso) {vec3 s=4.09712+4.20863*rho_ms-sqrt(9.59217+41.6808*rho_ms+17.7126*rho_ms*rho_ms);return (1.0-s*s)/maxEps(1.0-aniso*s*s);} 113float min3(vec3 v) {return min(v.x,min(v.y,v.z));} 114float max3(vec3 v) {return max(v.x,max(v.y,v.z));} 115float uint2float(uint i) {return uintBitsToFloat(0x3F800000u | (i>>9u))-1.0;} 116vec2 plasticSequence(const uint rstate) {return vec2(uint2float(rstate*3242174889u), 117uint2float(rstate*2447445414u));} 118#endif 119`;e.IncludesShadersStore[o]||(e.IncludesShadersStore[o]=t);const c={name:o,shader:t},a="rgbdDecodePixelShader",n=`varying vec2 vUV;uniform sampler2D textureSampler; 120#include<helperFunctions> 121#define CUSTOM_FRAGMENT_DEFINITIONS 122void main(void) 123{gl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);}`;e.ShadersStore[a]||(e.ShadersStore[a]=n);const i=[c];for(const r of i)e.IncludesShadersStore[r.name]||(e.IncludesShadersStore[r.name]=r.shader);const s={name:a,shader:n};export{s as rgbdDecodePixelShader};
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.