Skip to content

Commit

Permalink
only do the first draw pass for connected grass sides
Browse files Browse the repository at this point in the history
  • Loading branch information
octarine-noise committed Nov 5, 2014
1 parent ff94730 commit accf71f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
Expand Up @@ -45,6 +45,8 @@ public void setGray(float value) {
}
}

protected int drawPass = 0;

protected double[] uValues = new double[] {0.0, 16.0, 16.0, 0.0};
protected double[] vValues = new double[] {0.0, 0.0, 16.0, 16.0};

Expand Down Expand Up @@ -136,7 +138,8 @@ protected void renderWorldBlockBase(int pass, IBlockAccess world, int x, int y,
}

// render block
setPassCounters(1);
drawPass = 0;
setAOPassCounters(1);
setRenderBoundsFromBlock(block);
ISimpleBlockRenderingHandler handler = RenderUtils.getRenderingHandler(block.getRenderType());
if (handler != null) {
Expand Down Expand Up @@ -387,7 +390,7 @@ protected void saveShadingBottomRight(ShadingValues values) {
* if the underlying renderer draws overlays
* @param value pass counter
*/
protected void setPassCounters(int value) {
protected void setAOPassCounters(int value) {
aoXPYZPP.passCounter = value;
aoXPYZPN.passCounter = value;
aoXPYZNP.passCounter = value;
Expand Down Expand Up @@ -480,4 +483,12 @@ protected void setAOColors(int color) {
colorBlueBottomLeft *= blue;
colorBlueBottomRight *= blue;
}

@Override
public boolean renderStandardBlock(Block p_147784_1_, int p_147784_2_, int p_147784_3_, int p_147784_4_) {
drawPass++;
return super.renderStandardBlock(p_147784_1_, p_147784_2_, p_147784_3_, p_147784_4_);
}


}
Expand Up @@ -51,7 +51,7 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b
}

// render dirt block
setPassCounters(1);
setAOPassCounters(1);
setRenderBoundsFromBlock(block);
renderStandardBlock(block, x, y, z);

Expand Down
Expand Up @@ -46,7 +46,7 @@ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block b
}

// render cactus center
setPassCounters(1);
setAOPassCounters(1);
renderStandardBlock(block, x, y, z);

Double3 blockCenter = new Double3(x + 0.5, y + 0.5, z + 0.5);
Expand Down
Expand Up @@ -110,6 +110,7 @@ public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon
Tessellator.instance.setColorOpaque_I(biomeColor);
if (enableAO) setAOColors(biomeColor);
}
if (connectZN && drawPass > 1) return;
super.renderFaceZNeg(block, x, y, z, connectZN ? grassTopIcon : icon);
}

Expand All @@ -119,6 +120,7 @@ public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon
Tessellator.instance.setColorOpaque_I(biomeColor);
if (enableAO) setAOColors(biomeColor);
}
if (connectZP && drawPass > 1) return;
super.renderFaceZPos(block, x, y, z, connectZP ? grassTopIcon : icon);
}

Expand All @@ -128,6 +130,7 @@ public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon
Tessellator.instance.setColorOpaque_I(biomeColor);
if (enableAO) setAOColors(biomeColor);
}
if (connectXN && drawPass > 1) return;
super.renderFaceXNeg(block, x, y, z, connectXN ? grassTopIcon : icon);
}

Expand All @@ -137,6 +140,7 @@ public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon
Tessellator.instance.setColorOpaque_I(biomeColor);
if (enableAO) setAOColors(biomeColor);
}
if (connectXP && drawPass > 1) return;
super.renderFaceXPos(block, x, y, z, connectXP ? grassTopIcon : icon);
}

Expand Down

0 comments on commit accf71f

Please sign in to comment.