codechicken.lib.render.TextureUtils Java Examples

The following examples show how to use codechicken.lib.render.TextureUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RenderTracker.java    From WirelessRedstone with MIT License 6 votes vote down vote up
public void renderTracker(int freq)
{
    GL11.glDisable(GL11.GL_LIGHTING);

    TextureUtils.bindAtlas(0);
    CCRenderState.reset();
    CCRenderState.startDrawing(7);
    CCRenderState.setColour(0xFFFFFFFF);
    model.render(new IconTransformation(Blocks.obsidian.getIcon(0, 0)));
    CCRenderState.draw();
    
    Matrix4 pearlMat = CCModelLibrary.getRenderMatrix(
        new Vector3(0, 0.44+RedstoneEther.getSineWave(ClientUtils.getRenderTime(), 7)*0.02, 0),
        new Rotation(RedstoneEther.getRotation(ClientUtils.getRenderTime(), freq), new Vector3(0, 1, 0)),
        0.04);

    CCRenderState.changeTexture("wrcbe_core:textures/hedronmap.png");
    CCRenderState.startDrawing(4);
    CCRenderState.setColour(freq == 0 ? 0xC0C0C0FF : 0xFFFFFFFF);
    CCModelLibrary.icosahedron4.render(pearlMat);
    CCRenderState.draw();
    
    GL11.glEnable(GL11.GL_LIGHTING);
}
 
Example #2
Source File: RemoteTexManager.java    From WirelessRedstone with MIT License 6 votes vote down vote up
public static void load(TextureMap registrar)
{
    for(int i = 0; i < icons.length; i++)
        icons[i] = TextureUtils.getTextureSpecial(registrar, "wrcbe_addons:remote_"+i);
    
    texOn = TextureUtils.loadTextureColours(new ResourceLocation("wrcbe_addons", "textures/items/remoteOn.png"));
    texOff = TextureUtils.loadTextureColours(new ResourceLocation("wrcbe_addons", "textures/items/remoteOff.png"));
    texGrad = TextureUtils.loadTextureColours(new ResourceLocation("wrcbe_addons", "textures/items/remoteGrad.png"));

    for(int i = 0; i < RedstoneEther.numcolours; i++)
    {
        processTexture(RedstoneEther.colours[i], false, getIconIndex(i, false));
        processTexture(RedstoneEther.colours[i], true, getIconIndex(i, true));
    }
    processTexture(0xFFFFFFFF, false, getIconIndex(-1, false));
    processTexture(0xFFFFFFFF, true, getIconIndex(-1, true));
}
 
Example #3
Source File: CustomGradient.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
public CustomGradient(ResourceLocation textureFile)
{
    BufferedImage img = TextureUtils.loadBufferedImage(textureFile);
    if(img == null)
        throw new RuntimeException("File not found: "+textureFile.toString());

    int[] data = new int[img.getWidth()];
    img.getRGB(0, 0, img.getWidth(), 1, data, 0, img.getWidth());
    gradient = new int[img.getWidth()];
    for(int i = 0; i < data.length; i++)
        gradient[i] = (data[i]<<8)|(((data[i])>>24)&0xFF);
}
 
Example #4
Source File: TileCraftingGridRenderer.java    From Translocators with MIT License 4 votes vote down vote up
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f)
{
    TileCraftingGrid tcraft = (TileCraftingGrid)tile;
    
    TextureUtils.bindAtlas(0);
    IIcon icon = Translocator.blockCraftingGrid.gridIcon;
    Tessellator t = Tessellator.instance;
    t.setTranslation(x, y+0.001, z);
    t.startDrawingQuads();
    t.setNormal(0, 1, 0);
    t.addVertexWithUV(1, 0, 0, icon.getMinU(), icon.getMinV());
    t.addVertexWithUV(0, 0, 0, icon.getMinU(), icon.getMaxV());
    t.addVertexWithUV(0, 0, 1, icon.getMaxU(), icon.getMaxV());
    t.addVertexWithUV(1, 0, 1, icon.getMaxU(), icon.getMinV());
    t.draw();
    t.setTranslation(0, 0, 0);

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glPushMatrix();
    GL11.glTranslated(x+0.5, y, z+0.5);
    Transformation orient = Rotation.quarterRotations[tcraft.rotation];

    for(int i = 0; i < 9; i++)
    {
        ItemStack item = tcraft.items[i];
        if(item == null)
            continue;
        
        int row = i/3;
        int col = i%3;

        Vector3 pos = new Vector3((col-1)*5/16D, 0.1+0.01*Math.sin(i*1.7+ClientUtils.getRenderTime()/5), (row-1)*5/16D).apply(orient);
        GL11.glPushMatrix();
        GL11.glTranslated(pos.x, pos.y, pos.z);
        GL11.glScaled(0.5, 0.5, 0.5);

        RenderUtils.renderItemUniform(item);

        GL11.glPopMatrix();
    }
    
    if(tcraft.result != null)
    {
        GL11.glPushMatrix();
        GL11.glTranslated(0, 0.6 + 0.02 * Math.sin(ClientUtils.getRenderTime() / 10), 0);
        GL11.glScaled(0.8, 0.8, 0.8);

        RenderUtils.renderItemUniform(tcraft.result, ClientUtils.getRenderTime());
        
        GL11.glPopMatrix();
    }
    GL11.glPopMatrix();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
 
Example #5
Source File: TriangTexManager.java    From WirelessRedstone with MIT License 4 votes vote down vote up
public static void loadTextures()
{
    texRing = TextureUtils.loadTextureColours(new ResourceLocation("wrcbe_addons", "textures/items/triangRing.png"));
    texGrad = TextureUtils.loadTextureColours(new ResourceLocation("wrcbe_addons", "textures/items/triangGrad.png"));
    processTexture(-1, 0);
}