Example usage for org.lwjgl.opengl GL11 glTranslated

List of usage examples for org.lwjgl.opengl GL11 glTranslated

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glTranslated.

Prototype

public static native void glTranslated(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y,
        @NativeType("GLdouble") double z);

Source Link

Document

Double version of #glTranslatef Translatef .

Usage

From source file:com.builtbroken.atomic.content.machines.steam.generator.TESRSteamGenerator.java

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float deltaTick) {
    if (tile instanceof TileEntitySteamGenerator) {
        TileEntitySteamGenerator generator = ((TileEntitySteamGenerator) tile);
        float rotation = generator.rotate(deltaTick);

        GL11.glPushMatrix();/*from   w  ww.j  a v a2 s  . c om*/
        GL11.glTranslated(x + 0.5, y + 0.1, z + 0.5);

        renderSmallTurbine(rotation);

        GL11.glPopMatrix();
    }
}

From source file:com.builtbroken.icbm.content.fragments.RenderFragment.java

public void doRender(EntityFragment entity, double xx, double yy, double zz, float p_76986_8_,
        float p_76986_9_) {
    FragmentType type = entity.fragmentType;

    if (type == FragmentType.BLOCK) {
        GL11.glPushMatrix();/*from   w w  w  . j  ava 2 s  . c  o m*/
        GL11.glTranslated(xx, yy, zz);
        RenderUtility.renderCube(entity.renderShape.toAABB(),
                entity.fragmentMaterial == null ? Blocks.stone : entity.fragmentMaterial);
        GL11.glPopMatrix();
    } else if (type == FragmentType.BLAZE) {
        doRenderFireBall(entity, xx, yy, zz, p_76986_8_, p_76986_9_, 0.3f);
    } else {
        this.bindEntityTexture(entity);
        doRenderArrow(entity, xx, yy, zz, p_76986_8_, p_76986_9_);
    }
}

From source file:com.builtbroken.icbm.content.missile.tile.TileCrashedMissile.java

@Override
@SideOnly(Side.CLIENT)//from   w ww . j ava2 s  .  c o m
public void renderDynamic(Pos pos, float frame, int pass) {
    GL11.glPushMatrix();
    if (missile != null) {
        GL11.glTranslated(pos.x() + 0.5,
                pos.y() + (float) (missile.getHeight() / 2.0) - (float) (missile.getHeight() / 3.0),
                pos.z() + 0.5);
        if (block != null) {
            GL11.glTranslated(0, block.getBlockBoundsMaxY(), 0);
        }
        if (posOffset != null) {
            GL11.glTranslated(posOffset.x(), posOffset.y(), posOffset.z());
        }
        if (!(missile instanceof ICustomMissileRender)
                || !((ICustomMissileRender) missile).renderMissileInWorld(yaw - 90, pitch - 90, frame)) {
            renderDefaultMissile();
        }
    } else {
        GL11.glTranslated(pos.x() + 0.5, pos.y() + .4, pos.z() + 0.5);
        if (posOffset != null) {
            GL11.glTranslated(posOffset.x(), posOffset.y(), posOffset.z());
        }
        renderDefaultMissile();
    }
    GL11.glPopMatrix();
    if (block != null) {
        GL11.glPushMatrix();
        GL11.glTranslated(pos.x() + 0.5, pos.y() + 0.5, pos.z() + 0.5);
        RenderUtility.renderInventoryBlock(RenderUtility.renderBlocks, block, meta);
        GL11.glPopMatrix();
    }
}

From source file:com.builtbroken.icbm.content.missile.tile.TileCrashedMissile.java

private final void renderDefaultMissile() {
    GL11.glTranslated(0.5, 2, 0.5);
    GL11.glRotatef(yaw, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(pitch - 90, 0.0F, 0.0F, 1.0F);
    GL11.glScalef(.5f, .5f, .5f);//  w  w  w.ja  v a2  s.  c  o  m
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.CLASSIC_MISSILE_TEXTURE);
    if (missile == null || missile.getWarhead() != null) {
        Assets.CLASSIC_MISSILE_MODEL.renderOnly("WARHEAD 1", "WARHEAD 2", "WARHEAD 3", "WARHEAD 4");
    }
    Assets.CLASSIC_MISSILE_MODEL.renderAllExcept("WARHEAD 1", "WARHEAD 2", "WARHEAD 3", "WARHEAD 4");
}

From source file:com.builtbroken.icbm.content.rail.RenderMissileCart.java

