use of hellfirepvp.observerlib.client.util.RenderTypeDecorator in project AstralSorcery by HellFirePvP.
the class RenderingUtils method renderTranslucentItemStackModelGround.
public static void renderTranslucentItemStackModelGround(ItemStack stack, MatrixStack renderStack, Color overlayColor, Blending blendMode, int alpha) {
IBakedModel bakedModel = getItemModel(stack);
ForgeHooksClient.handleCameraTransforms(renderStack, bakedModel, ItemCameraTransforms.TransformType.GROUND, false);
TextureManager textureManager = Minecraft.getInstance().getTextureManager();
textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
textureManager.getTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
IRenderTypeBuffer.Impl buffer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
renderItemModelWithColor(stack, ItemCameraTransforms.TransformType.GROUND, bakedModel, renderStack, (renderType) -> {
RenderTypeDecorator decorated = RenderTypeDecorator.wrapSetup(renderType, () -> {
RenderSystem.enableBlend();
blendMode.apply();
}, () -> {
Blending.DEFAULT.apply();
RenderSystem.disableBlend();
});
return buffer.getBuffer(decorated);
}, LightmapUtil.getPackedFullbrightCoords(), OverlayTexture.NO_OVERLAY, overlayColor, alpha);
buffer.finish();
}
use of hellfirepvp.observerlib.client.util.RenderTypeDecorator in project AstralSorcery by HellFirePvP.
the class FXFacingSprite method renderNow.
@Override
public <T extends EntityVisualFX & EntityDynamicFX> void renderNow(BatchRenderContext<T> ctx, MatrixStack renderStack, IDrawRenderTypeBuffer drawBuffer, float pTicks) {
SpriteSheetResource ssr = this.sprite != null ? this.sprite : ctx.getSprite();
Tuple<Float, Float> uvOffset = ssr.getUVOffset(this, pTicks, spriteDisplayFactor);
int alpha = this.getAlpha(pTicks);
Color col = this.getColor(pTicks);
Vector3 vec = this.getRenderPosition(pTicks);
float scale = this.getScale(pTicks);
RenderTypeDecorator decorated = RenderTypeDecorator.wrapSetup(ctx.getRenderType(), ssr::bindTexture, BlockAtlasTexture.getInstance()::bindTexture);
IVertexBuilder buf = drawBuffer.getBuffer(decorated);
RenderingDrawUtils.renderFacingQuadVB(buf, renderStack, vec.getX(), vec.getY(), vec.getZ(), scale, 0F, uvOffset.getA(), uvOffset.getB(), ssr.getULength(), ssr.getVLength(), col.getRed(), col.getGreen(), col.getBlue(), alpha);
drawBuffer.draw();
}
use of hellfirepvp.observerlib.client.util.RenderTypeDecorator in project AstralSorcery by HellFirePvP.
the class FXSpritePlane method renderNow.
@Override
public <T extends EntityVisualFX & EntityDynamicFX> void renderNow(BatchRenderContext<T> ctx, MatrixStack renderStack, IDrawRenderTypeBuffer drawBuffer, float pTicks) {
SpriteSheetResource ssr = this.sprite != null ? this.sprite : ctx.getSprite();
Tuple<Float, Float> uvOffset = ssr.getUVOffset(this, pTicks, spriteDisplayFactor);
Vector3 vec = this.getRenderPosition(pTicks);
vec.subtract(RenderingVectorUtils.getStandardTranslationRemovalVector(pTicks));
float scale = this.getScale(pTicks);
int alpha = this.getAlpha(pTicks);
Color color = this.getColor(pTicks);
Vector3 axis = this.axis.clone();
float deg;
if (ticksPerFullRot >= 0) {
float anglePercent = ((float) (getAge())) / ((float) ticksPerFullRot);
deg = anglePercent * 360F;
deg = RenderingVectorUtils.interpolateRotation(lastRenderDegree, deg, pTicks);
this.lastRenderDegree = deg;
} else {
deg = fixDegree;
}
RenderTypeDecorator decorated = RenderTypeDecorator.wrapSetup(ctx.getRenderType(), ssr::bindTexture, () -> BlockAtlasTexture.getInstance().bindTexture());
IVertexBuilder buf = drawBuffer.getBuffer(decorated);
RenderingDrawUtils.renderAngleRotatedTexturedRectVB(buf, renderStack, vec, axis, (float) Math.toRadians(deg), scale, uvOffset.getA(), uvOffset.getB(), ssr.getULength(), ssr.getVLength(), color.getRed(), color.getGreen(), color.getBlue(), alpha);
drawBuffer.draw();
}
use of hellfirepvp.observerlib.client.util.RenderTypeDecorator in project AstralSorcery by HellFirePvP.
the class RenderTileFakedState method render.
@Override
public void render(TileFakedState tile, float pTicks, MatrixStack renderStack, IRenderTypeBuffer renderTypeBuffer, int combinedLight, int combinedOverlay) {
BlockState fakedState = tile.getFakedState();
if (fakedState.getBlock() instanceof AirBlock) {
return;
}
Color blendColor = tile.getOverlayColor();
int[] color = new int[] { blendColor.getRed(), blendColor.getGreen(), blendColor.getBlue(), 128 };
RenderType type = RenderTypeLookup.func_239221_b_(fakedState);
RenderTypeDecorator decorated = RenderTypeDecorator.wrapSetup(type, () -> {
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.depthMask(false);
}, () -> {
RenderSystem.depthMask(true);
RenderSystem.defaultBlendFunc();
RenderSystem.disableBlend();
});
BufferDecoratorBuilder decorator = BufferDecoratorBuilder.withColor(((r, g, b, a) -> color));
IVertexBuilder buf = renderTypeBuffer.getBuffer(decorated);
RenderingUtils.renderSimpleBlockModel(fakedState, renderStack, decorator.decorate(buf), tile.getPos(), tile, true);
}
Aggregations