mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-29 08:15:35 +00:00
dd5901d351
Multiview shaders. Refactor Frustum management Rewrite shared shadow map cull mask should respect stereo Stereo savegame screencap LocalMap refactoring use the vertex buffer hint instead of the display list patch to enable/disable display lists Character preview fixes
52 lines
1.1 KiB
GLSL
52 lines
1.1 KiB
GLSL
#version @GLSLVersion
|
|
|
|
#include "openmw_vertex.h.glsl"
|
|
|
|
#if @diffuseMap
|
|
varying vec2 diffuseMapUV;
|
|
#endif
|
|
|
|
#if @radialFog
|
|
varying float euclideanDepth;
|
|
#else
|
|
varying float linearDepth;
|
|
#endif
|
|
|
|
uniform bool useFalloff;
|
|
uniform vec4 falloffParams;
|
|
|
|
varying vec3 passViewPos;
|
|
varying float passFalloff;
|
|
|
|
#include "vertexcolors.glsl"
|
|
#include "depth.glsl"
|
|
|
|
void main(void)
|
|
{
|
|
gl_Position = mw_modelToClip(gl_Vertex);
|
|
|
|
vec4 viewPos = mw_modelToView(gl_Vertex);
|
|
gl_ClipVertex = viewPos;
|
|
#if @radialFog
|
|
euclideanDepth = length(viewPos.xyz);
|
|
#else
|
|
linearDepth = getLinearDepth(gl_Position.z, viewPos.z);
|
|
#endif
|
|
|
|
#if @diffuseMap
|
|
diffuseMapUV = (gl_TextureMatrix[@diffuseMapUV] * gl_MultiTexCoord@diffuseMapUV).xy;
|
|
#endif
|
|
|
|
passColor = gl_Color;
|
|
if (useFalloff)
|
|
{
|
|
vec3 viewNormal = gl_NormalMatrix * normalize(gl_Normal.xyz);
|
|
vec3 viewDir = normalize(viewPos.xyz);
|
|
float viewAngle = abs(dot(viewNormal, viewDir));
|
|
passFalloff = smoothstep(falloffParams.y, falloffParams.x, viewAngle);
|
|
}
|
|
else
|
|
{
|
|
passFalloff = 1.0;
|
|
}
|
|
}
|