forked from mirror/openmw-tes3mp
Reimplement detailMap, darkMap and emissiveMap
This commit is contained in:
parent
e845c576d4
commit
5fd84074c5
2 changed files with 51 additions and 0 deletions
|
@ -5,6 +5,21 @@ 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;
|
||||
|
||||
varying vec3 lighting;
|
||||
|
@ -17,8 +32,20 @@ void main()
|
|||
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
|
||||
|
||||
gl_FragData[0].xyz *= lighting;
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,18 @@
|
|||
varying vec2 diffuseMapUV;
|
||||
#endif
|
||||
|
||||
#if @darkMap
|
||||
varying vec2 darkMapUV;
|
||||
#endif
|
||||
|
||||
#if @detailMap
|
||||
varying vec2 detailMapUV;
|
||||
#endif
|
||||
|
||||
#if @emissiveMap
|
||||
varying vec2 emissiveMapUV;
|
||||
#endif
|
||||
|
||||
varying float depth;
|
||||
|
||||
varying vec3 lighting;
|
||||
|
@ -54,6 +66,18 @@ void main(void)
|
|||
diffuseMapUV = (gl_TextureMatrix[@diffuseMapUV] * gl_MultiTexCoord@diffuseMapUV).xy;
|
||||
#endif
|
||||
|
||||
#if @darkMap
|
||||
darkMapUV = (gl_TextureMatrix[@darkMapUV] * gl_MultiTexCoord@darkMapUV).xy;
|
||||
#endif
|
||||
|
||||
#if @detailMap
|
||||
detailMapUV = (gl_TextureMatrix[@detailMap] * gl_MultiTexCoord@detailMap).xy;
|
||||
#endif
|
||||
|
||||
#if @emissiveMap
|
||||
emissiveMapUV = (gl_TextureMatrix[@emissiveMapUV] * gl_MultiTexCoord@emissiveMapUV).xy;
|
||||
#endif
|
||||
|
||||
lighting = doLighting(viewPos.xyz, viewNormal, gl_Color.xyz);
|
||||
lighting = clamp(lighting, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue