UNPKG

@babylonjs/materials

Version:

For usage documentation please visit the [materials library documentation](https://doc.babylonjs.com/toolsAndResources/assetLibraries/materialsLibrary/).

110 lines 5.07 kB
// 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; #ifdef NORMAL attribute vec3 normal; #endif #ifdef VERTEXCOLOR attribute vec4 color; #endif #include<helperFunctions> #include<bonesDeclaration> #include<bakedVertexAnimationDeclaration> #include<instancesDeclaration> uniform mat4 view;uniform mat4 viewProjection; #ifdef DIFFUSEX varying vec2 vTextureUVX; #endif #ifdef DIFFUSEY varying vec2 vTextureUVY; #endif #ifdef DIFFUSEZ varying vec2 vTextureUVZ; #endif uniform float tileSize; #ifdef POINTSIZE uniform float pointSize; #endif varying vec3 vPositionW; #ifdef NORMAL varying mat3 tangentSpace; #endif #if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES) varying vec4 vColor; #endif #include<clipPlaneVertexDeclaration> #include<logDepthDeclaration> #include<fogVertexDeclaration> #include<__decl__lightFragment>[0..maxSimultaneousLights] #if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0 varying float vViewDepth; #endif #define CUSTOM_VERTEX_DEFINITIONS void main(void) { #define CUSTOM_VERTEX_MAIN_BEGIN #ifdef VERTEXCOLOR vec4 colorUpdated=color; #endif #include<instancesVertex> #include<bonesVertex> #include<bakedVertexAnimation> vec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos); #ifdef DIFFUSEX vTextureUVX=worldPos.zy/tileSize; #endif #ifdef DIFFUSEY vTextureUVY=worldPos.xz/tileSize; #endif #ifdef DIFFUSEZ vTextureUVZ=worldPos.xy/tileSize; #endif #ifdef NORMAL 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); #ifdef NONUNIFORMSCALING normalWorld=transposeMat3(inverseMat3(normalWorld)); #endif 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; #endif #include<clipPlaneVertex> #include<logDepthVertex> #include<fogVertex> #include<shadowsVertex>[0..maxSimultaneousLights] #include<vertexColorMixing> #if defined(POINTSIZE) && !defined(WEBGPU) gl_PointSize=pointSize; #endif #define CUSTOM_VERTEX_MAIN_END } `; // 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