Search in sources :

Example 76 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project ArsMagica2 by Mithion.

the class KeystoneReceptacleRenderer method renderAModelAt.

public void renderAModelAt(TileEntityKeystoneRecepticle tile, double d, double d1, double d2, float f) {
    int i = 0;
    if (tile.getWorldObj() != null) {
        i = tile.getBlockMetadata() + 1;
    }
    int j = 0;
    if (i == 0 || i == 4) {
        j = 0;
    }
    if (i == 1) {
        j = 90;
    }
    if (i == 2) {
        j = 180;
    }
    if (i == 3) {
        j = 270;
    }
    bindTexture(rLoc);
    //start
    GL11.glPushMatrix();
    //size
    GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
    //rotate based on metadata
    GL11.glRotatef(j, 0.0F, 1.0F, 0.0F);
    //if you read this comment out this line and you can see what happens
    GL11.glScalef(1.0F, -1F, -1F);
    //renders and yes 0.0625 is a random number
    model.renderModel(0.0625F);
    //end	
    GL11.glPopMatrix();
    if (tile.isActive()) {
        bindTexture(portal);
        GL11.glPushMatrix();
        GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
        GL11.glTranslatef((float) d + 0.5f, (float) d1 - 2.5F, (float) d2 + 0.5f);
        GL11.glScaled(4, 4, 4);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
        GL11.glDepthMask(false);
        Tessellator tessellator = Tessellator.instance;
        //rotate based on metadata
        GL11.glRotatef(j, 0.0F, 1.0F, 0.0F);
        //apply portal colors here
        GL11.glColor4f(1, 1, 1, 1);
        renderArsMagicaEffect(tessellator);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glPopAttrib();
        GL11.glPopMatrix();
    }
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator)

Example 77 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project ArsMagica2 by Mithion.

the class RenderRiftStorage method renderRift.

public void renderRift(EntityRiftStorage entityRiftStorage, double d, double d1, double d2, float f, float f1) {
    GL11.glPushMatrix();
    GL11.glTranslatef((float) d, (float) d1, (float) d2);
    GL11.glEnable(32826);
    GL11.glScalef(entityRiftStorage.getScale(0) * 2, entityRiftStorage.getScale(1) * 2, entityRiftStorage.getScale(0) * 2);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_SRC_ALPHA);
    //GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    Tessellator tessellator = Tessellator.instance;
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.8f);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glRotatef(180F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.8f);
    Minecraft.getMinecraft().renderEngine.bindTexture(rift);
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0f, 0.25f, 0.0f);
    GL11.glRotatef(entityRiftStorage.getRotation(), 0.0f, 0.0f, 1.0f);
    GL11.glTranslatef(0.0f, -0.25f, 0.0f);
    renderSprite(tessellator);
    GL11.glPopMatrix();
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    Minecraft.getMinecraft().renderEngine.bindTexture(rift2);
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0f, 0.25f, 0.0f);
    GL11.glRotatef(-entityRiftStorage.getRotation(), 0.0f, 0.0f, 1.0f);
    GL11.glTranslatef(0.0f, -0.25f, 0.1f);
    renderSprite(tessellator);
    GL11.glPopMatrix();
    GL11.glDisable(32826);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glPopMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator)

Example 78 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project ArsMagica2 by Mithion.

the class AMLineArc method drawArcingLine.

public void drawArcingLine(double srcX, double srcY, double srcZ, double dstX, double dstY, double dstZ, float partialTicks, float speed, double distance) {
    GL11.glPushMatrix();
    Minecraft.getMinecraft().renderEngine.bindTexture(rl);
    int fxQuality = AMCore.config.getGFXLevel() * 8;
    EntityPlayer player = Minecraft.getMinecraft().thePlayer;
    double interpolatedX = player.prevPosX + (player.posX - player.prevPosX) * partialTicks;
    double interpolatedY = player.prevPosY + (player.posY - player.prevPosY) * partialTicks;
    double interpolatedZ = player.prevPosZ + (player.posZ - player.prevPosZ) * partialTicks;
    Tessellator tessellator = Tessellator.instance;
    double deltaX = srcX - dstX;
    double deltaY = srcY - dstY;
    double deltaZ = srcZ - dstZ;
    float time = System.nanoTime() / 10000000L;
    float dist = MathHelper.sqrt_double(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);
    float blocks = Math.round(dist);
    float length = blocks * (fxQuality / 2.0F);
    float vMin = 0.0F;
    float VMax = 1.0F;
    GL11.glTranslated(-interpolatedX + dstX, -interpolatedY + dstY, -interpolatedZ + dstZ);
    tessellator.startDrawing(GL11.GL_TRIANGLE_STRIP);
    double wGain = (width * 3) / (length * distance);
    float curWidth = width * 3;
    for (int i = 0; i <= length * distance; i++) {
        float lengthFactor = i / length;
        float f3 = 1.0F - Math.abs(i - length / 2.0F) / (length / 2.0F);
        //ZXY
        double dx = deltaX + MathHelper.sin((float) ((srcX % 16.0D + dist * (1.0F - lengthFactor) * fxQuality / 2.0F - time % 32767.0F / 5.0F) / 4.0D)) * 0.5F * f3;
        double dy = deltaY + MathHelper.sin((float) ((srcY % 16.0D + dist * (1.0F - lengthFactor) * fxQuality / 2.0F - time % 32767.0F / 5.0F) / 3.0D)) * 0.5F * f3;
        double dz = deltaZ + MathHelper.sin((float) ((srcZ % 16.0D + dist * (1.0F - lengthFactor) * fxQuality / 2.0F - time % 32767.0F / 5.0F) / 2.0D)) * 0.5F * f3;
        tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha);
        float u = (1.0F - lengthFactor) * dist - time * speed;
        tessellator.addVertexWithUV(dx * lengthFactor - curWidth, dy * lengthFactor, dz * lengthFactor, u, 1.0f);
        tessellator.addVertexWithUV(dx * lengthFactor + curWidth, dy * lengthFactor, dz * lengthFactor, u, 0.0f);
        curWidth -= wGain;
    }
    tessellator.draw();
    forwardFactor = (forwardFactor + 0.01f) % 1.0f;
    GL11.glPopMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Example 79 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project ArsMagica2 by Mithion.

