use of net.minecraft.client.renderer.BufferBuilder in project SomeModjam5Mod by HellFirePvP.
the class RenderingUtils method renderTexturedCubeCentral.
public static void renderTexturedCubeCentral(Vector3 offset, double size, double u, double v, double uLength, double vLength) {
Tessellator tes = Tessellator.getInstance();
BufferBuilder vb = tes.getBuffer();
double half = size / 2D;
vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
vb.pos(offset.getX() - half, offset.getY() - half, offset.getZ() - half).tex(u, v).endVertex();
vb.pos(offset.getX() + half, offset.getY() - half, offset.getZ() - half).tex(u + uLength, v).endVertex();
vb.pos(offset.getX() + half, offset.getY() - half, offset.getZ() + half).tex(u + uLength, v + vLength).endVertex();
vb.pos(offset.getX() - half, offset.getY() - half, offset.getZ() + half).tex(u, v + vLength).endVertex();
vb.pos(offset.getX() - half, offset.getY() + half, offset.getZ() + half).tex(u, v).endVertex();
vb.pos(offset.getX() + half, offset.getY() + half, offset.getZ() + half).tex(u + uLength, v).endVertex();
vb.pos(offset.getX() + half, offset.getY() + half, offset.getZ() - half).tex(u + uLength, v + vLength).endVertex();
vb.pos(offset.getX() - half, offset.getY() + half, offset.getZ() - half).tex(u, v + vLength).endVertex();
vb.pos(offset.getX() - half, offset.getY() - half, offset.getZ() + half).tex(u + uLength, v).endVertex();
vb.pos(offset.getX() - half, offset.getY() + half, offset.getZ() + half).tex(u + uLength, v + vLength).endVertex();
vb.pos(offset.getX() - half, offset.getY() + half, offset.getZ() - half).tex(u, v + vLength).endVertex();
vb.pos(offset.getX() - half, offset.getY() - half, offset.getZ() - half).tex(u, v).endVertex();
vb.pos(offset.getX() + half, offset.getY() - half, offset.getZ() - half).tex(u + uLength, v).endVertex();
vb.pos(offset.getX() + half, offset.getY() + half, offset.getZ() - half).tex(u + uLength, v + vLength).endVertex();
vb.pos(offset.getX() + half, offset.getY() + half, offset.getZ() + half).tex(u, v + vLength).endVertex();
vb.pos(offset.getX() + half, offset.getY() - half, offset.getZ() + half).tex(u, v).endVertex();
vb.pos(offset.getX() + half, offset.getY() - half, offset.getZ() - half).tex(u, v).endVertex();
vb.pos(offset.getX() + half, offset.getY() + half, offset.getZ() - half).tex(u, v + vLength).endVertex();
vb.pos(offset.getX() - half, offset.getY() + half, offset.getZ() - half).tex(u + uLength, v + vLength).endVertex();
vb.pos(offset.getX() - half, offset.getY() - half, offset.getZ() - half).tex(u + uLength, v).endVertex();
vb.pos(offset.getX() - half, offset.getY() - half, offset.getZ() + half).tex(u, v).endVertex();
vb.pos(offset.getX() - half, offset.getY() + half, offset.getZ() + half).tex(u, v + vLength).endVertex();
vb.pos(offset.getX() + half, offset.getY() + half, offset.getZ() + half).tex(u + uLength, v + vLength).endVertex();
vb.pos(offset.getX() + half, offset.getY() - half, offset.getZ() + half).tex(u + uLength, v).endVertex();
tes.draw();
}
use of net.minecraft.client.renderer.BufferBuilder in project EnderIO by SleepyTrousers.
the class ConduitBundleRenderer method render.
// TESR rendering
@Override
public void render(@Nonnull TileConduitBundle te, double x, double y, double z, float partialTick, int b, float alpha) {
IConduitBundle bundle = te;
EntityPlayerSP player = Minecraft.getMinecraft().player;
if (bundle.hasFacade() && bundle.getPaintSource().isOpaqueCube() && !YetaUtil.isFacadeHidden(bundle, player)) {
return;
}
float brightness = -1;
boolean hasDynamic = false;
for (IClientConduit c : bundle.getClientConduits()) {
// TODO Temporary work around
IClientConduit.WithDefaultRendering con = (IClientConduit.WithDefaultRendering) c;
if (YetaUtil.renderConduit(player, con)) {
IConduitRenderer renderer = getRendererForConduit(con);
if (renderer.isDynamic()) {
if (!hasDynamic) {
hasDynamic = true;
BlockPos loc = bundle.getLocation();
brightness = bundle.getEntity().getWorld().getLightFor(EnumSkyBlock.SKY, loc);
RenderUtil.setupLightmapCoords(te.getPos(), te.getWorld());
RenderUtil.bindBlockTexture();
GlStateManager.enableNormalize();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.shadeModel(GL11.GL_SMOOTH);
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder tes = tessellator.getBuffer();
tes.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
}
renderer.renderDynamicEntity(this, bundle, con, x, y, z, partialTick, brightness);
}
}
}
if (hasDynamic) {
Tessellator.getInstance().draw();
GlStateManager.disableNormalize();
GlStateManager.disableBlend();
GlStateManager.shadeModel(GL11.GL_FLAT);
GlStateManager.popMatrix();
}
}
use of net.minecraft.client.renderer.BufferBuilder in project EnderIO by SleepyTrousers.
the class TESRPowerMonitor method renderTileEntity.
@Override
protected void renderTileEntity(@Nonnull TilePowerMonitor te, @Nonnull IBlockState blockState, float partialTicks, int destroyStage) {
boolean isPainted = te.getPaintSource() != null;
VertexRotationFacing xform = new VertexRotationFacing(te.getFacing());
xform.setCenter(new Vector3d(0.5, 0.5, 0.5));
xform.setRotation(EnumFacing.SOUTH);
te.bindTexture();
Helper helper = threadLocalHelper.get();
BufferBuilder tes = Tessellator.getInstance().getBuffer();
tes.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);
if (isPainted) {
helper.setupVertices(bb2, xform);
helper.renderSingleFace(tes, EnumFacing.SOUTH, 0 * px, 14 * px, 0 * px, 14 * px, xform, Helper.stdBrightness, false);
} else {
helper.setupVertices(bb1, xform);
helper.renderSingleFace(tes, EnumFacing.SOUTH, 1 * px, 15 * px, 1 * px, 15 * px, xform, Helper.stdBrightness, false);
}
Tessellator.getInstance().draw();
}
use of net.minecraft.client.renderer.BufferBuilder in project EnderIO by SleepyTrousers.
the class FillGaugeBakery method render.
public void render() {
if (canRender()) {
int i = world.getCombinedLight(pos.offset(face), 0);
int j = i % 65536;
int k = i / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
BufferBuilder tes = Tessellator.getInstance().getBuffer();
tes.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);
buffer.render(tes);
if (litBuffer != null) {
litBuffer.render(tes);
}
Tessellator.getInstance().draw();
}
}
use of net.minecraft.client.renderer.BufferBuilder in project RFTools by McJty.
the class MatterBeamerRenderer method render.
@Override
public void render(MatterBeamerTileEntity tileEntity, double x, double y, double z, float time, int destroyStage, float alpha) {
ResourceLocation txt;
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
BlockPos destination = tileEntity.getDestination();
if (destination != null) {
if (tileEntity.isPowered()) {
GlStateManager.pushMatrix();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
GlStateManager.depthMask(false);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_ONE, GL11.GL_ONE);
Minecraft mc = Minecraft.getMinecraft();
EntityPlayerSP p = mc.player;
double doubleX = p.lastTickPosX + (p.posX - p.lastTickPosX) * time;
double doubleY = p.lastTickPosY + (p.posY - p.lastTickPosY) * time;
double doubleZ = p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * time;
RenderHelper.Vector start = new RenderHelper.Vector(tileEntity.getPos().getX() + .5f, tileEntity.getPos().getY() + .5f, tileEntity.getPos().getZ() + .5f);
RenderHelper.Vector end = new RenderHelper.Vector(destination.getX() + .5f, destination.getY() + .5f, destination.getZ() + .5f);
RenderHelper.Vector player = new RenderHelper.Vector((float) doubleX, (float) doubleY + p.getEyeHeight(), (float) doubleZ);
GlStateManager.translate(-doubleX, -doubleY, -doubleZ);
this.bindTexture(redglow);
RenderHelper.drawBeam(start, end, player, tileEntity.isGlowing() ? .1f : .05f);
tessellator.draw();
GlStateManager.popMatrix();
}
}
BlockPos coord = tileEntity.getPos();
if (coord.equals(RFTools.instance.clientInfo.getSelectedTE())) {
txt = redglow;
} else if (coord.equals(RFTools.instance.clientInfo.getDestinationTE())) {
txt = blueglow;
} else {
txt = null;
}
if (txt != null) {
this.bindTexture(txt);
RenderGlowEffect.renderGlow(tessellator, x, y, z);
}
}
Aggregations