use of hellfirepvp.astralsorcery.client.effect.context.base.BatchRenderContext 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.context.base.BatchRenderContext in project AstralSorcery by HellFirePvP.
the class RegistryEffectTemplates method init.
public static void init() {
GENERIC_DEPTH_PARTICLE = register(new RenderContextGenericDepthParticle());
GENERIC_PARTICLE = register(new RenderContextGenericParticle());
GENERIC_ATLAS_PARTICLE = register(new RenderContextAtlasParticle());
LIGHTNING = register(new RenderContextLightning());
CRYSTAL_BURST_1 = register(new RenderContextBurst(SPR_CRYSTAL_EFFECT_1));
CRYSTAL_BURST_2 = register(new RenderContextBurst(SPR_CRYSTAL_EFFECT_2));
CRYSTAL_BURST_3 = register(new RenderContextBurst(SPR_CRYSTAL_EFFECT_3));
CRYSTAL = register(new RenderContextCrystal(TEX_MODEL_CRYSTAL_WHITE));
COLLECTOR_BURST = register(new RenderContextBurst(SPR_COLLECTOR_EFFECT));
GEM_CRYSTAL_BURST = register(new RenderContextBurst(SPR_GEM_CRYSTAL_BURST));
GEM_CRYSTAL_BURST_SKY = register(new RenderContextBurst(SPR_GEM_CRYSTAL_BURST_SKY));
GEM_CRYSTAL_BURST_DAY = register(new RenderContextBurst(SPR_GEM_CRYSTAL_BURST_DAY));
GEM_CRYSTAL_BURST_NIGHT = register(new RenderContextBurst(SPR_GEM_CRYSTAL_BURST_NIGHT));
LIGHTBEAM = register(new RenderContextLightbeam(SPR_LIGHTBEAM));
LIGHTBEAM_TRANSFER = register(new RenderContextLightbeam(SPR_LIGHTBEAM_TRANSFER));
TEXTURE_SPRITE = register(new RenderContextSpritePlaneDynamic());
FACING_SPRITE = register(new RenderContextFacingSprite());
CUBE_OPAQUE_ATLAS = register(new BatchRenderContext<>(RenderTypesAS.EFFECT_FX_CUBE_OPAQUE_ATLAS, (ctx, pos) -> new FXCube(pos)));
CUBE_TRANSLUCENT_ATLAS = register(new BatchRenderContext<>(RenderTypesAS.EFFECT_FX_CUBE_TRANSLUCENT_ATLAS, (ctx, pos) -> new FXCube(pos)));
CUBE_TRANSLUCENT_ATLAS_IGNORE_DEPTH = register(new BatchRenderContext<>(RenderTypesAS.EFFECT_FX_CUBE_TRANSLUCENT_ATLAS_DEPTH, (ctx, pos) -> new FXCube(pos)));
CUBE_AREA_OF_EFFECT = register(new BatchRenderContext<>(RenderTypesAS.EFFECT_FX_CUBE_AREA_OF_EFFECT, (ctx, pos) -> new FXCube(pos)));
BLOCK_TRANSLUCENT = register(new BatchRenderContext<>(RenderTypesAS.EFFECT_FX_BLOCK_TRANSLUCENT, (ctx, pos) -> new FXBlock(pos)));
BLOCK_TRANSLUCENT_IGNORE_DEPTH = register(new BatchRenderContext<>(RenderTypesAS.EFFECT_FX_BLOCK_TRANSLUCENT_DEPTH, (ctx, pos) -> new FXBlock(pos)));
COLOR_SPHERE = register(new BatchRenderContext<>(RenderTypesAS.EFFECT_FX_COLOR_SPHERE, (ctx, pos) -> new FXColorEffectSphere(pos)));
COLOR_SPHERE.setDrawWithTexture(false);
GENERIC_GATEWAY_PARTICLE = register(new RenderContextGenericParticle());
setupRenderOrder();
}
use of hellfirepvp.astralsorcery.client.effect.context.base.BatchRenderContext in project AstralSorcery by HellFirePvP.
the class FXBlock method render.
@Override
public <T extends EntityVisualFX> void render(BatchRenderContext<T> ctx, MatrixStack renderStack, IVertexBuilder vb, float pTicks) {
if (this.blockState == null) {
return;
}
int alpha = this.getAlpha(pTicks);
Color c = this.getColor(pTicks);
int[] colorOverride = new int[] { c.getRed(), c.getGreen(), c.getBlue(), alpha };
Vector3 translate = this.getRenderPosition(pTicks).subtract(RenderingVectorUtils.getStandardTranslationRemovalVector(pTicks));
Vector3 rotation = this.getInterpolatedRotation(pTicks);
float scale = this.getScale(pTicks);
renderStack.push();
renderStack.translate(translate.getX(), translate.getY(), translate.getZ());
renderStack.translate(0.5, 0.5, 0.5);
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()));
renderStack.translate(-0.5, -0.5, -0.5);
new BufferDecoratorBuilder().setColorDecorator((r, g, b, a) -> colorOverride).decorate(vb, decorated -> RenderingUtils.renderSimpleBlockModel(this.blockState, renderStack, decorated));
renderStack.pop();
}
Aggregations