use of hellfirepvp.astralsorcery.client.screen.journal.perk.BatchPerkContext 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);
}
use of hellfirepvp.astralsorcery.client.screen.journal.perk.BatchPerkContext 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);
}
use of hellfirepvp.astralsorcery.client.screen.journal.perk.BatchPerkContext in project AstralSorcery by HellFirePvP.
the class PerkTreeMajor 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();
}
BufferBuilder 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);
}
use of hellfirepvp.astralsorcery.client.screen.journal.perk.BatchPerkContext in project AstralSorcery by HellFirePvP.
the class PerkTreePoint 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.getPerkTreeSprite();
BatchPerkContext.TextureObjectGroup grp = PerkPointRenderGroup.INSTANCE.getGroup(tex);
if (grp == null) {
return new Rectangle.Float();
}
BufferBuilder buf = drawCtx.getContext(grp);
float size = renderSize * scale;
Tuple<Float, Float> frameUV = tex.getUVOffset(spriteOffsetTick);
RenderingGuiUtils.rect(buf, renderStack, x - size, y - size, zLevel, size * 2F, size * 2F).tex(frameUV.getA(), frameUV.getB(), tex.getULength(), tex.getVLength()).draw();
return new Rectangle.Float(-size, -size, size * 2, size * 2);
}
use of hellfirepvp.astralsorcery.client.screen.journal.perk.BatchPerkContext in project AstralSorcery by HellFirePvP.
the class ScreenJournalPerkTree method initializeDrawBuffer.
public static void initializeDrawBuffer() {
PerkTree.PERK_TREE.getVersion(LogicalSide.CLIENT).ifPresent(version -> {
if (lastPreparedBuffer == null || version.longValue() != lastPreparedBuffer) {
drawBuffer = new BatchPerkContext();
searchContext = drawBuffer.addContext(SpritesAS.SPR_PERK_SEARCH, BatchPerkContext.PRIORITY_OVERLAY);
sealContext = drawBuffer.addContext(SpritesAS.SPR_PERK_SEAL, BatchPerkContext.PRIORITY_FOREGROUND);
List<PerkRenderGroup> groups = Lists.newArrayList();
for (PerkTreePoint<?> p : PerkTree.PERK_TREE.getPerkPoints(LogicalSide.CLIENT)) {
p.addGroups(groups);
}
for (PerkRenderGroup group : groups) {
group.batchRegister(drawBuffer);
}
lastPreparedBuffer = version;
}
});
}
Aggregations