Force mipmap even if textures are the wrong size

This commit is contained in:
mezz committed 2016-07-13 05:23:01 -07:00
1 parent b76b223d62
commit ae0c02159f
2 files changed
+40 -2

No files matched your search

@@ -84,7 +84,16 @@
continue;
}
finally
@@ -129,6 +158,7 @@
@@ -122,17 +151,18 @@
if (lvt_11_2_ < k)
{
- field_147635_d.warn("Texture {} with size {}x{} limits mip level from {} to {}", new Object[] {resourcelocation, Integer.valueOf(textureatlassprite.func_94211_a()), Integer.valueOf(textureatlassprite.func_94216_b()), Integer.valueOf(MathHelper.func_151239_c(k)), Integer.valueOf(MathHelper.func_151239_c(lvt_11_2_))});
- k = lvt_11_2_;
+ // FORGE: do not lower the mipmap level, just log the problematic textures
+ field_147635_d.warn("Texture {} with size {}x{} will have visual artifacts at mip level {}, it can only support level {}. Please report to the mod author that the texture should be some multiple of 16x16.", resourcelocation, textureatlassprite.func_94211_a(), textureatlassprite.func_94216_b(), MathHelper.func_151239_c(k), MathHelper.func_151239_c(lvt_11_2_));
}
stitcher.func_110934_a(textureatlassprite);
}
@@ -92,6 +101,11 @@
int l = Math.min(j, k);
int i1 = MathHelper.func_151239_c(l);
- if (i1 < this.field_147636_j)
+ if (false && i1 < this.field_147636_j) // FORGE: do not lower the mipmap level
{
field_147635_d.warn("{}: dropping miplevel from {} to {}, because of minimum power of two: {}", new Object[] {this.field_94254_c, Integer.valueOf(this.field_147636_j), Integer.valueOf(i1), Integer.valueOf(l)});
this.field_147636_j = i1;
@@ -140,9 +170,12 @@
this.field_94249_f.func_147963_d(this.field_147636_j);
@@ -1,6 +1,30 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java
@@ -202,9 +202,11 @@
@@ -83,6 +83,7 @@
int[] aint1 = aint[l1 - 1];
int[] aint2 = new int[aint1.length >> 2];
int j = p_147949_1_ >> l1;
+ if (j > 0) { // FORGE: forcing higher mipmap levels on odd textures needs this check
int k = aint2.length / j;
int l = j << 1;
@@ -94,6 +95,7 @@
aint2[i1 + j1 * j] = func_147943_a(aint1[k1 + 0], aint1[k1 + 1], aint1[k1 + 0 + l], aint1[k1 + 1 + l], flag);
}
}
+ } // end if (j > 0)
aint[l1] = aint2;
}
@@ -168,6 +170,7 @@
for (int i = 0; i < p_147955_0_.length; ++i)
{
int[] aint = p_147955_0_[i];
+ if ((p_147955_1_ >> i <= 0) || (p_147955_2_ >> i <= 0)) break;
func_147947_a(i, aint, p_147955_1_ >> i, p_147955_2_ >> i, p_147955_3_ >> i, p_147955_4_ >> i, p_147955_5_, p_147955_6_, p_147955_0_.length > 1);
}
}
@@ -202,9 +205,11 @@
public static void func_180600_a(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_)
{