create_ponder_wonder

Exports Create ponders to disk.
git clone git://git.oshgnacknak.de/create_ponder_wonder.git
Log | Files | Refs | README

commit 184c8892982dc4ec1bf159986235089ce6cb6f87
parent b6ac4339c71b28cc66a4877b7c318c74b19da396
Author: Oshgnacknak <osh@oshgnacknak.de>
Date:   Fri,  9 Apr 2021 16:55:02 +0200

Fix scaling

Diffstat:
Msrc/main/java/de/oshgnacknak/create_ponder_wonder/RenderUtils.java | 38+++++++++++---------------------------
1 file changed, 11 insertions(+), 27 deletions(-)

diff --git a/src/main/java/de/oshgnacknak/create_ponder_wonder/RenderUtils.java b/src/main/java/de/oshgnacknak/create_ponder_wonder/RenderUtils.java @@ -14,7 +14,7 @@ import java.util.function.Consumer; public class RenderUtils { - private static final double SCALE = 1; + private static final double SCALE = 5; private static final int WIDTH = 1920; private static final int HEIGHT = 1080; private static final double Z_DISTANCE = 1400; @@ -22,12 +22,7 @@ public class RenderUtils { private RenderUtils() {} public static NativeImage render(Consumer<MatrixStack> renderFunc) { - int realWidth = scale(WIDTH); - int realHeight = scale(HEIGHT); - testForValidSize(realWidth, realHeight); - - - Framebuffer fb = new Framebuffer(realWidth, realHeight, true, Minecraft.IS_RUNNING_ON_MAC); + Framebuffer fb = new Framebuffer(WIDTH, HEIGHT, true, Minecraft.IS_RUNNING_ON_MAC); RenderSystem.pushMatrix(); RenderSystem.enableBlend(); @@ -38,18 +33,22 @@ public class RenderUtils { RenderSystem.enableTexture(); RenderSystem.enableCull(); - RenderSystem.viewport(0, 0, realWidth, realHeight); + RenderSystem.viewport(0, 0, WIDTH, HEIGHT); RenderSystem.matrixMode(GL11.GL_PROJECTION); RenderSystem.loadIdentity(); - RenderSystem.ortho(0.0D, WIDTH, HEIGHT, 0.0D, 1000.0D, 3000.0D); + RenderSystem.ortho(0.0d, + WIDTH / SCALE, + HEIGHT / SCALE, + 0.0d, 0, + 3000.0d); RenderSystem.matrixMode(GL11.GL_MODELVIEW); RenderSystem.loadIdentity(); MatrixStack matrixStack = new MatrixStack(); matrixStack.translate( - WIDTH / 2.0, - HEIGHT / 2.0, + WIDTH / (SCALE * 2.0), + HEIGHT / (SCALE * 2.0), -Z_DISTANCE); net.minecraft.client.renderer.RenderHelper.enableGuiDepthLighting(); @@ -60,21 +59,6 @@ public class RenderUtils { RenderSystem.disableBlend(); RenderSystem.popMatrix(); - return ScreenShotHelper.createScreenshot(realWidth, realHeight, fb); - } - - private static void testForValidSize(int realWidth, int realHeight) { - int maxTextureSize = GL11.glGetInteger(GL11.GL_MAX_TEXTURE_SIZE); - - if (realWidth > maxTextureSize || realHeight > maxTextureSize) { - throw new IllegalStateException(String.format( - "Image would be to large: %dx%d", - realWidth, - realHeight)); - } - } - - private static int scale(int value) { - return (int) Math.round(value * SCALE); + return ScreenShotHelper.createScreenshot(WIDTH, HEIGHT, fb); } }