Search in sources :

Example 1 with BufferContext

use of hellfirepvp.astralsorcery.client.util.draw.BufferContext in project AstralSorcery by HellFirePvP.

the class ScreenJournalPerkTree method drawSearchHalo.

private void drawSearchHalo(BatchPerkContext ctx, MatrixStack renderStack, float size, float x, float y) {
    BufferContext batch = ctx.getContext(searchContext);
    SpriteSheetResource searchMark = SpritesAS.SPR_PERK_SEARCH;
    searchMark.bindTexture();
    Vector3 starVec = new Vector3(x - size, y - size, 0);
    float uLength = searchMark.getUWidth();
    float vLength = searchMark.getVWidth();
    Tuple<Float, Float> frameUV = searchMark.getUVOffset();
    Matrix4f offset = renderStack.getLast().getMatrix();
    for (int i = 0; i < 4; i++) {
        int u = ((i + 1) & 2) >> 1;
        int v = ((i + 2) & 2) >> 1;
        Vector3 pos = starVec.clone().addX(size * u * 2).addY(size * v * 2);
        pos.drawPos(offset, batch).color(0.8F, 0.1F, 0.1F, 1F).tex(frameUV.getA() + uLength * u, frameUV.getB() + vLength * v).endVertex();
    }
}
Also used : SpriteSheetResource(hellfirepvp.astralsorcery.client.resource.SpriteSheetResource) Matrix4f(net.minecraft.util.math.vector.Matrix4f) Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) ScalingPoint(hellfirepvp.astralsorcery.client.screen.helper.ScalingPoint) PerkTreePoint(hellfirepvp.astralsorcery.common.perk.tree.PerkTreePoint) BufferContext(hellfirepvp.astralsorcery.client.util.draw.BufferContext)

Example 2 with BufferContext

use of hellfirepvp.astralsorcery.client.util.draw.BufferContext in project AstralSorcery by HellFirePvP.

the class BatchPerkContext method draw.

public void draw() {
    for (TextureObjectGroup group : bufferGroups.keySet()) {
        BufferContext batch = bufferGroups.get(group);
        group.getResource().bindTexture();
        batch.draw();
    }
}
Also used : BufferContext(hellfirepvp.astralsorcery.client.util.draw.BufferContext)

Example 3 with BufferContext

use of hellfirepvp.astralsorcery.client.util.draw.BufferContext in project AstralSorcery by HellFirePvP.

the class PerkTreeConstellation method renderPerkAtBatch.

@Nullable
@Override
@OnlyIn(Dist.CLIENT)
public Rectangle.Float renderPerkAtBatch(BatchPerkContext drawCtx, MatrixStack renderStack, AllocationStatus status, long spriteOffsetTick, float pTicks, float x, float y, float zLevel, float scale) {
    SpriteSheetResource tex = status.getPerkTreeHaloSprite();
    BatchPerkContext.TextureObjectGroup grp = PerkPointHaloRenderGroup.INSTANCE.getGroup(tex);
    if (grp == null) {
        return new Rectangle.Float();
    }
    BufferContext buf = drawCtx.getContext(grp);
    float haloSize = perkSpriteSize * scale;
    if (status.isAllocated()) {
        haloSize *= 1.3F;
    }
    Tuple<Float, Float> frameUV = tex.getUVOffset(spriteOffsetTick);
    RenderingGuiUtils.rect(buf, renderStack, x - haloSize, y - haloSize, zLevel, haloSize * 2F, haloSize * 2F).color(1F, 1F, 1F, 0.85F).tex(frameUV.getA(), frameUV.getB(), tex.getULength(), tex.getVLength()).draw();
    super.renderPerkAtBatch(drawCtx, renderStack, status, spriteOffsetTick, pTicks, x, y, zLevel, scale);
    float actualSize = perkSpriteSize * scale;
    return new Rectangle.Float(-actualSize, -actualSize, actualSize * 2, actualSize * 2);
}
Also used : SpriteSheetResource(hellfirepvp.astralsorcery.client.resource.SpriteSheetResource) BatchPerkContext(hellfirepvp.astralsorcery.client.screen.journal.perk.BatchPerkContext) BufferContext(hellfirepvp.astralsorcery.client.util.draw.BufferContext) Nullable(javax.annotation.Nullable) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 4 with BufferContext

use of hellfirepvp.astralsorcery.client.util.draw.BufferContext in project AstralSorcery by HellFirePvP.

the class PerkTreeGem method renderPerkAtBatch.

@Nullable
@Override
@OnlyIn(Dist.CLIENT)
public Rectangle.Float renderPerkAtBatch(BatchPerkContext drawCtx, MatrixStack renderStack, AllocationStatus status, long spriteOffsetTick, float pTicks, float x, float y, float zLevel, float scale) {
    SpriteSheetResource tex = status.getPerkTreeHaloSprite();
    BatchPerkContext.TextureObjectGroup grp = PerkPointHaloRenderGroup.INSTANCE.getGroup(tex);
    if (grp == null) {
        return new Rectangle.Float();
    }
    BufferContext buf = drawCtx.getContext(grp);
    float haloSize = getRenderSize() * 0.8F * scale;
    if (status.isAllocated()) {
        haloSize *= 1.5;
    }
    Tuple<Float, Float> frameUV = tex.getUVOffset(spriteOffsetTick);
    RenderingGuiUtils.rect(buf, renderStack, x - haloSize, y - haloSize, zLevel, haloSize * 2F, haloSize * 2F).color(1F, 1F, 1F, 0.85F).tex(frameUV.getA(), frameUV.getB(), tex.getULength(), tex.getVLength()).draw();
    super.renderPerkAtBatch(drawCtx, renderStack, status, spriteOffsetTick, pTicks, x, y, zLevel, scale);
    float actualSize = getRenderSize() * scale;
    return new Rectangle.Float(-actualSize, -actualSize, actualSize * 2, actualSize * 2);
}
Also used : SpriteSheetResource(hellfirepvp.astralsorcery.client.resource.SpriteSheetResource) BatchPerkContext(hellfirepvp.astralsorcery.client.screen.journal.perk.BatchPerkContext) BufferContext(hellfirepvp.astralsorcery.client.util.draw.BufferContext) Nullable(javax.annotation.Nullable) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 5 with BufferContext

use of hellfirepvp.astralsorcery.client.util.draw.BufferContext in project AstralSorcery by HellFirePvP.

the class ScreenJournalPerkTree method drawSeal.

private void drawSeal(BatchPerkContext ctx, MatrixStack renderStack, double size, double x, double y, long spriteOffsetTick) {
    BufferContext batch = ctx.getContext(sealContext);
    drawSeal(batch, renderStack, size, x, y, spriteOffsetTick, 1F);
}
Also used : BufferContext(hellfirepvp.astralsorcery.client.util.draw.BufferContext)

Aggregations

BufferContext (hellfirepvp.astralsorcery.client.util.draw.BufferContext)5 SpriteSheetResource (hellfirepvp.astralsorcery.client.resource.SpriteSheetResource)3 BatchPerkContext (hellfirepvp.astralsorcery.client.screen.journal.perk.BatchPerkContext)2 Nullable (javax.annotation.Nullable)2 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)2 ScalingPoint (hellfirepvp.astralsorcery.client.screen.helper.ScalingPoint)1 PerkTreePoint (hellfirepvp.astralsorcery.common.perk.tree.PerkTreePoint)1 Vector3 (hellfirepvp.astralsorcery.common.util.data.Vector3)1 Matrix4f (net.minecraft.util.math.vector.Matrix4f)1