@babylonjs/materials
Version:
For usage documentation please visit the [materials library documentation](https://doc.babylonjs.com/toolsAndResources/assetLibraries/materialsLibrary/).
110 lines • 5.07 kB
JavaScript
// Do not edit.
import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
import { helperFunctions } from "@babylonjs/core/Shaders/ShadersInclude/helperFunctions.js";
import { bonesDeclaration } from "@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration.js";
import { bakedVertexAnimationDeclaration } from "@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration.js";
import { instancesDeclaration } from "@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js";
import { clipPlaneVertexDeclaration } from "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration.js";
import { logDepthDeclaration } from "@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js";
import { fogVertexDeclaration } from "@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration.js";
import { lightFragmentDeclaration } from "@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration.js";
import { lightUboDeclaration } from "@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration.js";
import { instancesVertex } from "@babylonjs/core/Shaders/ShadersInclude/instancesVertex.js";
import { bonesVertex } from "@babylonjs/core/Shaders/ShadersInclude/bonesVertex.js";
import { bakedVertexAnimation } from "@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimation.js";
import { clipPlaneVertex } from "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js";
import { logDepthVertex } from "@babylonjs/core/Shaders/ShadersInclude/logDepthVertex.js";
import { fogVertex } from "@babylonjs/core/Shaders/ShadersInclude/fogVertex.js";
import { shadowsVertex } from "@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.js";
import { vertexColorMixing } from "@babylonjs/core/Shaders/ShadersInclude/vertexColorMixing.js";
const name = "triplanarVertexShader";
const shader = `precision highp float;attribute vec3 position;
attribute vec3 normal;
attribute vec4 color;
uniform mat4 view;uniform mat4 viewProjection;
varying vec2 vTextureUVX;
varying vec2 vTextureUVY;
varying vec2 vTextureUVZ;
uniform float tileSize;
uniform float pointSize;
varying vec3 vPositionW;
varying mat3 tangentSpace;
varying vec4 vColor;
varying float vViewDepth;
void main(void)
{
vec4 colorUpdated=color;
vec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);
vTextureUVX=worldPos.zy/tileSize;
vTextureUVY=worldPos.xz/tileSize;
vTextureUVZ=worldPos.xy/tileSize;
vec3 xtan=vec3(0,0,1);vec3 xbin=vec3(0,1,0);vec3 ytan=vec3(1,0,0);vec3 ybin=vec3(0,0,1);vec3 ztan=vec3(1,0,0);vec3 zbin=vec3(0,1,0);vec3 normalizedNormal=normalize(normal);normalizedNormal*=normalizedNormal;vec3 worldBinormal=normalize(xbin*normalizedNormal.x+ybin*normalizedNormal.y+zbin*normalizedNormal.z);vec3 worldTangent=normalize(xtan*normalizedNormal.x+ytan*normalizedNormal.y+ztan*normalizedNormal.z);mat3 normalWorld=mat3(finalWorld);
normalWorld=transposeMat3(inverseMat3(normalWorld));
worldTangent=normalize((normalWorld*worldTangent).xyz);worldBinormal=normalize((normalWorld*worldBinormal).xyz);vec3 worldNormal=normalize((normalWorld*normalize(normal)).xyz);tangentSpace[0]=worldTangent;tangentSpace[1]=worldBinormal;tangentSpace[2]=worldNormal;
gl_PointSize=pointSize;
}
`;
// Sideeffect
if (!ShaderStore.ShadersStore[name]) {
ShaderStore.ShadersStore[name] = shader;
}
const includes = [helperFunctions, bonesDeclaration, bakedVertexAnimationDeclaration, instancesDeclaration, clipPlaneVertexDeclaration, logDepthDeclaration, fogVertexDeclaration, lightFragmentDeclaration, lightUboDeclaration, instancesVertex, bonesVertex, bakedVertexAnimation, clipPlaneVertex, logDepthVertex, fogVertex, shadowsVertex, vertexColorMixing];
for (const inc of includes) {
if (!ShaderStore.IncludesShadersStore[inc.name]) {
ShaderStore.IncludesShadersStore[inc.name] = inc.shader;
}
}
/** @internal */
export const triplanarVertexShader = { name, shader };
//# sourceMappingURL=triplanar.vertex.js.map