mirror of https://github.com/OpenMW/openmw.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.1 KiB
GLSL
53 lines
1.1 KiB
GLSL
#version 120
|
|
|
|
#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;
|
|
}
|
|
}
|