List of usage examples for org.lwjgl.opengl GL11 glPushMatrix
public static native void glPushMatrix();
From source file:buildcraft.core.render.RenderEntityBlock.java
License:Minecraft Mod Public
public void doRenderBlock(EntityBlock entity, double i, double j, double k) { if (entity.isDead) { return;/* w w w . ja va 2 s. c om*/ } shadowSize = entity.shadowSize; World world = entity.worldObj; RenderInfo util = new RenderInfo(); util.texture = entity.texture; bindTexture(TextureMap.locationBlocksTexture); for (int iBase = 0; iBase < entity.iSize; ++iBase) { for (int jBase = 0; jBase < entity.jSize; ++jBase) { for (int kBase = 0; kBase < entity.kSize; ++kBase) { util.minX = 0; util.minY = 0; util.minZ = 0; double remainX = entity.iSize - iBase; double remainY = entity.jSize - jBase; double remainZ = entity.kSize - kBase; util.maxX = remainX > 1.0 ? 1.0 : remainX; util.maxY = remainY > 1.0 ? 1.0 : remainY; util.maxZ = remainZ > 1.0 ? 1.0 : remainZ; GL11.glPushMatrix(); GL11.glTranslatef((float) i, (float) j, (float) k); GL11.glRotatef(entity.rotationX, 1, 0, 0); GL11.glRotatef(entity.rotationY, 0, 1, 0); GL11.glRotatef(entity.rotationZ, 0, 0, 1); GL11.glTranslatef(iBase, jBase, kBase); int lightX, lightY, lightZ; lightX = (int) (Math.floor(entity.posX) + iBase); lightY = (int) (Math.floor(entity.posY) + jBase); lightZ = (int) (Math.floor(entity.posZ) + kBase); GL11.glDisable(2896 /* GL_LIGHTING */); renderBlock(util, world, 0, 0, 0, lightX, lightY, lightZ, false, true); GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); } } } }
From source file:buildcraft.core.render.RenderLaser.java
License:Minecraft Mod Public
private void doRender(EntityLaser laser, double x, double y, double z, float f, float f1) { if (!laser.isVisible() || laser.getTexture() == null) { return;/*ww w .j a va 2 s . c o m*/ } GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_LIGHTING); Position offset = laser.renderOffset(); GL11.glTranslated(x + offset.x, y + offset.y, z + offset.z); // FIXME: WARNING! not using getBox (laser) will kill laser movement. // we can use some other method for the animation though. doRenderLaser(renderManager.renderEngine, laser.data, laser.getTexture()); GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:buildcraft.core.render.RenderLaser.java
License:Minecraft Mod Public
public static void doRenderLaserWave(TextureManager textureManager, LaserData laser, ResourceLocation texture) { if (!laser.isVisible || texture == null) { return;//from w w w . ja v a 2 s . c o m } GL11.glPushMatrix(); laser.update(); GL11.glRotatef((float) laser.angleZ, 0, 1, 0); GL11.glRotatef((float) laser.angleY, 0, 0, 1); textureManager.bindTexture(texture); float factor = (float) (1.0 / 16.0); int indexList = 0; initScaledBoxes(); double x0 = 0; double x1 = laser.wavePosition; double x2 = x1 + scaledBoxes[0].length * STEP; double x3 = laser.renderSize; doRenderLaserLine(x1, laser.laserTexAnimation); for (double i = x1; i <= x2 && i <= laser.renderSize; i += STEP) { GL11.glCallList(scaledBoxes[(int) (laser.waveSize * 99F)][indexList]); indexList = (indexList + 1) % scaledBoxes[0].length; GL11.glTranslated(STEP, 0, 0); } if (x2 < x3) { doRenderLaserLine(x3 - x2, laser.laserTexAnimation); } GL11.glPopMatrix(); }
From source file:buildcraft.core.render.RenderLaser.java
License:Minecraft Mod Public
public static void doRenderLaser(TextureManager textureManager, LaserData laser, ResourceLocation texture) { if (!laser.isVisible || texture == null) { return;//from ww w . ja v a 2s. c o m } GL11.glPushMatrix(); GL11.glTranslated(laser.head.x, laser.head.y, laser.head.z); laser.update(); GL11.glRotatef((float) laser.angleZ, 0, 1, 0); GL11.glRotatef((float) laser.angleY, 0, 0, 1); textureManager.bindTexture(texture); float factor = (float) (1.0 / 16.0); float lasti = 0; int indexList = (int) ((new Date().getTime() / 100) % 20); initScaledBoxes(); doRenderLaserLine(laser.renderSize, laser.laserTexAnimation); GL11.glPopMatrix(); }
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);// ww w .j a va2 s . c o m lasti = i; } 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(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glTranslated(x, y, z);/* w w w. java 2 s . c o m*/ 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(); GL11.glDisable(GL11.GL_LIGHTING);/*www . j a v a2 s . c om*/ 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 w w .j a va2s .co 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.core.RenderEntityBlock.java
License:Minecraft Mod Public
public void doRenderBlock(EntityBlock entity, double i, double j, double k) { if (entity.isDead) return;/*from www. ja va2 s . c om*/ shadowSize = entity.shadowSize; World world = entity.worldObj; BlockInterface util = new BlockInterface(); util.texture = entity.texture; for (int iBase = 0; iBase < entity.iSize; ++iBase) for (int jBase = 0; jBase < entity.jSize; ++jBase) for (int kBase = 0; kBase < entity.kSize; ++kBase) { util.minX = 0; util.minY = 0; util.minZ = 0; double remainX = entity.iSize - iBase; double remainY = entity.jSize - jBase; double remainZ = entity.kSize - kBase; util.maxX = (remainX > 1.0 ? 1.0 : remainX); util.maxY = (remainY > 1.0 ? 1.0 : remainY); util.maxZ = (remainZ > 1.0 ? 1.0 : remainZ); GL11.glPushMatrix(); GL11.glTranslatef((float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F); GL11.glRotatef(entity.rotationX, 1, 0, 0); GL11.glRotatef(entity.rotationY, 0, 1, 0); GL11.glRotatef(entity.rotationZ, 0, 0, 1); GL11.glTranslatef(iBase, jBase, kBase); MinecraftForgeClient.bindTexture(DefaultProps.TEXTURE_BLOCKS); int lightX, lightY, lightZ; lightX = (int) (Math.floor(entity.posX) + iBase); lightY = (int) (Math.floor(entity.posY) + jBase); lightZ = (int) (Math.floor(entity.posZ) + kBase); GL11.glDisable(2896 /* GL_LIGHTING */); renderBlock(util, world, lightX, lightY, lightZ, false, true); GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); } }
From source file:buildcraft.energy.render.RenderEnergyEmitter.java
License:Minecraft Mod Public
public void renderTileEntityAt2(TileEntity tileentity, double x, double y, double z, float f) { if (BuildCraftCore.render == RenderMode.NoDynamic) { return;/*from w ww . java 2 s .c o m*/ } GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glColor3f(1, 1, 1); GL11.glTranslatef((float) x, (float) y, (float) z); float step; float[] angle = { 0, 0, 0 }; box.rotateAngleX = angle[0]; box.rotateAngleY = angle[1]; box.rotateAngleZ = angle[2]; float factor = (float) (1.0 / 16.0); //bindTexture(EntityLaser.LASER_TEXTURES[3]); bindTexture(CHAMBER_TEXTURE); box.render(factor); GL11.glPopAttrib(); GL11.glPopMatrix(); }