@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
JavaScript
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;
uniform mat4 viewProjectionR;
uniform float shadowLevel;
uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;
uniform vec2 vReflectionInfos;uniform mat4 reflectionMatrix;uniform vec3 vReflectionMicrosurfaceInfos;uniform float fFovMultiplier;
uniform float pointSize;
`;
// 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;
attribute vec3 position;
attribute vec3 normal;
varying vec3 vPositionW;
varying vec3 vNormalW;
attribute vec2 uv;
attribute vec2 uv2;
varying vec2 vMainUV1;
varying vec2 vMainUV2;
varying vec2 vDiffuseUV;
varying vec3 vPositionUVW;
varying vec3 vDirectionW;
void main(void) {
vPositionUVW=position;
if (gl_ViewID_OVR==0u) {gl_Position=viewProjection*finalWorld*vec4(position,1.0);} else {gl_Position=viewProjectionR*finalWorld*vec4(position,1.0);}
gl_Position=viewProjection*finalWorld*vec4(position,1.0);
vec4 worldPos=finalWorld*vec4(position,1.0);vPositionW=vec3(worldPos);
mat3 normalWorld=mat3(finalWorld);
normalWorld=transposeMat3(inverseMat3(normalWorld));
vNormalW=normalize(normalWorld*normal);
vDirectionW=normalize(vec3(finalWorld*vec4(position,0.0)));
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));}
vec2 uv=vec2(0.,0.);
vec2 uv2=vec2(0.,0.);
vMainUV1=uv;
vMainUV2=uv2;
if (vDiffuseInfos.x==0.)
{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}
else
{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}
vColor=colorUpdated;
gl_PointSize=pointSize;
}
`;
// 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