java类net.minecraft.client.renderer.block.model.BakedQuad的实例源码

NaturalProperties.java 文件源码 项目:Backmemed 阅读 28 收藏 0 点赞 0 评论 0
private boolean isFullSprite(BakedQuad p_isFullSprite_1_)
{
    TextureAtlasSprite textureatlassprite = p_isFullSprite_1_.getSprite();
    float f = textureatlassprite.getMinU();
    float f1 = textureatlassprite.getMaxU();
    float f2 = f1 - f;
    float f3 = f2 / 256.0F;
    float f4 = textureatlassprite.getMinV();
    float f5 = textureatlassprite.getMaxV();
    float f6 = f5 - f4;
    float f7 = f6 / 256.0F;
    int[] aint = p_isFullSprite_1_.getVertexData();
    int i = aint.length / 4;

    for (int j = 0; j < 4; ++j)
    {
        int k = j * i;
        float f8 = Float.intBitsToFloat(aint[k + 4]);
        float f9 = Float.intBitsToFloat(aint[k + 4 + 1]);

        if (!this.equalsDelta(f8, f, f3) && !this.equalsDelta(f8, f1, f3))
        {
            return false;
        }

        if (!this.equalsDelta(f9, f4, f7) && !this.equalsDelta(f9, f5, f7))
        {
            return false;
        }
    }

    return true;
}
BakedMonolithicGlyph.java 文件源码 项目:Solar 阅读 29 收藏 0 点赞 0 评论 0
@Override
protected List<BakedQuad> getQuads(IBlockState state) {
    List<BakedQuad> quads = new ArrayList<>();
    switch(MinecraftForgeClient.getRenderLayer()) {
        case SOLID:
            //Base
            quads.addAll(QuadBuilder.withFormat(format)
                    .setFrom(0, 0, 0)
                    .setTo(16, 16, 16)
                    .addAll(base)
                    .bake()
            );
            break;
        case CUTOUT_MIPPED:
            //Overlay
            int glyph = state.getValue(State.GLYPH);
            quads.addAll(QuadBuilder.withFormat(format)
                    .setFrom(0, 0, 0)
                    .setTo(16, 16, 16)
                    .setHasBrightness(true)
                    .addAll(overlay[glyph])
                    .bake()
            );
            break;
    }
    return quads;
}
BlockModelRenderer.java 文件源码 项目:DecompiledMinecraft 阅读 21 收藏 0 点赞 0 评论 0
public boolean renderModelAmbientOcclusion(IBlockAccess blockAccessIn, IBakedModel modelIn, Block blockIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSides)
{
    boolean flag = false;
    float[] afloat = new float[EnumFacing.values().length * 2];
    BitSet bitset = new BitSet(3);
    BlockModelRenderer.AmbientOcclusionFace blockmodelrenderer$ambientocclusionface = new BlockModelRenderer.AmbientOcclusionFace();

    for (EnumFacing enumfacing : EnumFacing.values())
    {
        List<BakedQuad> list = modelIn.getFaceQuads(enumfacing);

        if (!list.isEmpty())
        {
            BlockPos blockpos = blockPosIn.offset(enumfacing);

            if (!checkSides || blockIn.shouldSideBeRendered(blockAccessIn, blockpos, enumfacing))
            {
                this.renderModelAmbientOcclusionQuads(blockAccessIn, blockIn, blockPosIn, worldRendererIn, list, afloat, bitset, blockmodelrenderer$ambientocclusionface);
                flag = true;
            }
        }
    }

    List<BakedQuad> list1 = modelIn.getGeneralQuads();

    if (list1.size() > 0)
    {
        this.renderModelAmbientOcclusionQuads(blockAccessIn, blockIn, blockPosIn, worldRendererIn, list1, afloat, bitset, blockmodelrenderer$ambientocclusionface);
        flag = true;
    }

    return flag;
}
BlockModelRenderer.java 文件源码 项目:DecompiledMinecraft 阅读 22 收藏 0 点赞 0 评论 0
public boolean renderModelStandard(IBlockAccess blockAccessIn, IBakedModel modelIn, Block blockIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSides)
{
    boolean flag = false;
    BitSet bitset = new BitSet(3);

    for (EnumFacing enumfacing : EnumFacing.values())
    {
        List<BakedQuad> list = modelIn.getFaceQuads(enumfacing);

        if (!list.isEmpty())
        {
            BlockPos blockpos = blockPosIn.offset(enumfacing);

            if (!checkSides || blockIn.shouldSideBeRendered(blockAccessIn, blockpos, enumfacing))
            {
                int i = blockIn.getMixedBrightnessForBlock(blockAccessIn, blockpos);
                this.renderModelStandardQuads(blockAccessIn, blockIn, blockPosIn, enumfacing, i, false, worldRendererIn, list, bitset);
                flag = true;
            }
        }
    }

    List<BakedQuad> list1 = modelIn.getGeneralQuads();

    if (list1.size() > 0)
    {
        this.renderModelStandardQuads(blockAccessIn, blockIn, blockPosIn, (EnumFacing)null, -1, true, worldRendererIn, list1, bitset);
        flag = true;
    }

    return flag;
}
ShovelModel.java 文件源码 项目:Adventurers-Toolbox 阅读 27 收藏 0 点赞 0 评论 0
@Override
public IBakedModel bake(IModelState state, VertexFormat format,
        java.util.function.Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {

    ImmutableMap<TransformType, TRSRTransformation> transformMap = PerspectiveMapWrapper.getTransforms(state);

    TRSRTransformation transform = (TRSRTransformation.identity());

    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();

    if (headTexture != null && haftTexture != null && handleTexture != null) {

        ImmutableList.Builder<ResourceLocation> texBuilder = ImmutableList.builder();
        if (haftTexture != null) {
            texBuilder.add(haftTexture);
        }
        if (headTexture != null) {
            texBuilder.add(headTexture);
        }
        if (handleTexture != null) {
            texBuilder.add(handleTexture);
        }
        if (adornmentTexture != null) {
            texBuilder.add(adornmentTexture);
        }
        ImmutableList<ResourceLocation> textures = texBuilder.build();

        IBakedModel model = (new ItemLayerModel(textures)).bake(state, format, bakedTextureGetter);
        builder.addAll(model.getQuads(null, null, 0));
    }

    return new BakedShovelModel(this, builder.build(), format, Maps.immutableEnumMap(transformMap),
            Maps.<String, IBakedModel>newHashMap());
}
ModelUtils.java 文件源码 项目:Backmemed 阅读 20 收藏 0 点赞 0 评论 0
private static void dbgQuads(String p_dbgQuads_0_, List p_dbgQuads_1_, String p_dbgQuads_2_)
{
    for (Object bakedquad : p_dbgQuads_1_)
    {
        dbgQuad(p_dbgQuads_0_, (BakedQuad) bakedquad, p_dbgQuads_2_);
    }
}
BlockModelRenderer.java 文件源码 项目:Backmemed 阅读 25 收藏 0 点赞 0 评论 0
public boolean renderModelSmooth(IBlockAccess worldIn, IBakedModel modelIn, IBlockState stateIn, BlockPos posIn, VertexBuffer buffer, boolean checkSides, long rand)
{
    boolean flag = false;
    RenderEnv renderenv = buffer.getRenderEnv(worldIn, stateIn, posIn);

    for (EnumFacing enumfacing : EnumFacing.VALUES)
    {
        List<BakedQuad> list = modelIn.getQuads(stateIn, enumfacing, rand);

        if (!list.isEmpty() && (!checkSides || stateIn.shouldSideBeRendered(worldIn, posIn, enumfacing)) && (!Hacks.findMod(XRay.class).isEnabled() || !XRay.xrayBlocks.contains(stateIn.getBlock())))
        {
            list = BlockModelCustomizer.getRenderQuads(list, worldIn, stateIn, posIn, enumfacing, rand, renderenv);
            this.renderQuadsSmooth(worldIn, stateIn, posIn, buffer, list, renderenv);
            flag = true;
        }
    }

    List<BakedQuad> list1 = modelIn.getQuads(stateIn, (EnumFacing)null, rand);

    if (!list1.isEmpty())
    {
        list1 = BlockModelCustomizer.getRenderQuads(list1, worldIn, stateIn, posIn, (EnumFacing)null, rand, renderenv);
        this.renderQuadsSmooth(worldIn, stateIn, posIn, buffer, list1, renderenv);
        flag = true;
    }

    return flag;
}
ToolHeadModel.java 文件源码 项目:Adventurers-Toolbox 阅读 26 收藏 0 点赞 0 评论 0
public BakedToolHeadModel(ToolHeadModel parent, ImmutableList<BakedQuad> quads, VertexFormat format,
        ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms,
        Map<String, IBakedModel> cache) {
    this.quads = quads;
    this.format = format;
    this.parent = parent;
    this.transforms = itemTransforms();
}
SimpleBakedModel.java 文件源码 项目:BaseClient 阅读 21 收藏 0 点赞 0 评论 0
public SimpleBakedModel(List<BakedQuad> p_i46077_1_, List<List<BakedQuad>> p_i46077_2_, boolean p_i46077_3_, boolean p_i46077_4_, TextureAtlasSprite p_i46077_5_, ItemCameraTransforms p_i46077_6_)
{
    this.generalQuads = p_i46077_1_;
    this.faceQuads = p_i46077_2_;
    this.ambientOcclusion = p_i46077_3_;
    this.gui3d = p_i46077_4_;
    this.texture = p_i46077_5_;
    this.cameraTransforms = p_i46077_6_;
}
ModelFactory.java 文件源码 项目:SimpleTubes 阅读 28 收藏 0 点赞 0 评论 0
public static List<BakedQuad> convertCuboidToQuads(VertexFormat format, TexturedCuboid cuboid, boolean cull) {
    List<BakedQuad> list = new ArrayList<BakedQuad>();

    float x = cuboid.getX();
    float y = cuboid.getY();
    float z = cuboid.getZ();
    float width = cuboid.getWidth();
    float height = cuboid.getHeight();
    float depth = cuboid.getDepth();

    for (EnumFacing facing : EnumFacing.VALUES) {
        if (cuboid.getSidesToIgnore().contains(facing))
            continue;

        if (cuboid != null && cuboid.getTextureForSide(facing) != null && facing != null) {
            TextureAtlasSprite tex = cuboid.getTextureForSide(facing).getTexture();
            TRSRTransformation transform = cuboid.getTransform();
            float minU = getInterpU(cuboid.getTextureForSide(facing).getMinU(), tex);
            float minV = getInterpV(cuboid.getTextureForSide(facing).getMinV(), tex);
            float maxU = getInterpU(cuboid.getTextureForSide(facing).getMaxU(), tex);
            float maxV = getInterpV(cuboid.getTextureForSide(facing).getMaxV(), tex);
            Color col = cuboid.getColor();

            if (transform == null)
                transform = TRSRTransformation.identity();

            list.add(buildQuad(facing, x, y, z, width, height, depth, col, tex, minU, minV, maxU, maxV, false, transform));
            if (!cull)
                list.add(buildQuad(facing, x, y, z, width, height, depth, col, tex, minU, minV, maxU, maxV, true, transform));

        }
    }

    return list;
}


问题


面经


文章

微信
公众号

扫码关注公众号