@babylonjs/viewer
Version:
The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.
154 lines (148 loc) • 5.07 kB
JavaScript
import { S as ShaderStore } from './index-FzOfPXLV.esm.js';
import './bonesVertex-lAGOY5tc.esm.js';
import './bakedVertexAnimation-B-j7AgLw.esm.js';
import './morphTargetsVertex-C_o673bp.esm.js';
import './helperFunctions-4InRZPbu.esm.js';
import './sceneUboDeclaration-81FvQqbq.esm.js';
import './meshUboDeclaration-CjMfZXLK.esm.js';
import './clipPlaneVertex-D_rrr4Jo.esm.js';
// Do not edit.
const name$3 = "shadowMapVertexExtraDeclaration";
const shader$3 = `
uniform lightDataSM: vec3f;
uniform biasAndScaleSM: vec3f;uniform depthValuesSM: vec2f;varying vDepthMetricSM: f32;
varying vPositionWSM: vec3f;
varying zSM: f32;
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStoreWGSL[name$3]) {
ShaderStore.IncludesShadersStoreWGSL[name$3] = shader$3;
}
// Do not edit.
const name$2 = "shadowMapVertexNormalBias";
const shader$2 = `
var worldLightDirSM: vec3f=normalize(-uniforms.lightDataSM.xyz);
var directionToLightSM: vec3f=uniforms.lightDataSM.xyz-worldPos.xyz;var worldLightDirSM: vec3f=normalize(directionToLightSM);
var ndlSM: f32=dot(vNormalW,worldLightDirSM);var sinNLSM: f32=sqrt(1.0-ndlSM*ndlSM);var normalBiasSM: f32=uniforms.biasAndScaleSM.y*sinNLSM;worldPos=vec4f(worldPos.xyz-vNormalW*normalBiasSM,worldPos.w);
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStoreWGSL[name$2]) {
ShaderStore.IncludesShadersStoreWGSL[name$2] = shader$2;
}
// Do not edit.
const name$1 = "shadowMapVertexMetric";
const shader$1 = `
vertexOutputs.vPositionWSM=worldPos.xyz;
vertexOutputs.position.z-=uniforms.biasAndScaleSM.x*vertexOutputs.position.w*BIASFACTOR;
vertexOutputs.position.z+=uniforms.biasAndScaleSM.x*vertexOutputs.position.w*BIASFACTOR;
vertexOutputs.zSM=vertexOutputs.position.z;vertexOutputs.position.z=0.0;
vertexOutputs.vDepthMetricSM=(-vertexOutputs.position.z+uniforms.depthValuesSM.x)/uniforms.depthValuesSM.y+uniforms.biasAndScaleSM.x;
vertexOutputs.vDepthMetricSM=(vertexOutputs.position.z+uniforms.depthValuesSM.x)/uniforms.depthValuesSM.y+uniforms.biasAndScaleSM.x;
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStoreWGSL[name$1]) {
ShaderStore.IncludesShadersStoreWGSL[name$1] = shader$1;
}
// Do not edit.
const name = "shadowMapVertexShader";
const shader = `attribute position: vec3f;
attribute normal: vec3f;
attribute world0: vec4f;attribute world1: vec4f;attribute world2: vec4f;attribute world3: vec4f;
varying vUV: vec2f;uniform diffuseMatrix: mat4x4f;
attribute uv: vec2f;
attribute uv2: vec2f;
@vertex
fn main(input : VertexInputs)->FragmentInputs {var positionUpdated: vec3f=input.position;
var uvUpdated: vec2f=input.uv;
var uv2Updated: vec2f=input.uv2;
var normalUpdated: vec3f=input.normal;
var worldPos: vec4f=finalWorld* vec4f(positionUpdated,1.0);
var normWorldSM: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz);
var vNormalW: vec3f=normalUpdated/ vec3f(dot(normWorldSM[0],normWorldSM[0]),dot(normWorldSM[1],normWorldSM[1]),dot(normWorldSM[2],normWorldSM[2]));vNormalW=normalize(normWorldSM*vNormalW);
normWorldSM=transposeMat3(inverseMat3(normWorldSM));
var vNormalW: vec3f=normalize(normWorldSM*normalUpdated);
vertexOutputs.position=scene.viewProjection*worldPos;
vertexOutputs.vUV= (uniforms.diffuseMatrix* vec4f(uvUpdated,1.0,0.0)).xy;
vertexOutputs.vUV= (uniforms.diffuseMatrix* vec4f(uv2Updated,1.0,0.0)).xy;
}`;
// Sideeffect
if (!ShaderStore.ShadersStoreWGSL[name]) {
ShaderStore.ShadersStoreWGSL[name] = shader;
}
/** @internal */
const shadowMapVertexShaderWGSL = { name, shader };
export { shadowMapVertexShaderWGSL };
//# sourceMappingURL=shadowMap.vertex-BhmPOFau.esm.js.map