1import{p as e}from"./fileTools.pure-O3hflNMy.js";import{s as P,m as D,d as R,a as X,l as W}from"./logDepthDeclaration-NkckDCxs.js";import{h as b}from"./helperFunctions-B6Ks6Htg.js";import{b as F,a as G,i as z,c as C,d as B,e as w,f as H,g as Y}from"./clipPlaneVertex-B5KC89fQ.js";import{f as $,a as j,v as k}from"./vertexColorMixing-7o77qkoJ.js";import{m as Q,a as K,b as Z,c as q}from"./morphTargetsVertex-VF2XVHUB.js";const i="uvAttributeDeclaration",E=`#if defined(UV{X}) && !defined(USE_VERTEX_PULLING) 2attribute uv{X}: vec2f; 3#endif 4`;e.IncludesShadersStoreWGSL[i]||(e.IncludesShadersStoreWGSL[i]=E);const J={name:i,shader:E},a="prePassVertexDeclaration",x=`#ifdef PREPASS 5#ifdef PREPASS_LOCAL_POSITION 6varying vPosition : vec3f; 7#endif 8#ifdef PREPASS_DEPTH 9varying vViewPos: vec3f; 10#endif 11#ifdef PREPASS_NORMALIZED_VIEW_DEPTH 12varying vNormViewDepth: f32; 13#endif 14#if defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) 15uniform previousViewProjection: mat4x4f;varying vCurrentPosition: vec4f;varying vPreviousPosition: vec4f; 16#endif 17#endif 18`;e.IncludesShadersStoreWGSL[a]||(e.IncludesShadersStoreWGSL[a]=x);const ee={name:a,shader:x},r="samplerVertexDeclaration",I=`#if defined(_DEFINENAME_) && _DEFINENAME_DIRECTUV==0 19varying v_VARYINGNAME_UV: vec2f; 20#endif 21`;e.IncludesShadersStoreWGSL[r]||(e.IncludesShadersStoreWGSL[r]=I);const te={name:r,shader:I},n="bumpVertexDeclaration",V=`#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) 22#if defined(TANGENT) && defined(NORMAL) 23varying vTBN0: vec3f;varying vTBN1: vec3f;varying vTBN2: vec3f; 24#endif 25#endif 26`;e.IncludesShadersStoreWGSL[n]||(e.IncludesShadersStoreWGSL[n]=V);const ie={name:n,shader:V},f="lightVxFragmentDeclaration",S=`#ifdef LIGHT{X} 27uniform vLightData{X}: vec4f;uniform vLightDiffuse{X}: vec4f; 28#ifdef SPECULARTERM 29uniform vLightSpecular{X}: vec4f; 30#else 31var vLightSpecular{X}: vec4f= vec4f(0.); 32#endif 33#ifdef SHADOW{X} 34#ifdef SHADOWCSM{X} 35uniform lightMatrix{X}: mat4x4f[SHADOWCSMNUM_CASCADES{X}];varying var vPositionFromLight{X}: vec4f[SHADOWCSMNUM_CASCADES{X}];varying var vDepthMetric{X}: f32[SHADOWCSMNUM_CASCADES{X}];varying var vPositionFromCamera{X}: vec4f; 36#elif defined(SHADOWCUBE{X}) 37#else 38varying var vPositionFromLight{X}: vec4f;varying var vDepthMetric{X}: f32;uniform lightMatrix{X}: mat4x4f; 39#endif 40uniform shadowsInfo{X}: vec4f;uniform depthValues{X}: vec2f; 41#endif 42#ifdef SPOTLIGHT{X} 43uniform vLightDirection{X}: vec4f;uniform vLightFalloff{X}: vec4f; 44#elif defined(POINTLIGHT{X}) 45uniform vLightFalloff{X}: vec4f; 46#elif defined(HEMILIGHT{X}) 47uniform vLightGround{X}: vec3f; 48#endif 49#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) 50uniform vLightWidth{X}: vec4f;uniform vLightHeight{X}: vec4f; 51#endif 52#endif 53`;e.IncludesShadersStoreWGSL[f]||(e.IncludesShadersStoreWGSL[f]=S);const ae={name:f,shader:S},d="lightVxUboDeclaration",N=`#ifdef LIGHT{X} 54struct Light{X} 55{vLightData: vec4f, 56vLightDiffuse: vec4f, 57vLightSpecular: vec4f, 58#ifdef SPOTLIGHT{X} 59vLightDirection: vec4f, 60vLightFalloff: vec4f, 61#elif defined(POINTLIGHT{X}) 62vLightFalloff: vec4f, 63#elif defined(HEMILIGHT{X}) 64vLightGround: vec3f, 65#elif defined(CLUSTLIGHT{X}) 66vSliceData: vec2f, 67vSliceRanges: array<vec4f,CLUSTLIGHT_SLICES>, 68#endif 69#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED) 70vLightWidth: vec4f, 71vLightHeight: vec4f, 72#endif 73shadowsInfo: vec4f, 74depthValues: vec2f} ;var<uniform> light{X} : Light{X}; 75#ifdef SHADOW{X} 76#ifdef SHADOWCSM{X} 77uniform lightMatrix{X}: array<mat4x4f,SHADOWCSMNUM_CASCADES{X}>;varying vPositionFromLight{X}_0: vec4f;varying vDepthMetric{X}_0: f32;varying vPositionFromLight{X}_1: vec4f;varying vDepthMetric{X}_1: f32;varying vPositionFromLight{X}_2: vec4f;varying vDepthMetric{X}_2: f32;varying vPositionFromLight{X}_3: vec4f;varying vDepthMetric{X}_3: f32;varying vPositionFromCamera{X}: vec4f; 78#elif defined(SHADOWCUBE{X}) 79#else 80varying vPositionFromLight{X}: vec4f;varying vDepthMetric{X}: f32;uniform lightMatrix{X}: mat4x4f; 81#endif 82#endif 83#endif 84`;e.IncludesShadersStoreWGSL[d]||(e.IncludesShadersStoreWGSL[d]=N);const re={name:d,shader:N},o="vertexPullingDeclaration",T=`#ifdef USE_VERTEX_PULLING 85#ifdef VERTEX_PULLING_USE_INDEX_BUFFER 86var<storage,read> indices : array<u32>; 87#endif 88var<storage,read> position : array<f32>;uniform vp_position_info : vec4f; 89#ifdef NORMAL 90var<storage,read> normal : array<f32>;uniform vp_normal_info : vec4f; 91#endif 92#ifdef TANGENT 93var<storage,read> tangent : array<f32>;uniform vp_tangent_info : vec4f; 94#endif 95#ifdef UV1 96var<storage,read> uv : array<f32>;uniform vp_uv_info : vec4f; 97#define VP_UV1_SUPPORTED 98#endif 99#ifdef UV2 100var<storage,read> uv2 : array<f32>;uniform vp_uv2_info : vec4f; 101#define VP_UV2_SUPPORTED 102#endif 103#ifdef UV3 104var<storage,read> uv3 : array<f32>;uniform vp_uv3_info : vec4f; 105#define VP_UV3_SUPPORTED 106#endif 107#ifdef UV4 108var<storage,read> uv4 : array<f32>;uniform vp_uv4_info : vec4f; 109#define VP_UV4_SUPPORTED 110#endif 111#ifdef UV5 112var<storage,read> uv5 : array<f32>;uniform vp_uv5_info : vec4f; 113#define VP_UV5_SUPPORTED 114#endif 115#ifdef UV6 116var<storage,read> uv6 : array<f32>;uniform vp_uv6_info : vec4f; 117#define VP_UV6_SUPPORTED 118#endif 119#ifdef VERTEXCOLOR 120var<storage,read> color : array<f32>;uniform vp_color_info : vec4f; 121#endif 122#if NUM_BONE_INFLUENCERS>0 123var<storage,read> matricesIndices : array<u32>;var<storage,read> matricesWeights : array<f32>;uniform vp_matricesIndices_info : vec4f;uniform vp_matricesWeights_info : vec4f; 124#if NUM_BONE_INFLUENCERS>4 125var<storage,read> matricesIndicesExtra : array<u32>;var<storage,read> matricesWeightsExtra : array<f32>;uniform vp_matricesIndicesExtra_info : vec4f;uniform vp_matricesWeightsExtra_info : vec4f; 126#endif 127#endif 128fn vp_convertToFloat(word : u32,byteInWord : u32,dataType : u32,normalized : bool)->
128f32 {switch (dataType) {case 5120u: { 129let shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;let signedValue=f32(i32(value<<24u)>>24u);if (normalized) { return signedValue/127.0; } 130return signedValue;} 131case 5121u: { 132let shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;if (normalized) { return f32(value)/255.0; } 133return f32(value);} 134case 5122u: { 135let shift=(byteInWord & 0xFFFFFFFEu)*8u;let value=(word>>shift) & 0xFFFFu;let signedValue=f32(i32(value<<16u)>>16u);if (normalized) { return signedValue/32767.0; } 136return signedValue;} 137case 5123u: { 138let shift=(byteInWord & 0xFFFFFFFEu)*8u;let value=(word>>shift) & 0xFFFFu;if (normalized) { return f32(value)/65535.0; } 139return f32(value);} 140case 5126u: { 141return bitcast<f32>(word);} 142default: { return 0.0; }}} 143fn vp_componentSize(dataType : u32)->u32 {return select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);} 144fn vp_readVertexIndex(index : u32)->u32 { 145#ifndef VERTEX_PULLING_USE_INDEX_BUFFER 146return index; 147#else 148#ifdef VERTEX_PULLING_INDEX_BUFFER_32BITS 149return indices[index]; 150#else 151let u32_index=index/2u;let bit_offset=(index & 1u)*16u;return (indices[u32_index]>>bit_offset) & 0xFFFFu; 152#endif 153#endif 154} 155fn vp_readPositionValue(byteOffset : u32,dataType : u32,normalized : bool)->f32 {return vp_convertToFloat(bitcast<u32>(position[byteOffset/4u]),byteOffset % 4u,dataType,normalized);} 156fn vp_readPosition(info : vec4f,vertexIndex : u32)->vec3f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let cs=vp_componentSize(dataType);return vec3f( 157vp_readPositionValue(offset,dataType,normalized), 158vp_readPositionValue(offset+cs,dataType,normalized), 159vp_readPositionValue(offset+cs*2u,dataType,normalized) 160);} 161#ifdef NORMAL 162fn vp_readNormalValue(byteOffset : u32,dataType : u32,normalized : bool)->f32 {return vp_convertToFloat(bitcast<u32>(normal[byteOffset/4u]),byteOffset % 4u,dataType,normalized);} 163fn vp_readNormal(info : vec4f,vertexIndex : u32)->vec3f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let cs=vp_componentSize(dataType);return vec3f( 164vp_readNormalValue(offset,dataType,normalized), 165vp_readNormalValue(offset+cs,dataType,normalized), 166vp_readNormalValue(offset+cs*2u,dataType,normalized) 167);} 168#endif 169#ifdef TANGENT 170fn vp_readTangentValue(byteOffset : u32,dataType : u32,normalized : bool)->f32 {return vp_convertToFloat(bitcast<u32>(tangent[byteOffset/4u]),byteOffset % 4u,dataType,normalized);} 171fn vp_readTangent(info : vec4f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let cs=vp_componentSize(dataType);return vec4f( 172vp_readTangentValue(offset,dataType,normalized), 173vp_readTangentValue(offset+cs,dataType,normalized), 174vp_readTangentValue(offset+cs*2u,dataType,normalized), 175vp_readTangentValue(offset+cs*3u,dataType,normalized) 176);} 177#endif 178#ifdef UV1 179fn vp_readUVValue(byteOffset : u32,dataType : u32,normalized : bool)->f32 {return vp_convertToFloat(bitcast<u32>(uv[byteOffset/4u]),byteOffset % 4u,dataType,normalized);} 180fn vp_readUV(info : vec4f,vertexIndex : u32)->vec2f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let cs=vp_componentSize(dataType);return vec2f( 181vp_readUVValue(offset,dataType,normalized), 182vp_readUVValue(offset+cs,dataType,normalized) 183);} 184#endif 185#ifdef UV2 186fn vp_readUV2Value(byteOffset : u32,dataType : u32,normalized : bool)->f32 {return vp_convertToFloat(bitcast<u32>(uv2[byteOffset/4u]),byteOffset % 4u,dataType,normalized);} 187fn vp_readUV2(info : vec4f,vertexIndex : u32)->vec2f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let cs=vp_componentSize(dataType);return vec2f( 188vp_readUV2Value(offset,dataType,normalized), 189vp_readUV2Value(offset+cs,dataType,normalized) 190);} 191#endif 192#ifdef UV3 193fn vp_readUV3Value(byteOffset : u32,dataType : u32,normalized : bool)->f32 {return vp_convertToFloat(bitcast<u32>(uv3[byteOffset/4u]),byteOffset % 4u,dataType,normalized);} 194fn vp_readUV3(info : vec4f,vertexIndex : u32)->vec2f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let cs=vp_componentSize(dataType);return vec2f( 195vp_readUV3Value(offset,dataType,normalized), 196vp_readUV3Value(offset+cs,dataType,normalized) 197);} 198#endif 199#ifdef UV4 200fn vp_readUV4Value(byteOffset : u32,dataType : u32,normalized : bool)->f32 {return vp_convertToFloat(bitcast<u32>(uv4[byteOffset/4u]),byteOffset % 4u,dataType,normalized);} 201fn vp_readUV4(info : vec4f,vertexIndex : u32)->vec2f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let cs=vp_componentSize(dataType);return vec2f( 202vp_readUV4Value(offset,dataType,normalized), 203vp_readUV4Value(offset+cs,dataType,normalized) 204);} 205#endif 206#ifdef UV5 207fn vp_readUV5Value(byteOffset : u32,dataType : u32,normalized : bool)->f32 {return vp_convertToFloat(bitcast<u32>(uv5[byteOffset/4u]),byteOffset % 4u,dataType,normalized);} 208fn vp_readUV5(info : vec4f,vertexIndex : u32)->vec2f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let cs=vp_componentSize(dataType);return vec2f( 209vp_readUV5Value(offset,dataType,normalized), 210vp_readUV5Value(offset+cs,dataType,normalized) 211);} 212#endif 213#ifdef UV6 214fn vp_readUV6Value(byteOffset : u32,dataType : u32,normalized : bool)->f32 {return vp_convertToFloat(bitcast<u32>(uv6[byteOffset/4u]),byteOffset % 4u,dataType,normalized);} 215fn vp_readUV6(info : vec4f,vertexIndex : u32)->vec2f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let cs=vp_componentSize(dataType);return vec2f( 216vp_readUV6Value(offset,dataType,normalized), 217vp_readUV6Value(offset+cs,dataType,normalized) 218);} 219#endif 220#ifdef VERTEXCOLOR 221fn vp_readColorValue(byteOffset : u32,dataType : u32,normalized : bool)->f32 {return vp_convertToFloat(bitcast<u32>(color[byteOffset/4u]),byteOffset % 4u,dataType,normalized);} 222fn vp_readColor(info : vec4f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let cs=vp_componentSize(dataType);return vec4f( 223vp_readColorValue(offset,dataType,normalized), 224vp_readColorValue(offset+cs,dataType,normalized), 225vp_readColorValue(offset+cs*2u,dataType,normalized), 226vp_readColorValue(offset+cs*3u,dataType,normalized) 227);} 228#endif 229#if NUM_BONE_INFLUENCERS>0 230fn vp_readMatrixIndexValue(byteOffset : u32,dataType : u32,normalized : bool)->f32 {return vp_convertToFloat(matricesIndices[byteOffset/4u],byteOffset % 4u,dataType,normalized);} 231fn vp_readBoneIndices(info : vec4f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let cs=vp_componentSize(dataType);return vec4f( 232vp_readMatrixIndexValue(offset,dataType,normalized), 233vp_readMatrixIndexValue(offset+cs,dataType,normalized), 234vp_readMatrixIndexValue(offset+cs*2u,dataType,normalized), 235vp_readMatrixIndexValue(offset+cs*3u,dataType,normalized) 236);} 237fn vp_readMatrixWeightValue(byteOffset : u32,dataType : u32,normalized : bool)->f32 {return vp_convertToFloat(bitcast<u32>(matricesWeights[byteOffset/4u]),byteOffset % 4u,dataType,normalized);} 238fn vp_readBoneWeights(info : vec4f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let cs=vp_componentSize(dataType);return vec4f( 239vp_readMatrixWeightValue(offset,dataType,normalized), 240vp_readMatrixWeightValue(offset+cs,dataType,normalized), 241vp_readMatrixWeightValue(offset+cs*2u,dataType,normalized), 242vp_readMatrixWeightValue(offset+cs*3u,dataType,normalized) 243);} 244#if NUM_BONE_INFLUENCERS>4 245fn vp_readMatrixIndexExtraValue(byteOffset : u32,dataType : u32,normalized : bool)->f32 {return vp_convertToFloat(matricesIndicesExtra[byteOffset/4u],byteOffset % 4u,dataType,normalized);} 246fn vp_readBoneIndicesExtra(info : vec4f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let cs=vp_componentSize(dataType);return vec4f( 247vp_readMatrixIndexExtraValue(offset,dataType,normalized), 248vp_readMatrixIndexExtraValue(offset+cs,dataType,normalized), 249vp_readMatrixIndexExtraValue(offset+cs*2u,dataType,normalized), 250vp_readMatrixIndexExtraValue(offset+cs*3u,dataType,normalized) 251);} 252fn vp_readMatrixWeightExtraValue(byteOffset : u32,dataType : u32,normalized : bool)->f32 {return vp_convertToFloat(bitcast<u32>(matricesWeightsExtra[byteOffset/4u]),byteOffset % 4u,dataType,normalized);} 253fn vp_readBoneWeightsExtra(info : vec4f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let cs=vp_componentSize(dataType);return vec4f( 254vp_readMatrixWeightExtraValue(offset,dataType,normalized), 255vp_readMatrixWeightExtraValue(offset+cs,dataType,normalized), 256vp_readMatrixWeightExtraValue(offset+cs*2u,dataType,normalized), 257vp_readMatrixWeightExtraValue(offset+cs*3u,dataType,normalized) 258);} 259#endif 260#endif 261#endif 262`;e.IncludesShadersStoreWGSL[o]||(e.IncludesShadersStoreWGSL[o]=T);const ne={name:o,shader:T},s="vertexPullingVertex",A=`#ifdef USE_VERTEX_PULLING 263let vpVertexIndex: u32=vp_readVertexIndex(vertexInputs.vertexIndex);positionUpdated=vp_readPosition(uniforms.vp_position_info,vpVertexIndex); 264#ifdef NORMAL 265normalUpdated=vp_readNormal(uniforms.vp_normal_info,vpVertexIndex); 266#endif 267#ifdef TANGENT 268tangentUpdated=vp_readTangent(uniforms.vp_tangent_info,vpVertexIndex); 269#endif 270#ifdef UV1 271uvUpdated=vp_readUV(uniforms.vp_uv_info,vpVertexIndex); 272#endif 273#ifdef UV2 274uv2Updated=vp_readUV2(uniforms.vp_uv2_info,vpVertexIndex); 275#endif 276#ifdef UV3 277var uv3Updated: vec2f=vp_readUV3(uniforms.vp_uv3_info,vpVertexIndex); 278#endif 279#ifdef UV4 280var uv4Updated: vec2f=vp_readUV4(uniforms.vp_uv4_info,vpVertexIndex); 281#endif 282#ifdef UV5 283var uv5Updated: vec2f=vp_readUV5(uniforms.vp_uv5_info,vpVertexIndex); 284#endif 285#ifdef UV6 286var uv6Updated: vec2f=vp_readUV6(uniforms.vp_uv6_info,vpVertexIndex); 287#endif 288#ifdef VERTEXCOLOR 289colorUpdated=vp_readColor(uniforms.vp_color_info,vpVertexIndex); 290#endif 291#ifdef MORPHTARGETS 292let vp_basePosition: vec3f=positionUpdated; 293#ifdef NORMAL 294let vp_baseNormal: vec3f=normalUpdated; 295#endif 296#ifdef TANGENT 297let vp_baseTangent: vec4f=tangentUpdated; 298#endif 299#ifdef UV1 300let vp_baseUV: vec2f=uvUpdated; 301#endif 302#ifdef UV2 303let vp_baseUV2: vec2f=uv2Updated; 304#endif 305#ifdef VERTEXCOLOR 306let vp_baseColor: vec4f=colorUpdated; 307#endif 308#endif 309#if NUM_BONE_INFLUENCERS>0 310var vp_matricesIndices: vec4f=vp_readBoneIndices(uniforms.vp_matricesIndices_info,vpVertexIndex);var vp_matricesWeights: vec4f=vp_readBoneWeights(uniforms.vp_matricesWeights_info,vpVertexIndex); 311#if NUM_BONE_INFLUENCERS>4 312var vp_matricesIndicesExtra: vec4f=vp_readBoneIndicesExtra(uniforms.vp_matricesIndicesExtra_info,vpVertexIndex);var vp_matricesWeightsExtra: vec4f=vp_readBoneWeightsExtra(uniforms.vp_matricesWeightsExtra_info,vpVertexIndex); 313#endif 314#endif 315#endif 316`;e.IncludesShadersStoreWGSL[s]||(e.IncludesShadersStoreWGSL[s]=A);const fe={name:s,shader:A},v="prePassVertex",O=`#ifdef PREPASS_DEPTH 317vertexOutputs.vViewPos=(scene.view*worldPos).rgb; 318#endif 319#ifdef PREPASS_NORMALIZED_VIEW_DEPTH 320vertexOutputs.vNormViewDepth=((scene.view*worldPos).z-uniforms.cameraInfo.x)/(uniforms.cameraInfo.y-uniforms.cameraInfo.x); 321#endif 322#ifdef PREPASS_LOCAL_POSITION 323vertexOutputs.vPosition=positionUpdated.xyz; 324#endif 325#if (defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && defined(BONES_VELOCITY_ENABLED) 326vertexOutputs.vCurrentPosition=scene.viewProjection*worldPos; 327#if NUM_BONE_INFLUENCERS>0 328var previousInfluence: mat4x4f;previousInfluence=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[
3280])]*vertexInputs.matricesWeights[0]; 329#if NUM_BONE_INFLUENCERS>1 330previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[1])]*vertexInputs.matricesWeights[1]; 331#endif 332#if NUM_BONE_INFLUENCERS>2 333previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[2])]*vertexInputs.matricesWeights[2]; 334#endif 335#if NUM_BONE_INFLUENCERS>3 336previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[3])]*vertexInputs.matricesWeights[3]; 337#endif 338#if NUM_BONE_INFLUENCERS>4 339previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[0])]*vertexInputs.matricesWeightsExtra[0]; 340#endif 341#if NUM_BONE_INFLUENCERS>5 342previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[1])]*vertexInputs.matricesWeightsExtra[1]; 343#endif 344#if NUM_BONE_INFLUENCERS>6 345previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[2])]*vertexInputs.matricesWeightsExtra[2]; 346#endif 347#if NUM_BONE_INFLUENCERS>7 348previousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[3])]*vertexInputs.matricesWeightsExtra[3]; 349#endif 350vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld*previousInfluence* vec4f(positionUpdated,1.0); 351#else 352vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld* vec4f(positionUpdated,1.0); 353#endif 354#endif 355`;e.IncludesShadersStoreWGSL[v]||(e.IncludesShadersStoreWGSL[v]=O);const de={name:v,shader:O},u="uvVariableDeclaration",h=`#ifdef MAINUV{X} 356#if !defined(UV{X}) 357var uv{X}: vec2f=vec2f(0.,0.); 358#elif defined(USE_VERTEX_PULLING) 359var uv{X}: vec2f=uv{X}Updated; 360#else 361var uv{X}: vec2f=vertexInputs.uv{X}; 362#endif 363vertexOutputs.vMainUV{X}=uv{X}; 364#endif 365`;e.IncludesShadersStoreWGSL[u]||(e.IncludesShadersStoreWGSL[u]=h);const oe={name:u,shader:h},l="samplerVertexImplementation",U=`#if defined(_DEFINENAME_) && _DEFINENAME_DIRECTUV==0 366if (uniforms.v_INFONAME_==0.) 367{vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(uvUpdated,1.0,0.0)).xy;} 368#ifdef UV2 369else if (uniforms.v_INFONAME_==1.) 370{vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(uv2Updated,1.0,0.0)).xy;} 371#endif 372#ifdef UV3 373else if (uniforms.v_INFONAME_==2.) 374{vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(vertexInputs.uv3,1.0,0.0)).xy;} 375#endif 376#ifdef UV4 377else if (uniforms.v_INFONAME_==3.) 378{vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(vertexInputs.uv4,1.0,0.0)).xy;} 379#endif 380#ifdef UV5 381else if (uniforms.v_INFONAME_==4.) 382{vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(vertexInputs.uv5,1.0,0.0)).xy;} 383#endif 384#ifdef UV6 385else if (uniforms.v_INFONAME_==5.) 386{vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(vertexInputs.uv6,1.0,0.0)).xy;} 387#endif 388#endif 389`;e.IncludesShadersStoreWGSL[l]||(e.IncludesShadersStoreWGSL[l]=U);const se={name:l,shader:U},p="bumpVertex",L=`#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) 390#if defined(TANGENT) && defined(NORMAL) 391var tbnNormal: vec3f=normalize(normalUpdated);var tbnTangent: vec3f=normalize(tangentUpdated.xyz);var tbnBitangent: vec3f=cross(tbnNormal,tbnTangent)*tangentUpdated.w;var matTemp= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz)* mat3x3f(tbnTangent,tbnBitangent,tbnNormal);vertexOutputs.vTBN0=matTemp[0];vertexOutputs.vTBN1=matTemp[1];vertexOutputs.vTBN2=matTemp[2]; 392#endif 393#endif 394`;e.IncludesShadersStoreWGSL[p]||(e.IncludesShadersStoreWGSL[p]=L);const ve={name:p,shader:L},c="shadowsVertex",y=`#ifdef SHADOWS 395#if defined(SHADOWCSM{X}) 396#ifdef SCENE_UBO 397vertexOutputs.vPositionFromCamera{X}=scene.view*worldPos; 398#else 399vertexOutputs.vPositionFromCamera{X}=uniforms.view*worldPos; 400#endif 401#if SHADOWCSMNUM_CASCADES{X}>0 402vertexOutputs.vPositionFromLight{X}_0=uniforms.lightMatrix{X}[0]*worldPos; 403#ifdef USE_REVERSE_DEPTHBUFFER 404vertexOutputs.vDepthMetric{X}_0=(-vertexOutputs.vPositionFromLight{X}_0.z+light{X}.depthValues.x)/light{X}.depthValues.y; 405#else 406vertexOutputs.vDepthMetric{X}_0= (vertexOutputs.vPositionFromLight{X}_0.z+light{X}.depthValues.x)/light{X}.depthValues.y; 407#endif 408#endif 409#if SHADOWCSMNUM_CASCADES{X}>1 410vertexOutputs.vPositionFromLight{X}_1=uniforms.lightMatrix{X}
410[1]*worldPos; 411#ifdef USE_REVERSE_DEPTHBUFFER 412vertexOutputs.vDepthMetric{X}_1=(-vertexOutputs.vPositionFromLight{X}_1.z+light{X}.depthValues.x)/light{X}.depthValues.y; 413#else 414vertexOutputs.vDepthMetric{X}_1= (vertexOutputs.vPositionFromLight{X}_1.z+light{X}.depthValues.x)/light{X}.depthValues.y; 415#endif 416#endif 417#if SHADOWCSMNUM_CASCADES{X}>2 418vertexOutputs.vPositionFromLight{X}_2=uniforms.lightMatrix{X}[2]*worldPos; 419#ifdef USE_REVERSE_DEPTHBUFFER 420vertexOutputs.vDepthMetric{X}_2=(-vertexOutputs.vPositionFromLight{X}_2.z+light{X}.depthValues.x)/light{X}.depthValues.y; 421#else 422vertexOutputs.vDepthMetric{X}_2= (vertexOutputs.vPositionFromLight{X}_2.z+light{X}.depthValues.x)/light{X}.depthValues.y; 423#endif 424#endif 425#if SHADOWCSMNUM_CASCADES{X}>3 426vertexOutputs.vPositionFromLight{X}_3=uniforms.lightMatrix{X}[3]*worldPos; 427#ifdef USE_REVERSE_DEPTHBUFFER 428vertexOutputs.vDepthMetric{X}_3=(-vertexOutputs.vPositionFromLight{X}_3.z+light{X}.depthValues.x)/light{X}.depthValues.y; 429#else 430vertexOutputs.vDepthMetric{X}_3= (vertexOutputs.vPositionFromLight{X}_3.z+light{X}.depthValues.x)/light{X}.depthValues.y; 431#endif 432#endif 433#elif defined(SHADOW{X}) && !defined(SHADOWCUBE{X}) 434vertexOutputs.vPositionFromLight{X}=uniforms.lightMatrix{X}*worldPos; 435#ifdef USE_REVERSE_DEPTHBUFFER 436vertexOutputs.vDepthMetric{X}=(-vertexOutputs.vPositionFromLight{X}.z+light{X}.depthValues.x)/light{X}.depthValues.y; 437#else 438vertexOutputs.vDepthMetric{X}=(vertexOutputs.vPositionFromLight{X}.z+light{X}.depthValues.x)/light{X}.depthValues.y; 439#endif 440#endif 441#endif 442`;e.IncludesShadersStoreWGSL[c]||(e.IncludesShadersStoreWGSL[c]=y);const ue={name:c,shader:y},_="logDepthVertex",g=`#ifdef LOGARITHMICDEPTH 443vertexOutputs.vFragmentDepth=1.0+vertexOutputs.position.w;vertexOutputs.position.z=log2(max(0.000001,vertexOutputs.vFragmentDepth))*uniforms.logarithmicDepthConstant; 444#endif 445`;e.IncludesShadersStoreWGSL[_]||(e.IncludesShadersStoreWGSL[_]=g);const le={name:_,shader:g},m="defaultVertexShader",M=`#include<defaultUboDeclaration> 446#define CUSTOM_VERTEX_BEGIN 447#ifndef USE_VERTEX_PULLING 448attribute position: vec3f; 449#ifdef NORMAL 450attribute normal: vec3f; 451#endif 452#ifdef TANGENT 453attribute tangent: vec4f; 454#endif 455#ifdef UV1 456attribute uv: vec2f; 457#endif 458#include<uvAttributeDeclaration>[2..7] 459#ifdef VERTEXCOLOR 460attribute color: vec4f; 461#endif 462#endif 463#include<helperFunctions> 464#include<bonesDeclaration> 465#include<bakedVertexAnimationDeclaration> 466#include<instancesDeclaration> 467#include<prePassVertexDeclaration> 468#include<mainUVVaryingDeclaration>[1..7] 469#include<samplerVertexDeclaration>(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse) 470#include<samplerVertexDeclaration>(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail) 471#include<samplerVertexDeclaration>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient) 472#include<samplerVertexDeclaration>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity) 473#include<samplerVertexDeclaration>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive) 474#include<samplerVertexDeclaration>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap) 475#if defined(SPECULARTERM) 476#include<samplerVertexDeclaration>(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular) 477#endif 478#include<samplerVertexDeclaration>(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump) 479#include<samplerVertexDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal) 480varying vPositionW: vec3f; 481#ifdef NORMAL 482varying vNormalW: vec3f; 483#endif 484#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) 485varying vColor: vec4f; 486#endif 487#include<bumpVertexDeclaration> 488#include<clipPlaneVertexDeclaration> 489#include<fogVertexDeclaration> 490#include<__decl__lightVxFragment>[0..maxSimultaneousLights] 491#include<morphTargetsVertexGlobalDeclaration> 492#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets] 493#ifdef REFLECTIONMAP_SKYBOX 494varying vPositionUVW: vec3f; 495#endif 496#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) 497varying vDirectionW: vec3f; 498#endif 499#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 500varying vViewDepth: f32; 501#endif 502#include<logDepthDeclaration> 503#include<vertexPullingDeclaration> 504#define CUSTOM_VERTEX_DEFINITIONS 505@vertex 506fn main(input : VertexInputs)->FragmentInputs { 507#define CUSTOM_VERTEX_MAIN_BEGIN 508#ifdef USE_VERTEX_PULLING 509var positionUpdated: vec3f=vec3f(0.0); 510#ifdef NORMAL 511var normalUpdated: vec3f=vec3f(0.0); 512#endif 513#ifdef TANGENT 514var tangentUpdated: vec4f=vec4f(0.0); 515#endif 516#ifdef UV1 517var uvUpdated: vec2f=vec2f(0.0); 518#endif 519#ifdef UV2 520var uv2Updated: vec2f=vec2f(0.0); 521#endif 522#ifdef VERTEXCOLOR 523var colorUpdated: vec4f=vec4f(0.0); 524#endif 525#else 526var positionUpdated: vec3f=vertexInputs.position; 527#ifdef NORMAL 528var normalUpdated: vec3f=vertexInputs.normal; 529#endif 530#ifdef TANGENT 531var tangentUpdated: vec4f=vertexInputs.tangent; 532#endif 533#ifdef UV1 534var uvUpdated: vec2f=vertexInputs.uv; 535#endif 536#ifdef UV2 537var uv2Updated: vec2f=vertexInputs.uv2; 538#endif 539#ifdef VERTEXCOLOR 540var colorUpdated: vec4f=vertexInputs.color; 541#endif 542#endif 543#include<vertexPullingVertex> 544#include<morphTargetsVertexGlobal> 545#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets] 546#ifdef REFLECTIONMAP_SKYBOX 547vertexOutputs.vPositionUVW=positionUpdated; 548#endif 549#define CUSTOM_VERTEX_UPDATE_POSITION 550#define CUSTOM_VERTEX_UPDATE_NORMAL 551#include<instancesVertex> 552#if defined(PREPASS) && ((defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED) 553vertexOutputs.vCurrentPosition=scene.viewProjection*finalWorld*vec4f(positionUpdated,
5531.0);vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld*vec4f(positionUpdated,1.0); 554#endif 555#ifdef USE_VERTEX_PULLING 556#include<bonesVertex>(vertexInputs.matricesIndices,vp_matricesIndices,vertexInputs.matricesWeights,vp_matricesWeights,vertexInputs.matricesIndicesExtra,vp_matricesIndicesExtra,vertexInputs.matricesWeightsExtra,vp_matricesWeightsExtra) 557#include<bakedVertexAnimation>(vertexInputs.matricesIndices,vp_matricesIndices,vertexInputs.matricesWeights,vp_matricesWeights,vertexInputs.matricesIndicesExtra,vp_matricesIndicesExtra,vertexInputs.matricesWeightsExtra,vp_matricesWeightsExtra) 558#else 559#include<bonesVertex> 560#include<bakedVertexAnimation> 561#endif 562var worldPos: vec4f=finalWorld*vec4f(positionUpdated,1.0); 563#ifdef NORMAL 564var normalWorld: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz); 565#if defined(INSTANCES) && defined(THIN_INSTANCES) 566vertexOutputs.vNormalW=normalUpdated/ vec3f(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vertexOutputs.vNormalW=normalize(normalWorld*vertexOutputs.vNormalW); 567#else 568#ifdef NONUNIFORMSCALING 569normalWorld=transposeMat3(inverseMat3(normalWorld)); 570#endif 571vertexOutputs.vNormalW=normalize(normalWorld*normalUpdated); 572#endif 573#endif 574#define CUSTOM_VERTEX_UPDATE_WORLDPOS 575#ifdef MULTIVIEW 576if (gl_ViewID_OVR==0u) {vertexOutputs.position=scene.viewProjection*worldPos;} else {vertexOutputs.position=scene.viewProjectionR*worldPos;} 577#else 578vertexOutputs.position=scene.viewProjection*worldPos; 579#endif 580vertexOutputs.vPositionW= worldPos.xyz; 581#ifdef PREPASS 582#include<prePassVertex> 583#endif 584#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) 585vertexOutputs.vDirectionW=normalize((finalWorld* vec4f(positionUpdated,0.0)).xyz); 586#endif 587#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 588#ifdef RIGHT_HANDED 589vertexOutputs.vViewDepth=-(scene.view*worldPos).z; 590#else 591vertexOutputs.vViewDepth=(scene.view*worldPos).z; 592#endif 593#endif 594#ifndef UV1 595var uvUpdated: vec2f=vec2f(0.,0.); 596#endif 597#ifdef MAINUV1 598vertexOutputs.vMainUV1=uvUpdated; 599#endif 600#ifndef UV2 601var uv2Updated: vec2f=vec2f(0.,0.); 602#endif 603#ifdef MAINUV2 604vertexOutputs.vMainUV2=uv2Updated; 605#endif 606#include<uvVariableDeclaration>[3..7] 607#include<samplerVertexImplementation>(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_MATRIXNAME_,diffuse,_INFONAME_,DiffuseInfos.x) 608#include<samplerVertexImplementation>(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x) 609#include<samplerVertexImplementation>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x) 610#include<samplerVertexImplementation>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x) 611#include<samplerVertexImplementation>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x) 612#include<samplerVertexImplementation>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x) 613#if defined(SPECULARTERM) 614#include<samplerVertexImplementation>(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_MATRIXNAME_,specular,_INFONAME_,SpecularInfos.x) 615#endif 616#include<samplerVertexImplementation>(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x) 617#include<samplerVertexImplementation>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x) 618#include<bumpVertex> 619#include<clipPlaneVertex> 620#include<fogVertex> 621#include<shadowsVertex>[0..maxSimultaneousLights] 622#include<vertexColorMixing> 623#include<logDepthVertex> 624#define CUSTOM_VERTEX_MAIN_END 625} 626`;e.ShadersStoreWGSL[m]||(e.ShadersStoreWGSL[m]=M);const pe=[P,D,R,J,b,F,G,z,ee,X,te,ie,C,$,ae,re,Q,K,W,ne,fe,Z,q,B,w,H,de,oe,se,ve,Y,j,ue,k,le];for(const t of pe)e.IncludesShadersStoreWGSL[t.name]||(e.IncludesShadersStoreWGSL[t.name]=t.shader);const Ve={name:m,shader:M};export{Ve as defaultVertexShaderWGSL};
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.