1import{z as e}from"./index-TmXHDwAR.js";const t="helperFunctions",c=`const PI: f32=3.1415926535897932384626433832795;const TWO_PI: f32=6.283185307179586;const HALF_PI: f32=1.5707963267948966;const RECIPROCAL_PI: f32=0.3183098861837907;const RECIPROCAL_PI2: f32=0.15915494309189535;const RECIPROCAL_PI4: f32=0.07957747154594767;const HALF_MIN: f32=5.96046448e-08; 2const LinearEncodePowerApprox: f32=2.2;const GammaEncodePowerApprox: f32=1.0/LinearEncodePowerApprox;const LuminanceEncodeApprox: vec3f=vec3f(0.2126,0.7152,0.0722);const Epsilon:f32=0.0000001;fn square(x: f32)->f32 {return x*x;} 3fn saturate(x: f32)->f32 {return clamp(x,0.0,1.0);} 4fn saturateVec3(x: vec3f)->vec3f {return clamp(x,vec3f(),vec3f(1.0));} 5fn saturateEps(x: f32)->f32 {return clamp(x,Epsilon,1.0);} 6fn maxEps(x: f32)->f32 {return max(x,Epsilon);} 7fn maxEpsVec3(x: vec3f)->vec3f {return max(x,vec3f(Epsilon));} 8fn absEps(x: f32)->f32 {return abs(x)+Epsilon;} 9fn transposeMat3(inMatrix: mat3x3f)->mat3x3f {let i0: vec3f=inMatrix[0];let i1: vec3f=inMatrix[1];let i2: vec3f=inMatrix[2];let outMatrix:mat3x3f=mat3x3f( 10vec3(i0.x,i1.x,i2.x), 11vec3(i0.y,i1.y,i2.y), 12vec3(i0.z,i1.z,i2.z) 13);return outMatrix;} 14fn inverseMat3(inMatrix: mat3x3f)->mat3x3f {let a00: f32=inMatrix[0][0];let a01: f32=inMatrix[0][1];let a02: f32=inMatrix[0][2];let a10: f32=inMatrix[1][0];let a11: f32=inMatrix[1][1];let a12: f32=inMatrix[1][2];let a20: f32=inMatrix[2][0];let a21: f32=inMatrix[2][1];let a22: f32=inMatrix[2][2];let b01: f32=a22*a11-a12*a21;let b11: f32=-a22*a10+a12*a20;let b21: f32=a21*a10-a11*a20;let det: f32=a00*b01+a01*b11+a02*b21;return mat3x3f(b01/det,(-a22*a01+a02*a21)/det,(a12*a01-a02*a11)/det, 15b11/det,(a22*a00-a02*a20)/det,(-a12*a00+a02*a10)/det, 16b21/det,(-a21*a00+a01*a20)/det,(a11*a00-a01*a10)/det);} 17#if USE_EXACT_SRGB_CONVERSIONS 18fn toLinearSpaceExact(color: vec3f)->vec3f 19{let nearZeroSection: vec3f=0.0773993808*color;let remainingSection: vec3f=pow(0.947867299*(color+vec3f(0.055)),vec3f(2.4));return select(remainingSection,nearZeroSection,color<=vec3f(0.04045));} 20fn toGammaSpaceExact(color: vec3f)->vec3f 21{let nearZeroSection: vec3f=12.92*color;let remainingSection: vec3f=1.055*pow(color,vec3f(0.41666))-vec3f(0.055);return select(remainingSection,nearZeroSection,color<=vec3f(0.0031308));} 22#endif 23fn toLinearSpace(color: f32)->f32 24{ 25#if USE_EXACT_SRGB_CONVERSIONS 26var nearZeroSection=0.0773993808*color;var remainingSection=pow(0.947867299*(color+0.055),2.4);return select(remainingSection,nearZeroSection,color<=0.04045); 27#else 28return pow(color,LinearEncodePowerApprox); 29#endif 30} 31fn toLinearSpaceVec3(color: vec3f)->vec3f 32{ 33#if USE_EXACT_SRGB_CONVERSIONS 34return toLinearSpaceExact(color); 35#else 36return pow(color,vec3f(LinearEncodePowerApprox)); 37#endif 38} 39fn toLinearSpaceVec4(color: vec4<f32>)->vec4<f32> 40{ 41#if USE_EXACT_SRGB_CONVERSIONS 42return vec4f(toLinearSpaceExact(color.rgb),color.a); 43#else 44return vec4f(pow(color.rgb,vec3f(LinearEncodePowerApprox)),color.a); 45#endif 46} 47fn toGammaSpace(color: vec4<f32>)->vec4<f32> 48{ 49#if USE_EXACT_SRGB_CONVERSIONS 50return vec4<f32>(toGammaSpaceExact(color.rgb),color.a); 51#else 52return vec4<f32>(pow(color.rgb,vec3f(GammaEncodePowerApprox)),color.a); 53#endif 54} 55fn toGammaSpaceVec3(color: vec3f)->vec3f 56{ 57#if USE_EXACT_SRGB_CONVERSIONS 58return toGammaSpaceExact(color); 59#else 60return pow(color,vec3f(GammaEncodePowerApprox)); 61#endif 62} 63fn squareVec3(value: vec3f)->vec3f 64{return value*value;} 65fn pow5(value: f32)->f32 {let sq: f32=value*value;return sq*sq*value;} 66fn double_refract(I: vec3f,N: vec3f,eta: f32)->vec3f {let Tfront: vec3f=refract(I,N,1.0/eta);let Nback: vec3f=normalize(reflect(N,Tfront));return refract(Tfront,-Nback,eta);} 67fn getLuminanceUnclamped(color: vec3f)->f32 68{return dot(color,LuminanceEncodeApprox);} 69fn getLuminance(color: vec3f)->f32 70{return saturate(getLuminanceUnclamped(color));} 71fn getRand(seed: vec2<f32>)->f32 {return fract(sin(dot(seed.xy ,vec2<f32>(12.9898,78.233)))*43758.5453);} 72fn dither(seed: vec2<f32>,varianceAmount: f32)->f32 {let rand: f32=getRand(seed);let normVariance: f32=varianceAmount/255.0;let dither: f32=mix(-normVariance,normVariance,rand);return dither;} 73const rgbdMaxRange: f32=255.0;fn toRGBD(color: vec3f)->vec4<f32> {let maxRGB: f32=max(max(color.r,max(color.g,color.b)),Epsilon);var D: f32 =max(rgbdMaxRange/maxRGB,1.);
73D =clamp(floor(D)/255.0,0.,1.);var rgb: vec3f =color.rgb*D;rgb=toGammaSpaceVec3(rgb);return vec4<f32>(saturateVec3(rgb),D);} 74fn fromRGBD(rgbd: vec4<f32>)->vec3f {let rgb=toLinearSpaceVec3(rgbd.rgb);return rgb/rgbd.a;} 75fn parallaxCorrectNormal(vertexPos: vec3f,origVec: vec3f,cubeSize: vec3f,cubePos: vec3f)->vec3f {let invOrigVec: vec3f=vec3f(1.)/origVec;let halfSize: vec3f=cubeSize*0.5;let intersecAtMaxPlane: vec3f=(cubePos+halfSize-vertexPos)*invOrigVec;let intersecAtMinPlane: vec3f=(cubePos-halfSize-vertexPos)*invOrigVec;let largestIntersec: vec3f=max(intersecAtMaxPlane,intersecAtMinPlane);let distance: f32=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);let intersectPositionWS: vec3f=vertexPos+origVec*distance;return intersectPositionWS-cubePos;} 76fn equirectangularToCubemapDirection(uv : vec2f)->vec3f {var longitude : f32=uv.x*TWO_PI-PI;var latitude : f32=HALF_PI-uv.y*PI;var direction : vec3f;direction.x=cos(latitude)*sin(longitude);direction.y=sin(latitude);direction.z=cos(latitude)*cos(longitude);return direction;} 77fn sqrtClamped(value: f32)->f32 {return sqrt(max(value,0.));} 78fn avg(value: vec3f)->f32 {return dot(value,vec3f(0.333333333));} 79fn singleScatterToMultiScatterAlbedo(rho_ss: vec3f)->vec3f {let s: vec3f=sqrt(max(vec3f(1.0)-rho_ss,vec3f(0.0)));return (vec3f(1.0)-s)*(vec3f(1.0)-vec3f(0.139)*s)/(vec3f(1.0)+vec3f(1.17)*s);} 80fn multiScatterToSingleScatterAlbedo(rho_ms: vec3f)->vec3f {let s: vec3f=4.09712f+4.20863f*rho_ms-sqrt(9.59217f+41.6808f*rho_ms+17.7126f*rho_ms*rho_ms);return 1.0f-s*s;} 81fn multiScatterToSingleScatterAlbedoWithAniso(rho_ms: vec3f,aniso: f32)->vec3f {let s: vec3f=4.09712+4.20863f*rho_ms-sqrt(9.59217f+41.6808f*rho_ms+17.7126f*rho_ms*rho_ms);return (vec3f(1.0f)-s*s)/maxEpsVec3(vec3f(1.0f)-vec3f(aniso)*s*s);} 82fn min3(v: vec3f)->f32 {return min(v.x,min(v.y,v.z));} 83fn max3(v: vec3f)->f32 {return max(v.x,max(v.y,v.z));} 84fn uint2float(i: u32)->f32 {return bitcast<f32>(0x3F800000u | (i>>9u))-1.0;} 85fn plasticSequence(rstate: u32)->vec2f {return vec2f(uint2float(rstate*3242174889u), 86uint2float(rstate*2447445414u));} 87`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=c);const o={name:t,shader:c},a="rgbdDecodePixelShader",n=`varying vUV: vec2f;var textureSamplerSampler: sampler;var textureSampler: texture_2d<f32>; 88#include<helperFunctions> 89#define CUSTOM_FRAGMENT_DEFINITIONS 90@fragment 91fn main(input: FragmentInputs)->FragmentOutputs {fragmentOutputs.color=vec4f(fromRGBD(textureSample(textureSampler,textureSamplerSampler,input.vUV)),1.0);}`;e.ShadersStoreWGSL[a]||(e.ShadersStoreWGSL[a]=n);const f=[o];for(const r of f)e.IncludesShadersStoreWGSL[r.name]||(e.IncludesShadersStoreWGSL[r.name]=r.shader);const l={name:a,shader:n};export{l as rgbdDecodePixelShaderWGSL};
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.