Make default shader more consistent with Kzed shader

This commit is contained in:
Mike Primm 2011-07-12 18:02:01 -05:00
parent ea44be18d1
commit eb4e768764
2 changed files with 8 additions and 6 deletions

View file

@ -132,7 +132,7 @@ public class ColorScheme {
c[1] = new Color(Integer.parseInt(split[9]), Integer.parseInt(split[10]), Integer.parseInt(split[11]), Integer.parseInt(split[12])); c[1] = new Color(Integer.parseInt(split[9]), Integer.parseInt(split[10]), Integer.parseInt(split[11]), Integer.parseInt(split[12]));
c[2] = new Color(Integer.parseInt(split[13]), Integer.parseInt(split[14]), Integer.parseInt(split[15]), Integer.parseInt(split[16])); c[2] = new Color(Integer.parseInt(split[13]), Integer.parseInt(split[14]), Integer.parseInt(split[15]), Integer.parseInt(split[16]));
/* Blended color - for 'smooth' option on flat map */ /* Blended color - for 'smooth' option on flat map */
c[4] = new Color((c[0].getRed()+c[2].getRed())/2, (c[0].getGreen()+c[2].getGreen())/2, (c[0].getBlue()+c[2].getBlue())/2, (c[0].getAlpha()+c[2].getAlpha())/2); c[4] = new Color((c[1].getRed()+c[3].getRed())/2, (c[1].getGreen()+c[3].getGreen())/2, (c[1].getBlue()+c[3].getBlue())/2, (c[1].getAlpha()+c[3].getAlpha())/2);
if(isbiome) { if(isbiome) {
if(istemp) { if(istemp) {

View file

@ -142,18 +142,21 @@ public class DefaultHDShader implements HDShader {
if (colors != null) { if (colors != null) {
int seq; int seq;
int subalpha = ps.getSubmodelAlpha();
/* Figure out which color to use */ /* Figure out which color to use */
switch(ps.getLastBlockStep()) { switch(ps.getLastBlockStep()) {
case X_PLUS: case X_PLUS:
case X_MINUS: case X_MINUS:
seq = 0; seq = 2;
break; break;
case Z_PLUS: case Z_PLUS:
case Z_MINUS: case Z_MINUS:
seq = 2; seq = 0;
break; break;
default: default:
if(((pixelodd + mapiter.getY()) & 0x03) == 0) if(subalpha >= 0) /* We hit a block in a model */
seq = 4; /* Use smooth top */
else if(((pixelodd + mapiter.getY()) & 0x03) == 0)
seq = 3; seq = 3;
else else
seq = 1; seq = 1;
@ -164,10 +167,9 @@ public class DefaultHDShader implements HDShader {
/* Handle light level, if needed */ /* Handle light level, if needed */
lighting.applyLighting(ps, this, c, tmpcolor); lighting.applyLighting(ps, this, c, tmpcolor);
/* If we got alpha from subblock model, use it instead */ /* If we got alpha from subblock model, use it instead */
int subalpha = ps.getSubmodelAlpha();
if(subalpha >= 0) { if(subalpha >= 0) {
for(Color clr : tmpcolor) for(Color clr : tmpcolor)
clr.setAlpha(subalpha); clr.setAlpha(Math.max(subalpha,clr.getAlpha()));
} }
/* Blend color with accumulated color (weighted by alpha) */ /* Blend color with accumulated color (weighted by alpha) */
if(!transparency) { /* No transparency support */ if(!transparency) { /* No transparency support */