use of hellfirepvp.astralsorcery.client.effect.EntityDynamicFX in project AstralSorcery by HellFirePvP.
the class FXCrystal method renderNow.
@Override
public <T extends EntityVisualFX & EntityDynamicFX> void renderNow(BatchRenderContext<T> ctx, MatrixStack renderStack, IDrawRenderTypeBuffer drawBuffer, float pTicks) {
if (this.alternativeTexture != null) {
this.alternativeTexture.bindTexture();
}
int alpha = this.getAlpha(pTicks);
Color c = this.getColor(pTicks);
Vector3 vec = this.getRenderPosition(pTicks).subtract(RenderingVectorUtils.getStandardTranslationRemovalVector(pTicks));
float scale = this.getScale(pTicks);
if (this.lightRayColor != null) {
long seed = 0x515F1EB654AB915EL;
renderStack.push();
renderStack.translate(vec.getX(), vec.getY(), vec.getZ());
RenderingDrawUtils.renderLightRayFan(renderStack, drawBuffer, this.lightRayColor, seed, 5, 1F, 50);
renderStack.pop();
drawBuffer.draw();
}
renderStack.push();
renderStack.translate(vec.getX(), vec.getY() - 0.05F, vec.getZ());
renderStack.scale(scale, scale, scale);
renderStack.rotate(Vector3f.XP.rotationDegrees((float) rotation.getX()));
renderStack.rotate(Vector3f.YP.rotationDegrees((float) rotation.getY()));
renderStack.rotate(Vector3f.ZP.rotationDegrees((float) rotation.getZ()));
BufferDecoratorBuilder.withColor((r, g, b, a) -> new int[] { c.getRed(), c.getGreen(), c.getBlue(), alpha }).decorate(drawBuffer.getBuffer(ctx.getRenderType()), decorated -> ObjModelRender.renderCrystal(renderStack, decorated, drawBuffer::draw));
renderStack.pop();
if (this.alternativeTexture != null) {
ctx.getSprite().bindTexture();
}
}
use of hellfirepvp.astralsorcery.client.effect.EntityDynamicFX in project AstralSorcery by HellFirePvP.
the class BatchRenderContext method renderAll.
public void renderAll(List<EffectHandler.PendingEffect> effects, MatrixStack renderStack, IDrawRenderTypeBuffer drawBuffer, float pTicks) {
// Erase type due to impossible typing
BatchRenderContext blankCtx = this;
effects.stream().filter(effect -> effect.getEffect() instanceof EntityDynamicFX).forEach(effect -> ((EntityDynamicFX) effect.getEffect()).renderNow(blankCtx, renderStack, drawBuffer, pTicks));
RenderType drawType = this.getRenderType();
if (this.drawWithTexture) {
drawType = RenderTypeDecorator.wrapSetup(this.getRenderType(), () -> {
RenderSystem.enableTexture();
this.getSprite().bindTexture();
}, () -> {
BlockAtlasTexture.getInstance().bindTexture();
RenderSystem.disableTexture();
});
}
IVertexBuilder buf = drawBuffer.getBuffer(drawType);
effects.forEach(effect -> effect.getEffect().render(this, renderStack, buf, pTicks));
this.drawBatched(buf, drawBuffer);
}
Aggregations