@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.
261 lines (257 loc) • 12.2 kB
JavaScript
import { S as ShaderStore } from './index-MZPybX0H.esm.js';
import { s as sceneUboDeclarationWGSL } from './sceneUboDeclaration-F06dki1D.esm.js';
import { m as meshUboDeclarationWGSL } from './meshUboDeclaration-CCr-qXSL.esm.js';
import { d as defaultUboDeclarationWGSL } from './defaultUboDeclaration-DM5G_RrV.esm.js';
import { u as uvAttributeDeclarationWGSL, p as prePassVertexDeclarationWGSL, s as samplerVertexDeclarationWGSL, v as vertexPullingVertexWGSL, a as prePassVertexWGSL, b as uvVariableDeclarationWGSL, c as samplerVertexImplementationWGSL } from './samplerVertexImplementation-DHLJnHs8.esm.js';
import { h as helperFunctionsWGSL } from './helperFunctions-CiGzvr6_.esm.js';
import { b as bonesDeclarationWGSL } from './bonesDeclaration-PMvyqkeE.esm.js';
import { b as bakedVertexAnimationDeclarationWGSL, i as instancesVertexWGSL } from './instancesVertex-DMZ4QPzF.esm.js';
import { i as instancesDeclarationWGSL } from './instancesDeclaration-BNVwxGTw.esm.js';
import { m as mainUVVaryingDeclarationWGSL } from './mainUVVaryingDeclaration-CJ-yOzpF.esm.js';
import { b as bumpVertexDeclarationWGSL } from './bumpVertexDeclaration-BtOz3cqg.esm.js';
import { c as clipPlaneVertexDeclarationWGSL, a as clipPlaneVertexWGSL } from './clipPlaneVertex-DrcLG8k3.esm.js';
import { f as fogVertexDeclarationWGSL, a as fogVertexWGSL } from './fogVertex-jAzZJUX3.esm.js';
import { l as lightVxUboDeclarationWGSL, s as shadowsVertexWGSL } from './shadowsVertex-B99NbJxU.esm.js';
import { m as morphTargetsVertexGlobalDeclarationWGSL, a as morphTargetsVertexDeclarationWGSL } from './morphTargetsVertexDeclaration-BiDnarww.esm.js';
import { l as logDepthDeclarationWGSL } from './logDepthDeclaration-BPJH8Xtb.esm.js';
import { v as vertexPullingDeclarationWGSL } from './vertexPullingDeclaration-CJ8HDdQI.esm.js';
import { m as morphTargetsVertexGlobalWGSL, a as morphTargetsVertexWGSL } from './morphTargetsVertex-Cv-n_1Be.esm.js';
import { b as bonesVertexWGSL } from './bonesVertex-CJuJ5VLw.esm.js';
import { b as bakedVertexAnimationWGSL } from './bakedVertexAnimation-v7FGdAXH.esm.js';
import { b as bumpVertexWGSL } from './bumpVertex-CMrLLhgy.esm.js';
import { v as vertexColorMixingWGSL } from './vertexColorMixing-C_ggORv4.esm.js';
import { l as logDepthVertexWGSL } from './logDepthVertex-CRHdQPyM.esm.js';
// Do not edit.
const name$1 = "lightVxFragmentDeclaration";
const shader$1 = `
uniform vLightData{X}: vec4f;uniform vLightDiffuse{X}: vec4f;
uniform vLightSpecular{X}: vec4f;
var vLightSpecular{X}: vec4f= vec4f(0.);
uniform 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;
varying var vPositionFromLight{X}: vec4f;varying var vDepthMetric{X}: f32;uniform lightMatrix{X}: mat4x4f;
uniform shadowsInfo{X}: vec4f;uniform depthValues{X}: vec2f;
uniform vLightDirection{X}: vec4f;uniform vLightFalloff{X}: vec4f;
uniform vLightFalloff{X}: vec4f;
uniform vLightGround{X}: vec3f;
uniform vLightWidth{X}: vec4f;uniform vLightHeight{X}: vec4f;
`;
// Sideeffect
if (!ShaderStore.IncludesShadersStoreWGSL[name$1]) {
ShaderStore.IncludesShadersStoreWGSL[name$1] = shader$1;
}
/** @internal */
const lightVxFragmentDeclarationWGSL = { name: name$1, shader: shader$1 };
// Do not edit.
const name = "defaultVertexShader";
const shader = `
attribute position: vec3f;
attribute normal: vec3f;
attribute tangent: vec4f;
attribute uv: vec2f;
attribute color: vec4f;
varying vPositionW: vec3f;
varying vNormalW: vec3f;
varying vColor: vec4f;
varying vPositionUVW: vec3f;
varying vDirectionW: vec3f;
varying vViewDepth: f32;
@vertex
fn main(input : VertexInputs)->FragmentInputs {
var positionUpdated: vec3f=vec3f(0.0);
var normalUpdated: vec3f=vec3f(0.0);
var tangentUpdated: vec4f=vec4f(0.0);
var uvUpdated: vec2f=vec2f(0.0);
var uv2Updated: vec2f=vec2f(0.0);
var colorUpdated: vec4f=vec4f(0.0);
var positionUpdated: vec3f=vertexInputs.position;
var normalUpdated: vec3f=vertexInputs.normal;
var tangentUpdated: vec4f=vertexInputs.tangent;
var uvUpdated: vec2f=vertexInputs.uv;
var uv2Updated: vec2f=vertexInputs.uv2;
var colorUpdated: vec4f=vertexInputs.color;
vertexOutputs.vPositionUVW=positionUpdated;
vertexOutputs.vCurrentPosition=scene.viewProjection*finalWorld*vec4f(positionUpdated,1.0);vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld*vec4f(positionUpdated,1.0);
var worldPos: vec4f=finalWorld*vec4f(positionUpdated,1.0);
var normalWorld: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz);
vertexOutputs.vNormalW=normalUpdated/ vec3f(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vertexOutputs.vNormalW=normalize(normalWorld*vertexOutputs.vNormalW);
normalWorld=transposeMat3(inverseMat3(normalWorld));
vertexOutputs.vNormalW=normalize(normalWorld*normalUpdated);
if (gl_ViewID_OVR==0u) {vertexOutputs.position=scene.viewProjection*worldPos;} else {vertexOutputs.position=scene.viewProjectionR*worldPos;}
vertexOutputs.position=scene.viewProjection*worldPos;
vertexOutputs.vPositionW= worldPos.xyz;
vertexOutputs.vDirectionW=normalize((finalWorld* vec4f(positionUpdated,0.0)).xyz);
vertexOutputs.vViewDepth=-(scene.view*worldPos).z;
vertexOutputs.vViewDepth=(scene.view*worldPos).z;
var uvUpdated: vec2f=vec2f(0.,0.);
vertexOutputs.vMainUV1=uvUpdated;
var uv2Updated: vec2f=vec2f(0.,0.);
vertexOutputs.vMainUV2=uv2Updated;
}
`;
// Sideeffect
if (!ShaderStore.ShadersStoreWGSL[name]) {
ShaderStore.ShadersStoreWGSL[name] = shader;
}
const includes = [sceneUboDeclarationWGSL, meshUboDeclarationWGSL, defaultUboDeclarationWGSL, uvAttributeDeclarationWGSL, helperFunctionsWGSL, bonesDeclarationWGSL, bakedVertexAnimationDeclarationWGSL, instancesDeclarationWGSL, prePassVertexDeclarationWGSL, mainUVVaryingDeclarationWGSL, samplerVertexDeclarationWGSL, bumpVertexDeclarationWGSL, clipPlaneVertexDeclarationWGSL, fogVertexDeclarationWGSL, lightVxFragmentDeclarationWGSL, lightVxUboDeclarationWGSL, morphTargetsVertexGlobalDeclarationWGSL, morphTargetsVertexDeclarationWGSL, logDepthDeclarationWGSL, vertexPullingDeclarationWGSL, vertexPullingVertexWGSL, morphTargetsVertexGlobalWGSL, morphTargetsVertexWGSL, instancesVertexWGSL, bonesVertexWGSL, bakedVertexAnimationWGSL, prePassVertexWGSL, uvVariableDeclarationWGSL, samplerVertexImplementationWGSL, bumpVertexWGSL, clipPlaneVertexWGSL, fogVertexWGSL, shadowsVertexWGSL, vertexColorMixingWGSL, logDepthVertexWGSL];
for (const inc of includes) {
if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {
ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;
}
}
/** @internal */
const defaultVertexShaderWGSL = { name, shader };
export { defaultVertexShaderWGSL };
//# sourceMappingURL=default.vertex-C_LE1o7Q.esm.js.map