mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-29 06:28:30 +00:00
Update normalmap.fs
This commit is contained in:
@@ -23,15 +23,15 @@ uniform float specularExponent;
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 texelColor = texture(texture0, vec2(fragTexCoord.x, fragTexCoord.y));
|
vec4 texelColor = texture2D(texture0, vec2(fragTexCoord.x, fragTexCoord.y));
|
||||||
vec3 specular = vec3(0.0);
|
vec3 specular = vec3(0.0);
|
||||||
vec3 viewDir = normalize(viewPos - fragPosition);
|
vec3 viewDir = normalize(viewPos - fragPosition);
|
||||||
vec3 lightDir = normalize(lightPos - fragPosition);
|
vec3 lightDir = normalize(lightPos - fragPosition);
|
||||||
|
|
||||||
vec3 normal;
|
vec3 normal = vec3(0.0);
|
||||||
if (useNormalMap)
|
if (useNormalMap)
|
||||||
{
|
{
|
||||||
normal = texture(normalMap, vec2(fragTexCoord.x, fragTexCoord.y)).rgb;
|
normal = texture2D(normalMap, vec2(fragTexCoord.x, fragTexCoord.y)).rgb;
|
||||||
|
|
||||||
// Transform normal values to the range -1.0 ... 1.0
|
// Transform normal values to the range -1.0 ... 1.0
|
||||||
normal = normalize(normal*2.0 - 1.0);
|
normal = normalize(normal*2.0 - 1.0);
|
||||||
@@ -56,7 +56,7 @@ void main()
|
|||||||
|
|
||||||
specular += specCo;
|
specular += specCo;
|
||||||
|
|
||||||
finalColor = (texelColor*((tint + vec4(specular, 1.0))*vec4(lightDot, 1.0)));
|
vec4 finalColor = (texelColor*((tint + vec4(specular, 1.0))*vec4(lightDot, 1.0)));
|
||||||
finalColor += texelColor*(vec4(1.0, 1.0, 1.0, 1.0)/40.0)*tint;
|
finalColor += texelColor*(vec4(1.0, 1.0, 1.0, 1.0)/40.0)*tint;
|
||||||
|
|
||||||
// Gamma correction
|
// Gamma correction
|
||||||
|
Reference in New Issue
Block a user