2022-04-04 20:51:23 +00:00
|
|
|
#version @GLSLVersion
|
|
|
|
|
|
|
|
#include "multiview_vertex.glsl"
|
2020-12-16 21:46:09 +00:00
|
|
|
|
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
|
|
|
|
|
2022-04-27 15:37:07 +00:00
|
|
|
#include "openmw_vertex.h.glsl"
|
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;
|
|
|
|
|
|
|
|
#define PER_PIXEL_LIGHTING 1
|
|
|
|
|
|
|
|
#include "vertexcolors.glsl"
|
|
|
|
#include "shadows_vertex.glsl"
|
|
|
|
#include "lighting.glsl"
|
2021-06-01 19:15:25 +00:00
|
|
|
#include "depth.glsl"
|
2020-12-16 21:46:09 +00:00
|
|
|
|
|
|
|
void main(void)
|
|
|
|
{
|
2022-04-26 17:54:24 +00:00
|
|
|
gl_Position = mw_modelToClip(gl_Vertex);
|
2020-12-16 21:46:09 +00:00
|
|
|
|
2022-04-26 17:54:24 +00:00
|
|
|
vec4 viewPos = mw_modelToView(gl_Vertex);
|
2020-12-16 21:46:09 +00:00
|
|
|
gl_ClipVertex = viewPos;
|
|
|
|
euclideanDepth = length(viewPos.xyz);
|
2021-07-09 17:05:27 +00:00
|
|
|
linearDepth = getLinearDepth(gl_Position.z, viewPos.z);
|
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;
|
|
|
|
passTangent = gl_MultiTexCoord7.xyzw;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
passColor = gl_Color;
|
|
|
|
passViewPos = viewPos.xyz;
|
|
|
|
passNormal = gl_Normal.xyz;
|
|
|
|
|
|
|
|
#if @shadows_enabled
|
|
|
|
vec3 viewNormal = normalize((gl_NormalMatrix * gl_Normal).xyz);
|
|
|
|
setupShadowCoords(viewPos, viewNormal);
|
|
|
|
#endif
|
|
|
|
}
|