UNPKG

@babylonjs/core

Version:

Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.

94 lines 3.35 kB
// Do not edit. import { ShaderStore } from "../Engines/shaderStore.js"; import "./ShadersInclude/bonesDeclaration.js"; import "./ShadersInclude/bakedVertexAnimationDeclaration.js"; import "./ShadersInclude/morphTargetsVertexGlobalDeclaration.js"; import "./ShadersInclude/morphTargetsVertexDeclaration.js"; import "./ShadersInclude/helperFunctions.js"; import "./ShadersInclude/sceneUboDeclaration.js"; import "./ShadersInclude/meshUboDeclaration.js"; import "./ShadersInclude/shadowMapVertexExtraDeclaration.js"; import "./ShadersInclude/clipPlaneVertexDeclaration.js"; import "./ShadersInclude/morphTargetsVertexGlobal.js"; import "./ShadersInclude/morphTargetsVertex.js"; import "./ShadersInclude/instancesVertex.js"; import "./ShadersInclude/bonesVertex.js"; import "./ShadersInclude/bakedVertexAnimation.js"; import "./ShadersInclude/shadowMapVertexNormalBias.js"; import "./ShadersInclude/shadowMapVertexMetric.js"; import "./ShadersInclude/clipPlaneVertex.js"; const name = "shadowMapVertexShader"; const shader = `attribute position: vec3f; #ifdef NORMAL attribute normal: vec3f; #endif #include<bonesDeclaration> #include<bakedVertexAnimationDeclaration> #include<morphTargetsVertexGlobalDeclaration> #include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets] #ifdef INSTANCES attribute world0: vec4f;attribute world1: vec4f;attribute world2: vec4f;attribute world3: vec4f; #endif #include<helperFunctions> #include<sceneUboDeclaration> #include<meshUboDeclaration> #ifdef ALPHATEXTURE varying vUV: vec2f;uniform diffuseMatrix: mat4x4f; #ifdef UV1 attribute uv: vec2f; #endif #ifdef UV2 attribute uv2: vec2f; #endif #endif #include<shadowMapVertexExtraDeclaration> #include<clipPlaneVertexDeclaration> #define CUSTOM_VERTEX_DEFINITIONS @vertex fn main(input : VertexInputs)->FragmentInputs {var positionUpdated: vec3f=input.position; #ifdef UV1 var uvUpdated: vec2f=input.uv; #endif #ifdef UV2 var uv2Updated: vec2f=input.uv2; #endif #ifdef NORMAL var normalUpdated: vec3f=input.normal; #endif #include<morphTargetsVertexGlobal> #include<morphTargetsVertex>[0..maxSimultaneousMorphTargets] #include<instancesVertex> #include<bonesVertex> #include<bakedVertexAnimation> var worldPos: vec4f=finalWorld* vec4f(positionUpdated,1.0); #ifdef NORMAL var normWorldSM: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz); #if defined(INSTANCES) && defined(THIN_INSTANCES) var vNormalW: vec3f=normalUpdated/ vec3f(dot(normWorldSM[0],normWorldSM[0]),dot(normWorldSM[1],normWorldSM[1]),dot(normWorldSM[2],normWorldSM[2]));vNormalW=normalize(normWorldSM*vNormalW); #else #ifdef NONUNIFORMSCALING normWorldSM=transposeMat3(inverseMat3(normWorldSM)); #endif var vNormalW: vec3f=normalize(normWorldSM*normalUpdated); #endif #endif #include<shadowMapVertexNormalBias> vertexOutputs.position=scene.viewProjection*worldPos; #include<shadowMapVertexMetric> #ifdef ALPHATEXTURE #ifdef UV1 vertexOutputs.vUV= (uniforms.diffuseMatrix* vec4f(uvUpdated,1.0,0.0)).xy; #endif #ifdef UV2 vertexOutputs.vUV= (uniforms.diffuseMatrix* vec4f(uv2Updated,1.0,0.0)).xy; #endif #endif #include<clipPlaneVertex> }`; // Sideeffect if (!ShaderStore.ShadersStoreWGSL[name]) { ShaderStore.ShadersStoreWGSL[name] = shader; } /** @internal */ export const shadowMapVertexShaderWGSL = { name, shader }; //# sourceMappingURL=shadowMap.vertex.js.map