use of net.minecraft.client.renderer.VertexBuffer in project BetterWithAddons by DaedalusGame.
the class RenderUtils method drawCube.
public static void drawCube(float posX, float posY, float posZ, float width, float length, float height, int red, int green, int blue, int alpha) {
Minecraft.getMinecraft().entityRenderer.disableLightmap();
Tessellator t = Tessellator.getInstance();
VertexBuffer wr = t.getBuffer();
GlStateManager.disableTexture2D();
GlStateManager.pushMatrix();
GlStateManager.translate(posX, posY, posZ);
wr.begin(7, DefaultVertexFormats.POSITION_COLOR);
// P1
wr.pos(0F, 0F, 0F).color(red, green, blue, alpha).endVertex();
// P2
wr.pos(0F, height, 0F).color(red, green, blue, alpha).endVertex();
// P3
wr.pos(width, height, 0F).color(red, green, blue, alpha).endVertex();
// P4
wr.pos(width, 0F, 0F).color(red, green, blue, alpha).endVertex();
// P1
wr.pos(width, height, 0F).color(red, green, blue, alpha).endVertex();
// P2
wr.pos(width, height, length).color(red, green, blue, alpha).endVertex();
// P3
wr.pos(width, 0F, length).color(red, green, blue, alpha).endVertex();
// P4
wr.pos(width, 0F, 0F).color(red, green, blue, alpha).endVertex();
// P1
wr.pos(width, height, length).color(red, green, blue, alpha).endVertex();
// P1
wr.pos(0F, height, length).color(red, green, blue, alpha).endVertex();
// P1
wr.pos(0F, 0F, length).color(red, green, blue, alpha).endVertex();
// P1
wr.pos(width, 0F, length).color(red, green, blue, alpha).endVertex();
// P1
wr.pos(0F, height, length).color(red, green, blue, alpha).endVertex();
// P1
wr.pos(0F, height, 0F).color(red, green, blue, alpha).endVertex();
// P1
wr.pos(0F, 0F, 0F).color(red, green, blue, alpha).endVertex();
// P1
wr.pos(0F, 0F, length).color(red, green, blue, alpha).endVertex();
// P1
wr.pos(0F, 0F, 0F).color(red, green, blue, alpha).endVertex();
// P1
wr.pos(width, 0F, 0F).color(red, green, blue, alpha).endVertex();
// P1
wr.pos(width, 0F, length).color(red, green, blue, alpha).endVertex();
// P1
wr.pos(0F, 0F, length).color(red, green, blue, alpha).endVertex();
// P1
wr.pos(0F, height, 0F).color(red, green, blue, alpha).endVertex();
// P2
wr.pos(0F, height, length).color(red, green, blue, alpha).endVertex();
// P3
wr.pos(width, height, length).color(red, green, blue, alpha).endVertex();
// P4
wr.pos(width, height, 0F).color(red, green, blue, alpha).endVertex();
t.draw();
GlStateManager.popMatrix();
GlStateManager.enableTexture2D();
Minecraft.getMinecraft().entityRenderer.enableLightmap();
}
use of net.minecraft.client.renderer.VertexBuffer in project ImmersiveEngineering by BluSunrize.
the class EntityRenderRevolvershot method doRender.
@Override
public void doRender(Entity entity, double x, double y, double z, float f0, float f1) {
GlStateManager.pushMatrix();
this.bindEntityTexture(entity);
GlStateManager.translate(x, y, z);
GlStateManager.enableRescaleNormal();
Tessellator tessellator = ClientUtils.tes();
VertexBuffer worldrenderer = ClientUtils.tes().getBuffer();
// float f2 = 0.0F;
// float f3 = 0.5F;
// float f4 = 0/32f;
// float f5 = 5/32f;
// float f6 = 0.0F;
// float f7 = 0.15625F;
// float f8 = 5/32F;
// float f9 = 10/32F;
// float f10 = 0.05625F;
// GlStateManager.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
// GlStateManager.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
GlStateManager.disableCull();
GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * f1 - 90.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * f1, 0.0F, 0.0F, 1.0F);
// tessellator.startDrawingQuads();
// tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f8);
// tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f8);
// tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f9);
// tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f9);
// tessellator.draw();
// GlStateManager.glNormal3f(-f10, 0.0F, 0.0F);
// tessellator.startDrawingQuads();
// tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f8);
// tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f8);
// tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f9);
// tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f9);
// tessellator.draw();
GlStateManager.scale(.25f, .25f, .25f);
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(0, .0, -.25).tex(5 / 32d, 10 / 32d).endVertex();
worldrenderer.pos(0, .0, .25).tex(0 / 32d, 10 / 32d).endVertex();
worldrenderer.pos(0, .5, .25).tex(0 / 32d, 5 / 32d).endVertex();
worldrenderer.pos(0, .5, -.25).tex(5 / 32d, 5 / 32d).endVertex();
tessellator.draw();
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(.375, .125, 0).tex(8 / 32d, 5 / 32d).endVertex();
worldrenderer.pos(0, .125, 0).tex(0 / 32d, 5 / 32d).endVertex();
worldrenderer.pos(0, .375, 0).tex(0 / 32d, 0 / 32d).endVertex();
worldrenderer.pos(.375, .375, 0).tex(8 / 32d, 0 / 32d).endVertex();
tessellator.draw();
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(.375, .25, -.25).tex(8 / 32d, 5 / 32d).endVertex();
worldrenderer.pos(0, .25, -.25).tex(0 / 32d, 5 / 32d).endVertex();
worldrenderer.pos(0, .25, .25).tex(0 / 32d, 0 / 32d).endVertex();
worldrenderer.pos(.375, .25, .25).tex(8 / 32d, 0 / 32d).endVertex();
tessellator.draw();
GlStateManager.enableCull();
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
}
use of net.minecraft.client.renderer.VertexBuffer in project ImmersiveEngineering by BluSunrize.
the class TileRenderImmersiveConnectable method renderTileEntityAt.
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTicks, int destroyStage) {
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
// tes.draw();
if (te instanceof IImmersiveConnectable && te.getWorld() != null) {
Set<Connection> outputs = ImmersiveNetHandler.INSTANCE.getConnections(te.getWorld(), Utils.toCC(te));
if (outputs != null) {
VertexBuffer worldrenderer = ClientUtils.tes().getBuffer();
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
// GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
// GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
GlStateManager.disableLighting();
GlStateManager.disableCull();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
Iterator<Connection> itCon = outputs.iterator();
while (itCon.hasNext()) {
Connection con = itCon.next();
TileEntity tileEnd = te.getWorld().getTileEntity(con.end);
if (tileEnd instanceof IImmersiveConnectable) {
ClientUtils.tessellateConnection(con, (IImmersiveConnectable) te, ApiUtils.toIIC(tileEnd, te.getWorld()), con.cableType.getIcon(con));
}
}
GlStateManager.enableLighting();
GlStateManager.enableTexture2D();
ClientUtils.tes().draw();
}
}
GlStateManager.popMatrix();
}
use of net.minecraft.client.renderer.VertexBuffer in project ImmersiveEngineering by BluSunrize.
the class TileRenderTeslaCoil method drawAnimation.
public static void drawAnimation(LightningAnimation animation, double tileX, double tileY, double tileZ, float[] rgba, float lineWidth) {
GlStateManager.color(rgba[0], rgba[1], rgba[2], rgba[3]);
GL11.glLineWidth(lineWidth);
Tessellator tes = ClientUtils.tes();
VertexBuffer worldrenderer = tes.getBuffer();
worldrenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
List<Vec3d> subs = animation.subPoints;
worldrenderer.pos(animation.startPos.xCoord - tileX, animation.startPos.yCoord - tileY, animation.startPos.zCoord - tileZ).endVertex();
for (int i = 0; i < subs.size(); i++) worldrenderer.pos(subs.get(i).xCoord - tileX, subs.get(i).yCoord - tileY, subs.get(i).zCoord - tileZ).endVertex();
Vec3d end = (animation.targetEntity != null ? animation.targetEntity.getPositionVector() : animation.targetPos).addVector(-tileX, -tileY, -tileZ);
worldrenderer.pos(end.xCoord, end.yCoord, end.zCoord).endVertex();
tes.draw();
}
use of net.minecraft.client.renderer.VertexBuffer in project ConvenientAdditions by Necr0.
the class Slider method drawGradientRect.
public void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor) {
float f = (float) (startColor >> 24 & 255) / 255.0F;
float f1 = (float) (startColor >> 16 & 255) / 255.0F;
float f2 = (float) (startColor >> 8 & 255) / 255.0F;
float f3 = (float) (startColor & 255) / 255.0F;
float f4 = (float) (endColor >> 24 & 255) / 255.0F;
float f5 = (float) (endColor >> 16 & 255) / 255.0F;
float f6 = (float) (endColor >> 8 & 255) / 255.0F;
float f7 = (float) (endColor & 255) / 255.0F;
GlStateManager.disableTexture2D();
GlStateManager.enableBlend();
GlStateManager.disableAlpha();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.shadeModel(7425);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
vertexbuffer.pos((double) right, (double) top, 0).color(f1, f2, f3, f).endVertex();
vertexbuffer.pos((double) left, (double) top, 0).color(f1, f2, f3, f).endVertex();
vertexbuffer.pos((double) left, (double) bottom, 0).color(f5, f6, f7, f4).endVertex();
vertexbuffer.pos((double) right, (double) bottom, 0).color(f5, f6, f7, f4).endVertex();
tessellator.draw();
GlStateManager.shadeModel(7424);
GlStateManager.disableBlend();
GlStateManager.enableAlpha();
GlStateManager.enableTexture2D();
}
Aggregations