mirror of
https://gitflic.ru/project/lax1dude/eaglercraft-1_8.git
synced 2025-07-22 13:31:16 -09:00
139 lines
4.4 KiB
Java
139 lines
4.4 KiB
Java
|
|
# Eagler Context Redacted Diff
|
|
# Copyright (c) 2024 lax1dude. All rights reserved.
|
|
|
|
# Version: 1.0
|
|
# Author: lax1dude
|
|
|
|
> CHANGE 2 : 4 @ 2 : 3
|
|
|
|
~ import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
|
~
|
|
|
|
> CHANGE 2 : 10 @ 2 : 4
|
|
|
|
~ import net.lax1dude.eaglercraft.v1_8.internal.buffer.IntBuffer;
|
|
~
|
|
~ import net.lax1dude.eaglercraft.v1_8.IOUtils;
|
|
~ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
|
~ import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
|
~ import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
|
~ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
|
~ import net.lax1dude.eaglercraft.v1_8.opengl.ImageData;
|
|
|
|
> DELETE 2 @ 2 : 4
|
|
|
|
> DELETE 2 @ 2 : 6
|
|
|
|
> CHANGE 16 : 17 @ 16 : 17
|
|
|
|
~ public static int uploadTextureImage(int parInt1, ImageData parBufferedImage) {
|
|
|
|
> INSERT 112 : 117 @ 112
|
|
|
|
+ if (!parFlag2 && !EaglercraftGPU.checkNPOTCapable() && ImageData.isNPOTStatic(parInt2, parInt3)) {
|
|
+ parFlag2 = true;
|
|
+ logger.warn(
|
|
+ "An NPOT (non-power-of-two) texture was allocated with GL_REPEAT wrapping in an OpenGL context where that isn't supported, changing to GL_CLAMP_TO_EDGE to avoid errors");
|
|
+ }
|
|
|
|
> CHANGE 8 : 10 @ 8 : 9
|
|
|
|
~ EaglercraftGPU.glTexSubImage2D(GL_TEXTURE_2D, parInt1, parInt4, parInt5 + k, parInt2, l, GL_RGBA,
|
|
~ GL_UNSIGNED_BYTE, dataBuffer);
|
|
|
|
> CHANGE 4 : 5 @ 4 : 5
|
|
|
|
~ public static int uploadTextureImageAllocate(int parInt1, ImageData parBufferedImage, boolean parFlag,
|
|
|
|
> CHANGE 1 : 2 @ 1 : 2
|
|
|
|
~ allocateTexture(parInt1, parBufferedImage.width, parBufferedImage.height);
|
|
|
|
> CHANGE 8 : 9 @ 8 : 9
|
|
|
|
~ // deleteTexture(parInt1); //TODO: why
|
|
|
|
> CHANGE 2 : 8 @ 2 : 6
|
|
|
|
~ if (EaglercraftGPU.checkOpenGLESVersion() >= 300) {
|
|
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, '\u813d', parInt2);
|
|
~ EaglercraftGPU.glTexParameterf(GL_TEXTURE_2D, '\u813a', 0.0F);
|
|
~ EaglercraftGPU.glTexParameterf(GL_TEXTURE_2D, '\u813b', (float) parInt2);
|
|
~ // EaglercraftGPU.glTexParameterf(GL_TEXTURE_2D, '\u8501', 0.0F);
|
|
~ }
|
|
|
|
> CHANGE 1 : 2 @ 1 : 6
|
|
|
|
~ EaglercraftGPU.glTexStorage2D(GL_TEXTURE_2D, parInt2 + 1, GL_RGBA8, parInt3, parInt4);
|
|
|
|
> CHANGE 2 : 3 @ 2 : 3
|
|
|
|
~ public static int uploadTextureImageSub(int textureId, ImageData parBufferedImage, int parInt2, int parInt3,
|
|
|
|
> CHANGE 6 : 10 @ 6 : 10
|
|
|
|
~ private static void uploadTextureImageSubImpl(ImageData parBufferedImage, int parInt1, int parInt2, boolean parFlag,
|
|
~ boolean parFlag2) {
|
|
~ int i = parBufferedImage.width;
|
|
~ int j = parBufferedImage.height;
|
|
|
|
> INSERT 3 : 8 @ 3
|
|
|
|
+ if (!parFlag2 && !EaglercraftGPU.checkNPOTCapable() && parBufferedImage.isNPOT()) {
|
|
+ parFlag2 = true;
|
|
+ logger.warn(
|
|
+ "An NPOT (non-power-of-two) texture was allocated with GL_REPEAT wrapping in an OpenGL context where that isn't supported, changing to GL_CLAMP_TO_EDGE to avoid errors");
|
|
+ }
|
|
|
|
> CHANGE 8 : 10 @ 8 : 9
|
|
|
|
~ EaglercraftGPU.glTexSubImage2D(GL_TEXTURE_2D, 0, parInt1, parInt2 + i1, i, j1, GL_RGBA, GL_UNSIGNED_BYTE,
|
|
~ dataBuffer);
|
|
|
|
> CHANGE 6 : 8 @ 6 : 8
|
|
|
|
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
|
|
> CHANGE 1 : 3 @ 1 : 3
|
|
|
|
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
|
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
|
|
|
> CHANGE 10 : 12 @ 10 : 12
|
|
|
|
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, parFlag2 ? 9987 : 9729);
|
|
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
|
|
> CHANGE 1 : 3 @ 1 : 3
|
|
|
|
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, parFlag2 ? 9986 : 9728);
|
|
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
|
|
> CHANGE 25 : 26 @ 25 : 31
|
|
|
|
~ return readBufferedImage(resourceManager.getResource(imageLocation).getInputStream()).pixels;
|
|
|
|
> CHANGE 2 : 4 @ 2 : 4
|
|
|
|
~ public static ImageData readBufferedImage(InputStream imageStream) throws IOException {
|
|
~ ImageData bufferedimage;
|
|
|
|
> CHANGE 1 : 2 @ 1 : 2
|
|
|
|
~ bufferedimage = ImageData.loadImageFile(imageStream);
|
|
|
|
> INSERT 40 : 48 @ 40
|
|
|
|
+ public static int[] convertComponentOrder(int[] arr) {
|
|
+ for (int i = 0; i < arr.length; ++i) {
|
|
+ int j = arr[i];
|
|
+ arr[i] = ((j >> 16) & 0xFF) | (j & 0xFF00FF00) | ((j << 16) & 0xFF0000);
|
|
+ }
|
|
+ return arr;
|
|
+ }
|
|
+
|
|
|
|
> EOF
|