@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.
201 lines (192 loc) • 6.95 kB
JavaScript
import { S as ShaderStore } from './index-MZPybX0H.esm.js';
import { b as bonesDeclaration, a as bakedVertexAnimationDeclaration, i as instancesVertex, c as bonesVertex, d as bakedVertexAnimation } from './bakedVertexAnimation-wpiWOSwD.esm.js';
import { m as morphTargetsVertexGlobalDeclaration, a as morphTargetsVertexDeclaration, b as morphTargetsVertexGlobal, c as morphTargetsVertex } from './morphTargetsVertex-BRsti3ha.esm.js';
import { h as helperFunctions } from './helperFunctions-BVaVsPjM.esm.js';
import { s as sceneVertexDeclaration } from './sceneVertexDeclaration-BlWAYqj4.esm.js';
import { s as sceneUboDeclaration } from './sceneUboDeclaration-D-TsHbOr.esm.js';
import { m as meshUboDeclaration } from './meshUboDeclaration-Bv_BtoSy.esm.js';
import { c as clipPlaneVertexDeclaration, a as clipPlaneVertex } from './clipPlaneVertex-DpLNqQi1.esm.js';
// Do not edit.
const name$6 = "meshVertexDeclaration";
const shader$6 = `uniform mat4 world;uniform float visibility;
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStore[name$6]) {
ShaderStore.IncludesShadersStore[name$6] = shader$6;
}
/** @internal */
const meshVertexDeclaration = { name: name$6, shader: shader$6 };
// Do not edit.
const name$5 = "shadowMapVertexDeclaration";
const shader$5 = `
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStore[name$5]) {
ShaderStore.IncludesShadersStore[name$5] = shader$5;
}
/** @internal */
const shadowMapVertexDeclaration = { name: name$5, shader: shader$5 };
// Do not edit.
const name$4 = "shadowMapUboDeclaration";
const shader$4 = `layout(std140,column_major) uniform;
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStore[name$4]) {
ShaderStore.IncludesShadersStore[name$4] = shader$4;
}
/** @internal */
const shadowMapUboDeclaration = { name: name$4, shader: shader$4 };
// Do not edit.
const name$3 = "shadowMapVertexExtraDeclaration";
const shader$3 = `
uniform vec3 lightDataSM;
uniform vec3 biasAndScaleSM;uniform vec2 depthValuesSM;varying float vDepthMetricSM;
varying vec3 vPositionWSM;
varying float zSM;
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStore[name$3]) {
ShaderStore.IncludesShadersStore[name$3] = shader$3;
}
/** @internal */
const shadowMapVertexExtraDeclaration = { name: name$3, shader: shader$3 };
// Do not edit.
const name$2 = "shadowMapVertexNormalBias";
const shader$2 = `
vec3 worldLightDirSM=normalize(-lightDataSM.xyz);
vec3 directionToLightSM=lightDataSM.xyz-worldPos.xyz;vec3 worldLightDirSM=normalize(directionToLightSM);
float ndlSM=dot(vNormalW,worldLightDirSM);float sinNLSM=sqrt(1.0-ndlSM*ndlSM);float normalBiasSM=biasAndScaleSM.y*sinNLSM;worldPos.xyz-=vNormalW*normalBiasSM;
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStore[name$2]) {
ShaderStore.IncludesShadersStore[name$2] = shader$2;
}
/** @internal */
const shadowMapVertexNormalBias = { name: name$2, shader: shader$2 };
// Do not edit.
const name$1 = "shadowMapVertexMetric";
const shader$1 = `
vPositionWSM=worldPos.xyz;
gl_Position.z-=biasAndScaleSM.x*gl_Position.w*BIASFACTOR;
gl_Position.z+=biasAndScaleSM.x*gl_Position.w*BIASFACTOR;
zSM=gl_Position.z;gl_Position.z=0.0;
vDepthMetricSM=(-gl_Position.z+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;
vDepthMetricSM=(gl_Position.z+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStore[name$1]) {
ShaderStore.IncludesShadersStore[name$1] = shader$1;
}
/** @internal */
const shadowMapVertexMetric = { name: name$1, shader: shader$1 };
// Do not edit.
const name = "shadowMapVertexShader";
const shader = `attribute vec3 position;
attribute vec3 normal;
attribute vec4 world0;attribute vec4 world1;attribute vec4 world2;attribute vec4 world3;
varying vec2 vUV;uniform mat4 diffuseMatrix;
attribute vec2 uv;
attribute vec2 uv2;
void main(void)
{vec3 positionUpdated=position;
vec2 uvUpdated=uv;
vec2 uv2Updated=uv2;
vec3 normalUpdated=normal;
vec4 worldPos=finalWorld*vec4(positionUpdated,1.0);
mat3 normWorldSM=mat3(finalWorld);
vec3 vNormalW=normalUpdated/vec3(dot(normWorldSM[0],normWorldSM[0]),dot(normWorldSM[1],normWorldSM[1]),dot(normWorldSM[2],normWorldSM[2]));vNormalW=normalize(normWorldSM*vNormalW);
normWorldSM=transposeMat3(inverseMat3(normWorldSM));
vec3 vNormalW=normalize(normWorldSM*normalUpdated);
gl_Position=viewProjection*worldPos;
vUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));
vUV=vec2(diffuseMatrix*vec4(uv2Updated,1.0,0.0));
}`;
// Sideeffect
if (!ShaderStore.ShadersStore[name]) {
ShaderStore.ShadersStore[name] = shader;
}
const includes = [bonesDeclaration, bakedVertexAnimationDeclaration, morphTargetsVertexGlobalDeclaration, morphTargetsVertexDeclaration, helperFunctions, sceneVertexDeclaration, meshVertexDeclaration, shadowMapVertexDeclaration, sceneUboDeclaration, meshUboDeclaration, shadowMapUboDeclaration, shadowMapVertexExtraDeclaration, clipPlaneVertexDeclaration, morphTargetsVertexGlobal, morphTargetsVertex, instancesVertex, bonesVertex, bakedVertexAnimation, shadowMapVertexNormalBias, shadowMapVertexMetric, clipPlaneVertex];
for (const inc of includes) {
if (!ShaderStore.IncludesShadersStore[inc.name]) {
ShaderStore.IncludesShadersStore[inc.name] = inc.shader;
}
}
/** @internal */
const shadowMapVertexShader = { name, shader };
export { shadowMapVertexShader };
//# sourceMappingURL=shadowMap.vertex-Dul8Ah3R.esm.js.map