当前位置: 首页>>代码示例>>Java>>正文


Java MathHelper.roundUpToPowerOfTwo方法代码示例

本文整理汇总了Java中net.minecraft.util.MathHelper.roundUpToPowerOfTwo方法的典型用法代码示例。如果您正苦于以下问题:Java MathHelper.roundUpToPowerOfTwo方法的具体用法?Java MathHelper.roundUpToPowerOfTwo怎么用?Java MathHelper.roundUpToPowerOfTwo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.util.MathHelper的用法示例。


在下文中一共展示了MathHelper.roundUpToPowerOfTwo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doStitch

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public void doStitch()
{
    Stitcher.Holder[] astitcher$holder = (Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]);
    Arrays.sort((Object[])astitcher$holder);

    for (Stitcher.Holder stitcher$holder : astitcher$holder)
    {
        if (!this.allocateSlot(stitcher$holder))
        {
            String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", new Object[] {stitcher$holder.getAtlasSprite().getIconName(), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconWidth()), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconHeight())});
            throw new StitcherException(stitcher$holder, s);
        }
    }

    if (this.forcePowerOf2)
    {
        this.currentWidth = MathHelper.roundUpToPowerOfTwo(this.currentWidth);
        this.currentHeight = MathHelper.roundUpToPowerOfTwo(this.currentHeight);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:21,代码来源:Stitcher.java

示例2: doStitch

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public void doStitch()
{
    Stitcher.Holder[] astitcher$holder = (Stitcher.Holder[])((Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]));
    Arrays.sort((Object[])astitcher$holder);

    for (Stitcher.Holder stitcher$holder : astitcher$holder)
    {
        if (!this.allocateSlot(stitcher$holder))
        {
            String s = String.format("Unable to fit: %s, size: %dx%d, atlas: %dx%d, atlasMax: %dx%d - Maybe try a lower resolution resourcepack?", new Object[] {stitcher$holder.getAtlasSprite().getIconName(), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconWidth()), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconHeight()), Integer.valueOf(this.currentWidth), Integer.valueOf(this.currentHeight), Integer.valueOf(this.maxWidth), Integer.valueOf(this.maxHeight)});
            throw new StitcherException(stitcher$holder, s);
        }
    }

    if (this.forcePowerOf2)
    {
        this.currentWidth = MathHelper.roundUpToPowerOfTwo(this.currentWidth);
        this.currentHeight = MathHelper.roundUpToPowerOfTwo(this.currentHeight);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:21,代码来源:Stitcher.java

示例3: detectMaxMipmapLevel

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
private int detectMaxMipmapLevel(Map p_detectMaxMipmapLevel_1_, IResourceManager p_detectMaxMipmapLevel_2_)
{
    int i = this.detectMinimumSpriteSize(p_detectMaxMipmapLevel_1_, p_detectMaxMipmapLevel_2_, 20);

    if (i < 16)
    {
        i = 16;
    }

    i = MathHelper.roundUpToPowerOfTwo(i);

    if (i > 16)
    {
        Config.log("Sprite size: " + i);
    }

    int j = MathHelper.calculateLogBaseTwo(i);

    if (j < 4)
    {
        j = 4;
    }

    return j;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:26,代码来源:TextureMap.java

示例4: scaleToPowerOfTwo

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public static BufferedImage scaleToPowerOfTwo(BufferedImage p_scaleToPowerOfTwo_0_, int p_scaleToPowerOfTwo_1_)
{
    if (p_scaleToPowerOfTwo_0_ == null)
    {
        return p_scaleToPowerOfTwo_0_;
    }
    else
    {
        int i = p_scaleToPowerOfTwo_0_.getWidth();
        int j = p_scaleToPowerOfTwo_0_.getHeight();
        int k = Math.max(i, p_scaleToPowerOfTwo_1_);
        k = MathHelper.roundUpToPowerOfTwo(k);

        if (k == i)
        {
            return p_scaleToPowerOfTwo_0_;
        }
        else
        {
            int l = j * k / i;
            BufferedImage bufferedimage = new BufferedImage(k, l, 2);
            Graphics2D graphics2d = bufferedimage.createGraphics();
            Object object = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;

            if (k % i != 0)
            {
                object = RenderingHints.VALUE_INTERPOLATION_BILINEAR;
            }

            graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, object);
            graphics2d.drawImage(p_scaleToPowerOfTwo_0_, 0, 0, k, l, (ImageObserver)null);
            return bufferedimage;
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:36,代码来源:TextureUtils.java

示例5: smallestEncompassingPowerOfTwo

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public static int smallestEncompassingPowerOfTwo(int p_smallestEncompassingPowerOfTwo_0_)
{
    return MathHelper.roundUpToPowerOfTwo(p_smallestEncompassingPowerOfTwo_0_);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:RealmsMth.java

示例6: isPowerOfTwo

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public static boolean isPowerOfTwo(int p_isPowerOfTwo_0_)
{
    int i = MathHelper.roundUpToPowerOfTwo(p_isPowerOfTwo_0_);
    return i == p_isPowerOfTwo_0_;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:6,代码来源:TextureUtils.java


注:本文中的net.minecraft.util.MathHelper.roundUpToPowerOfTwo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。