List of usage examples for org.lwjgl.opengl GL11 glTranslated
public static native void glTranslated(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y, @NativeType("GLdouble") double z);
From source file:nedhyett.elementalcraft.block.energy.light.RenderArchangelLightWorld.java
License:Creative Commons License
@Override public void renderTileEntityAt(TileEntity t, double x, double y, double z, float var8) { if (t == null | !(t instanceof TileArchangelLight)) { return;//from w w w . j a v a2 s.co m } int meta = t.getWorldObj().getBlockMetadata(t.xCoord, t.yCoord, t.zCoord); TileArchangelLight ts = (TileArchangelLight) t; GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); GL11.glPushMatrix(); GL11.glRotatef(180F, 0, 0, 1); if (meta == 5) { GL11.glRotatef(-90F, 0, 0, 1); GL11.glTranslated(-1, -1, 0); } if (meta == 3) { GL11.glRotatef(-90, 90, 0, 1); GL11.glTranslatef(0, -1, 1); } if (meta == 4) { GL11.glRotatef(90, -90, 0, 1); GL11.glRotatef(90, 0, 0, 1); GL11.glTranslatef(0, -1, 1); } if (meta == 2) { GL11.glRotatef(90, 90, 0, 1); GL11.glTranslatef(0, -1, -1); } if (meta == 0) { GL11.glRotatef(180, 0, 0, 1); GL11.glTranslatef(0, -2, 0); } Minecraft.getMinecraft().renderEngine.bindTexture(texture); glEnable(32826); Utils.adjustLighting(t.getWorldObj(), t.xCoord, t.yCoord, t.zCoord, t.getWorldObj().getBlock(t.xCoord, t.yCoord, t.zCoord)); model.render(null, 0, 0, -0.1F, 0, 0, 0.0625F); glDisable(32826); GL11.glPopMatrix(); GL11.glPopMatrix(); }
From source file:net.awairo.mcmod.spawnchecker.presetmode.spawnervisualizer.MobSpawnerActivateAreaMarker.java
License:Minecraft Mod Public
@Override protected void render(MarkerModel model) { GL11.glPushMatrix();// ww w . ja v a 2s . c o m { GL11.glTranslated(posX - manager().viewerPosX, posY - manager().viewerPosY, posZ - manager().viewerPosZ); // ???????????????90?????? GL11.glRotatef(90, 1, 0, 0); // ? GL11.glRotatef((tickCounts + partialTicks) / 6, 0, 0, 1); model.render(); } GL11.glPopMatrix(); }
From source file:net.awairo.mcmod.spawnchecker.presetmode.spawnervisualizer.MobSpawnerPointMerker.java
License:Minecraft Mod Public
@Override protected void render(MarkerModel model) { GL11.glPushMatrix();/* ww w . j a v a 2 s . c om*/ { final double tick = inherent + tickCounts + partialTicks; final double tremor = Math.sin(tick * 0.06f) * 0.02; GL11.glTranslated(posX - manager().viewerPosX, posY - manager().viewerPosY + tremor, posZ - manager().viewerPosZ); setGLColor(argbColor); // ??? GL11.glRotatef(90, 1, 0, 0); // ???? GL11.glRotated(inherent + tick, 0, 0, 1); model.render(); } GL11.glPopMatrix(); }
From source file:net.cortexmodders.lyoko.client.render.vehicle.RenderVehicle.java
License:MIT License
public void doRenderVehicle(EntityVehicle parEntityVehicle, double x, double y, double z, float f, float f1) { GL11.glPushMatrix();//from www . j a v a 2 s .c o m { GL11.glDisable(GL11.GL_LIGHTING); // no idea what f1 is. the last value is like the length i think. // float hover = MathHelper.sin(f1 / 10.0F + // parEntityVehicle.hoverSpeed) * 0.1F + 0.06F; GL11.glTranslated(x, y - 1/* + hover */, z); this.renderModel(parEntityVehicle, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glEnable(GL11.GL_LIGHTING); } GL11.glPopMatrix(); }
From source file:net.lyonlancer5.mcmp.karasu.client.renderer.tileentity.TileEntityEndRodRenderer.java
License:Apache License
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) { GL11.glPushMatrix();/* w w w . j av a2 s. co m*/ GL11.glTranslated(x, y, z); colour(0xFFFFFF); bindTexture(TextureMap.locationBlocksTexture); ForgeDirection dir = ForgeDirection.getOrientation(tile.getBlockMetadata()); switch (dir) { case DOWN: GL11.glRotated(180, 1, 0, 0); GL11.glTranslated(0, -1, -1); break; case EAST: GL11.glRotated(270, 0, 0, 1); GL11.glTranslated(-1, 0, 0); break; case NORTH: GL11.glRotated(270, 1, 0, 0); GL11.glTranslated(0, -1, 0); break; case SOUTH: GL11.glRotated(90, 1, 0, 0); GL11.glTranslated(0, 0, -1); break; case WEST: GL11.glRotated(90, 0, 0, 1); GL11.glTranslated(0, -1, 0); break; default: break; } renderRod(renderer, tile.getBlockType(), tile.getBlockMetadata()); GL11.glPopMatrix(); }
From source file:net.malisis.blocks.renderer.VanishingBlockRenderer.java
License:Open Source License
private void renderVanishingTileEntity() { tileEntity = TileEntityUtils.getTileEntity(VanishingTileEntity.class, world, pos); if (tileEntity == null) return;//from www . jav a 2 s.co m // if (!tileEntity.blockDrawn/* || (!tileEntity.isInTransition() && !tileEntity.isVibrating())*/) // { // if (!tileEntity.isPowered() && tileEntity.getCopiedTileEntity() != null) // { // clean(); // TileEntityRendererDispatcher.instance.renderTileEntity(tileEntity.getCopiedTileEntity(), partialTick, 0); // } // if (tileEntity.blockDrawn) // return; // } enableBlending(); float fx = 0.0F; float fy = 0.0F; float fz = 0.0F; float scale = (float) (tileEntity.getDuration() - tileEntity.getTransitionTimer()) / tileEntity.getDuration(); boolean rendered = tileEntity.getCopiedState() != null; RenderParameters rp = new RenderParameters(); rp.useBlockBounds.set(false); rp.interpolateUV.set(false); // randomize position for vibrations if (tileEntity.isVibrating()) { rp.alpha.set(200); fx = rand.nextFloat() * 0.05F; fy = rand.nextFloat() * 0.05F; fz = rand.nextFloat() * 0.05F; if (rand.nextBoolean()) GL11.glTranslated(fx, fy, fz); else GL11.glRotatef(rand.nextInt(5), 1, 1, 1); } else if (tileEntity.isInTransition()) { int alpha = tileEntity.getCopiedState() != null ? 255 - (int) (scale * 255) : (int) (scale * 255); rp.alpha.set(alpha); cube.scale(scale - 0.001F); } else if (tileEntity.blockDrawn) return; if (tileEntity.getCopiedState() != null) { BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); wr.setVertexFormat(DefaultVertexFormats.BLOCK); try { boolean smbr = MalisisBlocksSettings.simpleMixedBlockRendering.get(); MalisisBlocksSettings.simpleMixedBlockRendering.set(true); BlockPos translate = BlockPosUtils.chunkPosition(pos); //GlStateManager.pushMatrix(); GlStateManager.translate(0.5F, 0.5F, 0.5F); GlStateManager.scale(scale, scale, scale); if (tileEntity.getCopiedState().getBlock().getRenderType() == MalisisCore.malisisRenderType) GlStateManager.translate(-translate.getX(), -translate.getY(), -translate.getZ()); else GlStateManager.translate(-pos.getX(), -pos.getY(), -pos.getZ()); GlStateManager.translate(-0.5F, -0.5F, -0.5F); GL11.glBlendFunc(GL11.GL_CONSTANT_ALPHA, GL11.GL_ONE_MINUS_CONSTANT_ALPHA); // GL11.glAlphaFunc(GL11.GL_GREATER, 1F); //GL14.glBlendColor(0, 0, 0, 1 - scale); //TODO: render underlying model with vanishing block texture // renderBlocks.overrideBlockTexture = block.getIcon(blockMetadata, 0); // rendered = renderBlocks.renderBlockByRenderType(tileEntity.copiedBlock, x, y, z); // renderBlocks.overrideBlockTexture = null; // next(); GL14.glBlendColor(0, 0, 0, scale); for (EnumWorldBlockLayer layer : EnumWorldBlockLayer.values()) { if (!tileEntity.getCopiedState().getBlock().canRenderInLayer(layer)) continue; ForgeHooksClient.setRenderLayer(layer); if (layer == EnumWorldBlockLayer.TRANSLUCENT) GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); if (tileEntity.getCopiedState().getBlock().getRenderType() == MalisisCore.malisisRenderType) blockRenderer.renderBlock(tileEntity.getCopiedState(), pos, ProxyAccess.get(world), wr); else { IBakedModel model = blockRenderer.getModelFromBlockState(tileEntity.getCopiedState(), ProxyAccess.get(world), pos); rendered |= blockRenderer.getBlockModelRenderer().renderModel(ProxyAccess.get(world), model, tileEntity.getCopiedState(), pos, wr, false); } next(); } if (!rendered) drawShape(cube, rp); //GlStateManager.popMatrix(); if (tileEntity.getCopiedTileEntity() != null) { clean(); TileEntityRendererDispatcher.instance.renderTileEntity(tileEntity.getCopiedTileEntity(), partialTick, 0); } MalisisBlocksSettings.simpleMixedBlockRendering.set(smbr); } catch (Exception e) { drawShape(cube, rp); } } else drawShape(cube, rp); }
From source file:net.malisis.core.renderer.MalisisRenderer.java
License:Open Source License
/** * Prepares the {@link Tessellator} and the GL states for the <b>renderType</b>. <b>data</b> is only used for TESR and IRWL.<br> * TESR and IRWL rendering are surrounded by glPushAttrib(GL_LIGHTING_BIT) and block texture sheet is bound. * * @param renderType the render type/*from w w w. j a v a2s. co m*/ * @param data the data */ public void prepare(RenderType renderType, double... data) { _initialize(); this.renderType = renderType; if (renderType == RenderType.ISBRH_WORLD) { tessellatorShift(); } else if (renderType == RenderType.ISBRH_INVENTORY) { GL11.glTranslatef(-0.5F, -0.5F, -0.5F); startDrawing(); } else if (renderType == RenderType.ITEM_INVENTORY) { GL11.glPushAttrib(GL11.GL_LIGHTING_BIT); startDrawing(); } else if (renderType == RenderType.TESR_WORLD) { GL11.glPushAttrib(GL11.GL_LIGHTING_BIT); RenderHelper.disableStandardItemLighting(); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glPushMatrix(); GL11.glTranslated(data[0], data[1], data[2]); bindTexture(TextureMap.locationBlocksTexture); startDrawing(); } else if (renderType == RenderType.WORLD_LAST) { GL11.glPushAttrib(GL11.GL_LIGHTING_BIT); RenderHelper.disableStandardItemLighting(); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glPushMatrix(); GL11.glTranslated(data[0], data[1], data[2]); bindTexture(TextureMap.locationBlocksTexture); startDrawing(); } }
From source file:net.malisis.demo.lavapool.LavaPoolRenderer.java
License:Open Source License
@Override public void render() { int a = 155;/*from ww w . j a v a2s .co m*/ enableBlending(); tileEntity = (LavaPoolTileEntity) super.tileEntity; block = (LavaPoolBlock) super.block; if (tileEntity.startAnim) { ar.setStartTime(); tileEntity.startAnim = false; rp.alpha.set(a); renderBlocks = new RenderBlocks(LavaPoolDemo.lavaPool.multiBlock); } AlphaTransform at = new AlphaTransform(a, 0).forTicks(40, 40); ar.animate(rp, at); rp.interpolateUV.set(false); for (BlockState state : block.multiBlock) { if (!state.matchesWorld(world)) { GL11.glPushMatrix(); GL11.glTranslated(0.5F, 0.5F, 0.5F); GL11.glTranslated(-x - 0.5F, -y - 0.5F, -z - 0.5F); GL11.glBlendFunc(GL11.GL_CONSTANT_ALPHA, GL11.GL_ONE_MINUS_CONSTANT_ALPHA); GL14.glBlendColor(0, 0, 0, rp.alpha.get() / 255F); renderBlocks.renderBlockByRenderType(state.getBlock(), state.getX(), state.getY(), state.getZ()); GL11.glPopMatrix(); } } }
From source file:net.malisis.doors.renderer.VanishingBlockRenderer.java
License:Open Source License
private void renderVanishingTileEntity() { VanishingTileEntity te = (VanishingTileEntity) this.tileEntity; if (!te.inTransition && !te.vibrating) { if (!te.powered && te.copiedTileEntity != null) { clean();/* w w w . j av a 2 s .c o m*/ TileEntityRendererDispatcher.instance.renderTileEntity(te.copiedTileEntity, partialTick); } return; } GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glAlphaFunc(GL11.GL_GREATER, 0); float fx = 0.0F; float fy = 0.0F; float fz = 0.0F; float scale = (float) (te.getDuration() - te.transitionTimer) / (float) te.getDuration(); boolean rendered = te.copiedBlock != null; RenderParameters rp = new RenderParameters(); rp.useBlockBounds.set(false); rp.interpolateUV.set(false); Shape shape = ShapePreset.Cube(); // randomize position for vibrations if (!te.inTransition && !te.powered) { rp.alpha.set(200); fx = rand.nextFloat() * 0.05F; fy = rand.nextFloat() * 0.05F; fz = rand.nextFloat() * 0.05F; if (rand.nextBoolean()) GL11.glTranslated(fx, fy, fz); else GL11.glRotatef(rand.nextInt(5), 1, 1, 1); } else { int alpha = te.copiedBlock != null ? 255 - (int) (scale * 255) : (int) (scale * 255); rp.alpha.set(alpha); shape.scale(scale - 0.001F); } if (te.copiedBlock != null) { RenderBlocks renderBlocks = new RenderBlocks(ProxyAccess.get(world)); renderBlocks.renderAllFaces = true; try { boolean smbr = MalisisDoorsSettings.simpleMixedBlockRendering.get(); MalisisDoorsSettings.simpleMixedBlockRendering.set(true); GL11.glPushMatrix(); GL11.glTranslated(0.5F, 0.5F, 0.5F); GL11.glScalef(scale, scale, scale); GL11.glTranslated(-x - 0.5F, -y - 0.5F, -z - 0.5F); GL11.glBlendFunc(GL11.GL_CONSTANT_ALPHA, GL11.GL_ONE_MINUS_CONSTANT_ALPHA); GL14.glBlendColor(0, 0, 0, 1 - scale); renderBlocks.overrideBlockTexture = block.getIcon(blockMetadata, 0); rendered = renderBlocks.renderBlockByRenderType(te.copiedBlock, x, y, z); renderBlocks.overrideBlockTexture = null; next(); if (te.copiedBlock.canRenderInPass(0)) { GL14.glBlendColor(0, 0, 0, scale); rendered |= renderBlocks.renderBlockByRenderType(te.copiedBlock, x, y, z); next(); } if (te.copiedBlock.canRenderInPass(1)) { GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); rendered |= renderBlocks.renderBlockByRenderType(te.copiedBlock, x, y, z); next(); } if (!rendered) drawShape(shape, rp); GL11.glPopMatrix(); if (te.copiedTileEntity != null) { clean(); TileEntityRendererDispatcher.instance.renderTileEntity(te.copiedTileEntity, partialTick); } MalisisDoorsSettings.simpleMixedBlockRendering.set(smbr); } catch (Exception e) { drawShape(shape, rp); } } else drawShape(shape, rp); }
From source file:net.maxiebyte.voxel.Main1.java
License:Open Source License
public void run() throws Exception { double rotation = 0; double x = 0; double y = 0; double z = -8; VoxelContext context = new VoxelContext(); new DefaultInit(context).init(); context.registerBlock(new BlockType("test:diamond", context).setColour(new GLColor(0, 0, 1, 0.8))); context.registerBlock(new BlockType("test:gold", context).setColour(new GLColor(0.8, 0.8, 0.8, 0.96))); Utils.initClient();/* ww w .j a va2 s.c om*/ World world = new DefaultWorld(context, Paths.get("target")); world.loadChunk(0, 0); new SphereGen(16, (sworld, sx, sy, sz) -> sworld.setBlockAt(sx, sy, sz, context.blockRegistry.getObject("default:stone"))).generate(world, 0, 20, 0, null); BlockType[] blocks = new BlockType[] { context.blockRegistry.getObject("default:stone"), context.blockRegistry.getObject("default:dirt"), context.blockRegistry.getObject("default:grass") }; for (int k = 0; k < 16 / 2; k++) { for (int i = k; i < 16 - k; i++) { for (int j = k; j < 16 - k; j++) { world.setBlockAt(i, k, j, blocks[k % blocks.length]); } } } for (int i = 3; i < 14; i++) { for (int j = 3; j < 14; j++) { world.setBlockAt(i, 3, j, context.blockRegistry.getObject("default:grass")); } } while (!Display.isCloseRequested()) { Keyboard.poll(); if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) { x += (double) 1 / 20; } if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) { x -= (double) 1 / 20; } if (Keyboard.isKeyDown(Keyboard.KEY_UP)) { y -= (double) 1 / 5; } if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) { y += (double) 1 / 5; } if (Keyboard.isKeyDown(Keyboard.KEY_A)) { z += (double) 1 / 20; } if (Keyboard.isKeyDown(Keyboard.KEY_Z)) { z -= (double) 1 / 20; } if (Keyboard.isKeyDown(Keyboard.KEY_0)) { rotation += (double) 1 / 2; } if (Keyboard.isKeyDown(Keyboard.KEY_1)) { rotation -= (double) 1 / 2; } context.clientLoopInnerStart(); GL11.glTranslated(x, y, z); GL11.glRotated(rotation, 0, 1, 0); context.renderWorld(world, (chunk) -> true); context.clientLoopInnerEnd(); } Utils.destroyClient(); }