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:buildcraft.builders.RenderPathMarker.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    TilePathMarker marker = (TilePathMarker) tileentity;

    if (marker != null) {
        GL11.glPushMatrix();//from  ww  w. j  a  v  a 2  s  .  com
        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);
        GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);

        for (LaserData laser : marker.lasers) {
            if (laser != null) {
                GL11.glPushMatrix();
                RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e, laser,
                        EntityLaser.LASER_TEXTURES[3]);
                GL11.glPopMatrix();
            }
        }

        //GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopAttrib();
        GL11.glPopMatrix();
    }
}

From source file:buildcraft.builders.urbanism.RenderBoxProvider.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    GL11.glPushMatrix();/*from ww  w  .jav  a 2 s  .co m*/
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glPushMatrix();
    GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);
    GL11.glTranslated(x, y, z);

    if (tileentity instanceof IBoxesProvider) {
        for (Box b : ((IBoxesProvider) tileentity).getBoxes()) {
            if (b.isVisible) {
                RenderBox.doRender(TileEntityRendererDispatcher.instance.field_147553_e, getTexture(b.kind), b);
            }
        }
    } else if (tileentity instanceof IBoxProvider) {
        Box b = ((IBoxProvider) tileentity).getBox();

        if (b.isVisible) {
            RenderBox.doRender(TileEntityRendererDispatcher.instance.field_147553_e, getTexture(b.kind), b);
        }
    }

    GL11.glPopMatrix();

    GL11.glPopAttrib();
    GL11.glPopMatrix();
}

From source file:buildcraft.core.client.RenderTickListener.java

License:Mozilla Public License

private static void renderMapLocation(@Nonnull ItemStack stack) {
    MapLocationType type = MapLocationType.getFromStack(stack);
    if (type == MapLocationType.SPOT) {
        EnumFacing face = ItemMapLocation.getPointFace(stack);
        IBox box = ItemMapLocation.getPointBox(stack);
        Vec3d[][] vectors = MAP_LOCATION_POINT[face.ordinal()];
        GL11.glTranslated(box.min().getX(), box.min().getY(), box.min().getZ());
        for (Vec3d[] vec : vectors) {
            LaserData_BC8 laser = new LaserData_BC8(BuildCraftLaserManager.STRIPES_WRITE, vec[0], vec[1],
                    1 / 16.0);/*from w  ww .  j  a v a 2 s . c  o m*/
            LaserRenderer_BC8.renderLaserStatic(laser);
        }

    } else if (type == MapLocationType.AREA) {

        IBox box = ItemMapLocation.getAreaBox(stack);
        lastRenderedMapLoc.reset();
        lastRenderedMapLoc.initialize(box);
        LaserBoxRenderer.renderLaserBoxStatic(lastRenderedMapLoc, BuildCraftLaserManager.STRIPES_WRITE);

    } else if (type == MapLocationType.PATH) {
        List<BlockPos> path = BCCoreItems.mapLocation.getPath(stack);
        if (path != null && path.size() > 1) {
            BlockPos last = null;
            for (BlockPos p : path) {
                if (last == null) {
                    last = p;
                }
            }
        }

        // TODO!
    } else if (type == MapLocationType.ZONE) {
        // TODO!
    }
}

From source file:buildcraft.core.lib.client.render.RenderUtils.java

License:Minecraft Mod Public

public static void translate(Vec3d vector) {
    GL11.glTranslated(vector.xCoord, vector.yCoord, vector.zCoord);
}

From source file:buildcraft.core.render.RenderBox.java

License:Minecraft Mod Public

public static void doRender(TextureManager t, ResourceLocation texture, Box box) {
    GL11.glPushMatrix();//from  w  w  w .ja  va 2 s  .  c  o  m
    GL11.glDisable(2896 /* GL_LIGHTING */);

    box.createLaserData();

    for (LaserData l : box.lasersData) {
        l.update();
        GL11.glPushMatrix();
        GL11.glTranslated(0.5F, 0.5F, 0.5F);
        RenderLaser.doRenderLaser(t, l, texture);
        GL11.glPopMatrix();
    }

    GL11.glEnable(2896 /* GL_LIGHTING */);
    GL11.glPopMatrix();
}

From source file:buildcraft.core.render.RenderBuilder.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    super.renderTileEntityAt(tileentity, x, y, z, f);

    TileAbstractBuilder builder = (TileAbstractBuilder) tileentity;

    if (builder != null) {
        GL11.glPushMatrix();/*from w w w. ja v  a  2  s  .c om*/
        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);
        GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);

        if (builder.getPathLaser() != null) {
            for (LaserData laser : builder.getPathLaser()) {
                if (laser != null) {
                    GL11.glPushMatrix();
                    RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e, laser,
                            EntityLaser.LASER_TEXTURES[4]);
                    GL11.glPopMatrix();
                }
            }
        }

        //GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopAttrib();
        GL11.glPopMatrix();

        renderItems.render(tileentity, x, y, z);
    }
}

From source file:buildcraft.core.render.RenderBuildingItems.java

License:Minecraft Mod Public

public void render(TileEntity tile, double x, double y, double z) {

    IBuildingItemsProvider provider = (IBuildingItemsProvider) tile;
    GL11.glPushMatrix();//from w w w  . ja  v a2s . c  o m

    GL11.glTranslated(x, y, z);
    GL11.glTranslated(-tile.xCoord, -tile.yCoord, -tile.zCoord);

    if (provider.getBuilders() != null) {
        for (BuildingItem i : provider.getBuilders()) {
            doRenderItem(i, 1.0F);
        }
    }

    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;//from  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 .j a  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;/*w w  w .j a 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();
}