Started work on blend maps
This commit is contained in:
@@ -781,6 +781,7 @@ void Renderer::DrawFBOScene()
|
|||||||
glActiveTexture(GL_TEXTURE3);
|
glActiveTexture(GL_TEXTURE3);
|
||||||
glBindTexture(GL_TEXTURE_2D, *texGroup.SpecularMap);
|
glBindTexture(GL_TEXTURE_2D, *texGroup.SpecularMap);
|
||||||
}
|
}
|
||||||
|
//Kolla om den har blendmap, skicka då med texture 4/5/6/7
|
||||||
glDrawArrays(GL_TRIANGLES, texGroup.StartIndex, texGroup.EndIndex - texGroup.StartIndex + 1);
|
glDrawArrays(GL_TRIANGLES, texGroup.StartIndex, texGroup.EndIndex - texGroup.StartIndex + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,13 @@ layout (binding=1) uniform sampler2D ShadowTexture;
|
|||||||
layout (binding=2) uniform sampler2D NormalMapTexture;
|
layout (binding=2) uniform sampler2D NormalMapTexture;
|
||||||
layout (binding=3) uniform sampler2D SpecularMapTexture;
|
layout (binding=3) uniform sampler2D SpecularMapTexture;
|
||||||
|
|
||||||
|
//TerrainTextures
|
||||||
|
layout (binding=4) uniform sampler2D AsphaltTexture;
|
||||||
|
layout (binding=5) uniform sampler2D GrassTexture;
|
||||||
|
layout (binding=6) uniform sampler2D SandTexture;
|
||||||
|
layout (binding=7) uniform sampler2D BlendMap;
|
||||||
|
|
||||||
|
uniform float texScale; //Determines how many times the textures will loop over the terrain
|
||||||
uniform vec3 SunDirection_cameraspace;
|
uniform vec3 SunDirection_cameraspace;
|
||||||
uniform mat4 V;
|
uniform mat4 V;
|
||||||
|
|
||||||
@@ -50,9 +57,26 @@ float Shadow(vec4 ShadowCoord)
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
//Fixa så den bara gör detta om modellen har en blend map
|
||||||
|
//vvvvvv
|
||||||
|
|
||||||
|
vec4 Blend = texture2D(BlendMap, TextureCoord.st ).rgb;
|
||||||
|
vec4 AsphaltTexel = texture2D(AsphaltTexture, TextureCoord.st * texScale).rgb;
|
||||||
|
vec4 GrassTexel = texture2D(GrassTexture, TextureCoord.st * texScale).rgb;
|
||||||
|
vec4 SandTexel = texture2D(SandTexture, TextureCoord.st * texScale).rgb;
|
||||||
|
|
||||||
|
//Mix the Terrain-textures together
|
||||||
|
AsphaltTexel *= mixmap.r;
|
||||||
|
GrassTexel = mix(AsphaltTexel, GrassTexel, mixmap.g);
|
||||||
|
vec4 tex = mix(GrassTexel, SandTexel, mixmap.b);
|
||||||
|
|
||||||
|
//^^^^^^
|
||||||
|
//Fixa så den bara gör detta om modellen har en blend map
|
||||||
|
|
||||||
|
|
||||||
// Diffuse Texture
|
// Diffuse Texture
|
||||||
frag_Diffuse = texture(DiffuseTexture, Input.TextureCoord) * Shadow(Input.ShadowCoord);
|
frag_Diffuse = tex;
|
||||||
|
//frag_Diffuse = texture(DiffuseTexture, Input.TextureCoord) * Shadow(Input.ShadowCoord);
|
||||||
|
|
||||||
// G-buffer Position
|
// G-buffer Position
|
||||||
frag_Position = vec4(Input.Position.xyz, 1.0);
|
frag_Position = vec4(Input.Position.xyz, 1.0);
|
||||||
|
|||||||
Reference in New Issue
Block a user