Search in sources :

Example 1 with LevelRendererAccessor

use of net.coderbot.iris.mixin.LevelRendererAccessor in project Iris by IrisShaders.

the class ShadowRenderer method renderEntities.

private void renderEntities(LevelRendererAccessor levelRenderer, Frustum frustum, MultiBufferSource.BufferSource bufferSource, PoseStack modelView, double cameraX, double cameraY, double cameraZ, float tickDelta) {
    EntityRenderDispatcher dispatcher = levelRenderer.getEntityRenderDispatcher();
    int shadowEntities = 0;
    profiler.push("cull");
    List<Entity> renderedEntities = new ArrayList<>(32);
    // TODO: I'm sure that this can be improved / optimized.
    for (Entity entity : getLevel().entitiesForRendering()) {
        if (!dispatcher.shouldRender(entity, frustum, cameraX, cameraY, cameraZ) || entity.isSpectator()) {
            continue;
        }
        renderedEntities.add(entity);
    }
    profiler.popPush("sort");
    // Sort the entities by type first in order to allow vanilla's entity batching system to work better.
    renderedEntities.sort(Comparator.comparingInt(entity -> entity.getType().hashCode()));
    profiler.popPush("build geometry");
    for (Entity entity : renderedEntities) {
        levelRenderer.invokeRenderEntity(entity, cameraX, cameraY, cameraZ, tickDelta, modelView, bufferSource);
        shadowEntities++;
    }
    renderedShadowEntities = shadowEntities;
}
Also used : Camera(net.minecraft.client.Camera) ShadowMatrices(net.coderbot.iris.shadow.ShadowMatrices) Object2ObjectMap(it.unimi.dsi.fastutil.objects.Object2ObjectMap) Matrix4f(com.mojang.math.Matrix4f) Vector3d(net.coderbot.iris.vendored.joml.Vector3d) IrisRenderSystem(net.coderbot.iris.gl.IrisRenderSystem) ProgramSamplers(net.coderbot.iris.gl.program.ProgramSamplers) GL20C(org.lwjgl.opengl.GL20C) ProgramManager(com.mojang.blaze3d.shaders.ProgramManager) FrustumHolder(net.coderbot.iris.shadows.frustum.FrustumHolder) EntityRenderDispatcher(net.minecraft.client.renderer.entity.EntityRenderDispatcher) OptionalBoolean(net.coderbot.iris.shaderpack.OptionalBoolean) ImmutableSet(com.google.common.collect.ImmutableSet) BatchingDebugMessageHelper(net.coderbot.batchedentityrendering.impl.BatchingDebugMessageHelper) ProfilerFiller(net.minecraft.util.profiling.ProfilerFiller) AdvancedShadowCullingFrustum(net.coderbot.iris.shadows.frustum.advanced.AdvancedShadowCullingFrustum) LevelRenderer(net.minecraft.client.renderer.LevelRenderer) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity) ProgramSet(net.coderbot.iris.shaderpack.ProgramSet) Objects(java.util.Objects) Matrix4fAccess(net.coderbot.iris.shadows.Matrix4fAccess) Nullable(org.jetbrains.annotations.Nullable) AbstractTexture(net.minecraft.client.renderer.texture.AbstractTexture) List(java.util.List) IrisImages(net.coderbot.iris.samplers.IrisImages) RenderBuffersExt(net.coderbot.batchedentityrendering.impl.RenderBuffersExt) ProgramSource(net.coderbot.iris.shaderpack.ProgramSource) BlockPos(net.minecraft.core.BlockPos) LevelRendererAccessor(net.coderbot.iris.mixin.LevelRendererAccessor) MultiBufferSource(net.minecraft.client.renderer.MultiBufferSource) BlockEntityRenderDispatcher(net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher) CommonUniforms(net.coderbot.iris.uniforms.CommonUniforms) RenderBuffers(net.minecraft.client.renderer.RenderBuffers) Frustum(net.minecraft.client.renderer.culling.Frustum) BoxCullingFrustum(net.coderbot.iris.shadows.frustum.fallback.BoxCullingFrustum) ShadowRenderTargets(net.coderbot.iris.shadows.ShadowRenderTargets) ClientLevel(net.minecraft.client.multiplayer.ClientLevel) ShadowMapRenderer(net.coderbot.iris.shadows.ShadowMapRenderer) GL30C(org.lwjgl.opengl.GL30C) Supplier(java.util.function.Supplier) PoseStack(com.mojang.blaze3d.vertex.PoseStack) Vector3f(com.mojang.math.Vector3f) CullingDataCache(net.coderbot.iris.shadows.CullingDataCache) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) Minecraft(net.minecraft.client.Minecraft) InternalTextureFormat(net.coderbot.iris.gl.texture.InternalTextureFormat) PackDirectives(net.coderbot.iris.shaderpack.PackDirectives) PackShadowDirectives(net.coderbot.iris.shaderpack.PackShadowDirectives) NonCullingFrustum(net.coderbot.iris.shadows.frustum.fallback.NonCullingFrustum) IntSupplier(java.util.function.IntSupplier) DrawCallTrackingRenderBuffers(net.coderbot.batchedentityrendering.impl.DrawCallTrackingRenderBuffers) GbufferProgram(net.coderbot.iris.layer.GbufferProgram) CelestialUniforms(net.coderbot.iris.uniforms.CelestialUniforms) Vector4f(net.coderbot.iris.vendored.joml.Vector4f) GL11C(org.lwjgl.opengl.GL11C) RenderType(net.minecraft.client.renderer.RenderType) IrisSamplers(net.coderbot.iris.samplers.IrisSamplers) RenderTargets(net.coderbot.iris.rendertarget.RenderTargets) CapturedRenderingState(net.coderbot.iris.uniforms.CapturedRenderingState) Entity(net.minecraft.world.entity.Entity) BlendModeOverride(net.coderbot.iris.gl.blending.BlendModeOverride) Program(net.coderbot.iris.gl.program.Program) ProgramBuilder(net.coderbot.iris.gl.program.ProgramBuilder) RenderSystem(com.mojang.blaze3d.systems.RenderSystem) CameraUniforms(net.coderbot.iris.uniforms.CameraUniforms) BoxCuller(net.coderbot.iris.shadows.frustum.BoxCuller) CullEverythingFrustum(net.coderbot.iris.shadows.frustum.CullEverythingFrustum) Comparator(java.util.Comparator) IrisVideoSettings(net.coderbot.iris.gui.option.IrisVideoSettings) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity) Entity(net.minecraft.world.entity.Entity) ArrayList(java.util.ArrayList) EntityRenderDispatcher(net.minecraft.client.renderer.entity.EntityRenderDispatcher) BlockEntityRenderDispatcher(net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 ProgramManager (com.mojang.blaze3d.shaders.ProgramManager)1 RenderSystem (com.mojang.blaze3d.systems.RenderSystem)1 PoseStack (com.mojang.blaze3d.vertex.PoseStack)1 Matrix4f (com.mojang.math.Matrix4f)1 Vector3f (com.mojang.math.Vector3f)1 Object2ObjectMap (it.unimi.dsi.fastutil.objects.Object2ObjectMap)1 ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1 List (java.util.List)1 Objects (java.util.Objects)1 IntSupplier (java.util.function.IntSupplier)1 Supplier (java.util.function.Supplier)1 BatchingDebugMessageHelper (net.coderbot.batchedentityrendering.impl.BatchingDebugMessageHelper)1 DrawCallTrackingRenderBuffers (net.coderbot.batchedentityrendering.impl.DrawCallTrackingRenderBuffers)1 RenderBuffersExt (net.coderbot.batchedentityrendering.impl.RenderBuffersExt)1 IrisRenderSystem (net.coderbot.iris.gl.IrisRenderSystem)1 BlendModeOverride (net.coderbot.iris.gl.blending.BlendModeOverride)1 Program (net.coderbot.iris.gl.program.Program)1