... Now mipmaps and Splatmaps i comming :)
This commit is contained in:
@@ -9,8 +9,14 @@
|
|||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
<c:SceneLight/>
|
<c:SceneLight/>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Test/SplatMapTest.mesh</Resource>
|
<Resource>Models/Ground.mesh</Resource>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform/>
|
<c:Transform/>
|
||||||
</Components>
|
</Components>
|
||||||
|
|||||||
@@ -151,8 +151,6 @@ vec4 CalcNormalMappedValue(vec3 normal, vec3 tangent, vec3 bitangent, vec2 textu
|
|||||||
return vec4(TBN * normalize(NormalMap), 0.0);
|
return vec4(TBN * normalize(NormalMap), 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TEXTURE_TILE 5.0
|
|
||||||
|
|
||||||
vec4 CalcBlendedTexel(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B, sampler2D A, sampler2D D,
|
vec4 CalcBlendedTexel(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B, sampler2D A, sampler2D D,
|
||||||
vec2 R_TileValues, vec2 G_TileValues, vec2 B_TileValues, vec2 A_TileValues, vec2 D_TileValues){
|
vec2 R_TileValues, vec2 G_TileValues, vec2 B_TileValues, vec2 A_TileValues, vec2 D_TileValues){
|
||||||
vec4 R_Channel = texture2D(R, Input.TextureCoordinate * R_TileValues);
|
vec4 R_Channel = texture2D(R, Input.TextureCoordinate * R_TileValues);
|
||||||
@@ -163,10 +161,11 @@ vec4 CalcBlendedTexel(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B, sa
|
|||||||
|
|
||||||
float total = blendValue.r + blendValue.g + blendValue.b + blendValue.a;
|
float total = blendValue.r + blendValue.g + blendValue.b + blendValue.a;
|
||||||
if(total > 1.0f){
|
if(total > 1.0f){
|
||||||
blendValue.r / total;
|
float totalDiv = 1.0f / total;
|
||||||
blendValue.g / total;
|
blendValue.r = blendValue.r * totalDiv;
|
||||||
blendValue.b / total;
|
blendValue.g = blendValue.g * totalDiv;
|
||||||
blendValue.a / total;
|
blendValue.b = blendValue.b * totalDiv;
|
||||||
|
blendValue.a = blendValue.a * totalDiv;
|
||||||
}
|
}
|
||||||
float D_percent = clamp( 1.0f - total, 0.0f, 1.0f);
|
float D_percent = clamp( 1.0f - total, 0.0f, 1.0f);
|
||||||
|
|
||||||
@@ -188,10 +187,11 @@ vec4 CalcBlendedNormal(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B, s
|
|||||||
|
|
||||||
float total = blendValue.r + blendValue.g + blendValue.b + blendValue.a;
|
float total = blendValue.r + blendValue.g + blendValue.b + blendValue.a;
|
||||||
if(total > 1.0f){
|
if(total > 1.0f){
|
||||||
blendValue.r / total;
|
float totalDiv = 1 / total;
|
||||||
blendValue.g / total;
|
blendValue.r = blendValue.r * totalDiv;
|
||||||
blendValue.b / total;
|
blendValue.g = blendValue.g * totalDiv;
|
||||||
blendValue.a / total;
|
blendValue.b = blendValue.b * totalDiv;
|
||||||
|
blendValue.a = blendValue.a * totalDiv;
|
||||||
}
|
}
|
||||||
float D_percent = clamp( 1.0f - total, 0.0f, 1.0f);
|
float D_percent = clamp( 1.0f - total, 0.0f, 1.0f);
|
||||||
|
|
||||||
|
|||||||
@@ -30,9 +30,10 @@ Texture::Texture(std::string path)
|
|||||||
glBindTexture(GL_TEXTURE_2D, m_Texture);
|
glBindTexture(GL_TEXTURE_2D, m_Texture);
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, format, image.Width, image.Height, 0, format, GL_UNSIGNED_BYTE, image.Data);
|
glTexImage2D(GL_TEXTURE_2D, 0, format, image.Width, image.Height, 0, format, GL_UNSIGNED_BYTE, image.Data);
|
||||||
|
glGenerateMipmap(GL_TEXTURE_2D);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
GLERROR("Texture load");
|
GLERROR("Texture load");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user