Java Code Examples for codechicken.lib.render.CCRenderState#setBrightness()
The following examples show how to use
codechicken.lib.render.CCRenderState#setBrightness() .
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: InvPipeRenderer.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
@Override public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, BufferBuilder buffer) { CCRenderState renderState = CCRenderState.instance(); renderState.reset(); renderState.bind(buffer); renderState.setBrightness(world, pos); IVertexOperation[] pipeline = {new Translation(pos)}; BlockInventoryPipe block = (BlockInventoryPipe) state.getBlock(); TileEntityInventoryPipe tileEntity = (TileEntityInventoryPipe) block.getPipeTileEntity(world, pos); if (tileEntity == null) { return false; } int paintingColor = tileEntity.getInsulationColor(); int connectedSidesMask = block.getActualConnections(tileEntity, world); BlockRenderLayer renderLayer = MinecraftForgeClient.getRenderLayer(); if (renderLayer == BlockRenderLayer.SOLID) { renderPipe(renderState, pipeline, paintingColor, connectedSidesMask); } ICoverable coverable = tileEntity.getCoverableImplementation(); coverable.renderCovers(renderState, new Matrix4().translate(pos.getX(), pos.getY(), pos.getZ()), renderLayer); return true; }
Example 2
Source File: CableRenderer.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
@Override public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, BufferBuilder buffer) { CCRenderState renderState = CCRenderState.instance(); renderState.reset(); renderState.bind(buffer); renderState.setBrightness(world, pos); IVertexOperation[] pipeline = {new Translation(pos)}; BlockCable blockCable = (BlockCable) state.getBlock(); TileEntityCable tileEntityCable = (TileEntityCable) blockCable.getPipeTileEntity(world, pos); if (tileEntityCable == null) return false; int paintingColor = tileEntityCable.getInsulationColor(); int connectedSidesMask = blockCable.getActualConnections(tileEntityCable, world); Insulation insulation = tileEntityCable.getPipeType(); Material material = tileEntityCable.getPipeMaterial(); if (insulation != null && material != null) { BlockRenderLayer renderLayer = MinecraftForgeClient.getRenderLayer(); if (renderLayer == BlockRenderLayer.CUTOUT) { renderCableBlock(material, insulation, paintingColor, renderState, pipeline, connectedSidesMask); } ICoverable coverable = tileEntityCable.getCoverableImplementation(); coverable.renderCovers(renderState, new Matrix4().translate(pos.getX(), pos.getY(), pos.getZ()), renderLayer); } return true; }
Example 3
Source File: StoneRenderer.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
@Override public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, BufferBuilder buffer) { //otherwise, we are in solid rendering layer and render primary stone CCRenderState renderState = CCRenderState.instance(); renderState.reset(); renderState.bind(buffer); Matrix4 translation = new Matrix4(); translation.translate(pos.getX(), pos.getY(), pos.getZ()); TextureAtlasSprite stoneSprite = TextureUtils.getBlockTexture("stone"); Material material = ((BlockSurfaceRock) state.getBlock()).getStoneMaterial(world, pos, state); int renderingColor = GTUtility.convertRGBtoOpaqueRGBA_CL(material.materialRGB); IVertexOperation[] operations = new IVertexOperation[] { new IconTransformation(stoneSprite), new ColourMultiplier(renderingColor), new TransformationList(translation)}; if (world != null) { renderState.setBrightness(world, pos); } renderState.setPipeline(operations); CCModel actualModel = getActualModel(world, pos); renderState.setModel(actualModel); renderState.render(); return true; }
Example 4
Source File: MetaTileEntityTESR.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void renderTileEntityFast(MetaTileEntityHolder te, double x, double y, double z, float partialTicks, int destroyStage, float partial, BufferBuilder buffer) { MetaTileEntity metaTileEntity = te.getMetaTileEntity(); if (metaTileEntity instanceof IFastRenderMetaTileEntity) { CCRenderState renderState = CCRenderState.instance(); renderState.reset(); renderState.bind(buffer); renderState.setBrightness(te.getWorld(), te.getPos()); Matrix4 translation = new Matrix4().translate(x, y, z); ((IFastRenderMetaTileEntity) metaTileEntity).renderMetaTileEntityFast(renderState, translation, partialTicks); } }
Example 5
Source File: FluidPipeRenderer.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, BufferBuilder buffer) { CCRenderState renderState = CCRenderState.instance(); renderState.reset(); renderState.bind(buffer); renderState.setBrightness(world, pos); BlockFluidPipe blockPipe = ((BlockFluidPipe) state.getBlock()); TileEntityFluidPipe tileEntityPipe = (TileEntityFluidPipe) blockPipe.getPipeTileEntity(world, pos); if (tileEntityPipe == null) { return false; } FluidPipeType fluidPipeType = tileEntityPipe.getPipeType(); Material pipeMaterial = tileEntityPipe.getPipeMaterial(); int paintingColor = tileEntityPipe.getInsulationColor(); if (fluidPipeType != null && pipeMaterial != null) { BlockRenderLayer renderLayer = MinecraftForgeClient.getRenderLayer(); if (renderLayer == BlockRenderLayer.CUTOUT) { int connectedSidesMask = blockPipe.getActualConnections(tileEntityPipe, world); IVertexOperation[] pipeline = new IVertexOperation[] {new Translation(pos)}; renderPipeBlock(pipeMaterial, fluidPipeType, paintingColor, renderState, pipeline, connectedSidesMask); } ICoverable coverable = tileEntityPipe.getCoverableImplementation(); coverable.renderCovers(renderState, new Matrix4().translate(pos.getX(), pos.getY(), pos.getZ()), renderLayer); } return true; }
Example 6
Source File: TileEntityRendererBase.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, float partial, BufferBuilder buffer) { CCRenderState renderState = CCRenderState.instance(); renderState.reset(); renderState.bind(buffer); if (te.getWorld() != null) { renderState.setBrightness(te.getWorld(), te.getPos()); } Matrix4 translation = new Matrix4().translate(x, y, z); draw(te, renderState, translation, partialTicks); }
Example 7
Source File: EnderChestRenderer.java From EnderStorage with MIT License | 5 votes |
public void renderTileEntityAt(TileEntity tile, double d, double d1, double d2, float f) { CCRenderState.reset(); CCRenderState.setBrightness(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord); CCRenderState.useNormals = true; TileEnderChest chest = (TileEnderChest) tile; renderChest(chest.rotation, chest.freq, !chest.owner.equals("global"), d, d1, d2, EnderStorageClientProxy.getTimeOffset(chest.xCoord, chest.yCoord, chest.zCoord), (float) chest.getRadianLidAngle(f)); }
Example 8
Source File: LightMatrix.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void operate() { LC lc = CCRenderState.lc; float[] a = ao(lc.side); float f = (a[0] * lc.fa + a[1] * lc.fb + a[2] * lc.fc + a[3] * lc.fd); int[] b = brightness(lc.side); CCRenderState.setColour(ColourRGBA.multiplyC(CCRenderState.colour, f)); CCRenderState.setBrightness((int) (b[0] * lc.fa + b[1] * lc.fb + b[2] * lc.fc + b[3] * lc.fd) & 0xFF00FF); }
Example 9
Source File: TileChunkLoaderRenderer.java From ChickenChunks with MIT License | 4 votes |
@Override public void renderTileEntityAt(TileEntity tile, double d, double d1, double d2, float f) { CCRenderState.reset(); CCRenderState.setBrightness(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord); double rot = ClientUtils.getRenderTime()*2; double height; double size; double updown = (ClientUtils.getRenderTime()%50) / 25F; updown = (float) Math.sin(updown*3.141593); updown *= 0.2; TileChunkLoaderBase chunkLoader = (TileChunkLoaderBase)tile; if(chunkLoader instanceof TileChunkLoader) { TileChunkLoader ctile = (TileChunkLoader)chunkLoader; rot /= Math.pow(ctile.radius, 0.2); height = 0.9; size = 0.08; } else if(chunkLoader instanceof TileSpotLoader) { height = 0.5; size = 0.05; } else return; RenderInfo renderInfo = chunkLoader.renderInfo; double active = (renderInfo.activationCounter)/20D; if(chunkLoader.active && renderInfo.activationCounter < 20) active += f/20D; else if(!chunkLoader.active && renderInfo.activationCounter > 0) active -= f/20D; if(renderInfo.showLasers) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); drawRays(d, d1, d2, rot, updown, tile.xCoord, tile.yCoord, tile.zCoord, chunkLoader.getChunks()); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_FOG); } rot = ClientUtils.getRenderTime()*active / 3F; Matrix4 pearlMat = CCModelLibrary.getRenderMatrix( new Vector3(d+0.5, d1+height+(updown + 0.3)*active, d2+0.5), new Rotation(rot, new Vector3(0, 1, 0)), size); GL11.glDisable(GL11.GL_LIGHTING); CCRenderState.changeTexture("chickenchunks:textures/hedronmap.png"); CCRenderState.startDrawing(4); CCModelLibrary.icosahedron4.render(pearlMat); CCRenderState.draw(); GL11.glEnable(GL11.GL_LIGHTING); }
Example 10
Source File: PlanarLightMatrix.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void operate() { super.operate(); CCRenderState.setBrightness(brightness(CCRenderState.side)); }
Example 11
Source File: SimpleBrightnessModel.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void operate() { CCRenderState.setBrightness(sample(CCRenderState.side)); }