@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.
233 lines • 11.6 kB
JavaScript
// Do not edit.
import { ShaderStore } from "../Engines/shaderStore.js";
import { sceneUboDeclarationWGSL } from "./ShadersInclude/sceneUboDeclaration.js";
import { meshUboDeclarationWGSL } from "./ShadersInclude/meshUboDeclaration.js";
import { defaultUboDeclarationWGSL } from "./ShadersInclude/defaultUboDeclaration.js";
import { uvAttributeDeclarationWGSL } from "./ShadersInclude/uvAttributeDeclaration.js";
import { helperFunctionsWGSL } from "./ShadersInclude/helperFunctions.js";
import { bonesDeclarationWGSL } from "./ShadersInclude/bonesDeclaration.js";
import { bakedVertexAnimationDeclarationWGSL } from "./ShadersInclude/bakedVertexAnimationDeclaration.js";
import { instancesDeclarationWGSL } from "./ShadersInclude/instancesDeclaration.js";
import { prePassVertexDeclarationWGSL } from "./ShadersInclude/prePassVertexDeclaration.js";
import { mainUVVaryingDeclarationWGSL } from "./ShadersInclude/mainUVVaryingDeclaration.js";
import { samplerVertexDeclarationWGSL } from "./ShadersInclude/samplerVertexDeclaration.js";
import { bumpVertexDeclarationWGSL } from "./ShadersInclude/bumpVertexDeclaration.js";
import { clipPlaneVertexDeclarationWGSL } from "./ShadersInclude/clipPlaneVertexDeclaration.js";
import { fogVertexDeclarationWGSL } from "./ShadersInclude/fogVertexDeclaration.js";
import { lightVxFragmentDeclarationWGSL } from "./ShadersInclude/lightVxFragmentDeclaration.js";
import { lightVxUboDeclarationWGSL } from "./ShadersInclude/lightVxUboDeclaration.js";
import { morphTargetsVertexGlobalDeclarationWGSL } from "./ShadersInclude/morphTargetsVertexGlobalDeclaration.js";
import { morphTargetsVertexDeclarationWGSL } from "./ShadersInclude/morphTargetsVertexDeclaration.js";
import { logDepthDeclarationWGSL } from "./ShadersInclude/logDepthDeclaration.js";
import { vertexPullingDeclarationWGSL } from "./ShadersInclude/vertexPullingDeclaration.js";
import { vertexPullingVertexWGSL } from "./ShadersInclude/vertexPullingVertex.js";
import { morphTargetsVertexGlobalWGSL } from "./ShadersInclude/morphTargetsVertexGlobal.js";
import { morphTargetsVertexWGSL } from "./ShadersInclude/morphTargetsVertex.js";
import { instancesVertexWGSL } from "./ShadersInclude/instancesVertex.js";
import { bonesVertexWGSL } from "./ShadersInclude/bonesVertex.js";
import { bakedVertexAnimationWGSL } from "./ShadersInclude/bakedVertexAnimation.js";
import { prePassVertexWGSL } from "./ShadersInclude/prePassVertex.js";
import { uvVariableDeclarationWGSL } from "./ShadersInclude/uvVariableDeclaration.js";
import { samplerVertexImplementationWGSL } from "./ShadersInclude/samplerVertexImplementation.js";
import { bumpVertexWGSL } from "./ShadersInclude/bumpVertex.js";
import { clipPlaneVertexWGSL } from "./ShadersInclude/clipPlaneVertex.js";
import { fogVertexWGSL } from "./ShadersInclude/fogVertex.js";
import { shadowsVertexWGSL } from "./ShadersInclude/shadowsVertex.js";
import { vertexColorMixingWGSL } from "./ShadersInclude/vertexColorMixing.js";
import { logDepthVertexWGSL } from "./ShadersInclude/logDepthVertex.js";
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 */
export const defaultVertexShaderWGSL = { name, shader };
//# sourceMappingURL=default.vertex.js.map