當前位置: 首頁>>代碼示例>>Java>>正文


Java BakedQuad.getFormat方法代碼示例

本文整理匯總了Java中net.minecraft.client.renderer.block.model.BakedQuad.getFormat方法的典型用法代碼示例。如果您正苦於以下問題:Java BakedQuad.getFormat方法的具體用法?Java BakedQuad.getFormat怎麽用?Java BakedQuad.getFormat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.client.renderer.block.model.BakedQuad的用法示例。


在下文中一共展示了BakedQuad.getFormat方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: putQuadColor

import net.minecraft.client.renderer.block.model.BakedQuad; //導入方法依賴的package包/類
public static void putQuadColor(VertexBuffer renderer, BakedQuad quad, int color)
{
    float cb = color & 0xFF;
    float cg = (color >>> 8) & 0xFF;
    float cr = (color >>> 16) & 0xFF;
    float ca = (color >>> 24) & 0xFF;
    VertexFormat format = quad.getFormat();
    int size = format.getIntegerSize();
    int offset = format.getColorOffset() / 4; // assumes that color is aligned
    for(int i = 0; i < 4; i++)
    {
        int vc = quad.getVertexData()[offset + size * i];
        float vcr = vc & 0xFF;
        float vcg = (vc >>> 8) & 0xFF;
        float vcb = (vc >>> 16) & 0xFF;
        float vca = (vc >>> 24) & 0xFF;
        int ncr = Math.min(0xFF, (int)(cr * vcr / 0xFF));
        int ncg = Math.min(0xFF, (int)(cg * vcg / 0xFF));
        int ncb = Math.min(0xFF, (int)(cb * vcb / 0xFF));
        int nca = Math.min(0xFF, (int)(ca * vca / 0xFF));
        renderer.putColorRGBA(renderer.getColorIndex(4 - i), ncr, ncg, ncb, nca);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:24,代碼來源:ForgeHooksClient.java

示例2: putBakedQuad

import net.minecraft.client.renderer.block.model.BakedQuad; //導入方法依賴的package包/類
public static void putBakedQuad(IVertexConsumer consumer, BakedQuad quad)
{
    try
    {
        consumer.setTexture(quad.getSprite());
    }
    catch(AbstractMethodError e)
    {
        // catch missing method errors caused by change to IVertexConsumer
    }
    consumer.setQuadOrientation(quad.getFace());
    if(quad.hasTintIndex())
    {
        consumer.setQuadTint(quad.getTintIndex());
    }
    consumer.setApplyDiffuseLighting(quad.shouldApplyDiffuseLighting());
    //int[] eMap = mapFormats(consumer.getVertexFormat(), DefaultVertexFormats.ITEM);
    float[] data = new float[4];
    VertexFormat formatFrom = consumer.getVertexFormat();
    VertexFormat formatTo = quad.getFormat();
    int countFrom = formatFrom.getElementCount();
    int countTo = formatTo.getElementCount();
    int[] eMap = formatMaps.getUnchecked(Pair.of(formatFrom, formatTo));
    for(int v = 0; v < 4; v++)
    {
        for(int e = 0; e < countFrom; e++)
        {
            if(eMap[e] != countTo)
            {
                unpack(quad.getVertexData(), data, quad.getFormat(), v, eMap[e]);
                consumer.put(e, data);
            }
            else
            {
                consumer.put(e);
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:40,代碼來源:LightUtil.java


注:本文中的net.minecraft.client.renderer.block.model.BakedQuad.getFormat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。