Search in sources :

Example 1 with EnumFaceDirection

use of net.minecraft.client.renderer.EnumFaceDirection in project Charset by CharsetMC.

the class ProjectorHelper method renderTexture.

public void renderTexture(IProjectorSurface surface, int uStart, int uEnd, int vStart, int vEnd) {
    double[] data = { surface.getCornerStart().y, surface.getCornerEnd().y, surface.getCornerStart().z, surface.getCornerEnd().z, surface.getCornerStart().x, surface.getCornerEnd().x };
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder worldrenderer = tessellator.getBuffer();
    float[] uvValues = surface.createUvArray(uStart, uEnd, vStart, vEnd);
    worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    EnumFaceDirection efd = EnumFaceDirection.getFacing(surface.getScreenFacing());
    for (int i = 0; i < 4; i++) {
        EnumFaceDirection.VertexInformation vi = efd.getVertexInformation(i);
        worldrenderer.pos(data[vi.xIndex], data[vi.yIndex], data[vi.zIndex]).tex(uvValues[i * 2], uvValues[i * 2 + 1]).endVertex();
    }
    tessellator.draw();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) EnumFaceDirection(net.minecraft.client.renderer.EnumFaceDirection)

Aggregations

BufferBuilder (net.minecraft.client.renderer.BufferBuilder)1 EnumFaceDirection (net.minecraft.client.renderer.EnumFaceDirection)1 Tessellator (net.minecraft.client.renderer.Tessellator)1