@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.
185 lines • 7.82 kB
JavaScript
// Do not edit.
import { ShaderStore } from "../Engines/shaderStore.js";
import "./ShadersInclude/defaultUboDeclaration.js";
import "./ShadersInclude/uvAttributeDeclaration.js";
import "./ShadersInclude/helperFunctions.js";
import "./ShadersInclude/bonesDeclaration.js";
import "./ShadersInclude/bakedVertexAnimationDeclaration.js";
import "./ShadersInclude/instancesDeclaration.js";
import "./ShadersInclude/prePassVertexDeclaration.js";
import "./ShadersInclude/mainUVVaryingDeclaration.js";
import "./ShadersInclude/samplerVertexDeclaration.js";
import "./ShadersInclude/bumpVertexDeclaration.js";
import "./ShadersInclude/clipPlaneVertexDeclaration.js";
import "./ShadersInclude/fogVertexDeclaration.js";
import "./ShadersInclude/lightVxFragmentDeclaration.js";
import "./ShadersInclude/lightVxUboDeclaration.js";
import "./ShadersInclude/morphTargetsVertexGlobalDeclaration.js";
import "./ShadersInclude/morphTargetsVertexDeclaration.js";
import "./ShadersInclude/logDepthDeclaration.js";
import "./ShadersInclude/morphTargetsVertexGlobal.js";
import "./ShadersInclude/morphTargetsVertex.js";
import "./ShadersInclude/instancesVertex.js";
import "./ShadersInclude/bonesVertex.js";
import "./ShadersInclude/bakedVertexAnimation.js";
import "./ShadersInclude/prePassVertex.js";
import "./ShadersInclude/uvVariableDeclaration.js";
import "./ShadersInclude/samplerVertexImplementation.js";
import "./ShadersInclude/bumpVertex.js";
import "./ShadersInclude/clipPlaneVertex.js";
import "./ShadersInclude/fogVertex.js";
import "./ShadersInclude/shadowsVertex.js";
import "./ShadersInclude/vertexColorMixing.js";
import "./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;
@vertex
fn main(input : VertexInputs)->FragmentInputs {
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);
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;
}
/** @internal */
export const defaultVertexShaderWGSL = { name, shader };
//# sourceMappingURL=default.vertex.js.map