Search in sources :

Example 1 with Transformation

use of uk.co.qmunity.lib.transform.Transformation in project BluePower by Qmunity.

the class GateBase method renderStatic.

@Override
@SideOnly(Side.CLIENT)
public boolean renderStatic(Vec3i translation, RenderHelper renderer, RenderBlocks renderBlocks, int pass) {
    Transformation t = null;
    if (getFace() == ForgeDirection.UP)
        t = new Rotation(180, 180, 0, Vec3d.center);
    if (getFace() == ForgeDirection.NORTH)
        t = new Rotation(90, 0, 0, Vec3d.center);
    if (getFace() == ForgeDirection.SOUTH)
        t = new Rotation(-90, 0, 0, Vec3d.center);
    if (getFace() == ForgeDirection.WEST)
        t = new Rotation(0, 0, -90, Vec3d.center);
    if (getFace() == ForgeDirection.EAST)
        t = new Rotation(0, 0, 90, Vec3d.center);
    if (t != null)
        renderer.addTransformation(t);
    int rotation = getRotation();
    if (rotation != -1)
        renderer.addTransformation(new Rotation(0, 90 * -rotation, 0));
    renderer.renderBox(BOX, getIcon(ForgeDirection.DOWN), getIcon(ForgeDirection.UP), getIcon(ForgeDirection.WEST), getIcon(ForgeDirection.EAST), getIcon(ForgeDirection.NORTH), getIcon(ForgeDirection.SOUTH));
    for (IGateComponent c : getComponents()) c.renderStatic(translation, renderer, pass);
    return true;
}
Also used : Transformation(uk.co.qmunity.lib.transform.Transformation) IGateComponent(com.bluepowermod.api.gate.IGateComponent) Rotation(uk.co.qmunity.lib.transform.Rotation) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 2 with Transformation

use of uk.co.qmunity.lib.transform.Transformation in project BluePower by Qmunity.

the class GateComponentCubes method onLayoutRefresh.

@Override
public void onLayoutRefresh() {
    if (layoutColor == -1)
        return;
    cubes.clear();
    double height = getHeight();
    double scale = 1D / getGate().getLayout().getLayout(layoutColor).getWidth();
    Transformation transformation = new Scale(scale, 1, scale);
    for (Rectangle r : getGate().getLayout().getSimplifiedLayout(layoutColor).getRectangles()) cubes.add(new Vec2dRect(r).extrude(height).transform(transformation).add(-0.5 + 1 / 64D, 2 / 16D, -0.5 + 1 / 64D));
}
Also used : Transformation(uk.co.qmunity.lib.transform.Transformation) Rectangle(java.awt.Rectangle) Scale(uk.co.qmunity.lib.transform.Scale) Vec2dRect(uk.co.qmunity.lib.vec.Vec2dRect)

Aggregations

Transformation (uk.co.qmunity.lib.transform.Transformation)2 IGateComponent (com.bluepowermod.api.gate.IGateComponent)1 SideOnly (cpw.mods.fml.relauncher.SideOnly)1 Rectangle (java.awt.Rectangle)1 Rotation (uk.co.qmunity.lib.transform.Rotation)1 Scale (uk.co.qmunity.lib.transform.Scale)1 Vec2dRect (uk.co.qmunity.lib.vec.Vec2dRect)1