the class RenderUtilities method renderIcon.

private static void renderIcon(IIcon IIcon, int renderColor) {
    Tessellator tessellator = Tessellator.instance;
    float f = 1.0F;
    float f1 = 0.5F;
    float f2 = 0.25F;
    tessellator.startDrawingQuads();
    RenderHelper.disableStandardItemLighting();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    tessellator.setColorRGBA_F((renderColor & 0xFF0000) >> 16, (renderColor & 0x00FF00) >> 8, renderColor & 0x0000FF, AMGuiHelper.instance.playerRunesAlpha);
    tessellator.addVertexWithUV(0.0F - f1, 0.0F - f2, 0.0D, IIcon.getMinU(), IIcon.getMaxV());
    tessellator.addVertexWithUV(f - f1, 0.0F - f2, 0.0D, IIcon.getMaxU(), IIcon.getMaxV());
    tessellator.addVertexWithUV(f - f1, f - f2, 0.0D, IIcon.getMaxU(), IIcon.getMinV());
    tessellator.addVertexWithUV(0.0F - f1, f - f2, 0.0D, IIcon.getMinU(), IIcon.getMinV());
    tessellator.draw();
    GL11.glDisable(GL11.GL_BLEND);
    RenderHelper.enableStandardItemLighting();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator)

Example 80 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project ArsMagica2 by Mithion.

the class RenderUtilities method drawTextInWorldAtOffset.

public static void drawTextInWorldAtOffset(String text, double x, double y, double z, int color) {
    Tessellator t = Tessellator.instance;
    FontRenderer fontrenderer = Minecraft.getMinecraft().fontRenderer;
    float f = 1.6F;
    float f1 = 0.016666668F * f;
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x, (float) y, (float) z);
    GL11.glNormal3f(0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(-f1, -f1, f1);
    GL11.glScalef(0.5f, 0.5f, 0.5f);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    Tessellator tessellator = Tessellator.instance;
    byte b0 = 0;
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    tessellator.startDrawingQuads();
    int j = fontrenderer.getStringWidth(text) / 2;
    tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.75F);
    tessellator.addVertex(-j - 1, -1 + b0, 0.0D);
    tessellator.addVertex(-j - 1, 8 + b0, 0.0D);
    tessellator.addVertex(j + 1, 8 + b0, 0.0D);
    tessellator.addVertex(j + 1, -1 + b0, 0.0D);
    tessellator.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    fontrenderer.drawString(text, -fontrenderer.getStringWidth(text) / 2, b0, 553648127);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    fontrenderer.drawString(text, -fontrenderer.getStringWidth(text) / 2, b0, -1);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glPopMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) FontRenderer(net.minecraft.client.gui.FontRenderer)

Aggregations

Tessellator (net.minecraft.client.renderer.Tessellator)247 VertexBuffer (net.minecraft.client.renderer.VertexBuffer)53 Block (net.minecraft.block.Block)13 IIcon (net.minecraft.util.IIcon)13 EnumFacing (net.minecraft.util.EnumFacing)8 Icon (net.minecraft.util.Icon)8 BlockPos (net.minecraft.util.math.BlockPos)8 FontRenderer (net.minecraft.client.gui.FontRenderer)7 WorldRenderer (net.minecraft.client.renderer.WorldRenderer)6 ResourceLocation (net.minecraft.util.ResourceLocation)6 SideOnly (cpw.mods.fml.relauncher.SideOnly)5 Minecraft (net.minecraft.client.Minecraft)5 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)5 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)5 IIconTransformation (logisticspipes.proxy.object3d.interfaces.IIconTransformation)4 RenderManager (net.minecraft.client.renderer.entity.RenderManager)4 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)4 ItemStack (net.minecraft.item.ItemStack)4 TileEntity (net.minecraft.tileentity.TileEntity)4 PhysicsWrapperEntity (ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)3