RackMountableRenderEvent.java 文件源码

java
阅读 18 收藏 0 点赞 0 评论 0

项目:HeroUtils 作者:
/**
 * Utility method for rendering an atlas texture as the front-side overlay
 * over a specified horizontal area.
 *
 * @param texture the atlas texture to use to render the overlay.
 * @param u0      the lower end of the vertical area to render at.
 * @param u1      the upper end of the vertical area to render at.
 */
public void renderOverlayFromAtlas(final ResourceLocation texture, final float u0, final float u1) {
    Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    final TextureAtlasSprite icon = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(texture.toString());
    final Tessellator t = Tessellator.getInstance();
    final VertexBuffer r = t.getBuffer();
    r.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    r.pos(u0, v1, 0).tex(icon.getInterpolatedU(u0 * 16), icon.getInterpolatedV(v1 * 16)).endVertex();
    r.pos(u1, v1, 0).tex(icon.getInterpolatedU(u1 * 16), icon.getInterpolatedV(v1 * 16)).endVertex();
    r.pos(u1, v0, 0).tex(icon.getInterpolatedU(u1 * 16), icon.getInterpolatedV(v0 * 16)).endVertex();
    r.pos(u0, v0, 0).tex(icon.getInterpolatedU(u0 * 16), icon.getInterpolatedV(v0 * 16)).endVertex();
    t.draw();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号