Skip to content

Commit

Permalink
Fix #957: Improve performance of hatch overlay rendering (#982)
Browse files Browse the repository at this point in the history
  • Loading branch information
Technici4n authored Dec 27, 2024
1 parent 7c9bc33 commit e8c4509
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/client/java/aztech/modern_industrialization/MIClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import aztech.modern_industrialization.blocks.storage.barrel.DeferredBarrelTextRenderer;
import aztech.modern_industrialization.blocks.storage.barrel.client.BarrelTooltipComponent;
import aztech.modern_industrialization.blocks.storage.tank.TankRenderer;
import aztech.modern_industrialization.client.MIRenderTypes;
import aztech.modern_industrialization.datagen.MIDatagenClient;
import aztech.modern_industrialization.datagen.MIDatagenServer;
import aztech.modern_industrialization.datagen.model.DelegatingModelBuilder;
Expand Down Expand Up @@ -96,6 +97,7 @@
import net.neoforged.neoforge.client.event.RegisterGuiLayersEvent;
import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent;
import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent;
import net.neoforged.neoforge.client.event.RegisterRenderBuffersEvent;
import net.neoforged.neoforge.client.event.RenderFrameEvent;
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
import net.neoforged.neoforge.client.gui.VanillaGuiLayers;
Expand Down Expand Up @@ -163,6 +165,10 @@ private static void init(FMLConstructModEvent ignored) {
IConfigScreenFactory.class,
(mc, parentScreen) -> AutoConfig.getConfigScreen(MIConfig.class, parentScreen).get());

modBus.addListener(RegisterRenderBuffersEvent.class, event -> {
event.registerRenderBuffer(MIRenderTypes.solidHighlight());
});

// Warn if neither JEI nor REI is present!
if (!ModList.get().isLoaded("emi") && !ModList.get().isLoaded("jei")
&& !ModList.get().isLoaded("roughlyenoughitems")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ private static RenderType makeMachineOverlay() {
}

private static RenderType makeSolidHighlight() {
return create("solid_highlight", DefaultVertexFormat.POSITION_COLOR_NORMAL, VertexFormat.Mode.QUADS, 65536, false, false,
// Use block vertex format to use the fast path in BufferBuilder, even if the shader doesn't use the extra vertex attributes.
return create("solid_highlight", DefaultVertexFormat.BLOCK, VertexFormat.Mode.QUADS, 65536, false, false,
CompositeState.builder()
.setTransparencyState(NO_TRANSPARENCY)
.setTextureState(NO_TEXTURE)
Expand Down

0 comments on commit e8c4509

Please sign in to comment.