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,14 +264,22 @@ public class HDBlockModels {
row = new short[16][];
blockmodels[m.blockid] = row;
}
short[] smod = null;
short[] smod = m.getScaledMap(scale);
/* See if scaled model is full block : much faster to not use it if it is */
if(smod != null) {
boolean keep = false;
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) {
if(smod == null) smod = m.getScaledMap(scale);
row[i] = smod;
}
}
}
}
}
model.modelvectors = blockmodels;
scaled_models_by_scale.put(scale, model);
}