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:cn.academy.vanilla.generic.client.render.RippleMarkRender.java

License:GNU General Public License

@Override
public void doRender(Entity entity, double x, double y, double z, float a, float b) {
    EntityRippleMark mark = (EntityRippleMark) entity;
    long dt = GameTimer.getTime() - mark.creationTime;

    GL11.glDisable(GL11.GL_CULL_FACE);//from  ww w.ja  va  2 s.c o  m
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0);
    GL11.glDepthMask(false);
    GL11.glPushMatrix();

    GL11.glTranslated(x, y, z);

    for (int i = 0; i < timeOffsets.length; ++i) {
        GL11.glPushMatrix();

        long mod = (dt - timeOffsets[i]) % CYCLE;
        float size = getSize(mod);

        GL11.glTranslatef(0, getHeight(mod), 0);
        GL11.glScalef(size, 1, size);
        material.color = mark.color.copy();
        material.color.a *= getAlpha(mod);
        mesh.draw(material);

        GL11.glPopMatrix();
    }

    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.1f);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
}

From source file:cn.academy.vanilla.meltdowner.client.render.RenderMdShield.java

License:GNU General Public License

@Override
public void doRender(Entity _entity, double x, double y, double z, float a, float b) {
    if (RenderUtils.isInShadowPass()) {
        return;//w  w w  .ja v  a 2 s .  com
    }

    long time = GameTimer.getTime();
    EntityMdShield entity = (EntityMdShield) _entity;

    // Calculate rotation
    long dt;
    if (entity.lastRender == 0)
        dt = 0;
    else
        dt = time - entity.lastRender;

    float rotationSpeed = MathUtils.lerpf(0.8f, 2f, Math.min(entity.ticksExisted / 30.0f, 1f));
    entity.rotation += rotationSpeed * dt;
    if (entity.rotation >= 360f)
        entity.rotation -= 360f;

    ShaderSimple.instance().useProgram();
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.05f);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glPushMatrix();

    GL11.glTranslated(x, y, z);
    GL11.glRotatef(-entity.rotationYaw, 0, 1, 0);
    GL11.glRotatef(entity.rotationPitch, 1, 0, 0);
    GL11.glRotatef(entity.rotation, 0, 0, 1);

    float size = EntityMdShield.SIZE * MathUtils.lerpf(0.2f, 1f, Math.min(entity.ticksExisted / 15.0f, 1f));
    float alpha = Math.min(entity.ticksExisted / 6.0f, 1.0f);

    GL11.glScalef(size, size, 1);

    RenderUtils.loadTexture(texture);
    mesh.draw(ShaderSimple.instance());

    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.1f);
    GL20.glUseProgram(0);

    entity.lastRender = time;
}

From source file:cn.academy.vanilla.teleporter.client.MarkRender.java

License:GNU General Public License

@Override
public void doRender(Entity ent, double x, double y, double z, float var8, float var9) {
    if (RenderUtils.isInShadowPass())
        return;// ww w  .j a v  a  2  s.  c  o m

    EntityTPMarking mark = (EntityTPMarking) ent;
    if (!mark.firstUpdated())
        return;

    int texID = (int) ((mark.ticksExisted / 2.5) % tex.length);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_DEPTH_TEST);

    GL11.glPushMatrix();
    {
        GL11.glTranslated(x, y, z);

        GL11.glRotated(-mark.rotationYaw, 0, 1, 0);
        GL11.glScaled(-1, -1, 1);
        ShaderSimple.instance().useProgram();
        RenderUtils.loadTexture(tex[texID]);

        if (!mark.available) {
            GL11.glColor4d(1, 0.2, 0.2, 1);
        } else {
            GL11.glColor4d(1, 1, 1, 1);
        }

        model.draw();
        GL20.glUseProgram(0);
    }
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_CULL_FACE);
}

From source file:cn.academy.vanilla.teleporter.client.RenderMarker.java

License:GNU General Public License

@Override
public void doRender(Entity ent, double x, double y, double z, float a, float b) {
    EntityMarker marker = (EntityMarker) ent;
    if (!marker.firstUpdated())
        return;/*from w  w  w.ja  v  a  2s.  c  o  m*/

    Entity targ = marker.target;
    float width, height;
    if (targ != null) {
        width = targ.width;
        height = targ.height;
    } else {
        width = marker.width;
        height = marker.height;
    }

    ShaderNotex.instance().useProgram();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    if (marker.ignoreDepth)
        GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glPushMatrix();

    GL11.glTranslated(x - width / 2, y + 0.05 * Math.sin(GameTimer.getAbsTime() / 400.0), z - width / 2);
    marker.color.bind();
    renderMark(width, height);

    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL20.glUseProgram(0);
}

From source file:cn.academy.vanilla.teleporter.client.RenderMarker.java

License:GNU General Public License

protected void renderMark(float width, float height) {
    for (int i = 0; i < 8; ++i) {
        GL11.glPushMatrix();//from   w ww. j  a  v  a2s .  c  o  m

        boolean rev = i < 4;
        double sx = width * mulArray[i][0], sy = height * mulArray[i][1], sz = width * mulArray[i][2];
        final double len = 0.2 * width;
        GL11.glTranslated(sx, sy, sz);
        GL11.glRotated(rotArray[i], 0, 1, 0);
        GL11.glLineWidth(3f);
        t.startDrawing(GL11.GL_LINES);
        t.setBrightness(15728880);
        t.addVertex(0, 0, 0);
        t.addVertex(0, rev ? len : -len, 0);
        t.addVertex(0, 0, 0);
        t.addVertex(len, 0, 0);
        t.addVertex(0, 0, 0);
        t.addVertex(0, 0, len);
        t.draw();

        GL11.glPopMatrix();
    }
}

