UNPKG

@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.

152 lines (148 loc) 5.41 kB
import { S as ShaderStore } from './index-MZPybX0H.esm.js'; import { s as sceneUboDeclaration } from './sceneUboDeclaration-D-TsHbOr.esm.js'; import { b as backgroundUboDeclaration } from './backgroundUboDeclaration-BohUXfzA.esm.js'; import { h as helperFunctions } from './helperFunctions-BVaVsPjM.esm.js'; import { b as bonesDeclaration, a as bakedVertexAnimationDeclaration, i as instancesVertex, c as bonesVertex, d as bakedVertexAnimation } from './bakedVertexAnimation-wpiWOSwD.esm.js'; import { i as instancesDeclaration } from './instancesDeclaration-BsiN991H.esm.js'; import { c as clipPlaneVertexDeclaration, a as clipPlaneVertex } from './clipPlaneVertex-DpLNqQi1.esm.js'; import { f as fogVertexDeclaration, a as fogVertex } from './fogVertex-DcP6EK01.esm.js'; import { l as lightVxFragmentDeclaration, a as lightVxUboDeclaration, s as shadowsVertex } from './shadowsVertex-BA-1OlXD.esm.js'; import { l as logDepthDeclaration } from './logDepthDeclaration-BdXvBJD5.esm.js'; import { l as logDepthVertex } from './logDepthVertex-Bf89Lbuy.esm.js'; // Do not edit. const name$1 = "backgroundVertexDeclaration"; const shader$1 = `uniform mat4 view;uniform mat4 viewProjection; #ifdef MULTIVIEW uniform mat4 viewProjectionR; #endif uniform float shadowLevel; #ifdef DIFFUSE uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos; #endif #ifdef REFLECTION uniform vec2 vReflectionInfos;uniform mat4 reflectionMatrix;uniform vec3 vReflectionMicrosurfaceInfos;uniform float fFovMultiplier; #endif #ifdef POINTSIZE uniform float pointSize; #endif `; // Sideeffect if (!ShaderStore.IncludesShadersStore[name$1]) { ShaderStore.IncludesShadersStore[name$1] = shader$1; } /** @internal */ const backgroundVertexDeclaration = { name: name$1, shader: shader$1 }; // Do not edit. const name = "backgroundVertexShader"; const shader = `precision highp float; #include<__decl__backgroundVertex> #include<helperFunctions> attribute vec3 position; #ifdef NORMAL attribute vec3 normal; #endif #include<bonesDeclaration> #include<bakedVertexAnimationDeclaration> #include<instancesDeclaration> varying vec3 vPositionW; #ifdef NORMAL varying vec3 vNormalW; #endif #ifdef UV1 attribute vec2 uv; #endif #ifdef UV2 attribute vec2 uv2; #endif #ifdef MAINUV1 varying vec2 vMainUV1; #endif #ifdef MAINUV2 varying vec2 vMainUV2; #endif #if defined(DIFFUSE) && DIFFUSEDIRECTUV==0 varying vec2 vDiffuseUV; #endif #include<clipPlaneVertexDeclaration> #include<fogVertexDeclaration> #include<__decl__lightVxFragment>[0..maxSimultaneousLights] #ifdef REFLECTIONMAP_SKYBOX varying vec3 vPositionUVW; #endif #if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) varying vec3 vDirectionW; #endif #include<logDepthDeclaration> #define CUSTOM_VERTEX_DEFINITIONS void main(void) { #define CUSTOM_VERTEX_MAIN_BEGIN #ifdef REFLECTIONMAP_SKYBOX vPositionUVW=position; #endif #include<instancesVertex> #include<bonesVertex> #include<bakedVertexAnimation> #ifdef MULTIVIEW if (gl_ViewID_OVR==0u) {gl_Position=viewProjection*finalWorld*vec4(position,1.0);} else {gl_Position=viewProjectionR*finalWorld*vec4(position,1.0);} #else gl_Position=viewProjection*finalWorld*vec4(position,1.0); #endif vec4 worldPos=finalWorld*vec4(position,1.0);vPositionW=vec3(worldPos); #ifdef NORMAL mat3 normalWorld=mat3(finalWorld); #ifdef NONUNIFORMSCALING normalWorld=transposeMat3(inverseMat3(normalWorld)); #endif vNormalW=normalize(normalWorld*normal); #endif #if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED) vDirectionW=normalize(vec3(finalWorld*vec4(position,0.0))); #ifdef EQUIRECTANGULAR_RELFECTION_FOV mat3 screenToWorld=inverseMat3(mat3(finalWorld*viewProjection));vec3 segment=mix(vDirectionW,screenToWorld*vec3(0.0,0.0,1.0),abs(fFovMultiplier-1.0));if (fFovMultiplier<=1.0) {vDirectionW=normalize(segment);} else {vDirectionW=normalize(vDirectionW+(vDirectionW-segment));} #endif #endif #ifndef UV1 vec2 uv=vec2(0.,0.); #endif #ifndef UV2 vec2 uv2=vec2(0.,0.); #endif #ifdef MAINUV1 vMainUV1=uv; #endif #ifdef MAINUV2 vMainUV2=uv2; #endif #if defined(DIFFUSE) && DIFFUSEDIRECTUV==0 if (vDiffuseInfos.x==0.) {vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));} else {vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));} #endif #include<clipPlaneVertex> #include<fogVertex> #include<shadowsVertex>[0..maxSimultaneousLights] #ifdef VERTEXCOLOR vColor=colorUpdated; #endif #if defined(POINTSIZE) && !defined(WEBGPU) gl_PointSize=pointSize; #endif #include<logDepthVertex> #define CUSTOM_VERTEX_MAIN_END } `; // Sideeffect if (!ShaderStore.ShadersStore[name]) { ShaderStore.ShadersStore[name] = shader; } const includes = [backgroundVertexDeclaration, sceneUboDeclaration, backgroundUboDeclaration, helperFunctions, bonesDeclaration, bakedVertexAnimationDeclaration, instancesDeclaration, clipPlaneVertexDeclaration, fogVertexDeclaration, lightVxFragmentDeclaration, lightVxUboDeclaration, logDepthDeclaration, instancesVertex, bonesVertex, bakedVertexAnimation, clipPlaneVertex, fogVertex, shadowsVertex, logDepthVertex]; for (const inc of includes) { if (!ShaderStore.IncludesShadersStore[inc.name]) { ShaderStore.IncludesShadersStore[inc.name] = inc.shader; } } /** @internal */ const backgroundVertexShader = { name, shader }; export { backgroundVertexShader }; //# sourceMappingURL=background.vertex-BWWWSu8Q.esm.js.map