@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.
132 lines (129 loc) • 5.43 kB
JavaScript
import { S as ShaderStore } from './index-MZPybX0H.esm.js';
import { s as sceneUboDeclarationWGSL } from './sceneUboDeclaration-F06dki1D.esm.js';
import { b as backgroundUboDeclarationWGSL } from './backgroundUboDeclaration-CCbyiLC8.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 { 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 { l as logDepthDeclarationWGSL } from './logDepthDeclaration-BPJH8Xtb.esm.js';
import { b as bonesVertexWGSL } from './bonesVertex-CJuJ5VLw.esm.js';
import { b as bakedVertexAnimationWGSL } from './bakedVertexAnimation-v7FGdAXH.esm.js';
import { l as logDepthVertexWGSL } from './logDepthVertex-CRHdQPyM.esm.js';
// Do not edit.
const name = "backgroundVertexShader";
const shader = `
attribute position: vec3f;
attribute normal: vec3f;
varying vPositionW: vec3f;
varying vNormalW: vec3f;
attribute uv: vec2f;
attribute uv2: vec2f;
varying vMainUV1: vec2f;
varying vMainUV2: vec2f;
varying vDiffuseUV: vec2f;
varying vPositionUVW: vec3f;
varying vDirectionW: vec3f;
@vertex
fn main(input : VertexInputs)->FragmentInputs {
vertexOutputs.vPositionUVW=vertexInputs.position;
if (gl_ViewID_OVR==0u) {vertexOutputs.position=scene.viewProjection*finalWorld* vec4f(vertexInputs.position,1.0);} else {vertexOutputs.position=scene.viewProjectionR*finalWorld* vec4f(vertexInputs.position,1.0);}
vertexOutputs.position=scene.viewProjection*finalWorld* vec4f(vertexInputs.position,1.0);
var worldPos: vec4f=finalWorld* vec4f(vertexInputs.position,1.0);vertexOutputs.vPositionW= worldPos.xyz;
var normalWorld: mat3x3f=mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz);
normalWorld=transposeMat3(inverseMat3(normalWorld));
vertexOutputs.vNormalW=normalize(normalWorld*vertexInputs.normal);
vertexOutputs.vDirectionW=normalize((finalWorld*vec4f(vertexInputs.position,0.0)).xyz);
var screenToWorld: mat3x3f=inverseMat3( mat3x3f(finalWorld*scene.viewProjection));var segment: vec3f=mix(vertexOutputs.vDirectionW,screenToWorld* vec3f(0.0,0.0,1.0),abs(fFovMultiplier-1.0));if (fFovMultiplier<=1.0) {vertexOutputs.vDirectionW=normalize(segment);} else {vertexOutputs.vDirectionW=normalize(vertexOutputs.vDirectionW+(vertexOutputs.vDirectionW-segment));}
var uv: vec2f=vec2f(0.,0.);
var uv=vertexInputs.uv;
var uv2: vec2f=vec2f(0.,0.);
var uv2=vertexInputs.uv2;
vertexOutputs.vMainUV1=uv;
vertexOutputs.vMainUV2=uv2;
if (uniforms.vDiffuseInfos.x==0.)
{vertexOutputs.vDiffuseUV= (uniforms.diffuseMatrix* vec4f(uv,1.0,0.0)).xy;}
else
{vertexOutputs.vDiffuseUV= (uniforms.diffuseMatrix* vec4f(uv2,1.0,0.0)).xy;}
vertexOutputs.vColor=vertexInputs.color;
}
`;
// Sideeffect
if (!ShaderStore.ShadersStoreWGSL[name]) {
ShaderStore.ShadersStoreWGSL[name] = shader;
}
const includes = [sceneUboDeclarationWGSL, backgroundUboDeclarationWGSL, helperFunctionsWGSL, bonesDeclarationWGSL, bakedVertexAnimationDeclarationWGSL, instancesDeclarationWGSL, clipPlaneVertexDeclarationWGSL, fogVertexDeclarationWGSL, lightVxUboDeclarationWGSL, logDepthDeclarationWGSL, instancesVertexWGSL, bonesVertexWGSL, bakedVertexAnimationWGSL, clipPlaneVertexWGSL, fogVertexWGSL, shadowsVertexWGSL, logDepthVertexWGSL];
for (const inc of includes) {
if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {
ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;
}
}
/** @internal */
const backgroundVertexShaderWGSL = { name, shader };
export { backgroundVertexShaderWGSL };
//# sourceMappingURL=background.vertex-Dy2pUQQr.esm.js.map