Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ protected MixinConfig() {

this.addMixinRule("features.render.particle", true);

this.addMixinRule("features.render.viewport", true);

this.addMixinRule("features.render.world", true);
this.addMixinRule("features.render.world.clouds", true);
this.addMixinRule("features.render.world.sky", true);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package net.caffeinemc.mods.sodium.mixin.features.render.viewport;

import com.mojang.blaze3d.opengl.GlStateManager;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Unique;

@Mixin(GlStateManager.class)
public class GlStateManagerMixin {
@Unique private static int viewportX;
@Unique private static int viewportY;
@Unique private static int viewportWidth;
@Unique private static int viewportHeight;
Comment on lines +11 to +14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our code style is to put the annotation on its own line.


/**
* @author Crosby
* @reason Viewport only changes a few times per frame
*/
@Overwrite
public static void _viewport(int x, int y, int width, int height) {
if (x != viewportX || y != viewportY || width != viewportWidth || height != viewportHeight) {
viewportX = x;
viewportY = y;
viewportWidth = width;
viewportHeight = height;
GL11.glViewport(x, y, width, height);
}
}
}
1 change: 1 addition & 0 deletions common/src/main/resources/sodium-common.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"features.render.model.ItemBlockRenderTypesMixin",
"features.render.model.item.ItemRendererMixin",
"features.render.particle.SingleQuadParticleMixin",
"features.render.viewport.GlStateManagerMixin",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will need conflict resolution since it seems

"features.render.world.sky.FogRendererMixin",
"features.render.world.sky.ClientLevelMixin",
"features.render.world.sky.LevelRendererMixin",
Expand Down