Detect scaled models that yield full blocks, and optimize to solid

This commit is contained in:
Mike Primm 2011-12-15 14:58:25 +08:00 committed by mikeprimm
parent ba2c3eac1c
commit 102012aa91

View File

@ -264,11 +264,19 @@ public class HDBlockModels {
row = new short[16][]; row = new short[16][];
blockmodels[m.blockid] = row; blockmodels[m.blockid] = row;
} }
short[] smod = null; short[] smod = m.getScaledMap(scale);
for(int i = 0; i < 16; i++) { /* See if scaled model is full block : much faster to not use it if it is */
if((m.databits & (1 << i)) != 0) { if(smod != null) {
if(smod == null) smod = m.getScaledMap(scale); boolean keep = false;
row[i] = smod; for(int i = 0; (!keep) && (i < smod.length); i++) {
if(smod[i] == 0) keep = true;
}
if(keep) {
for(int i = 0; i < 16; i++) {
if((m.databits & (1 << i)) != 0) {
row[i] = smod;
}
}
} }
} }
} }