use of codechicken.lib.vec.Transformation in project BluePower by Qmunity.
the class SawRenderFMP method renderItem.
@Override
public void renderItem(ItemRenderType renderType, ItemStack item, Object... data) {
double pi = Math.PI;
Transformation t;
switch(renderType) {
case INVENTORY:
t = new TransformationList(new Scale(1.8), new Translation(0, 0, -0.6), new Rotation(-pi / 4, 1, 0, 0), new Rotation(pi * 3 / 4, 0, 1, 0));
break;
case ENTITY:
t = new TransformationList(new Scale(1), new Translation(0, 0, -0.25), new Rotation(-pi / 4, 1, 0, 0));
break;
case EQUIPPED_FIRST_PERSON:
t = new TransformationList(new Scale(1.5), new Rotation(-pi / 3, 1, 0, 0), new Rotation(pi * 3 / 4, 0, 1, 0), new Translation(0.5, 0.5, 0.5));
break;
case EQUIPPED:
t = new TransformationList(new Scale(1.5), new Rotation(-pi / 5, 1, 0, 0), new Rotation(-pi * 3 / 4, 0, 1, 0), new Translation(0.75, 0.5, 0.75));
break;
default:
t = null;
break;
}
CCRenderState.reset();
CCRenderState.useNormals = true;
CCRenderState.pullLightmap();
CCRenderState.changeTexture("microblock:textures/items/saw.png");
CCRenderState.startDrawing();
handle.render(t);
holder.render(t);
CCRenderState.draw();
GL11.glDisable(GL11.GL_CULL_FACE);
CCRenderState.changeTexture(Refs.MODID + ":textures/items/fmpsaw.png");
CCRenderState.startDrawing();
int tex = 0;
if (item.getItem() == BPItems.ruby_saw) {
tex = 0;
} else if (item.getItem() == BPItems.amethyst_saw) {
tex = 1;
} else if (item.getItem() == BPItems.sapphire_saw) {
tex = 2;
}
blade.render(t, new UVTranslation(0, tex * 4 / 64D));
CCRenderState.draw();
GL11.glEnable(GL11.GL_CULL_FACE);
}
use of codechicken.lib.vec.Transformation in project GregTech by GregTechCE.
the class GridConnection method computePosition.
private Position computePosition() {
Transformation orientation = TextureArea.createOrientation(parentElementSize, parentOrientation.rotationValue);
PositionedRect parentRect = TextureArea.transformRect(orientation, parentElementRect);
switch(getOrientation()) {
case LEFT:
return new Position(0, connectionOffset);
case RIGHT:
return new Position(parentRect.position.x + parentRect.size.width, connectionOffset);
case TOP:
return new Position(connectionOffset, 0);
case BOTTOM:
return new Position(connectionOffset, parentRect.position.y + parentRect.size.height);
default:
return Position.ORIGIN;
}
}
use of codechicken.lib.vec.Transformation in project GregTech by GregTechCE.
the class TextureArea method createOrientation.
public static Transformation createOrientation(Size areaSize, int orientation) {
Transformation transformation = new Rotation(Math.toRadians(orientation * 90.0), 0.0, 0.0, 1.0).at(new Vector3(areaSize.width / 2.0, areaSize.height / 2.0, 0.0));
Size orientedSize = transformSize(transformation, areaSize);
double offsetX = (areaSize.width - orientedSize.width) / 2.0;
double offsetY = (areaSize.height - orientedSize.height) / 2.0;
return transformation.with(new Translation(-offsetX, -offsetY, 0.0));
}
use of codechicken.lib.vec.Transformation in project GregTech by GregTechCE.
the class TextureArea method drawRotated.
@SideOnly(Side.CLIENT)
public void drawRotated(int x, int y, Size areaSize, PositionedRect positionedRect, int orientation) {
Transformation transformation = createOrientation(areaSize, orientation);
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, 0.0f);
transformation.glApply();
draw(positionedRect.position.x, positionedRect.position.y, positionedRect.size.width, positionedRect.size.height);
GlStateManager.popMatrix();
}
Aggregations