PageSourceSearch

https://ds-k.site/_astro/default.fragment.B93vDHpe.js

js ds-k.site collected 2026-10-01 12:37:27 UTC 23,839 bytes, 462 lines download raw bytes

1import{S as e}from"./Layout.astro_astro_type_script_index_0_lang.D7HFstIc.js";import"./defaultUboDeclaration.B9OB6Njm.js";import"./oitFragment.DnUuI8rn.js";import"./logDepthDeclaration.BoY2_7ZG.js";import"./helperFunctions.BQK4OmV-.js";import"./lightFragment.D-4IdBQG.js";import"./clipPlaneFragment.BPRaAm28.js";import"./_commonjsHelpers.CqkleIqs.js";import"./meshUboDeclaration.DibNTUJA.js";const i="lightsFragmentFunctions",t=`struct lightingInfo
2{diffuse: vec3f,
3#ifdef SPECULARTERM
4specular: vec3f,
5#endif
6#ifdef NDOTL
7ndl: f32,
8#endif
9};fn computeLighting(viewDirectionW: vec3f,vNormal: vec3f,lightData: vec4f,diffuseColor: vec3f,specularColor: vec3f,range: f32,glossiness: f32)->lightingInfo {var result: lightingInfo;var lightVectorW: vec3f;var attenuation: f32=1.0;if (lightData.w==0.)
10{var direction: vec3f=lightData.xyz-fragmentInputs.vPositionW;attenuation=max(0.,1.0-length(direction)/range);lightVectorW=normalize(direction);}
11else
12{lightVectorW=normalize(-lightData.xyz);}
13var ndl: f32=max(0.,dot(vNormal,lightVectorW));
14#ifdef NDOTL
15result.ndl=ndl;
16#endif
17result.diffuse=ndl*diffuseColor*attenuation;
18#ifdef SPECULARTERM
19var angleW: vec3f=normalize(viewDirectionW+lightVectorW);var specComp: f32=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;
20#endif
21return result;}
22fn getAttenuation(cosAngle: f32,exponent: f32)->f32 {return max(0.,pow(cosAngle,exponent));}
23fn getIESAttenuation(cosAngle: f32,iesLightTexture: texture_2d<f32>,iesLightTextureSampler: sampler)->f32 {var angle=acos(cosAngle)/PI;return textureSampleLevel(iesLightTexture,iesLightTextureSampler,vec2f(angle,0),0.).r;}
24fn computeBasicSpotLighting(viewDirectionW: vec3f,lightVectorW: vec3f,vNormal: vec3f,attenuation: f32,diffuseColor: vec3f,specularColor: vec3f,glossiness: f32)->lightingInfo {var result: lightingInfo;var ndl: f32=max(0.,dot(vNormal,lightVectorW));
25#ifdef NDOTL
26result.ndl=ndl;
27#endif
28result.diffuse=ndl*diffuseColor*attenuation;
29#ifdef SPECULARTERM
30var angleW: vec3f=normalize(viewDirectionW+lightVectorW);var specComp: f32=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;
31#endif
32return result;}
33fn computeIESSpotLighting(viewDirectionW: vec3f,vNormal: vec3f,lightData: vec4f,lightDirection: vec4f,diffuseColor: vec3f,specularColor: vec3f,range: f32,glossiness: f32,iesLightTexture: texture_2d<f32>,iesLightTextureSampler: sampler)->lightingInfo {var direction: vec3f=lightData.xyz-fragmentInputs.vPositionW;var lightVectorW: vec3f=normalize(direction);var attenuation: f32=max(0.,1.0-length(direction)/range);var dotProduct=dot(lightDirection.xyz,-lightVectorW);var cosAngle: f32=max(0.,dotProduct);if (cosAngle>=lightDirection.w)
34{attenuation*=getIESAttenuation(dotProduct,iesLightTexture,iesLightTextureSampler);return computeBasicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}
35var result: lightingInfo;result.diffuse=vec3f(0.);
36#ifdef SPECULARTERM
37result.specular=vec3f(0.);
38#endif
39#ifdef NDOTL
40result.ndl=0.;
41#endif
42return result;}
43fn computeSpotLighting(viewDirectionW: vec3f,vNormal: vec3f ,lightData: vec4f,lightDirection: vec4f,diffuseColor: vec3f,specularColor: vec3f,range: f32,glossiness: f32)->lightingInfo {var direction: vec3f=lightData.xyz-fragmentInputs.vPositionW;var lightVectorW: vec3f=normalize(direction);var attenuation: f32=max(0.,1.0-length(direction)/range);var cosAngle: f32=max(0.,dot(lightDirection.xyz,-lightVectorW));if (cosAngle>=lightDirection.w)
44{attenuation*=getAttenuation(cosAngle,lightData.w);return computeBasicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}
45var result: lightingInfo;result.diffuse=vec3f(0.);
46#ifdef SPECULARTERM
47result.specular=vec3f(0.);
48#endif
49#ifdef NDOTL
50result.ndl=0.;
51#endif
52return result;}
53fn computeHemisphericLighting(viewDirectionW: vec3f,vNormal: vec3f,lightData: vec4f,diffuseColor: vec3f,specularColor: vec3f,groundColor: vec3f,glossiness: f32)->lightingInfo {var result: lightingInfo;var ndl: f32=dot(vNormal,lightData.xyz)*0.5+0.5;
54#ifdef NDOTL
55result.ndl=ndl;
56#endif
57result.diffuse=mix(groundColor,diffuseColor,ndl);
58#ifdef SPECULARTERM
59var angleW: vec3f=normalize(viewDirectionW+lightData.xyz);var specComp: f32=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor;
60#endif
61return result;}
62fn computeProjectionTextureDiffuseLighting(projectionLightTexture: texture_2d<f32>,projectionLightSampler: sampler,textureProjectionMatrix: mat4x4f,posW: vec3f)->vec3f {var strq: vec4f=textureProjectionMatrix*vec4f(posW,1.0);strq/=strq.w;var textureColor: vec3f=textureSample(projectionLightTexture,projectionLightSampler,strq.xy).rgb;return textureColor;}
63#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
64#include<ltcHelperFunctions>
65var areaLightsLTC1SamplerSampler: sampler;var areaLightsLTC1Sampler: texture_2d<f32>;var areaLightsLTC2SamplerSampler: sampler;var areaLightsLTC2Sampler: texture_2d<f32>;fn computeAreaLighting(ltc1: texture_2d<f32>,ltc1Sampler:sampler,ltc2:texture_2d<f32>,ltc2Sampler:sampler,viewDirectionW: vec3f,vNormal:vec3f,vPosition:vec3f,lightPosition:vec3f,halfWidth:vec3f, halfHeight:vec3f,diffuseColor:vec3f,specularColor:vec3f,roughness:f32 )->lightingInfo
66{var result: lightingInfo;var data: areaLightData=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc1Sampler,ltc2,ltc2Sampler,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness);
67#ifdef SPECULARTERM
68var fresnel:vec3f=( specularColor*data.Fresnel.x+( vec3f( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular;
69#endif
70result.diffuse+=diffuseColor*data.Diffuse;return result;}
71#endif
72#ifdef CLUSTLIGHT_BATCH
73#include<clusteredLightingFunctions>
74fn computeClusteredLighting(
75lightDataTexture: texture_2d<f32>,
76tileMaskBuffer: ptr<storage,array<u32>>,
77viewDirectionW: vec3f,
78vNormal: vec3f,
79lightData: vec4f,
80sliceRange: vec2u,
81glossiness: f32
82)->lightingInfo {var result: lightingInfo;let tilePosition=vec2u(fragmentInputs.position.xy*lightData.xy);let maskResolution=vec2u(lightData.zw);var tileIndex=(tilePosition.x*maskResolution.x+tilePosition.y)*maskResolution.y;let batchRange=sliceRange/CLUSTLIGHT_BATCH;var batchOffset=batchRange.x*CLUSTLIGHT_BATCH;tileIndex+=batchRange.x;for (var i=batchRange.x; i<=batchRange.y; i+=1) {var mask=tileMaskBuffer[tileIndex];tileIndex+=1;let maskOffset=max(sliceRange.x,batchOffset)-batchOffset; 
83let maskWidth=min(sliceRange.y-batchOffset+1,CLUSTLIGHT_BATCH);mask=extractBits(mask,maskOffset,maskWidth);while mask != 0 {let trailing=firstTrailingBit(mask);mask ^= 1u<<trailing;let light=getClusteredLight(lightDataTexture,batchOffset+maskOffset+trailing);var info: lightingInfo;if light.vLightDirection.w<0.0 {info=computeLighting(viewDirectionW,vNormal,light.vLightData,light.vLightDiffuse.rgb,light.vLightSpecular.rgb,light.vLightDiffuse.a,glossiness);} else {info=computeSpotLighting(viewDirectionW,vNormal,light.vLightData,light.vLightDirection,light.vLightDiffuse.rgb,light.vLightSpecular.rgb,light.vLightDiffuse.a,glossiness);}
84result.diffuse+=info.diffuse;
85#ifdef SPECULARTERM
86result.specular+=info.specular;
87#endif
88}
89batchOffset+=CLUSTLIGHT_BATCH;}
90return result;}
91#endif
92`;e.IncludesShadersStoreWGSL[i]||(e.IncludesShadersStoreWGSL[i]=t);const f="fresnelFunction",a=`#ifdef FRESNEL
93fn computeFresnelTerm(viewDirection: vec3f,worldNormal: vec3f,bias: f32,power: f32)->f32
94{let fresnelTerm: f32=pow(bias+abs(dot(viewDirection,worldNormal)),power);return clamp(fresnelTerm,0.,1.);}
95#endif
96`;e.IncludesShadersStoreWGSL[f]||(e.IncludesShadersStoreWGSL[f]=a);const r="defaultPixelShader",o=`#include<defaultUboDeclaration>
97#include<prePassDeclaration>[SCENE_MRT_COUNT]
98#include<oitDeclaration>
99#define CUSTOM_FRAGMENT_BEGIN
100varying vPositionW: vec3f;
101#ifdef NORMAL
102varying vNormalW: vec3f;
103#endif
104#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
105varying vColor: vec4f;
106#endif
107#ifdef CLUSTLIGHT_BATCH
108varying vViewDepth: f32
vendor: 12,139 bytes, lines 108-374
108;
109#endif
110#include<mainUVVaryingDeclaration>[1..7]
111#include<helperFunctions>
112#include<lightUboDeclaration>[0..maxSimultaneousLights]
113#include<lightsFragmentFunctions>
114#include<shadowsFragmentFunctions>
115#include<samplerFragmentDeclaration>(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_SAMPLERNAME_,diffuse)
116#include<samplerFragmentDeclaration>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)
117#include<samplerFragmentDeclaration>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)
118#include<samplerFragmentDeclaration>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)
119#include<samplerFragmentDeclaration>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)
120#include<samplerFragmentDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)
121#ifdef REFRACTION
122#ifdef REFRACTIONMAP_3D
123var refractionCubeSamplerSampler: sampler;var refractionCubeSampler: texture_cube<f32>;
124#else
125var refraction2DSamplerSampler: sampler;var refraction2DSampler: texture_2d<f32>;
126#endif
127#endif
128#if defined(SPECULARTERM)
129#include<samplerFragmentDeclaration>(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_SAMPLERNAME_,specular)
130#endif
131#include<fresnelFunction>
132#ifdef REFLECTION
133#ifdef REFLECTIONMAP_3D
134var reflectionCubeSamplerSampler: sampler;var reflectionCubeSampler: texture_cube<f32>;
135#else
136var reflection2DSamplerSampler: sampler;var reflection2DSampler: texture_2d<f32>;
137#endif
138#ifdef REFLECTIONMAP_SKYBOX
139varying vPositionUVW: vec3f;
140#else
141#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
142varying vDirectionW: vec3f;
143#endif
144#endif
145#include<reflectionFunction>
146#endif
147#include<imageProcessingDeclaration>
148#include<imageProcessingFunctions>
149#include<bumpFragmentMainFunctions>
150#include<bumpFragmentFunctions>
151#include<clipPlaneFragmentDeclaration>
152#include<logDepthDeclaration>
153#include<fogFragmentDeclaration>
154#define CUSTOM_FRAGMENT_DEFINITIONS
155@fragment
156fn main(input: FragmentInputs)->FragmentOutputs {
157#define CUSTOM_FRAGMENT_MAIN_BEGIN
158#include<clipPlaneFragment>
159var viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;
160#ifdef NORMAL
161var normalW: vec3f=normalize(fragmentInputs.vNormalW);
162#else
163var normalW: vec3f=normalize(-cross(dpdx(fragmentInputs.vPositionW),dpdy(fragmentInputs.vPositionW)));
164#endif
165#include<bumpFragment>
166#ifdef TWOSIDEDLIGHTING
167normalW=select(-normalW,normalW,fragmentInputs.frontFacing);
168#endif
169#ifdef DIFFUSE
170baseColor=textureSample(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDiffuseUV+uvOffset);
171#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)
172if (baseColor.a<uniforms.alphaCutOff) {discard;}
173#endif
174#ifdef ALPHAFROMDIFFUSE
175alpha*=baseColor.a;
176#endif
177#define CUSTOM_FRAGMENT_UPDATE_ALPHA
178baseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);
179#endif
180#if defined(DECAL) && !defined(DECAL_AFTER_DETAIL)
181var decalColor: vec4f=textureSample(decalSampler,decalSamplerSampler,fragmentInputs.vDecalUV+uvOffset);
182#include<decalFragment>(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)
183#endif
184#include<depthPrePass>
185#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
186baseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);
187#endif
188#ifdef DETAIL
189baseColor=vec4f(baseColor.rgb*2.0*mix(0.5,detailColor.r,uniforms.vDetailInfos.y),baseColor.a);
190#endif
191#if defined(DECAL) && defined(DECAL_AFTER_DETAIL)
192var decalColor: vec4f=textureSample(decalSampler,decalSamplerSampler,fragmentInputs.vDecalUV+uvOffset);
193#include<decalFragment>(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)
194#endif
195#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE
196var baseAmbientColor: vec3f= vec3f(1.,1.,1.);
197#ifdef AMBIENT
198baseAmbientColor=textureSample(ambientSampler,ambientSamplerSampler,fragmentInputs.vAmbientUV+uvOffset).rgb*uniforms.vAmbientInfos.y;
199#endif
200#define CUSTOM_FRAGMENT_BEFORE_LIGHTS
201var glossiness: f32=uniforms.vSpecularColor.a;var specularColor: vec3f=uniforms.vSpecularColor.rgb;
202#ifdef SPECULARTERM
203#ifdef SPECULAR
204var specularMapColor: vec4f=textureSample(specularSampler,specularSamplerSampler,fragmentInputs.vSpecularUV+uvOffset);specularColor=specularMapColor.rgb;
205#ifdef GLOSSINESS
206glossiness=glossiness*specularMapColor.a;
207#endif
208#endif
209#endif
210var diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;
211#ifdef SPECULARTERM
212var specularBase: vec3f= vec3f(0.,0.,0.);
213#endif
214var shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.;
215#ifdef LIGHTMAP
216var lightmapColor: vec4f=textureSample(lightmapSampler,lightmapSamplerSampler,fragmentInputs.vLightmapUV+uvOffset);
217#ifdef RGBDLIGHTMAP
218lightmapColor=vec4f(fromRGBD(lightmapColor),lightmapColor.a);
219#endif
220lightmapColor=vec4f(lightmapColor.rgb*uniforms.vLightmapInfos.y,lightmapColor.a);
221#endif
222#include<lightFragment>[0..maxSimultaneousLights]
223aggShadow=aggShadow/numLights;var refractionColor: vec4f= vec4f(0.,0.,0.,1.);
224#ifdef REFRACTION
225var refractionVector: vec3f=normalize(refract(-viewDirectionW,normalW,uniforms.vRefractionInfos.y));
226#ifdef REFRACTIONMAP_3D
227#ifdef USE_LOCAL_REFRACTIONMAP_CUBIC
228refractionVector=parallaxCorrectNormal(fragmentInputs.vPositionW,refractionVector,uniforms.vRefractionSize,uniforms.vRefractionPosition);
229#endif
230refractionVector.y=refractionVector.y*uniforms.vRefractionInfos.w;var refractionLookup: vec4f=textureSample(refractionCubeSampler,refractionCubeSamplerSampler,refractionVector);if (dot(refractionVector,viewDirectionW)<1.0) {refractionColor=refractionLookup;}
231#else
232var vRefractionUVW: vec3f= (uniforms.refractionMatrix*(scene.view* vec4f(fragmentInputs.vPositionW+refractionVector*uniforms.vRefractionInfos.z,1.0))).xyz;var refractionCoords: vec2f=vRefractionUVW.xy/vRefractionUVW.z;refractionCoords.y=1.0-refractionCoords.y;refractionColor=textureSample(refraction2DSampler,refraction2DSamplerSampler,refractionCoords);
233#endif
234#ifdef RGBDREFRACTION
235refractionColor=vec4f(fromRGBD(refractionColor),refractionColor.a);
236#endif
237#ifdef IS_REFRACTION_LINEAR
238refractionColor=vec4f(toGammaSpaceVec3(refractionColor.rgb),refractionColor.a);
239#endif
240refractionColor=vec4f(refractionColor.rgb*uniforms.vRefractionInfos.x,refractionColor.a);
241#endif
242var reflectionColor: vec4f= vec4f(0.,0.,0.,1.);
243#ifdef REFLECTION
244var vReflectionUVW: vec3f=computeReflectionCoords( vec4f(fragmentInputs.vPositionW,1.0),normalW);
245#ifdef REFLECTIONMAP_OPPOSITEZ
246vReflectionUVW=vec3f(vReflectionUVW.x,vReflectionUVW.y,vReflectionUVW.z*-1.0);
247#endif
248#ifdef REFLECTIONMAP_3D
249#ifdef ROUGHNESS
250var bias: f32=uniforms.vReflectionInfos.y;
251#ifdef SPECULARTERM
252#ifdef SPECULAR
253#ifdef GLOSSINESS
254bias*=(1.0-specularMapColor.a);
255#endif
256#endif
257#endif
258reflectionColor=textureSampleLevel(reflectionCubeSampler,reflectionCubeSamplerSampler,vReflectionUVW,bias);
259#else
260reflectionColor=textureSample(reflectionCubeSampler,reflectionCubeSamplerSampler,vReflectionUVW);
261#endif
262#else
263var coords: vec2f=vReflectionUVW.xy;
264#ifdef REFLECTIONMAP_PROJECTION
265coords/=vReflectionUVW.z;
266#endif
267coords.y=1.0-coords.y;reflectionColor=textureSample(reflection2DSampler,reflection2DSamplerSampler,coords);
268#endif
269#ifdef RGBDREFLECTION
270reflectionColor=vec4f(fromRGBD(reflectionColor),reflectionColor.a);
271#endif
272#ifdef IS_REFLECTION_LINEAR
273reflectionColor=vec4f(toGammaSpaceVec3(reflectionColor.rgb),reflectionColor.a);
274#endif
275reflectionColor=vec4f(reflectionColor.rgb*uniforms.vReflectionInfos.x,reflectionColor.a);
276#ifdef REFLECTIONFRESNEL
277var reflectionFresnelTerm: f32=computeFresnelTerm(viewDirectionW,normalW,uniforms.reflectionRightColor.a,uniforms.reflectionLeftColor.a);
278#ifdef REFLECTIONFRESNELFROMSPECULAR
279#ifdef SPECULARTERM
280reflectionColor=vec4f(reflectionColor.rgb*specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*uniforms.reflectionRightColor.rgb,reflectionColor.a);
281#else
282reflectionColor=vec4f(reflectionColor.rgb*uniforms.reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*uniforms.reflectionRightColor.rgb,reflectionColor.a);
283#endif
284#else
285reflectionColor=vec4f(reflectionColor.rgb*uniforms.reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*uniforms.reflectionRightColor.rgb,reflectionColor.a);
286#endif
287#endif
288#endif
289#ifdef REFRACTIONFRESNEL
290var refractionFresnelTerm: f32=computeFresnelTerm(viewDirectionW,normalW,uniforms.refractionRightColor.a,uniforms.refractionLeftColor.a);refractionColor=vec4f(refractionColor.rgb*uniforms.refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*uniforms.refractionRightColor.rgb,refractionColor.a);
291#endif
292#ifdef OPACITY
293var opacityMap: vec4f=textureSample(opacitySampler,opacitySamplerSampler,fragmentInputs.vOpacityUV+uvOffset);
294#ifdef OPACITYRGB
295opacityMap=vec4f(opacityMap.rgb* vec3f(0.3,0.59,0.11),opacityMap.a);alpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* uniforms.vOpacityInfos.y;
296#else
297alpha*=opacityMap.a*uniforms.vOpacityInfos.y;
298#endif
299#endif
300#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)
301alpha*=fragmentInputs.vColor.a;
302#endif
303#ifdef OPACITYFRESNEL
304var opacityFresnelTerm: f32=computeFresnelTerm(viewDirectionW,normalW,uniforms.opacityParts.z,uniforms.opacityParts.w);alpha+=uniforms.opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*uniforms.opacityParts.y;
305#endif
306#ifdef ALPHATEST
307#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS
308if (alpha<uniforms.alphaCutOff) {discard;}
309#endif
310#ifndef ALPHABLEND
311alpha=1.0;
312#endif
313#endif
314var emissiveColor: vec3f=uniforms.vEmissiveColor;
315#ifdef EMISSIVE
316emissiveColor+=textureSample(emissiveSampler,emissiveSamplerSampler,fragmentInputs.vEmissiveUV+uvOffset).rgb*uniforms.vEmissiveInfos.y;
317#endif
318#ifdef EMISSIVEFRESNEL
319var emissiveFresnelTerm: f32=computeFresnelTerm(viewDirectionW,normalW,uniforms.emissiveRightColor.a,uniforms.emissiveLeftColor.a);emissiveColor*=uniforms.emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*uniforms.emissiveRightColor.rgb;
320#endif
321#ifdef DIFFUSEFRESNEL
322var diffuseFresnelTerm: f32=computeFresnelTerm(viewDirectionW,normalW,uniforms.diffuseRightColor.a,uniforms.diffuseLeftColor.a);diffuseBase*=uniforms.diffuseLeftColor.rgb*(1.0-diffuseFresnelTerm)+diffuseFresnelTerm*uniforms.diffuseRightColor.rgb;
323#endif
324#ifdef EMISSIVEASILLUMINATION
325var finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor+uniforms.vAmbientColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;
326#else
327#ifdef LINKEMISSIVEWITHDIFFUSE
328var finalDiffuse: vec3f=clamp((diffuseBase+emissiveColor)*diffuseColor+uniforms.vAmbientColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;
329#else
330var finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor+emissiveColor+uniforms.vAmbientColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;
331#endif
332#endif
333#ifdef SPECULARTERM
334var finalSpecular: vec3f=specularBase*specularColor;
335#ifdef SPECULAROVERALPHA
336alpha=clamp(alpha+dot(finalSpecular, vec3f(0.3,0.59,0.11)),0.0,1.0);
337#endif
338#else
339var finalSpecular: vec3f= vec3f(0.0);
340#endif
341#ifdef REFLECTIONOVERALPHA
342alpha=clamp(alpha+dot(reflectionColor.rgb, vec3f(0.3,0.59,0.11)),0.0,1.0);
343#endif
344#ifdef EMISSIVEASILLUMINATION
345var color: vec4f= vec4f(clamp(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor.rgb+emissiveColor+refractionColor.rgb,0.0,1.0),alpha);
346#else
347var color: vec4f= vec4f(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor.rgb+refractionColor.rgb,alpha);
348#endif
349#ifdef LIGHTMAP
350#ifndef LIGHTMAPEXCLUDED
351#ifdef USELIGHTMAPASSHADOWMAP
352color=vec4f(color.rgb*lightmapColor.rgb,color.a);
353#else
354color=vec4f(color.rgb+lightmapColor.rgb,color.a);
355#endif
356#endif
357#endif
358#define CUSTOM_FRAGMENT_BEFORE_FOG
359color=vec4f(max(color.rgb,vec3f(0.)),color.a);
360#include<logDepthFragment>
361#include<fogFragment>
362#ifdef IMAGEPROCESSINGPOSTPROCESS
363color=vec4f(toLinearSpaceVec3(color.rgb),color.a);
364#else
365#ifdef IMAGEPROCESSING
366color=vec4f(toLinearSpaceVec3(color.rgb),color.a);color=applyImageProcessing(color);
367#endif
368#endif
369color=vec4f(color.rgb,color.a*mesh.visibility);
370#ifdef PREMULTIPLYALPHA
371color=vec4f(color.rgb*color.a, color.a);
372#endif
373#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR
374#ifdef PREPASS
375#if SCENE_MRT_COUNT>0
376var writeGeometryInfo: f32=select(0.0,1.0,color.a>0.4);var fragData: array<vec4<f32>,SCENE_MRT_COUNT>;
377#ifdef PREPASS_COLOR
378fragData[PREPASS_COLOR_INDEX]=color; 
379#endif
380#ifdef PREPASS_POSITION
381fragData[PREPASS_POSITION_INDEX]=vec4f(fragmentInputs.vPositionW,writeGeometryInfo);
382#endif
383#ifdef PREPASS_LOCAL_POSITION
384fragData[PREPASS_LOCAL_POSITION_INDEX]=vec4f(fragmentInputs.vPosition,writeGeometryInfo);
385#endif
386#ifdef PREPASS_VELOCITY
387var a: vec2f=(fragmentInputs.vCurrentPosition.xy/fragmentInputs.vCurrentPosition.w)*0.5+0.5;var b: vec2f=(fragmentInputs.vPreviousPosition.xy/fragmentInputs.vPreviousPosition.w)*0.5+0.5;var velocity: vec2f=abs(a-b);velocity= vec2f(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;fragData[PREPASS_VELOCITY_INDEX]= vec4f(velocity,0.0,writeGeometryInfo);
388#elif defined(PREPASS_VELOCITY_LINEAR)
389var velocity : vec2f=vec2f(0.5)*((fragmentInputs.vPreviousPosition.xy/fragmentInputs.vPreviousPosition.w) -
390(fragmentInputs.vCurrentPosition.xy/fragmentInputs.vCurrentPosition.w));fragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4f(velocity,0.0,writeGeometryInfo);
391#endif
392#ifdef PREPASS_IRRADIANCE
393fragData[PREPASS_IRRADIANCE_INDEX]=vec4f(0.0,0.0,0.0,writeGeometryInfo); 
394#endif
395#ifdef PREPASS_DEPTH
396fragData[PREPASS_DEPTH_INDEX]=vec4f(fragmentInputs.vViewPos.z,0.0,0.0,writeGeometryInfo); 
397#endif
398#ifdef PREPASS_SCREENSPACE_DEPTH
399fragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4f(fragmentInputs.position.z,0.0,0.0,writeGeometryInfo);
400#endif
401#ifdef PREPASS_NORMALIZED_VIEW_DEPTH
402fragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4f(fragmentInputs.vNormViewDepth,0.0,0.0,writeGeometryInfo);
403#endif
404#ifdef PREPASS_NORMAL
405#ifdef PREPASS_NORMAL_WORLDSPACE
406fragData[PREPASS_NORMAL_INDEX]=vec4f(normalW,writeGeometryInfo);
407#else
408fragData[PREPASS_NORMAL_INDEX]=vec4f(normalize((scene.view*vec4f(normalW,0.0)).rgb),writeGeometryInfo);
409#endif
410#endif
411#ifdef PREPASS_WORLD_NORMAL
412fragData[PREPASS_WORLD_NORMAL_INDEX]=vec4f(normalW*0.5+0.5,writeGeometryInfo);
413#endif
414#ifdef PREPASS_ALBEDO
415fragData[PREPASS_ALBEDO_INDEX]=vec4f(baseColor.rgb,writeGeometryInfo);
416#endif
417#ifdef PREPASS_ALBEDO_SQRT
418fragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4f(sqrt(baseColor.rgb),writeGeometryInfo);
419#endif
420#ifdef PREPASS_REFLECTIVITY
421#if defined(SPECULAR)
422fragData[PREPASS_REFLECTIVITY_INDEX]=vec4f(toLinearSpaceVec4(specularMapColor))*writeGeometryInfo; 
423#else
424fragData[PREPASS_REFLECTIVITY_INDEX]=vec4f(toLinearSpaceVec3(specularColor),1.0)*writeGeometryInfo;
425#endif
426#endif
427#if SCENE_MRT_COUNT>0
428fragmentOutputs.fragData0=fragData[0];
429#endif
430#if SCENE_MRT_COUNT>1
431fragmentOutputs.fragData1=fragData[1];
432#endif
433#if SCENE_MRT_COUNT>2
434fragmentOutputs.fragData2=fragData[2];
435#endif
436#if SCENE_MRT_COUNT>3
437fragmentOutputs.fragData3=fragData[3];
438#endif
439#if SCENE_MRT_COUNT>4
440fragmentOutputs.fragData4=fragData[4];
441#endif
442#if SCENE_MRT_COUNT>5
443fragmentOutputs.fragData5=fragData[5];
444#endif
445#if SCENE_MRT_COUNT>6
446fragmentOutputs.fragData6=fragData[6];
447#endif
448#if SCENE_MRT_COUNT>7
449fragmentOutputs.fragData7=fragData[7];
450#endif
451#endif
452#endif
453#if !defined(PREPASS) && !defined(ORDER_INDEPENDENT_TRANSPARENCY)
454fragmentOutputs.color=color;
455#endif
456#include<oitFragment>
457#if ORDER_INDEPENDENT_TRANSPARENCY
458if (fragDepth==nearestDepth) {fragmentOutputs.frontColor=vec4f(fragmentOutputs.frontColor.rgb+color.rgb*color.a*alphaMultiplier,1.0-alphaMultiplier*(1.0-color.a));} else {fragmentOutputs.backColor+=color;}
459#endif
460#define CUSTOM_FRAGMENT_MAIN_END
461}
462`;e.ShadersStoreWGSL[r]||(e.ShadersStoreWGSL[r]=o);const p={name:r,shader:o};export{p as defaultPixelShaderWGSL};

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.