use of com.enderio.core.client.render.BoundingBox in project EnderIO by SleepyTrousers.
the class TileKillerJoe method getKillBounds.
@Nonnull
private BoundingBox getKillBounds() {
if (killBounds == NULL_AABB) {
double killerJoeAttackHeight = KillerJoeConfig.killerJoeAttackHeight.get();
double killerJoeAttackLength = KillerJoeConfig.killerJoeAttackLength.get();
double killerJoeAttackWidth = KillerJoeConfig.killerJoeAttackWidth.get();
BoundingBox bb = new BoundingBox(getLocation());
Vector3d min = bb.getMin();
Vector3d max = bb.getMax();
max.y += killerJoeAttackHeight;
min.y -= killerJoeAttackHeight;
EnumFacing facingDir = facing;
if (ForgeDirectionOffsets.isPositiveOffset(facingDir)) {
max.add(ForgeDirectionOffsets.offsetScaled(facingDir, killerJoeAttackLength));
min.add(ForgeDirectionOffsets.forDir(facingDir));
} else {
min.add(ForgeDirectionOffsets.offsetScaled(facingDir, killerJoeAttackLength));
max.add(ForgeDirectionOffsets.forDir(facingDir));
}
if (facingDir.getFrontOffsetX() == 0) {
min.x -= killerJoeAttackWidth;
max.x += killerJoeAttackWidth;
} else {
min.z -= killerJoeAttackWidth;
max.z += killerJoeAttackWidth;
}
killBounds = new BoundingBox(min.x, min.y, min.z, max.x, max.y, max.z);
}
return killBounds;
}
use of com.enderio.core.client.render.BoundingBox in project EnderIO by SleepyTrousers.
the class IoConfigRenderer method renderSelection.
private void renderSelection() {
if (selection == null) {
return;
}
BoundingBox bb = new BoundingBox(selection.config.getLocation());
TextureAtlasSprite icon = selectedFaceIcon.get(TextureAtlasSprite.class);
List<Vertex> corners = bb.getCornersWithUvForFace(selection.face, icon.getMinU(), icon.getMaxU(), icon.getMinV(), icon.getMaxV());
GlStateManager.disableDepth();
GlStateManager.disableLighting();
RenderUtil.bindBlockTexture();
BufferBuilder tes = Tessellator.getInstance().getBuffer();
GlStateManager.color(1, 1, 1);
Vector3d trans = new Vector3d((-origin.x) + eye.x, (-origin.y) + eye.y, (-origin.z) + eye.z);
tes.setTranslation(trans.x, trans.y, trans.z);
RenderUtil.addVerticesToTessellator(corners, DefaultVertexFormats.POSITION_TEX, true);
Tessellator.getInstance().draw();
tes.setTranslation(0, 0, 0);
}
use of com.enderio.core.client.render.BoundingBox in project EnderIO by SleepyTrousers.
the class DefaultConduitRenderer method renderTransmissionDynamic.
protected void renderTransmissionDynamic(IConduit conduit, TextureAtlasSprite tex, Vector4f color, CollidableComponent component, float selfIllum) {
float scaleFactor = 0.6f;
float xLen = Math.abs(component.dir.getFrontOffsetX()) == 1 ? 1 : scaleFactor;
float yLen = Math.abs(component.dir.getFrontOffsetY()) == 1 ? 1 : scaleFactor;
float zLen = Math.abs(component.dir.getFrontOffsetZ()) == 1 ? 1 : scaleFactor;
GlStateManager.color(1, 1, 1);
BoundingBox cube = component.bound;
BoundingBox bb = cube.scale(xLen, yLen, zLen);
drawDynamicSection(bb, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV(), color, component.dir, false);
}
use of com.enderio.core.client.render.BoundingBox in project EnderIO by SleepyTrousers.
the class FillGaugeBakery method mkQuads.
private void mkQuads() {
VertexRotationFacing rot = new VertexRotationFacing(face);
rot.setCenter(CENTER);
rot.setRotation(EnumFacing.NORTH);
buffer = new HalfBakedList();
final double upperBound = (connectUp ? 16 : 13) * px, lowerBound = (connectDown ? 0 : 3) * px;
final double full_out = -.5 * px, half_out = full_out / 2, quarter_out = full_out / 4, bit_in = .01 * px;
BoundingBox border1 = new BoundingBox(6 * px, lowerBound, full_out, 7 * px, upperBound, bit_in);
buffer.add(border1, EnumFacing.NORTH, 15.01 * px, 15.99 * px, lowerBound, upperBound, tex, null);
buffer.add(border1, EnumFacing.EAST, 15.01 * px, 15.49 * px, lowerBound, upperBound, tex, null);
buffer.add(border1, EnumFacing.WEST, 15.99 * px, 15.51 * px, lowerBound, upperBound, tex, null);
BoundingBox border2 = new BoundingBox(9 * px, lowerBound, full_out, 10 * px, upperBound, bit_in);
buffer.add(border2, EnumFacing.NORTH, 12.01 * px, 12.99 * px, lowerBound, upperBound, tex, null);
buffer.add(border2, EnumFacing.EAST, 12.01 * px, 12.49 * px, lowerBound, upperBound, tex, null);
buffer.add(border2, EnumFacing.WEST, 12.99 * px, 12.51 * px, lowerBound, upperBound, tex, null);
BoundingBox back = new BoundingBox(6 * px, (connectDown ? 0 : 2) * px, full_out, 10 * px, (connectUp ? 16 : 14) * px, bit_in);
buffer.add(back, EnumFacing.SOUTH, 4.01 * px, 7.99 * px, (connectDown ? 0 : 2) * px, (connectUp ? 16 : 14) * px, tex, null);
if (!connectDown) {
BoundingBox border3 = new BoundingBox(6 * px, lowerBound - 1 * px, full_out, 10 * px, 3 * px, bit_in);
buffer.add(border3, EnumFacing.NORTH, 0.005 * px, 3.995 * px, 13.01 * px, 13.99 * px, tex, null);
buffer.add(border3, EnumFacing.UP, 0.005 * px, 3.995 * px, 13.5 * px, 13.99 * px, tex, null);
buffer.add(border3, EnumFacing.DOWN, 0.005 * px, 3.995 * px, 13.5 * px, 13.99 * px, tex, null);
buffer.add(border3, EnumFacing.WEST, 3.01 * px, 3.49 * px, 13.01 * px, 13.99 * px, tex, null);
buffer.add(border3, EnumFacing.EAST, 0.99 * px, 0.51 * px, 13.01 * px, 13.99 * px, tex, null);
}
if (!connectUp) {
BoundingBox border4 = new BoundingBox(6 * px, 13 * px, full_out, 10 * px, upperBound + 1 * px, bit_in);
buffer.add(border4, EnumFacing.NORTH, 0.005 * px, 3.995 * px, 2.01 * px, 2.99 * px, tex, null);
buffer.add(border4, EnumFacing.UP, 0.005 * px, 3.995 * px, 2.01 * px, 2.5 * px, tex, null);
buffer.add(border4, EnumFacing.DOWN, 0.005 * px, 3.995 * px, 2.01 * px, 2.5 * px, tex, null);
buffer.add(border4, EnumFacing.WEST, 3.01 * px, 3.49 * px, 2.01 * px, 2.99 * px, tex, null);
buffer.add(border4, EnumFacing.EAST, 0.99 * px, 0.51 * px, 2.01 * px, 2.99 * px, tex, null);
}
BoundingBox bg = new BoundingBox(6.5 * px, (connectDown ? 0 : 2.5) * px, quarter_out, 9.5 * px, (connectUp ? 16 : 13.5) * px, bit_in);
buffer.add(bg, EnumFacing.NORTH, 12.5 * px, 15.5 * px, (connectDown ? 0 : 2.5) * px, (connectUp ? 16 : 13.5) * px, tex, null);
buffer.transform(rot);
if (localFillLevel > 0.001) {
BoundingBox fg = new BoundingBox(6.5 * px, (connectDown ? 0 : 2.99) * px, half_out, 9.5 * px, localFillLevel * px, bit_in);
litBuffer = new HalfBakedList();
litBuffer.add(fg, EnumFacing.NORTH, 8.55 * px, 11.45 * px, (connectDown ? 0 : 2.99) * px, localFillLevel * px, tex, null);
litBuffer.transform(rot);
}
}
use of com.enderio.core.client.render.BoundingBox in project EnderIO by SleepyTrousers.
the class KillerJoeRenderMapper method renderHead.
private List<BakedQuad> renderHead(@Nullable IBlockStateWrapper state) {
EnumFacing facing = EnumFacing.NORTH;
if (state != null) {
TileEntity tileEntity = state.getTileEntity();
if (tileEntity instanceof AbstractMachineEntity) {
facing = ((AbstractMachineEntity) tileEntity).getFacing();
if (facing.getAxis() == EnumFacing.Axis.X) {
facing = facing.getOpposite();
}
}
}
VertexRotationFacing rot = new VertexRotationFacing(EnumFacing.NORTH);
rot.setCenter(CENTER);
rot.setRotation(facing);
BoundingBox bb = new BoundingBox(4 * px, 4 * px, 4 * px, 12 * px, 12 * px, 12 * px);
VertexTransform sca = new VertexScale(.9, .9, .9, CENTER);
VertexTransform rotx = new VertexRotation(0.03054326, new Vector3d(1, 0, 0), CENTER);
VertexTransform roty = new VertexRotation(0.17453290, new Vector3d(0, 1, 0), CENTER);
VertexTransform rotz = new VertexRotation(0.23928460, new Vector3d(0, 0, 1), CENTER);
VertexTransform mov = new VertexTranslation(0.25 * px, -1 * px, 0);
TextureAtlasSprite tex1 = head1.get(TextureAtlasSprite.class);
TextureAtlasSprite tex2 = head2.get(TextureAtlasSprite.class);
HalfBakedList buffer = new HalfBakedList();
buffer.add(bb, EnumFacing.NORTH, 0f, .5f, 0f, .5f, tex1, null);
buffer.add(bb, EnumFacing.EAST, .5f, 1f, 0f, .5f, tex1, null);
buffer.add(bb, EnumFacing.SOUTH, 0f, .5f, .5f, 1f, tex1, null);
buffer.add(bb, EnumFacing.WEST, .5f, 1f, .5f, 1f, tex1, null);
buffer.add(bb, EnumFacing.UP, 0f, .5f, 0f, .5f, tex2, null);
buffer.add(bb, EnumFacing.DOWN, .5f, 1f, 0f, .5f, tex2, null);
List<BakedQuad> quads = new ArrayList<BakedQuad>();
buffer.bake(quads, sca, rotx, roty, rotz, mov, rot);
for (double angle : ROTS) {
buffer = new HalfBakedList();
BoundingBox bb1 = new BoundingBox(4.5 * px, 10.5 * px, 3 * px, 5.5 * px, 11.5 * px, 4 * px);
BoundingBox bb2 = new BoundingBox(7.5 * px, 9.5 * px, 3 * px, 8.5 * px, 10.5 * px, 4 * px);
BoundingBox bb3 = new BoundingBox(10.5 * px, 10.5 * px, 3 * px, 11.5 * px, 11.5 * px, 4 * px);
for (EnumFacing face : EnumFacing.values()) {
buffer.add(bb1, face, (face.ordinal() + 1) * px, (face.ordinal() + 2) * px, 9 * px, 10 * px, tex2, null);
buffer.add(bb2, face, (face.ordinal() + 1) * px, (face.ordinal() + 2) * px, 10 * px, 11 * px, tex2, null);
buffer.add(bb3, face, (face.ordinal() + 1) * px, (face.ordinal() + 2) * px, 11 * px, 12 * px, tex2, null);
}
VertexTransform rota = new VertexRotation(angle, new Vector3d(0, 1, 0), CENTER);
buffer.bake(quads, sca, rota, rotx, roty, rotz, mov, rot);
}
return quads;
}
Aggregations