Merge branch 'master' of github.com:teamfisk/TacticalZ

This commit is contained in:
FakeShemp
2016-03-14 20:07:04 +01:00
95 changed files with 39354 additions and 25846 deletions
+5 -8
View File
@@ -1,7 +1,10 @@
#version 430
#include "Shaders/Util/CommonNormalFunc.glsl"
#define MIN_AMBIENT_LIGHT 0.3
#define MAX_SPLITS 4
uniform mat4 M;
uniform mat4 V;
uniform mat4 P;
@@ -16,6 +19,7 @@ uniform vec3 CameraPosition;
uniform int SSAOQuality;
uniform float FarDistance[MAX_SPLITS];
uniform int NormalTextureType;
uniform vec2 DiffuseUVRepeat;
uniform vec2 NormalUVRepeat;
uniform vec2 SpecularUVRepeat;
@@ -139,13 +143,6 @@ LightResult CalcDirectionalLightSource(vec4 direction, vec4 color, float intensi
return result;
}
vec4 CalcNormalMappedValue(vec3 normal, vec3 tangent, vec3 bitangent, vec2 textureCoordinate, sampler2D normalMap)
{
mat3 TBN = mat3(tangent, bitangent, normal);
vec3 NormalMap = texture(normalMap, textureCoordinate).xyz * 2.0 - vec3(1.0);
return vec4(TBN * normalize(NormalMap), 0.0);
}
// Returns a "random" value.
float Random(vec3 seed, int i)
{
@@ -301,7 +298,7 @@ void main()
vec4 diffuseTexel = texture2D(DiffuseTexture, Input.TextureCoordinate * DiffuseUVRepeat);
vec4 glowTexel = texture2D(GlowMapTexture, Input.TextureCoordinate * GlowUVRepeat);
vec4 specularTexel = texture2D(SpecularMapTexture, Input.TextureCoordinate * SpecularUVRepeat);
vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate * NormalUVRepeat, NormalMapTexture);
vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate * NormalUVRepeat, NormalMapTexture, NormalTextureType);
normal = normalize(normal);
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
vec4 viewVec = normalize(-Input.ViewSpacePosition);