use of uk.co.qmunity.lib.vec.Vec3dCube in project BluePower by Qmunity.
the class PartWireFreestanding method renderFrame.
protected void renderFrame(RenderHelper helper, double wireSize, double frameSeparation, double frameThickness, boolean down, boolean up, boolean west, boolean east, boolean north, boolean south, boolean sideDown, boolean sideUp, boolean sideWest, boolean sideEast, boolean sideNorth, boolean sideSouth, boolean isInWorld, IIcon texture, int color) {
helper.setColor(color);
for (Vec3dCube box : getFrameBoxes(wireSize, frameSeparation, frameThickness, down, up, west, east, north, south, sideDown, sideUp, sideWest, sideEast, sideNorth, sideSouth, isInWorld)) helper.renderBox(box, texture);
helper.setColor(0xFFFFFF);
}
use of uk.co.qmunity.lib.vec.Vec3dCube in project BluePower by Qmunity.
the class PartWireFreestanding method renderStatic.
@Override
@SideOnly(Side.CLIENT)
public boolean renderStatic(Vec3i translation, RenderHelper renderer, RenderBlocks renderBlocks, int pass) {
double wireSize = getSize() / 16D;
double frameSeparation = 4 / 16D - (wireSize - 2 / 16D);
double frameThickness = 1 / 16D;
int color = getColorMultiplier();
boolean isInWorld = getParent() != null;
boolean down = shouldRenderConnection(ForgeDirection.DOWN);
boolean up = shouldRenderConnection(ForgeDirection.UP);
boolean north = shouldRenderConnection(ForgeDirection.NORTH);
boolean south = shouldRenderConnection(ForgeDirection.SOUTH);
boolean west = shouldRenderConnection(ForgeDirection.WEST);
boolean east = shouldRenderConnection(ForgeDirection.EAST);
renderer.setColor(color);
// Wire
renderer.renderBox(new Vec3dCube(0.5 - (wireSize / 2), 0.5 - (wireSize / 2), 0.5 - (wireSize / 2), 0.5 + (wireSize / 2), 0.5 + (wireSize / 2), 0.5 + (wireSize / 2)), getIcons(ForgeDirection.UNKNOWN));
if (up || !isInWorld)
renderer.renderBox(new Vec3dCube(0.5 - (wireSize / 2), 0.5 + (wireSize / 2), 0.5 - (wireSize / 2), 0.5 + (wireSize / 2), 1, 0.5 + (wireSize / 2)), getIcons(ForgeDirection.UP));
if (down || !isInWorld)
renderer.renderBox(new Vec3dCube(0.5 - (wireSize / 2), 0, 0.5 - (wireSize / 2), 0.5 + (wireSize / 2), 0.5 - (wireSize / 2), 0.5 + (wireSize / 2)), getIcons(ForgeDirection.DOWN));
if (north || !isInWorld)
renderer.renderBox(new Vec3dCube(0.5 - (wireSize / 2), 0.5 - (wireSize / 2), 0, 0.5 + (wireSize / 2), 0.5 + (wireSize / 2), 0.5 - (wireSize / 2)), getIcons(ForgeDirection.NORTH));
if (south || !isInWorld)
renderer.renderBox(new Vec3dCube(0.5 - (wireSize / 2), 0.5 - (wireSize / 2), 0.5 + (wireSize / 2), 0.5 + (wireSize / 2), 0.5 + (wireSize / 2), 1), getIcons(ForgeDirection.SOUTH));
if (west || !isInWorld)
renderer.renderBox(new Vec3dCube(0, 0.5 - (wireSize / 2), 0.5 - (wireSize / 2), 0.5 - (wireSize / 2), 0.5 + (wireSize / 2), 0.5 + (wireSize / 2)), getIcons(ForgeDirection.WEST));
if (east || !isInWorld)
renderer.renderBox(new Vec3dCube(0.5 + (wireSize / 2), 0.5 - (wireSize / 2), 0.5 - (wireSize / 2), 1, 0.5 + (wireSize / 2), 0.5 + (wireSize / 2)), getIcons(ForgeDirection.EAST));
renderer.setColor(getFrameColorMultiplier());
// Frame
renderFrame(renderer, wireSize, frameSeparation, frameThickness, down, up, west, east, north, south, isInWorld, getFrameIcon(), getFrameColorMultiplier());
return true;
}
use of uk.co.qmunity.lib.vec.Vec3dCube in project BluePower by Qmunity.
the class PartRedwireFace method getOcclusionBoxes.
@Override
public List<Vec3dCube> getOcclusionBoxes() {
List<Vec3dCube> boxes = new ArrayList<Vec3dCube>();
double h = getHeight() / 16D;
double d = 4 / 16D;
boxes.add(new Vec3dCube(d, 0, d, 1 - d, h, 1 - d));
VectorHelper.rotateBoxes(boxes, getFace(), 0);
return boxes;
}
use of uk.co.qmunity.lib.vec.Vec3dCube in project BluePower by Qmunity.
the class RenderLamp method renderTileEntityAt.
/******* TESR ***********/
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
if (!(te.getBlockType() instanceof BlockLamp))
return;
if (pass != 0) {
BlockLamp bLamp = (BlockLamp) te.getBlockType();
int power = ((TileLamp) te).getPower();
int color = bLamp.getColor(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord);
int redMask = 0xFF0000, greenMask = 0xFF00, blueMask = 0xFF;
int r = (color & redMask) >> 16;
int g = (color & greenMask) >> 8;
int b = (color & blueMask);
if (bLamp.isInverted()) {
power = 15 - power;
}
// power = 15;
Vec3i vector = new Vec3i(te);
Vec3dCube box = new Vec3dCube(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5).expand(0.8 / 16D);
boolean[] renderFaces = new boolean[] { true, true, true, true, true, true };
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
Vec3i v = vector.getRelative(d);
Block bl = v.getBlock();
if (bl instanceof BlockLamp && ((BlockLamp) bl).getPower(v.getWorld(), v.getX(), v.getY(), v.getZ()) > 0) {
if (d.offsetX < 0) {
box.getMin().setX(-0.5);
renderFaces[2] = false;
} else if (d.offsetY < 0) {
box.getMin().setY(-0.5);
renderFaces[1] = false;
} else if (d.offsetZ < 0) {
box.getMin().setZ(-0.5);
renderFaces[4] = false;
} else if (d.offsetX > 0) {
box.getMax().setX(0.5);
renderFaces[3] = false;
} else if (d.offsetY > 0) {
box.getMax().setY(0.5);
renderFaces[0] = false;
} else if (d.offsetZ > 0) {
box.getMax().setZ(0.5);
renderFaces[5] = false;
}
}
}
box.getMin().add(0.5, 0.5, 0.5);
box.getMax().add(0.5, 0.5, 0.5);
GL11.glTranslated(x, y, z);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
// GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glBegin(GL11.GL_QUADS);
double powerDivision = power / 18D;
com.bluepowermod.client.render.RenderHelper.drawColoredCube(box, r / 256D, g / 256D, b / 256D, powerDivision * 0.625D, renderFaces);
GL11.glEnd();
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
GL11.glDisable(GL11.GL_BLEND);
GL11.glTranslated(-x, -y, -z);
}
}
use of uk.co.qmunity.lib.vec.Vec3dCube in project BluePower by Qmunity.
the class RenderCircuitTile method renderItem.
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
boolean blend = GL11.glGetBoolean(GL11.GL_BLEND);
boolean alpha = GL11.glGetBoolean(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glPushMatrix();
{
switch(type) {
case ENTITY:
GL11.glTranslated(-0.5, 0, -0.5);
break;
case EQUIPPED:
GL11.glTranslated(-0.375, 0.5, -0.125);
GL11.glScaled(1.5, 1.5, 1.5);
break;
case EQUIPPED_FIRST_PERSON:
GL11.glTranslated(-0.375, 0.75, -0.125);
GL11.glScaled(1.5, 1.5, 1.5);
break;
case INVENTORY:
GL11.glTranslated(0, 0.4, 0);
GL11.glScaled(1.75, 1.75, 1.75);
break;
default:
break;
}
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
Tessellator.instance.startDrawingQuads();
RenderHelper rh = RenderHelper.instance;
rh.renderBox(new Vec3dCube(4 / 16D, 0, 4 / 16D, 12 / 16D, 2 / 16D, 12 / 16D), Blocks.stone_slab.getIcon(0, 0));
rh.reset();
Tessellator.instance.draw();
double wireHeight = 1 / 32D;
double wireWidth = 1.5 / 16D;
double bundledHeight = 4 / 32D;
double bundledWidth = 6 / 16D;
IIcon wireTexture = IconSupplier.wire;
// Bluestone tiles
rh.setColor(WireHelper.getColorForPowerLevel(RedwireType.BLUESTONE, (byte) (255 / 2)));
if (item.getItem() == BPItems.bluestone_cathode_tile) {
com.bluepowermod.client.render.RenderHelper.renderDigitalRedstoneTorch(0, 0, 0, 13 / 16D, true);
Tessellator.instance.startDrawingQuads();
rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 7 / 16D), wireTexture);
Tessellator.instance.draw();
}
if (item.getItem() == BPItems.bluestone_pointer_tile) {
com.bluepowermod.client.render.RenderHelper.renderDigitalRedstoneTorch(0, 0, 0, 13 / 16D, true);
GL11.glPushMatrix();
GL11.glTranslated(0.5, 0, 0.5);
GL11.glScaled(0.875, 1, 0.875);
GL11.glTranslated(-0.5, 0, -0.5);
com.bluepowermod.client.render.RenderHelper.renderPointer(0, 3 / 16D, 0, 0.25);
GL11.glPopMatrix();
Tessellator.instance.startDrawingQuads();
rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 7 / 16D), wireTexture);
Tessellator.instance.draw();
}
if (item.getItem() == BPItems.bluestone_anode_tile) {
Tessellator.instance.startDrawingQuads();
rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 7.5 / 16D), wireTexture);
rh.renderBox(new Vec3dCube(4 / 16D, 2 / 16D, 0.5 - (wireWidth / 2), 12 / 16D, 2 / 16D + wireHeight, 0.5 + (wireWidth / 2)), wireTexture);
Tessellator.instance.draw();
}
if (item.getItem() == BPItems.bluestone_wire_tile) {
Tessellator.instance.startDrawingQuads();
rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 12 / 16D), wireTexture);
Tessellator.instance.draw();
}
// Redstone tiles
rh.setColor(WireHelper.getColorForPowerLevel(RedwireType.RED_ALLOY, (byte) (255 / 2)));
if (item.getItem() == BPItems.redstone_cathode_tile) {
com.bluepowermod.client.render.RenderHelper.renderAnalogRedstoneTorch(0, 0, 0, 13 / 16D, true);
Tessellator.instance.startDrawingQuads();
rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 7 / 16D), wireTexture);
Tessellator.instance.draw();
}
if (item.getItem() == BPItems.redstone_pointer_tile) {
com.bluepowermod.client.render.RenderHelper.renderAnalogRedstoneTorch(0, 0, 0, 13 / 16D, true);
GL11.glPushMatrix();
GL11.glTranslated(0.5, 0, 0.5);
GL11.glScaled(0.875, 1, 0.875);
GL11.glTranslated(-0.5, 0, -0.5);
com.bluepowermod.client.render.RenderHelper.renderPointer(0, 3 / 16D, 0, 0.25);
GL11.glPopMatrix();
Tessellator.instance.startDrawingQuads();
rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 7 / 16D), wireTexture);
Tessellator.instance.draw();
}
if (item.getItem() == BPItems.redstone_anode_tile) {
Tessellator.instance.startDrawingQuads();
rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 7.5 / 16D), wireTexture);
rh.renderBox(new Vec3dCube(4 / 16D, 2 / 16D, 0.5 - (wireWidth / 2), 12 / 16D, 2 / 16D + wireHeight, 0.5 + (wireWidth / 2)), wireTexture);
Tessellator.instance.draw();
}
if (item.getItem() == BPItems.redstone_wire_tile) {
Tessellator.instance.startDrawingQuads();
rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 12 / 16D), wireTexture);
Tessellator.instance.draw();
}
rh.setColor(0xFFFFFF);
if (item.getItem() == BPItems.stone_bundle) {
GL11.glPushMatrix();
{
GL11.glTranslated(0.5, 0, 0.5);
GL11.glScaled(0.5, 0.5, 0.5);
GL11.glTranslated(-0.5, 0.125, -0.5);
Tessellator.instance.startDrawingQuads();
rh.renderBox(new Vec3dCube(0.5 - (bundledWidth / 2), 2 / 16D, 0, 0.5 + (bundledWidth / 2), 2 / 16D + bundledHeight, 1), null, IconSupplier.wireBundledStraight1, IconSupplier.wireBundledSide1, IconSupplier.wireBundledSide2, IconSupplier.wireBundledConnection, IconSupplier.wireBundledConnection);
Tessellator.instance.draw();
}
GL11.glPopMatrix();
}
// Misc renderers
rh.setColor(0xFFFFFF);
rh.addTransformation(new Translation(0.375, 0, 0.375));
Tessellator.instance.startDrawingQuads();
if (item.getItem() == BPItems.quartz_resonator_tile) {
new GateComponentQuartzResonator(null, -1).renderStatic(new Vec3i(0, 0, 0), rh, 0);
}
if (item.getItem() == BPItems.silicon_chip_tile) {
new GateComponentSiliconChip(null, -1).setState(true).renderStatic(new Vec3i(0, 0, 0), rh, 0);
}
if (item.getItem() == BPItems.tainted_silicon_chip_tile) {
new GateComponentTaintedSiliconChip(null, -1).setState(true).renderStatic(new Vec3i(0, 0, 0), rh, 0);
}
Tessellator.instance.draw();
rh.reset();
}
GL11.glPopMatrix();
if (!blend)
GL11.glDisable(GL11.GL_BLEND);
if (!alpha)
GL11.glDisable(GL11.GL_ALPHA_TEST);
}
Aggregations