From source file:cn.lambdacraft.crafting.client.renderer.RenderWire.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
    TileWire wire = (TileWire) tileentity;
    Tessellator t = Tessellator.instance;
    GL11.glPushMatrix();/*from w  ww  . j  a va 2 s .  c o m*/
    GL11.glTranslated(d0 + 0.5, d1 + 0.5, d2 + 0.5);
    renderWireBox(t, -1, wire.renderSides);
    for (int i = 0; i < 6; i++) {
        if (wire.renderSides[i])
            renderWireBox(t, i, wire.renderSides);
    }
    GL11.glPopMatrix();
}

From source file:cn.lambdacraft.mob.client.renderer.RenderAlienSlave.java

License:Open Source License

private void renderElectro(EntityAlienSlave ent, Vec3 vec3, Tessellator t, double x, double y, double z,
        boolean isLeft) {
    double dx = vec3.xCoord, dy = vec3.yCoord, dz = vec3.zCoord;
    double tx = 0.0, ty = 1.2, tz = 0.0;
    GL11.glPushMatrix();//  www. j  a v a  2  s.c  o m
    GL11.glDisable(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);
    RenderUtils.loadTexture(ClientProps.VORTIGAUNT_RAY_PATH[rand.nextInt(3)]);

    Vec3 v1 = RenderUtils.newV3(tx - WIDTH, ty, tz), v2 = RenderUtils.newV3(tx + WIDTH, ty, tz),
            v3 = RenderUtils.newV3(tx, ty - WIDTH, tz), v4 = RenderUtils.newV3(tx, ty + WIDTH, tz);
    double d = Math.sqrt(dx * dx + dy * dy + dz * dz) * 1.3;

    GL11.glTranslated(x, y, z);

    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
    t.startDrawingQuads();
    t.setBrightness(15728880);
    t.setColorRGBA_F(0.1F, 0.9F, 0.1F, 0.7F);
    RenderUtils.addVertex(v1, 0, 0);
    RenderUtils.addVertex(v2, 1, 0);
    RenderUtils.addVertex(v2.addVector(dx, dy, dz), 1, d);
    RenderUtils.addVertex(v1.addVector(dx, dy, dz), 0, d);

    RenderUtils.addVertex(v3, 0, 0);
    RenderUtils.addVertex(v4, 1, 0);
    RenderUtils.addVertex(v4.addVector(dx, dy, dz), 1, d);
    RenderUtils.addVertex(v3.addVector(dx, dy, dz), 0, d);
    t.draw();

    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();

}

From source file:cn.lambdacraft.mob.client.renderer.RenderShockwave.java

License:Open Source License

protected void renderWave(Tessellator t, double x, double y, double z, float radius) {
    GL11.glPushMatrix();// www.jav  a2s  .  c o  m

    GL11.glTranslated(x, y, z);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
    t.startDrawingQuads();
    t.setColorRGBA(255, 255, 255, 128);
    t.setBrightness(15728880);

    t.addVertexWithUV(-radius, 0.0, -radius, 0.0, 0.0);
    t.addVertexWithUV(-radius, 0.0, radius, 0.0, 1.0);
    t.addVertexWithUV(radius, 0.0, radius, 1.0, 1.0);
    t.addVertexWithUV(radius, 0.0, -radius, 1.0, 0.0);

    t.draw();

    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glPopMatrix();
}

From source file:cn.lambdacraft.terrain.client.model.ModelXenAmethyst.java

License:Open Source License

@Override
public void render(TileEntity is, double x, double y, double z, float f1, float scale, float f) {
    GL11.glPushMatrix();//from  ww w  .  j  a  va  2s . c  om
    //      GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
    GL11.glTranslated(x + 0.5, y + 1.6, z + 0.5);
    GL11.glScalef(-1.0F, -1.0F, 1.0F);
    RenderUtils.loadTexture(ClientProps.AMETHYST_PATH);
    Shape1.render(scale);
    Shape2.render(scale);
    Shape3.render(scale);
    GL11.glPopMatrix();
}

From source file:cn.lambdacraft.terrain.client.model.ModelXenLight.java

License:Open Source License

@Override
public void render(TileEntity is, double x, double y, double z, float f1, float scale, float f) {
    TileEntityXenLight tile = (TileEntityXenLight) is;
    GL11.glPushMatrix();/*from w ww  . j  a  v a  2 s  . c  om*/
    GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
    GL11.glScalef(-1.0F, -1.0F, 1.0F);
    RenderUtils.loadTexture(ClientProps.XENLIGHT_PATH);
    Shape1.render(scale);
    //~
    GL11.glRotated(12.5 * MathHelper.sin(tile.ticksExisted * 0.07F), 0.1, 1, -0.1);
    if (tile.isLighting) {
        if (tile.tickSinceChange < 15)
            GL11.glTranslatef(0.0F, 0.0166F * (15 - tile.tickSinceChange), 0.0F);
    } else {
        if (tile.tickSinceChange < 5)
            GL11.glTranslatef(0.0F, 0.05F * tile.tickSinceChange, 0.0F);
        else
            GL11.glTranslatef(0.0F, 0.25F, 0.0F);
    }
    Shape2.render(scale);
    Shape3.render(scale);
    GL11.glPopMatrix();
}