imrove debug logging
This commit is contained in:
parent
0be3f218e5
commit
324332c242
10 changed files with 37 additions and 27 deletions
|
@ -853,8 +853,6 @@ public class Client implements IThreadListener {
|
|||
GL15.glMatrixMode(GL15.GL_MODELVIEW);
|
||||
this.textureMap = new TextureMap();
|
||||
this.textureManager.loadTexture(TextureMap.BLOCKS, this.textureMap);
|
||||
this.textureManager.bindTexture(TextureMap.BLOCKS);
|
||||
TextureUtil.setParams();
|
||||
this.modelManager = new ModelManager(this.textureMap);
|
||||
this.modelManager.onReload();
|
||||
this.renderItem = new RenderItem(this.textureManager, this.modelManager);
|
||||
|
|
|
@ -96,13 +96,13 @@ public enum Font implements Identifyable, Displayable {
|
|||
img = TextureUtil.readImage(FileUtils.getResource("textures/font_" + font.name + ".png"));
|
||||
}
|
||||
catch(FileNotFoundException e) {
|
||||
Log.IO.error("Konnte Font-Textur nicht laden: Datei nicht vorhanden");
|
||||
Log.IO.error("Konnte Font-Textur '%s' nicht laden: Datei nicht vorhanden", font.name);
|
||||
}
|
||||
catch(IOException e) {
|
||||
Log.IO.error(e, "Konnte Font-Textur nicht laden");
|
||||
Log.IO.error(e, "Konnte Font-Textur '%s' nicht laden", font.name);
|
||||
}
|
||||
if(img != null && (img.getWidth() != width * 16 || img.getHeight() != height * 16)) {
|
||||
Log.IO.error("Konnte Font-Textur nicht laden: Größe ist nicht %dx%d", width * 16, height * 16);
|
||||
Log.IO.error("Konnte Font-Textur '%s' nicht laden: Größe ist nicht %dx%d", font.name, width * 16, height * 16);
|
||||
img = null;
|
||||
}
|
||||
if(img == null)
|
||||
|
@ -112,7 +112,7 @@ public enum Font implements Identifyable, Displayable {
|
|||
calculate(data, font.sizes, width, height, 0);
|
||||
font.texture = GL15.glGenTextures();
|
||||
TextureUtil.uploadImage(font.texture, img);
|
||||
Log.RENDER.debug("Font-Textur wurde mit ID #%d geladen", font.texture);
|
||||
Log.RENDER.debug("Font-Textur '%s' wurde mit ID #%d geladen", font.name, font.texture);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,8 +141,8 @@ public enum Font implements Identifyable, Displayable {
|
|||
public static void unloadFonts() {
|
||||
for(Font font : values()) {
|
||||
if(font.texture != 0) {
|
||||
GL15.glDeleteTextures(font.texture);
|
||||
Log.RENDER.debug("Font-Textur mit ID #%d wurde gelöscht", font.texture);
|
||||
GlState.deleteTexture(font.texture);
|
||||
Log.RENDER.debug("Font-Textur '%s' mit ID #%d wurde gelöscht", font.name, font.texture);
|
||||
font.texture = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ public class VertexBuffer {
|
|||
public VertexBuffer(VertexFormat format) {
|
||||
this.format = format;
|
||||
this.id = GL15.glGenBuffers();
|
||||
// Log.SYSTEM.debug("Puffer mit Größe %d (%dE) wurde mit ID #%d geladen", this.format.getNextOffset(), this.format.getElementCount(), this.id);
|
||||
}
|
||||
|
||||
public void bindBuffer() {
|
||||
|
@ -36,6 +37,7 @@ public class VertexBuffer {
|
|||
public void deleteGlBuffers() {
|
||||
if(this.id >= 0) {
|
||||
GL15.glDeleteBuffers(this.id);
|
||||
// Log.SYSTEM.debug("Puffer mit Größe %d (%dE) / ID #%d wurde gelöscht", this.format.getNextOffset(), this.format.getElementCount(), this.id);
|
||||
this.id = -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,18 +15,6 @@ public class VertexFormat
|
|||
private List<Integer> uvOffsetsById;
|
||||
private int normalElementOffset;
|
||||
|
||||
public VertexFormat(VertexFormat vertexFormatIn)
|
||||
{
|
||||
this();
|
||||
|
||||
for (int i = 0; i < vertexFormatIn.getElementCount(); ++i)
|
||||
{
|
||||
this.addElement(vertexFormatIn.getElement(i));
|
||||
}
|
||||
|
||||
this.nextOffset = vertexFormatIn.getNextOffset();
|
||||
}
|
||||
|
||||
public VertexFormat()
|
||||
{
|
||||
this.elements = Lists.<VertexFormatElement>newArrayList();
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.awt.image.BufferedImage;
|
|||
import java.io.IOException;
|
||||
|
||||
import client.renderer.GlState;
|
||||
import common.log.Log;
|
||||
|
||||
public class DynamicTexture extends Texture {
|
||||
private final int[] data;
|
||||
|
@ -21,6 +22,7 @@ public class DynamicTexture extends Texture {
|
|||
this.height = height;
|
||||
this.data = new int[width * height];
|
||||
TextureUtil.allocateTexture(this.getGlTextureId(), width, height);
|
||||
Log.RENDER.debug("Dynamische Textur in Größe %dx%d wurde mit ID #%d erstellt", width, height, this.getGlTextureId());
|
||||
}
|
||||
|
||||
public void loadTexture() throws IOException {
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.List;
|
|||
import client.util.FileUtils;
|
||||
import common.collect.Lists;
|
||||
import common.log.Log;
|
||||
import common.util.Util;
|
||||
|
||||
public class LayeredTexture extends Texture
|
||||
{
|
||||
|
@ -21,7 +22,10 @@ public class LayeredTexture extends Texture
|
|||
|
||||
public void loadTexture() throws IOException
|
||||
{
|
||||
this.deleteGlTexture();
|
||||
int id = this.deleteGlTexture();
|
||||
if(id != -1)
|
||||
Log.RENDER.debug("Textur '%s' mit ID #%d wurde gelöscht", Util.buildLines("|", this.layers), id);
|
||||
|
||||
BufferedImage bufferedimage = null;
|
||||
|
||||
try
|
||||
|
@ -49,5 +53,6 @@ public class LayeredTexture extends Texture
|
|||
}
|
||||
|
||||
TextureUtil.uploadImage(this.getGlTextureId(), bufferedimage);
|
||||
Log.RENDER.debug("Textur '%s' wurde mit ID #%d geladen", Util.buildLines("|", this.layers), this.getGlTextureId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
|
||||
import client.util.FileUtils;
|
||||
import common.log.Log;
|
||||
|
||||
public class SimpleTexture extends Texture {
|
||||
private final String texture;
|
||||
|
@ -14,12 +15,15 @@ public class SimpleTexture extends Texture {
|
|||
}
|
||||
|
||||
public void loadTexture() throws IOException {
|
||||
this.deleteGlTexture();
|
||||
int id = this.deleteGlTexture();
|
||||
if(id != -1)
|
||||
Log.RENDER.debug("Textur '%s' mit ID #%d wurde gelöscht", this.texture, id);
|
||||
InputStream in = null;
|
||||
try {
|
||||
in = FileUtils.getResource(this.texture);
|
||||
BufferedImage img = TextureUtil.readImage(in);
|
||||
TextureUtil.uploadImage(this.getGlTextureId(), img);
|
||||
Log.RENDER.debug("Textur '%s' wurde mit ID #%d geladen", this.texture, this.getGlTextureId());
|
||||
}
|
||||
finally {
|
||||
if(in != null)
|
||||
|
|
|
@ -15,11 +15,14 @@ public abstract class Texture {
|
|||
return this.id;
|
||||
}
|
||||
|
||||
public final void deleteGlTexture() {
|
||||
public final int deleteGlTexture() {
|
||||
if(this.id != -1) {
|
||||
GlState.deleteTexture(this.id);
|
||||
int id = this.id;
|
||||
this.id = -1;
|
||||
return id;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public abstract void loadTexture() throws IOException;
|
||||
|
|
|
@ -45,8 +45,13 @@ public class TextureManager {
|
|||
|
||||
public void deleteTexture(String res) {
|
||||
Texture tex = this.getTexture(res);
|
||||
if(tex != null)
|
||||
GlState.deleteTexture(tex.getGlTextureId());
|
||||
if(tex != null) {
|
||||
int id = tex.getGlTextureId();
|
||||
if(id != -1) {
|
||||
GlState.deleteTexture(id);
|
||||
Log.RENDER.debug("Textur '%s' mit ID #%d wurde gelöscht (Manager)", res, id);
|
||||
}
|
||||
}
|
||||
this.textures.remove(res);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,9 @@ public class TextureMap extends Texture
|
|||
sprites.put(loc, sprite);
|
||||
}
|
||||
this.initMissingImage();
|
||||
this.deleteGlTexture();
|
||||
int id = this.deleteGlTexture();
|
||||
if(id != -1)
|
||||
Log.RENDER.debug("Textur-Atlas mit ID #%d wurde gelöscht", id);
|
||||
this.loadTextureAtlas();
|
||||
}
|
||||
|
||||
|
@ -154,7 +156,6 @@ public class TextureMap extends Texture
|
|||
throw stitcherexception;
|
||||
}
|
||||
|
||||
Log.RENDER.info("Textur-Atlas in Größe " + stitcher.getCurrentWidth() + "x" + stitcher.getCurrentHeight() + " erstellt");
|
||||
TextureUtil.allocateTexture(this.getGlTextureId(), this.width = stitcher.getCurrentWidth(), this.height = stitcher.getCurrentHeight());
|
||||
Map<String, Sprite> map = Maps.<String, Sprite>newHashMap(this.mapRegisteredSprites);
|
||||
|
||||
|
@ -176,6 +177,8 @@ public class TextureMap extends Texture
|
|||
{
|
||||
textureatlassprite3.copyFrom(this.missingImage);
|
||||
}
|
||||
|
||||
Log.RENDER.info("Textur-Atlas in Größe %dx%d wurde mit ID #%d erstellt", stitcher.getCurrentWidth(), + stitcher.getCurrentHeight(), this.getGlTextureId());
|
||||
}
|
||||
|
||||
public Sprite getAtlasSprite(String iconName)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue