1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 17:19:56 +00:00
openmw-tes3mp/files/shaders/objects_fragment.glsl
2016-02-18 19:37:59 +01:00

66 lines
1.2 KiB
GLSL

#version 120
#if @diffuseMap
uniform sampler2D diffuseMap;
varying vec2 diffuseMapUV;
#endif
#if @darkMap
uniform sampler2D darkMap;
varying vec2 darkMapUV;
#endif
#if @detailMap
uniform sampler2D detailMap;
varying vec2 detailMapUV;
#endif
#if @emissiveMap
uniform sampler2D emissiveMap;
varying vec2 emissiveMapUV;
#endif
varying float depth;
#define PER_PIXEL_LIGHTING 0
#if !PER_PIXEL_LIGHTING
varying vec4 lighting;
#else
varying vec3 passViewPos;
varying vec3 passViewNormal;
varying vec4 passColour;
#endif
#include "lighting.glsl"
void main()
{
#if @diffuseMap
gl_FragData[0] = texture2D(diffuseMap, diffuseMapUV);
#else
gl_FragData[0] = vec4(1.0, 1.0, 1.0, 1.0);
#endif
#if @detailMap
gl_FragData[0].xyz *= texture2D(detailMap, detailMapUV).xyz * 2.0;
#endif
#if @darkMap
gl_FragData[0].xyz *= texture2D(darkMap, darkMapUV).xyz;
#endif
#if !PER_PIXEL_LIGHTING
gl_FragData[0] *= lighting;
#else
gl_FragData[0] *= doLighting(passViewPos, passViewNormal, passColour);
#endif
#if @emissiveMap
gl_FragData[0].xyz += texture2D(emissiveMap, emissiveMapUV).xyz;
#endif
float fogValue = clamp((depth - gl_Fog.start) * gl_Fog.scale, 0.0, 1.0);
gl_FragData[0].xyz = mix(gl_FragData[0].xyz, gl_Fog.color.xyz, fogValue);
}