当前位置: 首页>>代码示例>>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;未经允许,请勿转载。