mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 17:59:56 +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
63 lines
1.5 KiB
GLSL
63 lines
1.5 KiB
GLSL
#version @GLSLVersion
|
|
|
|
#include "multiview_vertex.glsl"
|
|
|
|
#if @useUBO
|
|
#extension GL_ARB_uniform_buffer_object : require
|
|
#endif
|
|
|
|
#if @useGPUShader4
|
|
#extension GL_EXT_gpu_shader4: require
|
|
#endif
|
|
|
|
#include "openmw_vertex.h.glsl"
|
|
varying vec2 uv;
|
|
varying float euclideanDepth;
|
|
varying float linearDepth;
|
|
|
|
#define PER_PIXEL_LIGHTING (@normalMap || @forcePPL)
|
|
|
|
#if !PER_PIXEL_LIGHTING
|
|
centroid varying vec3 passLighting;
|
|
centroid varying vec3 shadowDiffuseLighting;
|
|
#endif
|
|
varying vec3 passViewPos;
|
|
varying vec3 passNormal;
|
|
|
|
#include "vertexcolors.glsl"
|
|
#include "shadows_vertex.glsl"
|
|
|
|
#include "lighting.glsl"
|
|
#include "depth.glsl"
|
|
|
|
void main(void)
|
|
{
|
|
gl_Position = mw_modelToClip(gl_Vertex);
|
|
|
|
vec4 viewPos = mw_modelToView(gl_Vertex);
|
|
gl_ClipVertex = viewPos;
|
|
euclideanDepth = length(viewPos.xyz);
|
|
linearDepth = getLinearDepth(gl_Position.z, viewPos.z);
|
|
|
|
#if (!PER_PIXEL_LIGHTING || @shadows_enabled)
|
|
vec3 viewNormal = normalize((gl_NormalMatrix * gl_Normal).xyz);
|
|
#endif
|
|
|
|
passColor = gl_Color;
|
|
passNormal = gl_Normal.xyz;
|
|
passViewPos = viewPos.xyz;
|
|
|
|
#if !PER_PIXEL_LIGHTING
|
|
vec3 diffuseLight, ambientLight;
|
|
doLighting(viewPos.xyz, viewNormal, diffuseLight, ambientLight, shadowDiffuseLighting);
|
|
passLighting = getDiffuseColor().xyz * diffuseLight + getAmbientColor().xyz * ambientLight + getEmissionColor().xyz;
|
|
clampLightingResult(passLighting);
|
|
shadowDiffuseLighting *= getDiffuseColor().xyz;
|
|
#endif
|
|
|
|
uv = gl_MultiTexCoord0.xy;
|
|
|
|
#if (@shadows_enabled)
|
|
setupShadowCoords(viewPos, viewNormal);
|
|
#endif
|
|
}
|