@Override
public void doRender(final Entity entity, final double xx, final double yy, final double zz,
        final float p_76986_8_, final float delta) {
    final EntityMissileCart cart = (EntityMissileCart) entity;
    float f5 = cart.prevRotationPitch + (cart.rotationPitch - cart.prevRotationPitch) * delta;

    double x2 = MathHelper.lerp(cart.lastRenderX, xx, delta);
    double y2 = MathHelper.lerp(cart.lastRenderY, yy, delta);
    double z2 = MathHelper.lerp(cart.lastRenderZ, zz, delta);

    GL11.glPushMatrix();/*from w ww.  j a v a  2 s . c  o m*/
    GL11.glTranslated(x2, y2, z2);
    GL11.glRotatef(180.0F - delta, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-f5, 0.0F, 0.0F, 1.0F);

    cart.lastRenderX = x2;
    cart.lastRenderY = y2;
    cart.lastRenderZ = z2;

    if (cart.getType() == MissileCartTypes.SMALL) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0f, 0.05f, 0f);
        GL11.glRotated(90, 0, 1, 0);

        GL11.glRotated(cart.rotationYaw, 0, 1, 0);

        //Renders the cart
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.SMALL_WORKSTATION_TEXTURE2);
        Assets.CART1x3.renderAll();

        if (cart.getCargoMissile() != null) {
            //Render missile
            GL11.glRotated(-90, 0, 1, 0);
            renderMissile(cart.getCargoMissile(), cart.railSide, cart.facingDirection);
        }

        GL11.glPopMatrix();
    } else if (cart.getType() == MissileCartTypes.MICRO) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0f, .32f, 0f);
        GL11.glRotated(90, 0, 1, 0);

        //Renders the cart
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.GREY_FAKE_TEXTURE);
        Assets.CART1x1.renderAll();

        if (cart.getCargoMissile() != null) {
            GL11.glTranslated(0, -0.44, 0);
            if (cart.getCargoMissile() instanceof ICustomMissileRender) {
                GL11.glTranslatef(0f, ((ICustomMissileRender) cart.getCargoMissile()).getRenderHeightOffset(),
                        0f);
            }
            renderMissile(cart.getCargoMissile(), ForgeDirection.EAST, ForgeDirection.UP);
        }

        GL11.glPopMatrix();
    } else if (cart.getType() == MissileCartTypes.ThreeByThree) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0f, -0.05f, 0f);
        GL11.glRotated(90, 0, 1, 0);

        //Renders the cart
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.GREY_FAKE_TEXTURE);
        Assets.CART3x3.renderAll();

        if (cart.getCargoMissile() != null) {
            GL11.glTranslated(0, -0.3, 0);
            if (cart.getCargoMissile() instanceof ICustomMissileRender) {
                GL11.glTranslatef(0f, ((ICustomMissileRender) cart.getCargoMissile()).getRenderHeightOffset(),
                        0f);
            }
            renderMissile(cart.getCargoMissile(), ForgeDirection.EAST, ForgeDirection.UP);
        }

        GL11.glPopMatrix();
    } else {
        float halfWidth = cart.width / 2.0F;
        float halfLength = cart.length / 2.0F;
        float yaw = (float) Math.abs(MathUtility.clampAngleTo180(cart.rotationYaw));
        if (yaw >= 45 && yaw <= 135) {
            halfWidth = cart.length / 2.0F;
            halfLength = cart.width / 2.0F;
        }
        AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(-(double) halfWidth, 0, -(double) halfLength,

                +(double) halfWidth, 0.3, +(double) halfLength);

        GL11.glPushMatrix();
        GL11.glTranslated(xx, yy, zz);
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.GREY_FAKE_TEXTURE);
        RenderUtility.renderCube(bounds, Blocks.iron_block, Blocks.iron_block.getIcon(0, 0));

        if (cart.getCargoMissile() != null) {
            GL11.glTranslated(0, -0.1, 0);
            if (cart.getCargoMissile() instanceof ICustomMissileRender) {
                GL11.glTranslatef(0f, ((ICustomMissileRender) cart.getCargoMissile()).getRenderHeightOffset(),
                        0f);
            }
            renderMissile(cart.getCargoMissile(), ForgeDirection.EAST, ForgeDirection.UP);
        }
        GL11.glPopMatrix();
    }
    GL11.glPopMatrix();

    if (Engine.runningAsDev) {
        drawBounds(cart, xx, yy, zz);
    }
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

