mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-22 13:19:44 +00:00
Fix PBR specular & normal textures getting ignored (#874)
* Fix PBR textures not loading - Stack was being overfilled by MemoryStack - Added tons of logging for ignored important exceptions - Added missing interface on mixin (should it be moved to gtnhlib?) * Move PBR debug to angelica config * Free malloc'd memory
This commit is contained in:
1 parent
67c8628aeb
commit
81d03ea552
6 files changed
+26
-8
No files matched your search
@@ -1,9 +1,11 @@
|
||||
package net.coderbot.iris.texture.pbr;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.mojang.AutoClosableAbstractTexture;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.TextureAtlasSpriteAccessor;
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.TextureMapAccessor;
|
||||
import lombok.Getter;
|
||||
import net.coderbot.iris.Iris;
|
||||
import net.coderbot.iris.texture.util.TextureExporter;
|
||||
import net.coderbot.iris.texture.util.TextureManipulationUtil;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
@@ -88,7 +90,7 @@ public class PBRAtlasTexture extends AutoClosableAbstractTexture {
|
||||
}
|
||||
}
|
||||
|
||||
if (PBRTextureManager.DEBUG) {
|
||||
if (AngelicaConfig.enablePBRDebug) {
|
||||
TextureExporter.exportTextures("pbr_debug/atlas", id.getResourceDomain() + "_" + id.getResourcePath().replaceAll("/", "_"), glId, mipLevel, atlasWidth, atlasHeight);
|
||||
}
|
||||
}
|
||||
@@ -98,6 +100,7 @@ public class PBRAtlasTexture extends AutoClosableAbstractTexture {
|
||||
upload(atlasWidth, atlasHeight, mipLevel, anisotropicFiltering);
|
||||
return true;
|
||||
} catch (Throwable t) {
|
||||
Iris.logger.error("Could not upload PBR texture", t);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,6 @@ import org.lwjgl.opengl.GL11;
|
||||
public class PBRTextureManager {
|
||||
public static final PBRTextureManager INSTANCE = new PBRTextureManager();
|
||||
|
||||
public static final boolean DEBUG = System.getProperty("iris.pbr.debug") != null;
|
||||
|
||||
// TODO: Figure out how to merge these two.
|
||||
private static Runnable normalTextureChangeListener;
|
||||
private static Runnable specularTextureChangeListener;
|
||||
@@ -85,7 +83,7 @@ public class PBRTextureManager {
|
||||
loader.load(texture, Minecraft.getMinecraft().getResourceManager(), consumer);
|
||||
return consumer.toHolder();
|
||||
} catch (Exception e) {
|
||||
Iris.logger.debug("Failed to load PBR textures for texture " + id, e);
|
||||
Iris.logger.error("Failed to load PBR textures for texture " + id, e);
|
||||
} finally {
|
||||
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, previousTextureBinding);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package net.coderbot.iris.texture.util;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.compat.mojang.NativeImage;
|
||||
import net.coderbot.iris.Iris;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -28,6 +30,8 @@ public class TextureExporter {
|
||||
|
||||
try {
|
||||
nativeImage.writeToFile(file);
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception e) {
|
||||
Iris.logger.error("Could not export texture", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user