UNPKG

bp-cloner

Version:

More info and explanations here - https://doc.babylonjs.com/communityExtensions/clonerSystem

189 lines (188 loc) 8.14 kB
import { S as e } from "./index-7uRiSnMV.js"; const i = "uvAttributeDeclaration", a = `#ifdef UV{X} attribute uv{X}: vec2f; #endif `; e.IncludesShadersStoreWGSL[i] || (e.IncludesShadersStoreWGSL[i] = a); const t = "prePassVertexDeclaration", c = `#ifdef PREPASS #ifdef PREPASS_LOCAL_POSITION varying vPosition : vec3f; #endif #ifdef PREPASS_DEPTH varying vViewPos: vec3f; #endif #if defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR) uniform previousViewProjection: mat4x4f;varying vCurrentPosition: vec4f;varying vPreviousPosition: vec4f; #endif #endif `; e.IncludesShadersStoreWGSL[t] || (e.IncludesShadersStoreWGSL[t] = c); const r = "samplerVertexDeclaration", h = `#if defined(_DEFINENAME_) && _DEFINENAME_DIRECTUV==0 varying v_VARYINGNAME_UV: vec2f; #endif `; e.IncludesShadersStoreWGSL[r] || (e.IncludesShadersStoreWGSL[r] = h); const s = "bumpVertexDeclaration", l = `#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) #if defined(TANGENT) && defined(NORMAL) varying vTBN0: vec3f;varying vTBN1: vec3f;varying vTBN2: vec3f; #endif #endif `; e.IncludesShadersStoreWGSL[s] || (e.IncludesShadersStoreWGSL[s] = l); const n = "lightVxUboDeclaration", S = `#ifdef LIGHT{X} struct Light{X} {vLightData: vec4f, vLightDiffuse: vec4f, vLightSpecular: vec4f, #ifdef SPOTLIGHT{X} vLightDirection: vec4f, vLightFalloff: vec4f, #elif defined(POINTLIGHT{X}) vLightFalloff: vec4f, #elif defined(HEMILIGHT{X}) vLightGround: vec3f, #endif #if defined(AREALIGHT{X}) vLightWidth: vec4f, vLightHeight: vec4f, #endif shadowsInfo: vec4f, depthValues: vec2f} ;var<uniform> light{X} : Light{X}; #ifdef SHADOW{X} #ifdef SHADOWCSM{X} uniform 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; #elif defined(SHADOWCUBE{X}) #else varying vPositionFromLight{X}: vec4f;varying vDepthMetric{X}: f32;uniform lightMatrix{X}: mat4x4f; #endif #endif #endif `; e.IncludesShadersStoreWGSL[n] || (e.IncludesShadersStoreWGSL[n] = S); const f = "prePassVertex", E = `#ifdef PREPASS_DEPTH vertexOutputs.vViewPos=(scene.view*worldPos).rgb; #endif #ifdef PREPASS_LOCAL_POSITION vertexOutputs.vPosition=positionUpdated.xyz; #endif #if (defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && defined(BONES_VELOCITY_ENABLED) vertexOutputs.vCurrentPosition=scene.viewProjection*worldPos; #if NUM_BONE_INFLUENCERS>0 var previousInfluence: mat4x4f;previousInfluence=mPreviousBones[ i32(matricesIndices[0])]*matricesWeights[0]; #if NUM_BONE_INFLUENCERS>1 previousInfluence+=mPreviousBones[ i32(matricesIndices[1])]*matricesWeights[1]; #endif #if NUM_BONE_INFLUENCERS>2 previousInfluence+=mPreviousBones[ i32(matricesIndices[2])]*matricesWeights[2]; #endif #if NUM_BONE_INFLUENCERS>3 previousInfluence+=mPreviousBones[ i32(matricesIndices[3])]*matricesWeights[3]; #endif #if NUM_BONE_INFLUENCERS>4 previousInfluence+=mPreviousBones[ i32(matricesIndicesExtra[0])]*matricesWeightsExtra[0]; #endif #if NUM_BONE_INFLUENCERS>5 previousInfluence+=mPreviousBones[ i32(matricesIndicesExtra[1])]*matricesWeightsExtra[1]; #endif #if NUM_BONE_INFLUENCERS>6 previousInfluence+=mPreviousBones[ i32(matricesIndicesExtra[2])]*matricesWeightsExtra[2]; #endif #if NUM_BONE_INFLUENCERS>7 previousInfluence+=mPreviousBones[ i32(matricesIndicesExtra[3])]*matricesWeightsExtra[3]; #endif vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld*previousInfluence* vec4f(positionUpdated,1.0); #else vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld* vec4f(positionUpdated,1.0); #endif #endif `; e.IncludesShadersStoreWGSL[f] || (e.IncludesShadersStoreWGSL[f] = E); const o = "uvVariableDeclaration", _ = `#ifdef MAINUV{X} #if !defined(UV{X}) var uv{X}: vec2f=vec2f(0.,0.); #else var uv{X}: vec2f=vertexInputs.uv{X}; #endif vertexOutputs.vMainUV{X}=uv{X}; #endif `; e.IncludesShadersStoreWGSL[o] || (e.IncludesShadersStoreWGSL[o] = _); const d = "samplerVertexImplementation", p = `#if defined(_DEFINENAME_) && _DEFINENAME_DIRECTUV==0 if (uniforms.v_INFONAME_==0.) {vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(uvUpdated,1.0,0.0)).xy;} #ifdef UV2 else if (uniforms.v_INFONAME_==1.) {vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(uv2Updated,1.0,0.0)).xy;} #endif #ifdef UV3 else if (uniforms.v_INFONAME_==2.) {vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(vertexInputs.uv3,1.0,0.0)).xy;} #endif #ifdef UV4 else if (uniforms.v_INFONAME_==3.) {vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(vertexInputs.uv4,1.0,0.0)).xy;} #endif #ifdef UV5 else if (uniforms.v_INFONAME_==4.) {vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(vertexInputs.uv5,1.0,0.0)).xy;} #endif #ifdef UV6 else if (uniforms.v_INFONAME_==5.) {vertexOutputs.v_VARYINGNAME_UV= (uniforms._MATRIXNAME_Matrix* vec4f(vertexInputs.uv6,1.0,0.0)).xy;} #endif #endif `; e.IncludesShadersStoreWGSL[d] || (e.IncludesShadersStoreWGSL[d] = p); const v = "bumpVertex", m = `#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) #if defined(TANGENT) && defined(NORMAL) var 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]; #endif #endif `; e.IncludesShadersStoreWGSL[v] || (e.IncludesShadersStoreWGSL[v] = m); const u = "shadowsVertex", x = `#ifdef SHADOWS #if defined(SHADOWCSM{X}) vertexOutputs.vPositionFromCamera{X}=scene.view*worldPos; #if SHADOWCSMNUM_CASCADES{X}>0 vertexOutputs.vPositionFromLight{X}_0=uniforms.lightMatrix{X}[0]*worldPos; #ifdef USE_REVERSE_DEPTHBUFFER vertexOutputs.vDepthMetric{X}_0=(-vertexOutputs.vPositionFromLight{X}_0.z+light{X}.depthValues.x)/light{X}.depthValues.y; #else vertexOutputs.vDepthMetric{X}_0= (vertexOutputs.vPositionFromLight{X}_0.z+light{X}.depthValues.x)/light{X}.depthValues.y; #endif #endif #if SHADOWCSMNUM_CASCADES{X}>1 vertexOutputs.vPositionFromLight{X}_1=uniforms.lightMatrix{X}[1]*worldPos; #ifdef USE_REVERSE_DEPTHBUFFER vertexOutputs.vDepthMetric{X}_1=(-vertexOutputs.vPositionFromLight{X}_1.z+light{X}.depthValues.x)/light{X}.depthValues.y; #else vertexOutputs.vDepthMetric{X}_1= (vertexOutputs.vPositionFromLight{X}_1.z+light{X}.depthValues.x)/light{X}.depthValues.y; #endif #endif #if SHADOWCSMNUM_CASCADES{X}>2 vertexOutputs.vPositionFromLight{X}_2=uniforms.lightMatrix{X}[2]*worldPos; #ifdef USE_REVERSE_DEPTHBUFFER vertexOutputs.vDepthMetric{X}_2=(-vertexOutputs.vPositionFromLight{X}_2.z+light{X}.depthValues.x)/light{X}.depthValues.y; #else vertexOutputs.vDepthMetric{X}_2= (vertexOutputs.vPositionFromLight{X}_2.z+light{X}.depthValues.x)/light{X}.depthValues.y; #endif #endif #if SHADOWCSMNUM_CASCADES{X}>3 vertexOutputs.vPositionFromLight{X}_3=uniforms.lightMatrix{X}[3]*worldPos; #ifdef USE_REVERSE_DEPTHBUFFER vertexOutputs.vDepthMetric{X}_3=(-vertexOutputs.vPositionFromLight{X}_3.z+light{X}.depthValues.x)/light{X}.depthValues.y; #else vertexOutputs.vDepthMetric{X}_3= (vertexOutputs.vPositionFromLight{X}_3.z+light{X}.depthValues.x)/light{X}.depthValues.y; #endif #endif #elif defined(SHADOW{X}) && !defined(SHADOWCUBE{X}) vertexOutputs.vPositionFromLight{X}=uniforms.lightMatrix{X}*worldPos; #ifdef USE_REVERSE_DEPTHBUFFER vertexOutputs.vDepthMetric{X}=(-vertexOutputs.vPositionFromLight{X}.z+light{X}.depthValues.x)/light{X}.depthValues.y; #else vertexOutputs.vDepthMetric{X}=(vertexOutputs.vPositionFromLight{X}.z+light{X}.depthValues.x)/light{X}.depthValues.y; #endif #endif #endif `; e.IncludesShadersStoreWGSL[u] || (e.IncludesShadersStoreWGSL[u] = x);