@babylonjs/core
Version:
Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.
133 lines • 5.16 kB
JavaScript
// Do not edit.
import { ShaderStore } from "../Engines/shaderStore.js";
import { backgroundVertexDeclaration } from "./ShadersInclude/backgroundVertexDeclaration.js";
import { sceneUboDeclaration } from "./ShadersInclude/sceneUboDeclaration.js";
import { backgroundUboDeclaration } from "./ShadersInclude/backgroundUboDeclaration.js";
import { helperFunctions } from "./ShadersInclude/helperFunctions.js";
import { bonesDeclaration } from "./ShadersInclude/bonesDeclaration.js";
import { bakedVertexAnimationDeclaration } from "./ShadersInclude/bakedVertexAnimationDeclaration.js";
import { instancesDeclaration } from "./ShadersInclude/instancesDeclaration.js";
import { clipPlaneVertexDeclaration } from "./ShadersInclude/clipPlaneVertexDeclaration.js";
import { fogVertexDeclaration } from "./ShadersInclude/fogVertexDeclaration.js";
import { lightVxFragmentDeclaration } from "./ShadersInclude/lightVxFragmentDeclaration.js";
import { lightVxUboDeclaration } from "./ShadersInclude/lightVxUboDeclaration.js";
import { logDepthDeclaration } from "./ShadersInclude/logDepthDeclaration.js";
import { instancesVertex } from "./ShadersInclude/instancesVertex.js";
import { bonesVertex } from "./ShadersInclude/bonesVertex.js";
import { bakedVertexAnimation } from "./ShadersInclude/bakedVertexAnimation.js";
import { clipPlaneVertex } from "./ShadersInclude/clipPlaneVertex.js";
import { fogVertex } from "./ShadersInclude/fogVertex.js";
import { shadowsVertex } from "./ShadersInclude/shadowsVertex.js";
import { logDepthVertex } from "./ShadersInclude/logDepthVertex.js";
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 */
export const backgroundVertexShader = { name, shader };
//# sourceMappingURL=background.vertex.js.map