@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.
167 lines • 5.55 kB
JavaScript
// Do not edit.
import { ShaderStore } from "../Engines/shaderStore.js";
import "./ShadersInclude/bonesDeclaration.js";
import "./ShadersInclude/bakedVertexAnimationDeclaration.js";
import "./ShadersInclude/morphTargetsVertexGlobalDeclaration.js";
import "./ShadersInclude/morphTargetsVertexDeclaration.js";
import "./ShadersInclude/instancesDeclaration.js";
import "./ShadersInclude/geometryVertexDeclaration.js";
import "./ShadersInclude/geometryUboDeclaration.js";
import "./ShadersInclude/clipPlaneVertexDeclaration.js";
import "./ShadersInclude/morphTargetsVertexGlobal.js";
import "./ShadersInclude/morphTargetsVertex.js";
import "./ShadersInclude/instancesVertex.js";
import "./ShadersInclude/bonesVertex.js";
import "./ShadersInclude/bakedVertexAnimation.js";
import "./ShadersInclude/clipPlaneVertex.js";
import "./ShadersInclude/bumpVertex.js";
const name = "geometryVertexShader";
const shader = `precision highp float;
attribute vec3 position;attribute vec3 normal;
varying vec2 vUV;
uniform mat4 diffuseMatrix;
uniform mat4 bumpMatrix;varying vec2 vBumpUV;
uniform mat4 reflectivityMatrix;uniform mat4 albedoMatrix;varying vec2 vReflectivityUV;varying vec2 vAlbedoUV;
attribute vec2 uv;
attribute vec2 uv2;
varying mat4 vWorldView;
varying vec3 vNormalW;
varying vec3 vNormalV;
varying vec4 vViewPos;
varying vec3 vPositionW;
uniform mat4 previousViewProjection;varying vec4 vCurrentPosition;varying vec4 vPreviousPosition;
void main(void)
{vec3 positionUpdated=position;vec3 normalUpdated=normal;
vec2 uvUpdated=uv;
vec2 uv2Updated=uv2;
vCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);vPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);
vec4 worldPos=vec4(finalWorld*vec4(positionUpdated,1.0));
vWorldView=view*finalWorld;mat3 normalWorld=mat3(finalWorld);vNormalW=normalize(normalWorld*normalUpdated);
vNormalV=normalize(vec3(finalWorld*vec4(normalUpdated,0.0)));
vNormalV=normalize(vec3((view*finalWorld)*vec4(normalUpdated,0.0)));
vViewPos=view*worldPos;
vCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);
mat4 previousInfluence;previousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];
previousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];
previousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];
previousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];
previousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];
previousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];
previousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];
previousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];
vPreviousPosition=previousViewProjection*finalPreviousWorld*previousInfluence*vec4(positionUpdated,1.0);
vPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);
vPositionW=worldPos.xyz/worldPos.w;
gl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);
vUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));
vUV=uvUpdated;
vBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));
vReflectivityUV=vec2(reflectivityMatrix*vec4(uvUpdated,1.0,0.0));
vAlbedoUV=vec2(albedoMatrix*vec4(uvUpdated,1.0,0.0));
vUV=vec2(diffuseMatrix*vec4(uv2Updated,1.0,0.0));
vUV=uv2Updated;
vBumpUV=vec2(bumpMatrix*vec4(uv2Updated,1.0,0.0));
vReflectivityUV=vec2(reflectivityMatrix*vec4(uv2Updated,1.0,0.0));
vAlbedoUV=vec2(albedoMatrix*vec4(uv2Updated,1.0,0.0));
}
`;
// Sideeffect
if (!ShaderStore.ShadersStore[name]) {
ShaderStore.ShadersStore[name] = shader;
}
/** @internal */
export const geometryVertexShader = { name, shader };
//# sourceMappingURL=geometry.vertex.js.map