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:buildcraft.core.render.RenderLaser.java
License:Minecraft Mod Public
private static void doRenderLaserLine(double len, int texId) { float lasti = 0; if (len - 1 > 0) { for (float i = 0; i <= len - 1; i += 1) { getBox(texId).render(1F / 16F); GL11.glTranslated(1, 0, 0); lasti = i;//from w w w . j a va2 s . c o m } lasti++; } GL11.glPushMatrix(); GL11.glScalef((float) len - lasti, 1, 1); getBox(texId).render(1F / 16F); GL11.glPopMatrix(); GL11.glTranslated((float) (len - lasti), 0, 0); }
From source file:buildcraft.core.render.RenderPathMarker.java
License:Minecraft Mod Public
@Override public void renderTileEntityAt(TilePathMarker marker, double x, double y, double z, float f, int arg) { if (marker != null) { GL11.glPushMatrix();//from w w w . j ava 2 s . co m GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glTranslated(x, y, z); GL11.glTranslated(-marker.getPos().getX(), -marker.getPos().getY(), -marker.getPos().getZ()); for (LaserData laser : marker.lasers) { if (laser != null) { GL11.glPushMatrix(); RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.worldObj, Minecraft.getMinecraft().renderEngine, laser, EntityLaser.LASER_BLUE); GL11.glPopMatrix(); } } GL11.glPopAttrib(); GL11.glPopMatrix(); } }
From source file:buildcraft.core.render.RenderRobot.java
License:Minecraft Mod Public
private void doRender(EntityRobot robot, double x, double y, double z, float f, float f1) { GL11.glPushMatrix();//from w ww. jav a 2 s.c o m GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslated(x, y, z); renderManager.renderEngine.bindTexture(robot.getTexture()); float factor = (float) (1.0 / 16.0); box.render(factor); if (robot.laser.isVisible) { robot.laser.head.x = robot.posX; robot.laser.head.y = robot.posY; robot.laser.head.z = robot.posZ; RenderLaser.doRenderLaser(renderManager.renderEngine, robot.laser, EntityLaser.LASER_TEXTURES[1]); } GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:buildcraft.core.render.RenderRobot.java
License:Minecraft Mod Public
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { if (RenderManager.instance == null || RenderManager.instance.renderEngine == null) { return;//from w ww .j a va2 s . c o m } RenderBlocks renderBlocks = (RenderBlocks) data[0]; GL11.glPushMatrix(); GL11.glDisable(GL11.GL_LIGHTING); // FIXME: Texture localisation should be factorized between items and // entities. if (item.getItem() == BuildCraftCore.robotBaseItem) { RenderManager.instance.renderEngine.bindTexture(TEXTURE_BASE); } else if (item.getItem() == BuildCraftCore.robotBuilderItem) { RenderManager.instance.renderEngine.bindTexture(TEXTURE_BUILDER); } else if (item.getItem() == BuildCraftCore.robotPickerItem) { RenderManager.instance.renderEngine.bindTexture(TEXTURE_PICKER); } float factor = (float) (1.0 / 16.0); if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { GL11.glTranslated(0.25F, 0.5F, 0); } box.render(1F / 16F); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:buildcraft.energy.render.RenderEnergyEmitter.java
License:Minecraft Mod Public
@Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) { TileEnergyEmitter emitter = (TileEnergyEmitter) tileentity; if (emitter != null) { GL11.glPushMatrix();/*www .ja v a 2 s . c o m*/ GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glTranslated(x, y, z); for (Target t : emitter.targets.values()) { GL11.glPushMatrix(); GL11.glTranslated(0.5F, 0.5F, 0.5F); RenderLaser.doRenderLaserWave(TileEntityRendererDispatcher.instance.field_147553_e, t.data, EntityLaser.LASER_TEXTURES[3]); GL11.glPopMatrix(); } //GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopAttrib(); GL11.glPopMatrix(); } }
From source file:buildcraft.factory.render.RenderHopper.java
License:Minecraft Mod Public
private void render(double x, double y, double z) { if (BuildCraftCore.render == RenderMode.NoDynamic) { return;/*from w w w .j a va2 s . c om*/ } GL11.glPushMatrix(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslated(x, y, z); bindTexture(HOPPER_TEXTURE); top.render((float) (1.0 / 16.0)); bottom.render((float) (1.0 / 16.0)); bindTexture(HOPPER_MIDDLE_TEXTURE); middle.render(Tessellator.instance, 1F / 16F); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:buildcraft.robotics.render.RenderRobot.java
License:Minecraft Mod Public
private void doRender(EntityRobot robot, double x, double y, double z, float partialTicks) { GL11.glPushMatrix();//from www. java 2 s . c o m GL11.glTranslated(x, y, z); float robotYaw = this.interpolateRotation(robot.prevRenderYawOffset, robot.renderYawOffset, partialTicks); GL11.glRotatef(-robotYaw, 0.0f, 1.0f, 0.0f); if (robot.getStackInSlot(0) != null) { GL11.glPushMatrix(); GL11.glTranslatef(-0.125F, 0, -0.125F); doRenderItem(robot.getStackInSlot(0)); GL11.glColor3f(1, 1, 1); GL11.glPopMatrix(); } if (robot.getStackInSlot(1) != null) { GL11.glPushMatrix(); GL11.glTranslatef(+0.125F, 0, -0.125F); doRenderItem(robot.getStackInSlot(1)); GL11.glColor3f(1, 1, 1); GL11.glPopMatrix(); } if (robot.getStackInSlot(2) != null) { GL11.glPushMatrix(); GL11.glTranslatef(+0.125F, 0, +0.125F); doRenderItem(robot.getStackInSlot(2)); GL11.glColor3f(1, 1, 1); GL11.glPopMatrix(); } if (robot.getStackInSlot(3) != null) { GL11.glPushMatrix(); GL11.glTranslatef(-0.125F, 0, +0.125F); doRenderItem(robot.getStackInSlot(3)); GL11.glColor3f(1, 1, 1); GL11.glPopMatrix(); } if (robot.itemInUse != null) { GL11.glPushMatrix(); GL11.glRotatef(robot.itemAngle2, 0, 0, 1); if (robot.itemActive) { long newDate = new Date().getTime(); robot.itemActiveStage = (robot.itemActiveStage + (newDate - robot.lastUpdateTime) / 10) % 45; GL11.glRotatef(robot.itemActiveStage, 0, 0, 1); robot.lastUpdateTime = newDate; } GL11.glTranslatef(-0.4F, 0, 0); GL11.glRotatef(-45F + 180F, 0, 1, 0); GL11.glScalef(0.8F, 0.8F, 0.8F); ItemStack itemstack1 = robot.itemInUse; if (itemstack1.getItem().requiresMultipleRenderPasses()) { for (int k = 0; k < itemstack1.getItem().getRenderPasses(itemstack1.getItemDamage()); ++k) { RenderUtils.setGLColorFromInt(itemstack1.getItem().getColorFromItemStack(itemstack1, k)); this.renderManager.itemRenderer.renderItem(robot, itemstack1, k); } } else { RenderUtils.setGLColorFromInt(itemstack1.getItem().getColorFromItemStack(itemstack1, 0)); this.renderManager.itemRenderer.renderItem(robot, itemstack1, 0); } GL11.glColor3f(1, 1, 1); GL11.glPopMatrix(); } if (robot.laser.isVisible) { robot.laser.head.x = robot.posX; robot.laser.head.y = robot.posY; robot.laser.head.z = robot.posZ; RenderLaser.doRenderLaser(renderManager.renderEngine, robot.laser, EntityLaser.LASER_TEXTURES[1]); } if (robot.getTexture() != null) { renderManager.renderEngine.bindTexture(robot.getTexture()); float storagePercent = (float) robot.getBattery().getEnergyStored() / (float) robot.getBattery().getMaxEnergyStored(); if (robot.hurtTime > 0) { GL11.glColor3f(1.0f, 0.6f, 0.6f); GL11.glRotatef(robot.hurtTime * 0.01f, 0, 0, 1); } doRenderRobot(1F / 16F, renderManager.renderEngine, storagePercent, robot.isActive()); } for (ItemStack s : robot.getWearables()) { doRenderWearable(robot, renderManager.renderEngine, s); } GL11.glPopMatrix(); }
From source file:buildcraft.robotics.render.RenderRobot.java
License:Minecraft Mod Public
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { if (RenderManager.instance == null || RenderManager.instance.renderEngine == null) { return;/*from w ww .j a va2 s. c om*/ } GL11.glPushMatrix(); if (item.getItem() == BuildCraftRobotics.robotItem) { ItemRobot robot = (ItemRobot) item.getItem(); RenderManager.instance.renderEngine.bindTexture(robot.getTextureRobot(item)); } if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { GL11.glTranslated(0.0, 1.0, 0.7); } else if (type == ItemRenderType.ENTITY) { GL11.glScaled(0.6, 0.6, 0.6); } else if (type == ItemRenderType.INVENTORY) { GL11.glScaled(1.5, 1.5, 1.5); } doRenderRobot(1F / 16F, RenderManager.instance.renderEngine, 0.9F, false); GL11.glPopMatrix(); }
From source file:buildcraft.robots.render.RenderRobot.java
License:Minecraft Mod Public
private void doRender(EntityRobot robot, double x, double y, double z) { GL11.glPushMatrix();//from w w w .j a v a 2s. co m GL11.glTranslated(x, y, z); if (robot.getStackInSlot(0) != null) { GL11.glPushMatrix(); GL11.glTranslatef(-0.125F, 0, -0.125F); doRenderItem(robot.getStackInSlot(0)); GL11.glPopMatrix(); } if (robot.getStackInSlot(1) != null) { GL11.glPushMatrix(); GL11.glTranslatef(+0.125F, 0, -0.125F); doRenderItem(robot.getStackInSlot(1)); GL11.glPopMatrix(); } if (robot.getStackInSlot(2) != null) { GL11.glPushMatrix(); GL11.glTranslatef(+0.125F, 0, +0.125F); doRenderItem(robot.getStackInSlot(2)); GL11.glPopMatrix(); } if (robot.getStackInSlot(3) != null) { GL11.glPushMatrix(); GL11.glTranslatef(-0.125F, 0, +0.125F); doRenderItem(robot.getStackInSlot(3)); GL11.glPopMatrix(); } if (robot.itemInUse != null) { GL11.glPushMatrix(); GL11.glRotatef((float) (-robot.itemAngle1 / (2 * Math.PI) * 360) + 180, 0, 1, 0); GL11.glRotatef((float) (robot.itemAngle2 / (2 * Math.PI) * 360), 0, 0, 1); if (robot.itemActive) { long newDate = new Date().getTime(); robot.itemActiveStage = (robot.itemActiveStage + (newDate - robot.lastUpdateTime) / 10) % 45; GL11.glRotatef(robot.itemActiveStage, 0, 0, 1); robot.lastUpdateTime = newDate; } GL11.glTranslatef(-0.4F, 0, 0); GL11.glRotatef(-45F + 180F, 0, 1, 0); GL11.glScalef(0.8F, 0.8F, 0.8F); ItemStack itemstack1 = robot.itemInUse; if (itemstack1.getItem().requiresMultipleRenderPasses()) { for (int k = 0; k < itemstack1.getItem().getRenderPasses(itemstack1.getItemDamage()); ++k) { RenderUtils.setGLColorFromInt(itemstack1.getItem().getColorFromItemStack(itemstack1, k)); this.renderManager.itemRenderer.renderItem(robot, itemstack1, k); } } else { RenderUtils.setGLColorFromInt(itemstack1.getItem().getColorFromItemStack(itemstack1, 0)); this.renderManager.itemRenderer.renderItem(robot, itemstack1, 0); } GL11.glColor3f(1, 1, 1); GL11.glPopMatrix(); } if (robot.laser.isVisible) { robot.laser.head.x = robot.posX; robot.laser.head.y = robot.posY; robot.laser.head.z = robot.posZ; RenderLaser.doRenderLaser(renderManager.renderEngine, robot.laser, EntityLaser.LASER_TEXTURES[1]); } if (robot.getTexture() != null) { renderManager.renderEngine.bindTexture(robot.getTexture()); doRenderRobot(1F / 16F, renderManager.renderEngine); } GL11.glPopMatrix(); }
From source file:buildcraft.robots.render.RenderRobot.java
License:Minecraft Mod Public
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { if (RenderManager.instance == null || RenderManager.instance.renderEngine == null) { return;/* w w w . j a v a 2s .c o m*/ } GL11.glPushMatrix(); if (item.getItem() == BuildCraftSilicon.robotItem) { ItemRobot robot = (ItemRobot) item.getItem(); RenderManager.instance.renderEngine.bindTexture(robot.getTextureRobot(item)); } if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { GL11.glTranslated(0.0, 1.0, 0.7); } else if (type == ItemRenderType.ENTITY) { GL11.glScaled(0.6, 0.6, 0.6); } else if (type == ItemRenderType.INVENTORY) { GL11.glScaled(1.5, 1.5, 1.5); } doRenderRobot(1F / 16F, RenderManager.instance.renderEngine); GL11.glPopMatrix(); }