public static void drawSphere(double x, double y, double z, float size, int slices, int stacks) {
    final Sphere s = new Sphere();
    GL11.glPushMatrix();/*from  w  w  w.j  a  va 2s  .  c  om*/
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(1.2F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    s.setDrawStyle(GLU.GLU_SILHOUETTE);
    GL11.glTranslated(x - RenderManager.renderPosX, y - RenderManager.renderPosY, z - RenderManager.renderPosZ);
    s.draw(size, slices, stacks);
    GL11.glLineWidth(2.0F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
    GL11.glPopMatrix();
}

From source file:com.dyonovan.neotech.pipes.entities.EnergyResourceEntity.java

License:Creative Commons License

@Override
public void renderResource(float tickPartial) {
    GlStateManager.pushMatrix();//from   w  w w  .  j a va  2s  .co  m
    GlStateManager.pushAttrib();

    RenderManager manager = Minecraft.getMinecraft().getRenderManager();
    GL11.glTranslated(xPos - manager.renderPosX, yPos - manager.renderPosY, zPos - manager.renderPosZ);

    RenderUtils.bindTexture(new ResourceLocation(Reference.MOD_ID(), "textures/entity/energyEntity.png"));

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.disableLighting();

    //TODO Find another way to render power
    //RenderHelper.setupBillboard(Minecraft.getMinecraft().thePlayer);

    WorldRenderer renderer = Tessellator.getInstance().getWorldRenderer();
    renderer.startDrawingQuads();
    renderer.addVertexWithUV(-0.2, -0.2, -0.2, 0, 0);
    renderer.addVertexWithUV(-0.2, 0.2, -0.2, 0, 1);
    renderer.addVertexWithUV(0.2, 0.2, -0.2, 1, 1);
    renderer.addVertexWithUV(0.2, -0.2, -0.2, 1, 0);
    Tessellator.getInstance().draw();

    GlStateManager.enableLighting();

    RenderUtils.bindMinecraftBlockSheet();

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GlStateManager.popAttrib();
    GlStateManager.popMatrix();
}

From source file:com.dyonovan.neotech.pipes.entities.FluidResourceEntity.java

License:Creative Commons License

@Override
public void renderResource(float tickPartial) {
    if (resource != null && resource.getFluid() != null) {
        GlStateManager.pushMatrix();/*from   w w  w .j a  v  a  2  s.  c  om*/
        GlStateManager.pushAttrib();

        RenderManager manager = Minecraft.getMinecraft().getRenderManager();
        GL11.glTranslated(xPos - manager.renderPosX, yPos - manager.renderPosY, zPos - manager.renderPosZ);

        RenderUtils.bindMinecraftBlockSheet();
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GlStateManager.disableLighting();

        TextureAtlasSprite fluidIcon = resource.getFluid().getFluid().getIcon();
        RenderHelper.renderCubeWithTexture(-0.2, -0.2, -0.2, 0.2, 0.2, 0.2, fluidIcon.getMinU(),
                fluidIcon.getMinV(), fluidIcon.getMaxU(), fluidIcon.getMaxV());

        GlStateManager.enableLighting();
        RenderUtils.bindMinecraftBlockSheet();

        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GlStateManager.popAttrib();
        GlStateManager.popMatrix();
    }
}

From source file:com.dyonovan.neotech.pipes.entities.ItemResourceEntity.java

License:Creative Commons License

@Override
public void renderResource(float tickPartial) {
    GlStateManager.pushMatrix();/*from   w  ww.ja v  a 2 s .  c o m*/
    GlStateManager.pushAttrib();

    RenderManager manager = Minecraft.getMinecraft().getRenderManager();
    GL11.glTranslated(xPos - manager.renderPosX, yPos - manager.renderPosY, zPos - manager.renderPosZ);
    RenderUtils.bindMinecraftBlockSheet();
    GL11.glScaled(0.5, 0.5, 0.5);
    try {
        Minecraft.getMinecraft().getRenderItem().renderItemModel(resource);
    } catch (NullPointerException ignored) {
    }

    GlStateManager.popAttrib();
    GlStateManager.popMatrix();
}

From source file:com.farincorporated.frameutils.client.rendering.FramePistonRenderer.java

private void TranslateModel(double x, double y, double z, int face, double progress) {
    switch (face) {
    case 0://from w  ww. ja v a 2  s  . com
        GL11.glTranslated(x + 0.5, y + 0.5 - progress, z + 0.5);
        break;
    case 1:
        GL11.glTranslated(x + 0.5, y + 0.5 + progress, z + 0.5);
        break;
    case 2:
        GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5 - progress);
        break;
    case 3:
        GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5 + progress);
        break;
    case 4:
        GL11.glTranslated(x + 0.5 - progress, y + 0.5, z + 0.5);
        break;
    case 5:
        GL11.glTranslated(x + 0.5 + progress, y + 0.5, z + 0.5);
        break;
    }
}