use of net.minecraft.client.renderer.Tessellator in project Engine by VoltzEngine-Project.
the class Render2DHelper method drawGradientRect.
/**
* Draws a rectangle with a vertical gradient between the specified colors.
*/
public static void drawGradientRect(int p_73733_1_, int p_73733_2_, int p_73733_3_, int p_73733_4_, int p_73733_5_, int p_73733_6_) {
float f = (float) (p_73733_5_ >> 24 & 255) / 255.0F;
float f1 = (float) (p_73733_5_ >> 16 & 255) / 255.0F;
float f2 = (float) (p_73733_5_ >> 8 & 255) / 255.0F;
float f3 = (float) (p_73733_5_ & 255) / 255.0F;
float f4 = (float) (p_73733_6_ >> 24 & 255) / 255.0F;
float f5 = (float) (p_73733_6_ >> 16 & 255) / 255.0F;
float f6 = (float) (p_73733_6_ >> 8 & 255) / 255.0F;
float f7 = (float) (p_73733_6_ & 255) / 255.0F;
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_ALPHA_TEST);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glShadeModel(GL11.GL_SMOOTH);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(f1, f2, f3, f);
tessellator.addVertex((double) p_73733_3_, (double) p_73733_2_, (double) zLevel);
tessellator.addVertex((double) p_73733_1_, (double) p_73733_2_, (double) zLevel);
tessellator.setColorRGBA_F(f5, f6, f7, f4);
tessellator.addVertex((double) p_73733_1_, (double) p_73733_4_, (double) zLevel);
tessellator.addVertex((double) p_73733_3_, (double) p_73733_4_, (double) zLevel);
tessellator.draw();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
use of net.minecraft.client.renderer.Tessellator in project Engine by VoltzEngine-Project.
the class Render2DHelper method drawTexturedModalRect.
/**
* Draws a textured rectangle at the stored z-value. Args: x, y, u, v, width, height
*/
public static void drawTexturedModalRect(int p_73729_1_, int p_73729_2_, int p_73729_3_, int p_73729_4_, int p_73729_5_, int p_73729_6_) {
float f = 0.00390625F;
float f1 = 0.00390625F;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double) (p_73729_1_ + 0), (double) (p_73729_2_ + p_73729_6_), (double) zLevel, (double) ((float) (p_73729_3_ + 0) * f), (double) ((float) (p_73729_4_ + p_73729_6_) * f1));
tessellator.addVertexWithUV((double) (p_73729_1_ + p_73729_5_), (double) (p_73729_2_ + p_73729_6_), (double) zLevel, (double) ((float) (p_73729_3_ + p_73729_5_) * f), (double) ((float) (p_73729_4_ + p_73729_6_) * f1));
tessellator.addVertexWithUV((double) (p_73729_1_ + p_73729_5_), (double) (p_73729_2_ + 0), (double) zLevel, (double) ((float) (p_73729_3_ + p_73729_5_) * f), (double) ((float) (p_73729_4_ + 0) * f1));
tessellator.addVertexWithUV((double) (p_73729_1_ + 0), (double) (p_73729_2_ + 0), (double) zLevel, (double) ((float) (p_73729_3_ + 0) * f), (double) ((float) (p_73729_4_ + 0) * f1));
tessellator.draw();
}
use of net.minecraft.client.renderer.Tessellator in project Engine by VoltzEngine-Project.
the class FluidRenderUtility method renderFluidTesselation.
/*public static int[] getFluidDisplayLists(FluidStack fluidStack, World world, boolean flowing)
{
if (fluidStack == null)
{
return null;
}
Fluid fluid = fluidStack.getFluid();
if (fluid == null)
{
return null;
}
Map<Fluid, int[]> cache = flowing ? flowingRenderCache : stillRenderCache;
int[] diplayLists = cache.get(fluid);
if (diplayLists != null)
{
return diplayLists;
}
diplayLists = new int[DISPLAY_STAGES];
if (fluid.getBlockID() > 0)
{
liquidBlock.baseBlock = Block.blocksList[fluid.getBlockID()];
liquidBlock.texture = getFluidTexture(fluidStack.getFluid(), flowing);
}
else
{
liquidBlock.baseBlock = Block.waterStill;
liquidBlock.texture = getFluidTexture(fluidStack.getFluid(), flowing);
}
cache.put(fluid, diplayLists);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_CULL_FACE);
for (int s = 0; s < DISPLAY_STAGES; ++s)
{
diplayLists[s] = GLAllocation.generateDisplayLists(1);
GL11.glNewList(diplayLists[s], 4864 /* GL_COMPILE *);
liquidBlock.min.x = 0.01f;
liquidBlock.min.y = 0;
liquidBlock.min.z = 0.01f;
liquidBlock.max.x = 0.99f;
liquidBlock.max.y = (float) s / (float) DISPLAY_STAGES;
liquidBlock.max.z = 0.99f;
RenderBlockEntity.instance.renderBlock(liquidBlock, world, 0, 0, 0, false, true);
GL11.glEndList();
}
GL11.glColor4f(1, 1, 1, 1);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
return diplayLists;
}*/
/**
* Based on Open Blocks tank renderer
*
* @param tank
*/
public static void renderFluidTesselation(IFluidTank tank, double ySouthEast, double yNorthEast, double ySouthWest, double yNorthWest) {
FluidStack fluidStack = tank.getFluid();
if (fluidStack != null && fluidStack.amount > 0) {
GL11.glPushMatrix();
GL11.glDisable(2896);
Fluid fluid = fluidStack.getFluid();
IIcon texture = fluid.getStillIcon();
RenderUtility.bind(getFluidSheet(fluid));
int color = fluid.getColor(fluidStack);
Tessellator t = Tessellator.instance;
double uMin = texture.getInterpolatedU(0.0);
double uMax = texture.getInterpolatedU(16.0);
double vMin = texture.getInterpolatedV(0.0);
double vMax = texture.getInterpolatedV(16.0);
double vHeight = vMax - vMin;
float r = (color >> 16 & 0xFF) / 255.0F;
float g = (color >> 8 & 0xFF) / 255.0F;
float b = (color & 0xFF) / 255.0F;
// north side
t.startDrawingQuads();
t.setColorOpaque_F(r, g, b);
// bottom
t.addVertexWithUV(0.5, -0.5, -0.5, uMax, vMin);
// bottom
t.addVertexWithUV(-0.5, -0.5, -0.5, uMin, vMin);
// top
t.addVertexWithUV(-0.5, -0.5 + yNorthWest, -0.5, uMin, vMin + (vHeight * yNorthWest));
// north/west
t.addVertexWithUV(0.5, -0.5 + yNorthEast, -0.5, uMax, vMin + (vHeight * yNorthEast));
// top
// north/east
t.draw();
// south side
t.startDrawingQuads();
t.setColorOpaque_F(r, g, b);
// top
t.addVertexWithUV(0.5, -0.5, 0.5, uMin, vMin);
// south
t.addVertexWithUV(0.5, -0.5 + ySouthEast, 0.5, uMin, vMin + (vHeight * ySouthEast));
// east
t.addVertexWithUV(-0.5, -0.5 + ySouthWest, 0.5, uMax, vMin + (vHeight * ySouthWest));
// top
// south
// west
t.addVertexWithUV(-0.5, -0.5, 0.5, uMax, vMin);
t.draw();
// east side
t.startDrawingQuads();
t.setColorOpaque_F(r, g, b);
// top
t.addVertexWithUV(0.5, -0.5, -0.5, uMin, vMin);
// north/east
t.addVertexWithUV(0.5, -0.5 + yNorthEast, -0.5, uMin, vMin + (vHeight * yNorthEast));
// top
// south/east
t.addVertexWithUV(0.5, -0.5 + ySouthEast, 0.5, uMax, vMin + (vHeight * ySouthEast));
t.addVertexWithUV(0.5, -0.5, 0.5, uMax, vMin);
t.draw();
// west side
t.startDrawingQuads();
t.setColorOpaque_F(r, g, b);
t.addVertexWithUV(-0.5, -0.5, 0.5, uMin, vMin);
// top
// south/west
t.addVertexWithUV(-0.5, -0.5 + ySouthWest, 0.5, uMin, vMin + (vHeight * ySouthWest));
// top
// north/west
t.addVertexWithUV(-0.5, -0.5 + yNorthWest, -0.5, uMax, vMin + (vHeight * yNorthWest));
t.addVertexWithUV(-0.5, -0.5, -0.5, uMax, vMin);
t.draw();
// top
t.startDrawingQuads();
t.setColorOpaque_F(r, g, b);
// south
// east
t.addVertexWithUV(0.5, -0.5 + ySouthEast, 0.5, uMax, vMin);
// north
// east
t.addVertexWithUV(0.5, -0.5 + yNorthEast, -0.5, uMin, vMin);
// north
// west
t.addVertexWithUV(-0.5, -0.5 + yNorthWest, -0.5, uMin, vMax);
// south
// west
t.addVertexWithUV(-0.5, -0.5 + ySouthWest, 0.5, uMax, vMax);
t.draw();
// bottom
t.startDrawingQuads();
t.setColorOpaque_F(r, g, b);
t.addVertexWithUV(0.5, -0.5, -0.5, uMax, vMin);
t.addVertexWithUV(0.5, -0.5, 0.5, uMin, vMin);
t.addVertexWithUV(-0.5, -0.5, 0.5, uMin, vMax);
t.addVertexWithUV(-0.5, -0.5, -0.5, uMax, vMax);
t.draw();
GL11.glEnable(2896);
GL11.glPopMatrix();
}
}
use of net.minecraft.client.renderer.Tessellator in project Engine by VoltzEngine-Project.
the class RenderUtility method renderCube.
/**
* Renders a cube with custom block boundaries.
*/
public static void renderCube(double x1, double y1, double z1, double x2, double y2, double z2, Block block, IIcon overrideTexture, int meta) {
GL11.glPushMatrix();
if (RenderManager.instance != null && RenderManager.instance.renderEngine != null && TextureMap.locationBlocksTexture != null) {
RenderManager.instance.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
}
Tessellator t = Tessellator.instance;
GL11.glColor4f(1, 1, 1, 1);
getBlockRenderer().setRenderBounds(x1, y1, z1, x2, y2, z2);
t.startDrawingQuads();
IIcon useTexture = overrideTexture != null ? overrideTexture : getTextureSafe(block, 0, meta);
t.setNormal(0.0F, -1.0F, 0.0F);
getBlockRenderer().renderFaceYNeg(block, 0, 0, 0, useTexture);
useTexture = overrideTexture != null ? overrideTexture : getTextureSafe(block, 1, meta);
t.setNormal(0.0F, 1.0F, 0.0F);
getBlockRenderer().renderFaceYPos(block, 0, 0, 0, useTexture);
useTexture = overrideTexture != null ? overrideTexture : getTextureSafe(block, 2, meta);
t.setNormal(0.0F, 0.0F, -1.0F);
getBlockRenderer().renderFaceZNeg(block, 0, 0, 0, useTexture);
useTexture = overrideTexture != null ? overrideTexture : getTextureSafe(block, 3, meta);
t.setNormal(0.0F, 0.0F, 1.0F);
getBlockRenderer().renderFaceZPos(block, 0, 0, 0, useTexture);
useTexture = overrideTexture != null ? overrideTexture : getTextureSafe(block, 4, meta);
t.setNormal(-1.0F, 0.0F, 0.0F);
getBlockRenderer().renderFaceXNeg(block, 0, 0, 0, useTexture);
useTexture = overrideTexture != null ? overrideTexture : getTextureSafe(block, 5, meta);
t.setNormal(1.0F, 0.0F, 0.0F);
getBlockRenderer().renderFaceXPos(block, 0, 0, 0, useTexture);
t.draw();
GL11.glPopMatrix();
}
use of net.minecraft.client.renderer.Tessellator in project Railcraft by Railcraft.
the class RenderWall method renderItem.
@Override
public void renderItem(RenderBlocks renderBlocks, ItemStack item, ItemRenderType renderType) {
Block block = getBlock();
int meta = item.getItemDamage();
renderBlocks.setRenderBoundsFromBlock(block);
Tessellator tess = Tessellator.instance;
for (int i = 0; i < 2; ++i) {
if (i == 0)
renderBlocks.setRenderBounds(0.0D, 0.0D, 0.3125D, 1.0D, 0.8125D, 0.6875D);
if (i == 1)
renderBlocks.setRenderBounds(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D);
OpenGL.glTranslatef(-0.5F, -0.5F, -0.5F);
tess.startDrawingQuads();
tess.setNormal(0.0F, -1.0F, 0.0F);
IIcon icon = block.getIcon(0, meta);
if (icon != null)
renderBlocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, icon);
tess.draw();
tess.startDrawingQuads();
tess.setNormal(0.0F, 1.0F, 0.0F);
icon = block.getIcon(1, meta);
if (icon != null)
renderBlocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, icon);
tess.draw();
tess.startDrawingQuads();
tess.setNormal(0.0F, 0.0F, -1.0F);
icon = block.getIcon(2, meta);
if (icon != null)
renderBlocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, icon);
tess.draw();
tess.startDrawingQuads();
tess.setNormal(0.0F, 0.0F, 1.0F);
icon = block.getIcon(3, meta);
if (icon != null)
renderBlocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, icon);
tess.draw();
tess.startDrawingQuads();
tess.setNormal(-1.0F, 0.0F, 0.0F);
icon = block.getIcon(4, meta);
if (icon != null)
renderBlocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, icon);
tess.draw();
tess.startDrawingQuads();
tess.setNormal(1.0F, 0.0F, 0.0F);
icon = block.getIcon(5, meta);
if (icon != null)
renderBlocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, icon);
tess.draw();
OpenGL.glTranslatef(0.5F, 0.5F, 0.5F);
}
renderBlocks.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
}
Aggregations