1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 09:23:53 +00:00
openmw/files/shaders/compatibility/bs/default.vert

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

76 lines
1.6 KiB
GLSL
Raw Normal View History

2022-04-24 15:29:16 +00:00
#version 120
2021-04-01 05:05:47 +00:00
#if @useUBO
#extension GL_ARB_uniform_buffer_object : require
#endif
#if @useGPUShader4
#extension GL_EXT_gpu_shader4: require
#endif
2023-02-26 22:31:41 +00:00
#define PER_PIXEL_LIGHTING 1
2023-02-25 19:03:39 +00:00
#include "lib/core/vertex.h.glsl"
2023-02-26 22:31:41 +00:00
2020-12-16 21:46:09 +00:00
#if @diffuseMap
varying vec2 diffuseMapUV;
#endif
#if @emissiveMap
varying vec2 emissiveMapUV;
#endif
#if @normalMap
varying vec2 normalMapUV;
varying vec4 passTangent;
#endif
varying float euclideanDepth;
varying float linearDepth;
varying vec3 passViewPos;
varying vec3 passNormal;
2023-02-25 19:03:39 +00:00
#include "lib/light/lighting.glsl"
#include "lib/view/depth.glsl"
2020-12-16 21:46:09 +00:00
2023-02-26 22:31:41 +00:00
#include "compatibility/vertexcolors.glsl"
#include "compatibility/shadows_vertex.glsl"
#include "compatibility/normals.glsl"
2023-02-26 22:31:41 +00:00
2020-12-16 21:46:09 +00:00
void main(void)
{
2023-02-25 19:03:39 +00:00
gl_Position = modelToClip(gl_Vertex);
2020-12-16 21:46:09 +00:00
2023-02-25 19:03:39 +00:00
vec4 viewPos = modelToView(gl_Vertex);
2020-12-16 21:46:09 +00:00
gl_ClipVertex = viewPos;
euclideanDepth = length(viewPos.xyz);
linearDepth = getLinearDepth(gl_Position.z, viewPos.z);
passColor = gl_Color;
passViewPos = viewPos.xyz;
passNormal = gl_Normal.xyz;
normalToViewMatrix = gl_NormalMatrix;
#if @normalMap
normalToViewMatrix *= generateTangentSpace(gl_MultiTexCoord7.xyzw, passNormal);
#endif
2020-12-16 21:46:09 +00:00
#if @diffuseMap
diffuseMapUV = (gl_TextureMatrix[@diffuseMapUV] * gl_MultiTexCoord@diffuseMapUV).xy;
#endif
#if @emissiveMap
emissiveMapUV = (gl_TextureMatrix[@emissiveMapUV] * gl_MultiTexCoord@emissiveMapUV).xy;
#endif
#if @normalMap
normalMapUV = (gl_TextureMatrix[@normalMapUV] * gl_MultiTexCoord@normalMapUV).xy;
#endif
#if @shadows_enabled
vec3 viewNormal = normalize(gl_NormalMatrix * passNormal);
2020-12-16 21:46:09 +00:00
setupShadowCoords(viewPos, viewNormal);
#endif
}