Java Code Examples for net.minecraft.block.Block#getMixedBrightnessForBlock()
The following examples show how to use
net.minecraft.block.Block#getMixedBrightnessForBlock() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockExtendedNodeJarRenderer.java From Gadomancy with GNU Lesser General Public License v3.0 | 6 votes |
private int setBrightness(IBlockAccess blockAccess, int i, int j, int k, Block block) { Tessellator tessellator = Tessellator.instance; int mb = block.getMixedBrightnessForBlock(blockAccess, i, j, k); tessellator.setBrightness(mb); float f = 1.0F; int l = block.colorMultiplier(blockAccess, i, j, k); float f1 = (l >> 16 & 0xFF) / 255.0F; float f2 = (l >> 8 & 0xFF) / 255.0F; float f3 = (l & 0xFF) / 255.0F; if (EntityRenderer.anaglyphEnable) { float f6 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F; float f4 = (f1 * 30.0F + f2 * 70.0F) / 100.0F; float f7 = (f1 * 30.0F + f3 * 70.0F) / 100.0F; f1 = f6; f2 = f4; f3 = f7; } tessellator.setColorOpaque_F(f * f1, f * f2, f * f3); return mb; }
Example 2
Source File: RenderHelperAO.java From GardenCollection with MIT License | 5 votes |
private void setupAOBrightnessYNeg (IBlockAccess blockAccess, Block block, int x, int y, int z, boolean bgXP, boolean bgXN, boolean bgZP, boolean bgZN) { aoLightValueScratchXYNN = blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(); aoLightValueScratchYZNN = blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(); aoLightValueScratchYZNP = blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(); aoLightValueScratchXYPN = blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(); aoLightValueScratchXYZNNN = aoLightValueScratchXYNN; aoLightValueScratchXYZNNP = aoLightValueScratchXYNN; aoLightValueScratchXYZPNN = aoLightValueScratchXYPN; aoLightValueScratchXYZPNP = aoLightValueScratchXYPN; aoBrightnessXYNN = block.getMixedBrightnessForBlock(blockAccess, x - 1, y, z); aoBrightnessYZNN = block.getMixedBrightnessForBlock(blockAccess, x, y, z - 1); aoBrightnessYZNP = block.getMixedBrightnessForBlock(blockAccess, x, y, z + 1); aoBrightnessXYPN = block.getMixedBrightnessForBlock(blockAccess, x + 1, y, z); aoBrightnessXYZNNN = aoBrightnessXYNN; aoBrightnessXYZNNP = aoBrightnessXYNN; aoBrightnessXYZPNN = aoBrightnessXYPN; aoBrightnessXYZPNP = aoBrightnessXYPN; if (bgXN || bgZN) { aoLightValueScratchXYZNNN = blockAccess.getBlock(x - 1, y, z - 1).getAmbientOcclusionLightValue(); aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(blockAccess, x - 1, y, z - 1); } if (bgXN || bgZP) { aoLightValueScratchXYZNNP = blockAccess.getBlock(x - 1, y, z + 1).getAmbientOcclusionLightValue(); aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(blockAccess, x - 1, y, z + 1); } if (bgXP || bgZN) { aoLightValueScratchXYZPNN = blockAccess.getBlock(x + 1, y, z - 1).getAmbientOcclusionLightValue(); aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(blockAccess, x + 1, y, z - 1); } if (bgXP || bgZP) { aoLightValueScratchXYZPNP = blockAccess.getBlock(x + 1, y, z + 1).getAmbientOcclusionLightValue(); aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(blockAccess, x + 1, y, z + 1); } }
Example 3
Source File: RenderHelperAO.java From GardenCollection with MIT License | 5 votes |
private void setupAOBrightnessYPos (IBlockAccess blockAccess, Block block, int x, int y, int z, boolean bgXP, boolean bgXN, boolean bgZP, boolean bgZN) { aoLightValueScratchXYNP = blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(); aoLightValueScratchYZPN = blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(); aoLightValueScratchYZPP = blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(); aoLightValueScratchXYPP = blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(); aoLightValueScratchXYZNPN = aoLightValueScratchXYNP; aoLightValueScratchXYZNPP = aoLightValueScratchXYNP; aoLightValueScratchXYZPPN = aoLightValueScratchXYPP; aoLightValueScratchXYZPPP = aoLightValueScratchXYPP; aoBrightnessXYNP = block.getMixedBrightnessForBlock(blockAccess, x - 1, y, z); aoBrightnessYZPN = block.getMixedBrightnessForBlock(blockAccess, x, y, z - 1); aoBrightnessYZPP = block.getMixedBrightnessForBlock(blockAccess, x, y, z + 1); aoBrightnessXYPP = block.getMixedBrightnessForBlock(blockAccess, x + 1, y, z); aoBrightnessXYZNPN = aoBrightnessXYNP; aoBrightnessXYZNPP = aoBrightnessXYNP; aoBrightnessXYZPPN = aoBrightnessXYPP; aoBrightnessXYZPPP = aoBrightnessXYPP; if (bgXN || bgZN) { aoLightValueScratchXYZNPN = blockAccess.getBlock(x - 1, y, z - 1).getAmbientOcclusionLightValue(); aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(blockAccess, x - 1, y, z - 1); } if (bgXN || bgZP) { aoLightValueScratchXYZNPP = blockAccess.getBlock(x - 1, y, z + 1).getAmbientOcclusionLightValue(); aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(blockAccess, x - 1, y, z + 1); } if (bgXP || bgZN) { aoLightValueScratchXYZPPN = blockAccess.getBlock(x + 1, y, z - 1).getAmbientOcclusionLightValue(); aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(blockAccess, x + 1, y, z - 1); } if (bgXP || bgZP) { aoLightValueScratchXYZPPP = blockAccess.getBlock(x + 1, y, z + 1).getAmbientOcclusionLightValue(); aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(blockAccess, x + 1, y, z + 1); } }
Example 4
Source File: RenderHelperAO.java From GardenCollection with MIT License | 5 votes |
private void setupAOBrightnessZNeg (IBlockAccess blockAccess, Block block, int x, int y, int z, boolean bgXP, boolean bgXN, boolean bgYP, boolean bgYN) { aoLightValueScratchXZNN = blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(); aoLightValueScratchYZNN = blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(); aoLightValueScratchYZPN = blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(); aoLightValueScratchXZPN = blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(); aoLightValueScratchXYZNNN = aoLightValueScratchXZNN; aoLightValueScratchXYZNPN = aoLightValueScratchXZNN; aoLightValueScratchXYZPNN = aoLightValueScratchXZPN; aoLightValueScratchXYZPPN = aoLightValueScratchXZPN; aoBrightnessXZNN = block.getMixedBrightnessForBlock(blockAccess, x - 1, y, z); aoBrightnessYZNN = block.getMixedBrightnessForBlock(blockAccess, x, y - 1, z); aoBrightnessYZPN = block.getMixedBrightnessForBlock(blockAccess, x, y + 1, z); aoBrightnessXZPN = block.getMixedBrightnessForBlock(blockAccess, x + 1, y, z); aoBrightnessXYZNNN = aoBrightnessXZNN; aoBrightnessXYZNPN = aoBrightnessXZNN; aoBrightnessXYZPNN = aoBrightnessXZPN; aoBrightnessXYZPPN = aoBrightnessXZPN; if (bgXN || bgYN) { aoLightValueScratchXYZNNN = blockAccess.getBlock(x - 1, y - 1, z).getAmbientOcclusionLightValue(); aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(blockAccess, x - 1, y - 1, z); } if (bgXN || bgYP) { aoLightValueScratchXYZNPN = blockAccess.getBlock(x - 1, y + 1, z).getAmbientOcclusionLightValue(); aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(blockAccess, x - 1, y + 1, z); } if (bgXP || bgYN) { aoLightValueScratchXYZPNN = blockAccess.getBlock(x + 1, y - 1, z).getAmbientOcclusionLightValue(); aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(blockAccess, x + 1, y - 1, z); } if (bgXP || bgYP) { aoLightValueScratchXYZPPN = blockAccess.getBlock(x + 1, y + 1, z).getAmbientOcclusionLightValue(); aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(blockAccess, x + 1, y + 1, z); } }
Example 5
Source File: RenderHelperAO.java From GardenCollection with MIT License | 5 votes |
private void setupAOBrightnessZPos (IBlockAccess blockAccess, Block block, int x, int y, int z, boolean bgXP, boolean bgXN, boolean bgYP, boolean bgYN) { aoLightValueScratchXZNP = blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(); aoLightValueScratchXZPP = blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(); aoLightValueScratchYZNP = blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(); aoLightValueScratchYZPP = blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(); aoLightValueScratchXYZNNP = aoLightValueScratchXZNP; aoLightValueScratchXYZNPP = aoLightValueScratchXZNP; aoLightValueScratchXYZPNP = aoLightValueScratchXZPP; aoLightValueScratchXYZPPP = aoLightValueScratchXZPP; aoBrightnessXZNP = block.getMixedBrightnessForBlock(blockAccess, x - 1, y, z); aoBrightnessXZPP = block.getMixedBrightnessForBlock(blockAccess, x + 1, y, z); aoBrightnessYZNP = block.getMixedBrightnessForBlock(blockAccess, x, y - 1, z); aoBrightnessYZPP = block.getMixedBrightnessForBlock(blockAccess, x, y + 1, z); aoBrightnessXYZNNP = aoBrightnessXZNP; aoBrightnessXYZNPP = aoBrightnessXZNP; aoBrightnessXYZPNP = aoBrightnessXZPP; aoBrightnessXYZPPP = aoBrightnessXZPP; if (bgXN || bgYN) { aoLightValueScratchXYZNNP = blockAccess.getBlock(x - 1, y - 1, z).getAmbientOcclusionLightValue(); aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(blockAccess, x - 1, y - 1, z); } if (bgXN || bgYP) { aoLightValueScratchXYZNPP = blockAccess.getBlock(x - 1, y + 1, z).getAmbientOcclusionLightValue(); aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(blockAccess, x - 1, y + 1, z); } if (bgXP || bgYN) { aoLightValueScratchXYZPNP = blockAccess.getBlock(x + 1, y - 1, z).getAmbientOcclusionLightValue(); aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(blockAccess, x + 1, y - 1, z); } if (bgXP || bgYP) { aoLightValueScratchXYZPPP = blockAccess.getBlock(x + 1, y + 1, z).getAmbientOcclusionLightValue(); aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(blockAccess, x + 1, y + 1, z); } }
Example 6
Source File: RenderHelperAO.java From GardenCollection with MIT License | 5 votes |
private void setupAOBrightnessXNeg (IBlockAccess blockAccess, Block block, int x, int y, int z, boolean bgYP, boolean bgYN, boolean bgZN, boolean bgZP) { aoLightValueScratchXYNN = blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(); aoLightValueScratchXZNN = blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(); aoLightValueScratchXZNP = blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(); aoLightValueScratchXYNP = blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(); aoLightValueScratchXYZNNN = aoLightValueScratchXZNN; aoLightValueScratchXYZNNP = aoLightValueScratchXZNP; aoLightValueScratchXYZNPN = aoLightValueScratchXZNN; aoLightValueScratchXYZNPP = aoLightValueScratchXZNP; aoBrightnessXYNN = block.getMixedBrightnessForBlock(blockAccess, x, y - 1, z); aoBrightnessXZNN = block.getMixedBrightnessForBlock(blockAccess, x, y, z - 1); aoBrightnessXZNP = block.getMixedBrightnessForBlock(blockAccess, x, y, z + 1); aoBrightnessXYNP = block.getMixedBrightnessForBlock(blockAccess, x, y + 1, z); aoBrightnessXYZNNN = aoBrightnessXZNN; aoBrightnessXYZNNP = aoBrightnessXZNP; aoBrightnessXYZNPN = aoBrightnessXZNN; aoBrightnessXYZNPP = aoBrightnessXZNP; if (bgZN || bgYN) { aoLightValueScratchXYZNNN = blockAccess.getBlock(x, y - 1, z - 1).getAmbientOcclusionLightValue(); aoBrightnessXYZNNN = block.getMixedBrightnessForBlock(blockAccess, x, y - 1, z - 1); } if (bgZP || bgYN) { aoLightValueScratchXYZNNP = blockAccess.getBlock(x, y - 1, z + 1).getAmbientOcclusionLightValue(); aoBrightnessXYZNNP = block.getMixedBrightnessForBlock(blockAccess, x, y - 1, z + 1); } if (bgZN || bgYP) { aoLightValueScratchXYZNPN = blockAccess.getBlock(x, y + 1, z - 1).getAmbientOcclusionLightValue(); aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(blockAccess, x, y + 1, z - 1); } if (bgZP || bgYP) { aoLightValueScratchXYZNPP = blockAccess.getBlock(x, y + 1, z + 1).getAmbientOcclusionLightValue(); aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(blockAccess, x, y + 1, z + 1); } }
Example 7
Source File: RenderHelperAO.java From GardenCollection with MIT License | 5 votes |
private void setupAOBrightnessXPos (IBlockAccess blockAccess, Block block, int x, int y, int z, boolean bgYP, boolean bgYN, boolean bgZN, boolean bgZP) { aoLightValueScratchXYPN = blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(); aoLightValueScratchXZPN = blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(); aoLightValueScratchXZPP = blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(); aoLightValueScratchXYPP = blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(); aoLightValueScratchXYZPNN = aoLightValueScratchXZPN; aoLightValueScratchXYZPNP = aoLightValueScratchXZPP; aoLightValueScratchXYZPPN = aoLightValueScratchXZPN; aoLightValueScratchXYZPPP = aoLightValueScratchXZPP; aoBrightnessXYPN = block.getMixedBrightnessForBlock(blockAccess, x, y - 1, z); aoBrightnessXZPN = block.getMixedBrightnessForBlock(blockAccess, x, y, z - 1); aoBrightnessXZPP = block.getMixedBrightnessForBlock(blockAccess, x, y, z + 1); aoBrightnessXYPP = block.getMixedBrightnessForBlock(blockAccess, x, y + 1, z); aoBrightnessXYZPNN = aoBrightnessXZPN; aoBrightnessXYZPNP = aoBrightnessXZPP; aoBrightnessXYZPPN = aoBrightnessXZPN; aoBrightnessXYZPPP = aoBrightnessXZPP; if (bgYN || bgZN) { aoLightValueScratchXYZPNN = blockAccess.getBlock(x, y - 1, z - 1).getAmbientOcclusionLightValue(); aoBrightnessXYZPNN = block.getMixedBrightnessForBlock(blockAccess, x, y - 1, z - 1); } if (bgYN || bgZP) { aoLightValueScratchXYZPNP = blockAccess.getBlock(x, y - 1, z + 1).getAmbientOcclusionLightValue(); aoBrightnessXYZPNP = block.getMixedBrightnessForBlock(blockAccess, x, y - 1, z + 1); } if (bgYP || bgZN) { aoLightValueScratchXYZPPN = blockAccess.getBlock(x, y + 1, z - 1).getAmbientOcclusionLightValue(); aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(blockAccess, x, y + 1, z - 1); } if (bgYP || bgZP) { aoLightValueScratchXYZPPP = blockAccess.getBlock(x, y + 1, z + 1).getAmbientOcclusionLightValue(); aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(blockAccess, x, y + 1, z + 1); } }
Example 8
Source File: BlockDoorRenderer.java From Et-Futurum with The Unlicense | 4 votes |
@Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { Tessellator tessellator = Tessellator.instance; int meta = world.getBlockMetadata(x, y, z); if ((meta & 8) != 0) { if (world.getBlock(x, y - 1, z) != block) return false; } else if (world.getBlock(x, y + 1, z) != block) return false; int brightness = block.getMixedBrightnessForBlock(world, x, y, z); tessellator.setBrightness(renderer.renderMinY > 0.0D ? brightness : block.getMixedBrightnessForBlock(world, x, y - 1, z)); tessellator.setColorOpaque_F(0.5F, 0.5F, 0.5F); renderer.renderFaceYNeg(block, x, y, z, renderer.getBlockIcon(block, world, x, y, z, 0)); if ((meta & 8) != 0) { tessellator.setBrightness(renderer.renderMaxY < 1.0D ? brightness : block.getMixedBrightnessForBlock(world, x, y + 1, z)); tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F); renderer.uvRotateTop = 2; renderer.renderFaceYPos(block, x, y, z, renderer.getBlockIcon(block, world, x, y, z, 1)); renderer.uvRotateTop = 0; } tessellator.setBrightness(renderer.renderMinZ > 0.0D ? brightness : block.getMixedBrightnessForBlock(world, x, y, z - 1)); tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F); renderer.renderFaceZNeg(block, x, y, z, renderer.getBlockIcon(block, world, x, y, z, 2)); renderer.flipTexture = false; tessellator.setBrightness(renderer.renderMaxZ < 1.0D ? brightness : block.getMixedBrightnessForBlock(world, x, y, z + 1)); tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F); renderer.renderFaceZPos(block, x, y, z, renderer.getBlockIcon(block, world, x, y, z, 3)); renderer.flipTexture = false; tessellator.setBrightness(renderer.renderMinX > 0.0D ? brightness : block.getMixedBrightnessForBlock(world, x - 1, y, z)); tessellator.setColorOpaque_F(0.6F, 0.6F, 0.6F); renderer.renderFaceXNeg(block, x, y, z, renderer.getBlockIcon(block, world, x, y, z, 4)); renderer.flipTexture = false; tessellator.setBrightness(renderer.renderMaxX < 1.0D ? brightness : block.getMixedBrightnessForBlock(world, x + 1, y, z)); tessellator.setColorOpaque_F(0.6F, 0.6F, 0.6F); renderer.renderFaceXPos(block, x, y, z, renderer.getBlockIcon(block, world, x, y, z, 5)); renderer.flipTexture = false; return true; }
Example 9
Source File: RenderHelperAO.java From GardenCollection with MIT License | 4 votes |
public void setupYNegAOPartial (IBlockAccess blockAccess, Block block, int x, int y, int z, float r, float g, float b) { Tessellator tessellator = Tessellator.instance; tessellator.setBrightness(983055); int yGrass = (state.renderMinY <= 0) ? y - 1 : y; boolean blocksGrassXYPN = !blockAccess.getBlock(x + 1, yGrass, z).getCanBlockGrass(); boolean blocksGrassXYNN = !blockAccess.getBlock(x - 1, yGrass, z).getCanBlockGrass(); boolean blocksGrassYZNP = !blockAccess.getBlock(x, yGrass, z + 1).getCanBlockGrass(); boolean blocksGrassYZNN = !blockAccess.getBlock(x, yGrass, z - 1).getCanBlockGrass(); if (state.renderMinY > 0) setupAOBrightnessYNeg(blockAccess, block, x, y, z, blocksGrassXYPN, blocksGrassXYNN, blocksGrassYZNP, blocksGrassYZNN); setupAOBrightnessYPos(blockAccess, block, x, y - 1, z, blocksGrassXYPN, blocksGrassXYNN, blocksGrassYZNP, blocksGrassYZNN); float yClamp = MathHelper.clamp_float((float) state.renderMinY, 0, 1); mixAOBrightnessLightValueY(yClamp, 1 - yClamp); int blockBrightness = block.getMixedBrightnessForBlock(blockAccess, x, y, z); if (state.renderMinY <= 0.0D || !blockAccess.getBlock(x, y - 1, z).isOpaqueCube()) blockBrightness = block.getMixedBrightnessForBlock(blockAccess, x, y - 1, z); float aoOpposingBlock = blockAccess.getBlock(x, y - 1, z).getAmbientOcclusionLightValue(); float aoXYZNNP = (aoLightValueScratchXYNI + aoLightValueScratchXYZNIP + aoOpposingBlock + aoLightValueScratchYZIP) / 4.0F; float aoXYZPNP = (aoOpposingBlock + aoLightValueScratchYZIP + aoLightValueScratchXYPI + aoLightValueScratchXYZPIP) / 4.0F; float aoXYZPNN = (aoLightValueScratchYZIN + aoOpposingBlock + aoLightValueScratchXYZPIN + aoLightValueScratchXYPI) / 4.0F; float aoXYZNNN = (aoLightValueScratchXYZNIN + aoLightValueScratchXYNI + aoLightValueScratchYZIN + aoOpposingBlock) / 4.0F; float aoTR = (float)((double)aoXYZNNP * state.renderMinX * (1.0D - state.renderMaxZ) + (double)aoXYZPNP * state.renderMinX * state.renderMaxZ + (double)aoXYZPNN * (1.0D - state.renderMinX) * state.renderMaxZ + (double)aoXYZNNN * (1.0D - state.renderMinX) * (1.0D - state.renderMaxZ)); float aoTL = (float)((double)aoXYZNNP * state.renderMinX * (1.0D - state.renderMinZ) + (double)aoXYZPNP * state.renderMinX * state.renderMinZ + (double)aoXYZPNN * (1.0D - state.renderMinX) * state.renderMinZ + (double)aoXYZNNN * (1.0D - state.renderMinX) * (1.0D - state.renderMinZ)); float aoBL = (float)((double)aoXYZNNP * state.renderMaxX * (1.0D - state.renderMinZ) + (double)aoXYZPNP * state.renderMaxX * state.renderMinZ + (double)aoXYZPNN * (1.0D - state.renderMaxX) * state.renderMinZ + (double)aoXYZNNN * (1.0D - state.renderMaxX) * (1.0D - state.renderMinZ)); float aoBR = (float)((double)aoXYZNNP * state.renderMaxX * (1.0D - state.renderMaxZ) + (double)aoXYZPNP * state.renderMaxX * state.renderMaxZ + (double)aoXYZPNN * (1.0D - state.renderMaxX) * state.renderMaxZ + (double)aoXYZNNN * (1.0D - state.renderMaxX) * (1.0D - state.renderMaxZ)); int brXYZNNP = getAOBrightness(aoBrightnessXYNI, aoBrightnessXYZNIP, aoBrightnessYZIP, blockBrightness); int brXYZPNP = getAOBrightness(aoBrightnessYZIP, aoBrightnessXYPI, aoBrightnessXYZPIP, blockBrightness); int brXYZPNN = getAOBrightness(aoBrightnessYZIN, aoBrightnessXYZPIN, aoBrightnessXYPI, blockBrightness); int brXYZNNN = getAOBrightness(aoBrightnessXYZNIN, aoBrightnessXYNI, aoBrightnessYZIN, blockBrightness); state.brightnessTopRight = mixAOBrightness(brXYZNNP, brXYZNNN, brXYZPNN, brXYZPNP, state.renderMaxX * (1.0D - state.renderMaxZ), (1.0D - state.renderMaxX) * (1.0D - state.renderMaxZ), (1.0D - state.renderMaxX) * state.renderMaxZ, state.renderMaxX * state.renderMaxZ); state.brightnessTopLeft = mixAOBrightness(brXYZNNP, brXYZNNN, brXYZPNN, brXYZPNP, state.renderMaxX * (1.0D - state.renderMinZ), (1.0D - state.renderMaxX) * (1.0D - state.renderMinZ), (1.0D - state.renderMaxX) * state.renderMinZ, state.renderMaxX * state.renderMinZ); state.brightnessBottomLeft = mixAOBrightness(brXYZNNP, brXYZNNN, brXYZPNN, brXYZPNP, state.renderMinX * (1.0D - state.renderMinZ), (1.0D - state.renderMinX) * (1.0D - state.renderMinZ), (1.0D - state.renderMinX) * state.renderMinZ, state.renderMinX * state.renderMinZ); state.brightnessBottomRight = mixAOBrightness(brXYZNNP, brXYZNNN, brXYZPNN, brXYZPNP, state.renderMinX * (1.0D - state.renderMaxZ), (1.0D - state.renderMinX) * (1.0D - state.renderMaxZ), (1.0D - state.renderMinX) * state.renderMaxZ, state.renderMinX * state.renderMaxZ); state.setColor(r * state.colorMultYNeg, g * state.colorMultYNeg, b * state.colorMultYNeg); state.scaleColor(state.colorTopLeft, aoTL); state.scaleColor(state.colorBottomLeft, aoBL); state.scaleColor(state.colorBottomRight, aoBR); state.scaleColor(state.colorTopRight, aoTR); }
Example 10
Source File: RenderHelperAO.java From GardenCollection with MIT License | 4 votes |
public void setupYPosAOPartial (IBlockAccess blockAccess, Block block, int x, int y, int z, float r, float g, float b) { Tessellator tessellator = Tessellator.instance; tessellator.setBrightness(983055); if (state.renderMaxY >= 1.0D) ++y; aoBrightnessXYNP = block.getMixedBrightnessForBlock(blockAccess, x - 1, y, z); aoBrightnessXYPP = block.getMixedBrightnessForBlock(blockAccess, x + 1, y, z); aoBrightnessYZPN = block.getMixedBrightnessForBlock(blockAccess, x, y, z - 1); aoBrightnessYZPP = block.getMixedBrightnessForBlock(blockAccess, x, y, z + 1); aoBrightnessXYZNPN = aoBrightnessXYNP; aoBrightnessXYZPPN = aoBrightnessXYPP; aoBrightnessXYZNPP = aoBrightnessXYNP; aoBrightnessXYZPPP = aoBrightnessXYPP; aoLightValueScratchXYNP = blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(); aoLightValueScratchXYPP = blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(); aoLightValueScratchYZPN = blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(); aoLightValueScratchYZPP = blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(); aoLightValueScratchXYZNPN = aoLightValueScratchXYNP; aoLightValueScratchXYZPPN = aoLightValueScratchXYPP; aoLightValueScratchXYZNPP = aoLightValueScratchXYNP; aoLightValueScratchXYZPPP = aoLightValueScratchXYPP; boolean blocksGrassXYPP = blockAccess.getBlock(x + 1, y + 1, z).getCanBlockGrass(); boolean blocksGrassXYNP = blockAccess.getBlock(x - 1, y + 1, z).getCanBlockGrass(); boolean blocksGrassYZPP = blockAccess.getBlock(x, y + 1, z + 1).getCanBlockGrass(); boolean blocksGrassYZPN = blockAccess.getBlock(x, y + 1, z - 1).getCanBlockGrass(); if (blocksGrassYZPN || blocksGrassXYNP) { aoLightValueScratchXYZNPN = blockAccess.getBlock(x - 1, y, z - 1).getAmbientOcclusionLightValue(); aoBrightnessXYZNPN = block.getMixedBrightnessForBlock(blockAccess, x - 1, y, z - 1); } if (blocksGrassYZPN || blocksGrassXYPP) { aoLightValueScratchXYZPPN = blockAccess.getBlock(x + 1, y, z - 1).getAmbientOcclusionLightValue(); aoBrightnessXYZPPN = block.getMixedBrightnessForBlock(blockAccess, x + 1, y, z - 1); } if (blocksGrassYZPP || blocksGrassXYNP) { aoLightValueScratchXYZNPP = blockAccess.getBlock(x - 1, y, z + 1).getAmbientOcclusionLightValue(); aoBrightnessXYZNPP = block.getMixedBrightnessForBlock(blockAccess, x - 1, y, z + 1); } if (blocksGrassYZPP || blocksGrassXYPP) { aoLightValueScratchXYZPPP = blockAccess.getBlock(x + 1, y, z + 1).getAmbientOcclusionLightValue(); aoBrightnessXYZPPP = block.getMixedBrightnessForBlock(blockAccess, x + 1, y, z + 1); } if (state.renderMaxY >= 1.0D) --y; int blockBrightness = block.getMixedBrightnessForBlock(blockAccess, x, y, z); if (state.renderMaxY >= 1.0D || !blockAccess.getBlock(x, y + 1, z).isOpaqueCube()) blockBrightness = block.getMixedBrightnessForBlock(blockAccess, x, y + 1, z); float aoOpposingBlock = blockAccess.getBlock(x, y + 1, z).getAmbientOcclusionLightValue(); float aoXYZNPN = (aoLightValueScratchXYZNPP + aoLightValueScratchXYNP + aoLightValueScratchYZPP + aoOpposingBlock) / 4.0F; // TR float aoXYZNPP = (aoLightValueScratchYZPP + aoOpposingBlock + aoLightValueScratchXYZPPP + aoLightValueScratchXYPP) / 4.0F; // TL float aoXYZPPP = (aoOpposingBlock + aoLightValueScratchYZPN + aoLightValueScratchXYPP + aoLightValueScratchXYZPPN) / 4.0F; // BL float aoXYZPPN = (aoLightValueScratchXYNP + aoLightValueScratchXYZNPN + aoOpposingBlock + aoLightValueScratchYZPN) / 4.0F; // BR float aoTL = (float)((double)aoXYZPPP * state.renderMaxX * (1.0D - state.renderMaxZ) + (double)aoXYZNPP * state.renderMaxX * state.renderMaxZ + (double)aoXYZNPN * (1.0D - state.renderMaxX) * state.renderMaxZ + (double)aoXYZPPN * (1.0D - state.renderMaxX) * (1.0D - state.renderMaxZ)); float aoBL = (float)((double)aoXYZPPP * state.renderMaxX * (1.0D - state.renderMinZ) + (double)aoXYZNPP * state.renderMaxX * state.renderMinZ + (double)aoXYZNPN * (1.0D - state.renderMaxX) * state.renderMinZ + (double)aoXYZPPN * (1.0D - state.renderMaxX) * (1.0D - state.renderMinZ)); float aoBR = (float)((double)aoXYZPPP * state.renderMinX * (1.0D - state.renderMinZ) + (double)aoXYZNPP * state.renderMinX * state.renderMinZ + (double)aoXYZNPN * (1.0D - state.renderMinX) * state.renderMinZ + (double)aoXYZPPN * (1.0D - state.renderMinX) * (1.0D - state.renderMinZ)); float aoTR = (float)((double)aoXYZPPP * state.renderMinX * (1.0D - state.renderMaxZ) + (double)aoXYZNPP * state.renderMinX * state.renderMaxZ + (double)aoXYZNPN * (1.0D - state.renderMinX) * state.renderMaxZ + (double)aoXYZPPN * (1.0D - state.renderMinX) * (1.0D - state.renderMaxZ)); int brXYZPPN = getAOBrightness(aoBrightnessXYNP, aoBrightnessXYZNPP, aoBrightnessYZPP, blockBrightness); int brXYZNPN = getAOBrightness(aoBrightnessYZPP, aoBrightnessXYPP, aoBrightnessXYZPPP, blockBrightness); int brXYZNPP = getAOBrightness(aoBrightnessYZPN, aoBrightnessXYZPPN, aoBrightnessXYPP, blockBrightness); int brXYZPPP = getAOBrightness(aoBrightnessXYZNPN, aoBrightnessXYNP, aoBrightnessYZPN, blockBrightness); state.brightnessTopLeft = mixAOBrightness(brXYZPPP, brXYZPPN, brXYZNPN, brXYZNPP, state.renderMaxZ, state.renderMaxX); state.brightnessBottomLeft = mixAOBrightness(brXYZPPP, brXYZPPN, brXYZNPN, brXYZNPP, state.renderMinZ, state.renderMaxX); state.brightnessBottomRight = mixAOBrightness(brXYZPPP, brXYZPPN, brXYZNPN, brXYZNPP, state.renderMinZ, state.renderMinX); state.brightnessTopRight = mixAOBrightness(brXYZPPP, brXYZPPN, brXYZNPN, brXYZNPP, state.renderMaxZ, state.renderMinX); state.setColor(r * state.colorMultYPos, g * state.colorMultYPos, b * state.colorMultYPos); state.scaleColor(state.colorTopLeft, aoTL); state.scaleColor(state.colorBottomLeft, aoBL); state.scaleColor(state.colorBottomRight, aoBR); state.scaleColor(state.colorTopRight, aoTR); }
Example 11
Source File: RenderHelperAO.java From GardenCollection with MIT License | 4 votes |
public void setupZNegAOPartial (IBlockAccess blockAccess, Block block, int x, int y, int z, float r, float g, float b) { Tessellator tessellator = Tessellator.instance; tessellator.setBrightness(983055); int zGrass = (state.renderMinZ <= 0) ? z - 1 : z; boolean blocksGrassXZPN = !blockAccess.getBlock(x + 1, y, zGrass).getCanBlockGrass(); boolean blocksGrassXZNN = !blockAccess.getBlock(x - 1, y, zGrass).getCanBlockGrass(); boolean blocksGrassYZPN = !blockAccess.getBlock(x, y + 1, zGrass).getCanBlockGrass(); boolean blocksGrassYZNN = !blockAccess.getBlock(x, y - 1, zGrass).getCanBlockGrass(); if (state.renderMinZ > 0) setupAOBrightnessZNeg(blockAccess, block, x, y, z, blocksGrassXZPN, blocksGrassXZNN, blocksGrassYZPN, blocksGrassYZNN); setupAOBrightnessZPos(blockAccess, block, x, y, z - 1, blocksGrassXZPN, blocksGrassXZNN, blocksGrassYZPN, blocksGrassYZNN); float zClamp = MathHelper.clamp_float((float) state.renderMinZ, 0, 1); mixAOBrightnessLightValueZ(zClamp, 1 - zClamp); int blockBrightness = block.getMixedBrightnessForBlock(blockAccess, x, y, z); if (state.renderMinZ <= 0.0D || !blockAccess.getBlock(x, y, z - 1).isOpaqueCube()) blockBrightness = block.getMixedBrightnessForBlock(blockAccess, x, y, z - 1); float aoOpposingBlock = blockAccess.getBlock(x, y, z - 1).getAmbientOcclusionLightValue(); float aoXYZNPN = (aoLightValueScratchXZNI + aoLightValueScratchXYZNPI + aoOpposingBlock + aoLightValueScratchYZPI) / 4.0F; float aoXYZPPN = (aoOpposingBlock + aoLightValueScratchYZPI + aoLightValueScratchXZPI + aoLightValueScratchXYZPPI) / 4.0F; float aoXYZPNN = (aoLightValueScratchYZNI + aoOpposingBlock + aoLightValueScratchXYZPNI + aoLightValueScratchXZPI) / 4.0F; float aoXYZNNN = (aoLightValueScratchXYZNNI + aoLightValueScratchXZNI + aoLightValueScratchYZNI + aoOpposingBlock) / 4.0F; float aoTL = (float)((double)aoXYZNPN * state.renderMaxY * (1.0D - state.renderMinX) + (double)aoXYZPPN * state.renderMaxY * state.renderMinX + (double)aoXYZPNN * (1.0D - state.renderMaxY) * state.renderMinX + (double)aoXYZNNN * (1.0D - state.renderMaxY) * (1.0D - state.renderMinX)); float aoBL = (float)((double)aoXYZNPN * state.renderMaxY * (1.0D - state.renderMaxX) + (double)aoXYZPPN * state.renderMaxY * state.renderMaxX + (double)aoXYZPNN * (1.0D - state.renderMaxY) * state.renderMaxX + (double)aoXYZNNN * (1.0D - state.renderMaxY) * (1.0D - state.renderMaxX)); float aoBR = (float)((double)aoXYZNPN * state.renderMinY * (1.0D - state.renderMaxX) + (double)aoXYZPPN * state.renderMinY * state.renderMaxX + (double)aoXYZPNN * (1.0D - state.renderMinY) * state.renderMaxX + (double)aoXYZNNN * (1.0D - state.renderMinY) * (1.0D - state.renderMaxX)); float aoTR = (float)((double)aoXYZNPN * state.renderMinY * (1.0D - state.renderMinX) + (double)aoXYZPPN * state.renderMinY * state.renderMinX + (double)aoXYZPNN * (1.0D - state.renderMinY) * state.renderMinX + (double)aoXYZNNN * (1.0D - state.renderMinY) * (1.0D - state.renderMinX)); int brXYZNPN = getAOBrightness(aoBrightnessXZNI, aoBrightnessXYZNPI, aoBrightnessYZPI, blockBrightness); int brXYZPPN = getAOBrightness(aoBrightnessYZPI, aoBrightnessXZPI, aoBrightnessXYZPPI, blockBrightness); int brXYZPNN = getAOBrightness(aoBrightnessYZNI, aoBrightnessXYZPNI, aoBrightnessXZPI, blockBrightness); int brXYZNNN = getAOBrightness(aoBrightnessXYZNNI, aoBrightnessXZNI, aoBrightnessYZNI, blockBrightness); state.brightnessTopLeft = mixAOBrightness(brXYZNPN, brXYZPPN, brXYZPNN, brXYZNNN, state.renderMaxY * (1.0D - state.renderMinX), state.renderMaxY * state.renderMinX, (1.0D - state.renderMaxY) * state.renderMinX, (1.0D - state.renderMaxY) * (1.0D - state.renderMinX)); state.brightnessBottomLeft = mixAOBrightness(brXYZNPN, brXYZPPN, brXYZPNN, brXYZNNN, state.renderMaxY * (1.0D - state.renderMaxX), state.renderMaxY * state.renderMaxX, (1.0D - state.renderMaxY) * state.renderMaxX, (1.0D - state.renderMaxY) * (1.0D - state.renderMaxX)); state.brightnessBottomRight = mixAOBrightness(brXYZNPN, brXYZPPN, brXYZPNN, brXYZNNN, state.renderMinY * (1.0D - state.renderMaxX), state.renderMinY * state.renderMaxX, (1.0D - state.renderMinY) * state.renderMaxX, (1.0D - state.renderMinY) * (1.0D - state.renderMaxX)); state.brightnessTopRight = mixAOBrightness(brXYZNPN, brXYZPPN, brXYZPNN, brXYZNNN, state.renderMinY * (1.0D - state.renderMinX), state.renderMinY * state.renderMinX, (1.0D - state.renderMinY) * state.renderMinX, (1.0D - state.renderMinY) * (1.0D - state.renderMinX)); state.setColor(r * state.colorMultZNeg, g * state.colorMultZNeg, b * state.colorMultZNeg); state.scaleColor(state.colorTopLeft, aoTL); state.scaleColor(state.colorBottomLeft, aoBL); state.scaleColor(state.colorBottomRight, aoBR); state.scaleColor(state.colorTopRight, aoTR); }
Example 12
Source File: RenderHelperAO.java From GardenCollection with MIT License | 4 votes |
public void setupZPosAOPartial (IBlockAccess blockAccess, Block block, int x, int y, int z, float r, float g, float b) { Tessellator tessellator = Tessellator.instance; tessellator.setBrightness(983055); int zGrass = (state.renderMaxZ >= 1) ? z + 1 : z; boolean blocksGrassXZPP = !blockAccess.getBlock(x + 1, y, zGrass).getCanBlockGrass(); boolean blocksGrassXZNP = !blockAccess.getBlock(x - 1, y, zGrass).getCanBlockGrass(); boolean blocksGrassYZPP = !blockAccess.getBlock(x, y + 1, zGrass).getCanBlockGrass(); boolean blocksGrassYZNP = !blockAccess.getBlock(x, y - 1, zGrass).getCanBlockGrass(); if (state.renderMaxZ < 1) setupAOBrightnessZPos(blockAccess, block, x, y, z, blocksGrassXZPP, blocksGrassXZNP, blocksGrassYZPP, blocksGrassYZNP); setupAOBrightnessZNeg(blockAccess, block, x, y, z + 1, blocksGrassXZPP, blocksGrassXZNP, blocksGrassYZPP, blocksGrassYZNP); float zClamp = MathHelper.clamp_float((float) state.renderMaxZ, 0, 1); mixAOBrightnessLightValueZ(zClamp, 1 - zClamp); int blockBrightness = block.getMixedBrightnessForBlock(blockAccess, x, y, z); if (state.renderMaxZ >= 1.0D || !blockAccess.getBlock(x, y, z + 1).isOpaqueCube()) blockBrightness = block.getMixedBrightnessForBlock(blockAccess, x, y, z + 1); float aoOpposingBlock = blockAccess.getBlock(x, y, z + 1).getAmbientOcclusionLightValue(); float aoXYZNPP = (aoLightValueScratchXZNI + aoLightValueScratchXYZNPI + aoOpposingBlock + aoLightValueScratchYZPI) / 4.0F; float aoXYZPPP = (aoOpposingBlock + aoLightValueScratchYZPI + aoLightValueScratchXZPI + aoLightValueScratchXYZPPI) / 4.0F; float aoXYZPNP = (aoLightValueScratchYZNI + aoOpposingBlock + aoLightValueScratchXYZPNI + aoLightValueScratchXZPI) / 4.0F; float aoXYZNNP = (aoLightValueScratchXYZNNI + aoLightValueScratchXZNI + aoLightValueScratchYZNI + aoOpposingBlock) / 4.0F; float aoTL = (float)((double)aoXYZNPP * state.renderMaxY * (1.0D - state.renderMinX) + (double)aoXYZPPP * state.renderMaxY * state.renderMinX + (double)aoXYZPNP * (1.0D - state.renderMaxY) * state.renderMinX + (double)aoXYZNNP * (1.0D - state.renderMaxY) * (1.0D - state.renderMinX)); float aoBL = (float)((double)aoXYZNPP * state.renderMinY * (1.0D - state.renderMinX) + (double)aoXYZPPP * state.renderMinY * state.renderMinX + (double)aoXYZPNP * (1.0D - state.renderMinY) * state.renderMinX + (double)aoXYZNNP * (1.0D - state.renderMinY) * (1.0D - state.renderMinX)); float aoBR = (float)((double)aoXYZNPP * state.renderMinY * (1.0D - state.renderMaxX) + (double)aoXYZPPP * state.renderMinY * state.renderMaxX + (double)aoXYZPNP * (1.0D - state.renderMinY) * state.renderMaxX + (double)aoXYZNNP * (1.0D - state.renderMinY) * (1.0D - state.renderMaxX)); float aoTR = (float)((double)aoXYZNPP * state.renderMaxY * (1.0D - state.renderMaxX) + (double)aoXYZPPP * state.renderMaxY * state.renderMaxX + (double)aoXYZPNP * (1.0D - state.renderMaxY) * state.renderMaxX + (double)aoXYZNNP * (1.0D - state.renderMaxY) * (1.0D - state.renderMaxX)); int brXYZNPP = getAOBrightness(aoBrightnessXZNI, aoBrightnessXYZNPI, aoBrightnessYZPI, blockBrightness); int brXYZPPP = getAOBrightness(aoBrightnessYZPI, aoBrightnessXZPI, aoBrightnessXYZPPI, blockBrightness); int brXYZPNP = getAOBrightness(aoBrightnessYZNI, aoBrightnessXYZPNI, aoBrightnessXZPI, blockBrightness); int brXYZNNP = getAOBrightness(aoBrightnessXYZNNI, aoBrightnessXZNI, aoBrightnessYZNI, blockBrightness); state.brightnessTopLeft = mixAOBrightness(brXYZNPP, brXYZNNP, brXYZPNP, brXYZPPP, state.renderMaxY * (1.0D - state.renderMinX), (1.0D - state.renderMaxY) * (1.0D - state.renderMinX), (1.0D - state.renderMaxY) * state.renderMinX, state.renderMaxY * state.renderMinX); state.brightnessBottomLeft = mixAOBrightness(brXYZNPP, brXYZNNP, brXYZPNP, brXYZPPP, state.renderMinY * (1.0D - state.renderMinX), (1.0D - state.renderMinY) * (1.0D - state.renderMinX), (1.0D - state.renderMinY) * state.renderMinX, state.renderMinY * state.renderMinX); state.brightnessBottomRight = mixAOBrightness(brXYZNPP, brXYZNNP, brXYZPNP, brXYZPPP, state.renderMinY * (1.0D - state.renderMaxX), (1.0D - state.renderMinY) * (1.0D - state.renderMaxX), (1.0D - state.renderMinY) * state.renderMaxX, state.renderMinY * state.renderMaxX); state.brightnessTopRight = mixAOBrightness(brXYZNPP, brXYZNNP, brXYZPNP, brXYZPPP, state.renderMaxY * (1.0D - state.renderMaxX), (1.0D - state.renderMaxY) * (1.0D - state.renderMaxX), (1.0D - state.renderMaxY) * state.renderMaxX, state.renderMaxY * state.renderMaxX); state.setColor(r * state.colorMultZPos, g * state.colorMultZPos, b * state.colorMultZPos); state.scaleColor(state.colorTopLeft, aoTL); state.scaleColor(state.colorBottomLeft, aoBL); state.scaleColor(state.colorBottomRight, aoBR); state.scaleColor(state.colorTopRight, aoTR); }
Example 13
Source File: RenderHelperAO.java From GardenCollection with MIT License | 4 votes |
public void setupXNegAOPartial (IBlockAccess blockAccess, Block block, int x, int y, int z, float r, float g, float b) { Tessellator tessellator = Tessellator.instance; tessellator.setBrightness(983055); int xGrass = (state.renderMinX <= 0) ? x - 1 : x; boolean blocksGrassXYNP = !blockAccess.getBlock(xGrass, y + 1, z).getCanBlockGrass(); boolean blocksGrassXYNN = !blockAccess.getBlock(xGrass, y - 1, z).getCanBlockGrass(); boolean blocksGrassXZNN = !blockAccess.getBlock(xGrass, y, z - 1).getCanBlockGrass(); boolean blocksGrassXZNP = !blockAccess.getBlock(xGrass, y, z + 1).getCanBlockGrass(); if (state.renderMinX > 0) setupAOBrightnessXNeg(blockAccess, block, x, y, z, blocksGrassXYNP, blocksGrassXYNN, blocksGrassXZNN, blocksGrassXZNP); setupAOBrightnessXPos(blockAccess, block, x - 1, y, z, blocksGrassXYNP, blocksGrassXYNN, blocksGrassXZNN, blocksGrassXZNP); float xClamp = MathHelper.clamp_float((float) state.renderMinX, 0, 1); mixAOBrightnessLightValueX(xClamp, 1 - xClamp); int blockBrightness = block.getMixedBrightnessForBlock(blockAccess, x, y, z); if (state.renderMinX <= 0.0D || !blockAccess.getBlock(x - 1, y, z).isOpaqueCube()) blockBrightness = block.getMixedBrightnessForBlock(blockAccess, x - 1, y, z); float aoOpposingBlock = blockAccess.getBlock(x - 1, y, z).getAmbientOcclusionLightValue(); float aoXYZNNP = (aoLightValueScratchXYIN + aoLightValueScratchXYZINP + aoOpposingBlock + aoLightValueScratchXZIP) / 4.0F; float aoXYZNPP = (aoOpposingBlock + aoLightValueScratchXZIP + aoLightValueScratchXYIP + aoLightValueScratchXYZIPP) / 4.0F; float aoXYZNPN = (aoLightValueScratchXZIN + aoOpposingBlock + aoLightValueScratchXYZIPN + aoLightValueScratchXYIP) / 4.0F; float aoXYZNNN = (aoLightValueScratchXYZINN + aoLightValueScratchXYIN + aoLightValueScratchXZIN + aoOpposingBlock) / 4.0F; float aoTL = (float)((double)aoXYZNPP * state.renderMaxY * state.renderMaxZ + (double)aoXYZNPN * state.renderMaxY * (1.0D - state.renderMaxZ) + (double)aoXYZNNN * (1.0D - state.renderMaxY) * (1.0D - state.renderMaxZ) + (double)aoXYZNNP * (1.0D - state.renderMaxY) * state.renderMaxZ); float aoBL = (float)((double)aoXYZNPP * state.renderMaxY * state.renderMinZ + (double)aoXYZNPN * state.renderMaxY * (1.0D - state.renderMinZ) + (double)aoXYZNNN * (1.0D - state.renderMaxY) * (1.0D - state.renderMinZ) + (double)aoXYZNNP * (1.0D - state.renderMaxY) * state.renderMinZ); float aoBR = (float)((double)aoXYZNPP * state.renderMinY * state.renderMinZ + (double)aoXYZNPN * state.renderMinY * (1.0D - state.renderMinZ) + (double)aoXYZNNN * (1.0D - state.renderMinY) * (1.0D - state.renderMinZ) + (double)aoXYZNNP * (1.0D - state.renderMinY) * state.renderMinZ); float aoTR = (float)((double)aoXYZNPP * state.renderMinY * state.renderMaxZ + (double)aoXYZNPN * state.renderMinY * (1.0D - state.renderMaxZ) + (double)aoXYZNNN * (1.0D - state.renderMinY) * (1.0D - state.renderMaxZ) + (double)aoXYZNNP * (1.0D - state.renderMinY) * state.renderMaxZ); int brXYZNNP = getAOBrightness(aoBrightnessXYIN, aoBrightnessXYZINP, aoBrightnessXZIP, blockBrightness); int brXYZNPP = getAOBrightness(aoBrightnessXZIP, aoBrightnessXYIP, aoBrightnessXYZIPP, blockBrightness); int brXYZNPN = getAOBrightness(aoBrightnessXZIN, aoBrightnessXYZIPN, aoBrightnessXYIP, blockBrightness); int brXYZNNN = getAOBrightness(aoBrightnessXYZINN, aoBrightnessXYIN, aoBrightnessXZIN, blockBrightness); state.brightnessTopLeft = mixAOBrightness(brXYZNPP, brXYZNPN, brXYZNNN, brXYZNNP, state.renderMaxY * state.renderMaxZ, state.renderMaxY * (1.0D - state.renderMaxZ), (1.0D - state.renderMaxY) * (1.0D - state.renderMaxZ), (1.0D - state.renderMaxY) * state.renderMaxZ); state.brightnessBottomLeft = mixAOBrightness(brXYZNPP, brXYZNPN, brXYZNNN, brXYZNNP, state.renderMaxY * state.renderMinZ, state.renderMaxY * (1.0D - state.renderMinZ), (1.0D - state.renderMaxY) * (1.0D - state.renderMinZ), (1.0D - state.renderMaxY) * state.renderMinZ); state.brightnessBottomRight = mixAOBrightness(brXYZNPP, brXYZNPN, brXYZNNN, brXYZNNP, state.renderMinY * state.renderMinZ, state.renderMinY * (1.0D - state.renderMinZ), (1.0D - state.renderMinY) * (1.0D - state.renderMinZ), (1.0D - state.renderMinY) * state.renderMinZ); state.brightnessTopRight = mixAOBrightness(brXYZNPP, brXYZNPN, brXYZNNN, brXYZNNP, state.renderMinY * state.renderMaxZ, state.renderMinY * (1.0D - state.renderMaxZ), (1.0D - state.renderMinY) * (1.0D - state.renderMaxZ), (1.0D - state.renderMinY) * state.renderMaxZ); state.setColor(r * state.colorMultXNeg, g * state.colorMultXNeg, b * state.colorMultXNeg); state.scaleColor(state.colorTopLeft, aoTL); state.scaleColor(state.colorBottomLeft, aoBL); state.scaleColor(state.colorBottomRight, aoBR); state.scaleColor(state.colorTopRight, aoTR); }
Example 14
Source File: RenderHelperAO.java From GardenCollection with MIT License | 4 votes |
public void setupXPosAOPartial (IBlockAccess blockAccess, Block block, int x, int y, int z, float r, float g, float b) { Tessellator tessellator = Tessellator.instance; tessellator.setBrightness(983055); int xGrass = (state.renderMaxX >= 1) ? x + 1 : x; boolean blocksGrassXYNP = !blockAccess.getBlock(xGrass, y + 1, z).getCanBlockGrass(); boolean blocksGrassXYNN = !blockAccess.getBlock(xGrass, y - 1, z).getCanBlockGrass(); boolean blocksGrassXZNN = !blockAccess.getBlock(xGrass, y, z - 1).getCanBlockGrass(); boolean blocksGrassXZNP = !blockAccess.getBlock(xGrass, y, z + 1).getCanBlockGrass(); if (state.renderMaxX < 1) setupAOBrightnessXPos(blockAccess, block, x, y, z, blocksGrassXYNP, blocksGrassXYNN, blocksGrassXZNN, blocksGrassXZNP); setupAOBrightnessXNeg(blockAccess, block, x + 1, y, z, blocksGrassXYNP, blocksGrassXYNN, blocksGrassXZNN, blocksGrassXZNP); float xClamp = MathHelper.clamp_float((float) state.renderMaxX, 0, 1); mixAOBrightnessLightValueX(xClamp, 1 - xClamp); int blockBrightness = block.getMixedBrightnessForBlock(blockAccess, x, y, z); if (state.renderMaxX >= 1.0D || !blockAccess.getBlock(x + 1, y, z).isOpaqueCube()) blockBrightness = block.getMixedBrightnessForBlock(blockAccess, x + 1, y, z); float aoOpposingBlock = blockAccess.getBlock(x + 1, y, z).getAmbientOcclusionLightValue(); float aoXYZPNP = (aoLightValueScratchXYIN + aoLightValueScratchXYZINP + aoOpposingBlock + aoLightValueScratchXZIP) / 4.0F; float aoXYZPNN = (aoLightValueScratchXYZINN + aoLightValueScratchXYIN + aoLightValueScratchXZIN + aoOpposingBlock) / 4.0F; float aoXYZPPN = (aoLightValueScratchXZIN + aoOpposingBlock + aoLightValueScratchXYZIPN + aoLightValueScratchXYIP) / 4.0F; float aoXYZPPP = (aoOpposingBlock + aoLightValueScratchXZIP + aoLightValueScratchXYIP + aoLightValueScratchXYZIPP) / 4.0F; float aoTL = (float)((double)aoXYZPNP * (1.0D - state.renderMinY) * state.renderMaxZ + (double)aoXYZPNN * (1.0D - state.renderMinY) * (1.0D - state.renderMaxZ) + (double)aoXYZPPN * state.renderMinY * (1.0D - state.renderMaxZ) + (double)aoXYZPPP * state.renderMinY * state.renderMaxZ); float aoBL = (float)((double)aoXYZPNP * (1.0D - state.renderMinY) * state.renderMinZ + (double)aoXYZPNN * (1.0D - state.renderMinY) * (1.0D - state.renderMinZ) + (double)aoXYZPPN * state.renderMinY * (1.0D - state.renderMinZ) + (double)aoXYZPPP * state.renderMinY * state.renderMinZ); float aoBR = (float)((double)aoXYZPNP * (1.0D - state.renderMaxY) * state.renderMinZ + (double)aoXYZPNN * (1.0D - state.renderMaxY) * (1.0D - state.renderMinZ) + (double)aoXYZPPN * state.renderMaxY * (1.0D - state.renderMinZ) + (double)aoXYZPPP * state.renderMaxY * state.renderMinZ); float aoTR = (float)((double)aoXYZPNP * (1.0D - state.renderMaxY) * state.renderMaxZ + (double)aoXYZPNN * (1.0D - state.renderMaxY) * (1.0D - state.renderMaxZ) + (double)aoXYZPPN * state.renderMaxY * (1.0D - state.renderMaxZ) + (double)aoXYZPPP * state.renderMaxY * state.renderMaxZ); int brXYZPNP = getAOBrightness(aoBrightnessXYIN, aoBrightnessXYZINP, aoBrightnessXZIP, blockBrightness); int brXYZPNN = getAOBrightness(aoBrightnessXZIP, aoBrightnessXYIP, aoBrightnessXYZIPP, blockBrightness); int brXYZPPN = getAOBrightness(aoBrightnessXZIN, aoBrightnessXYZIPN, aoBrightnessXYIP, blockBrightness); int brXYZPPP = getAOBrightness(aoBrightnessXYZINN, aoBrightnessXYIN, aoBrightnessXZIN, blockBrightness); state.brightnessTopLeft = mixAOBrightness(brXYZPNP, brXYZPPP, brXYZPPN, brXYZPNN, (1.0D - state.renderMinY) * state.renderMaxZ, (1.0D - state.renderMinY) * (1.0D - state.renderMaxZ), state.renderMinY * (1.0D - state.renderMaxZ), state.renderMinY * state.renderMaxZ); state.brightnessBottomLeft = mixAOBrightness(brXYZPNP, brXYZPPP, brXYZPPN, brXYZPNN, (1.0D - state.renderMinY) * state.renderMinZ, (1.0D - state.renderMinY) * (1.0D - state.renderMinZ), state.renderMinY * (1.0D - state.renderMinZ), state.renderMinY * state.renderMinZ); state.brightnessBottomRight = mixAOBrightness(brXYZPNP, brXYZPPP, brXYZPPN, brXYZPNN, (1.0D - state.renderMaxY) * state.renderMinZ, (1.0D - state.renderMaxY) * (1.0D - state.renderMinZ), state.renderMaxY * (1.0D - state.renderMinZ), state.renderMaxY * state.renderMinZ); state.brightnessTopRight = mixAOBrightness(brXYZPNP, brXYZPPP, brXYZPPN, brXYZPNN, (1.0D - state.renderMaxY) * state.renderMaxZ, (1.0D - state.renderMaxY) * (1.0D - state.renderMaxZ), state.renderMaxY * (1.0D - state.renderMaxZ), state.renderMaxY * state.renderMaxZ); state.setColor(r * state.colorMultXPos, g * state.colorMultXPos, b * state.colorMultXPos); state.scaleColor(state.colorTopLeft, aoTL); state.scaleColor(state.colorBottomLeft, aoBL); state.scaleColor(state.colorBottomRight, aoBR); state.scaleColor(state.colorTopRight, aoTR); }