more texture creation logging
Some checks reported errors
studiorailgun/Renderer/pipeline/head Something is wrong with the build of this commit

This commit is contained in:
austin 2024-08-28 23:11:39 -04:00
parent 831df3d6af
commit 88135c4fbe

View File

@ -167,6 +167,7 @@ public class Texture {
height = 1; height = 1;
try { try {
BufferedImage image_data = ImageIO.read(FileUtils.getAssetFile(path)); BufferedImage image_data = ImageIO.read(FileUtils.getAssetFile(path));
LoggerInterface.loggerRenderer.DEBUG("Read image");
// //
//transparency check //transparency check
@ -204,21 +205,16 @@ public class Texture {
for(int x = 0; x < width; x++){ for(int x = 0; x < width; x++){
Color temp = new Color(image_data.getRGB(x, y), hasTransparency); Color temp = new Color(image_data.getRGB(x, y), hasTransparency);
if(data.position() + 3 > data.limit() + 1){
throw new IllegalStateException("Hit buffer limit!");
}
data.put((byte)temp.getRed()); data.put((byte)temp.getRed());
data.put((byte)temp.getGreen()); data.put((byte)temp.getGreen());
data.put((byte)temp.getBlue()); data.put((byte)temp.getBlue());
if(hasTransparency){ if(hasTransparency){
if(data.position() + 1 > data.limit() + 1){
throw new IllegalStateException("Hit buffer limit!");
}
data.put((byte)temp.getAlpha()); data.put((byte)temp.getAlpha());
} }
} }
} }
} catch (IOException ex) { } catch (IOException ex) {
LoggerInterface.loggerRenderer.DEBUG("Failed to read image");
ex.printStackTrace(); ex.printStackTrace();
hasTransparency = false; hasTransparency = false;
data = BufferUtils.createByteBuffer(3); data = BufferUtils.createByteBuffer(3);