diff --git a/src/projectzombie/display/DisplayRenderUI.java b/src/projectzombie/display/DisplayRenderUI.java index b255b7c..5ac3995 100755 --- a/src/projectzombie/display/DisplayRenderUI.java +++ b/src/projectzombie/display/DisplayRenderUI.java @@ -1,5 +1,13 @@ package projectzombie.display; +import org.lwjgl.opengl.GL33; + +import gl_engine.matrix.Matrix4; +import gl_engine.vec.Vec3d; +import projectzombie.Main; +import projectzombie.init.Models; +import projectzombie.util.gl.GlHelpers; + public class DisplayRenderUI { public static boolean showFPS = false; @@ -8,7 +16,15 @@ public class DisplayRenderUI public static void render() { + Matrix4 matrix = Matrix4.identity(); + Matrix4 projection = Matrix4.scale(new Vec3d(1/GlHelpers.getAspectRatio(), 1, 1)); + GL33.glUniformMatrix4fv(Main.window.glsl_projection, true, projection.getArray()); + GL33.glUniformMatrix4fv(Main.window.glsl_camera, true, matrix.getArray()); + GL33.glUniformMatrix4fv(Main.window.glsl_model, true, matrix.getArray()); + + Models.UI_ITEM_SLOTS.bind(); + Models.UI_ITEM_SLOTS.render(); // Render the loaded menu //Main.menu.render(); diff --git a/src/projectzombie/display/DisplayWindow.java b/src/projectzombie/display/DisplayWindow.java index f72990b..344c3ff 100755 --- a/src/projectzombie/display/DisplayWindow.java +++ b/src/projectzombie/display/DisplayWindow.java @@ -98,7 +98,7 @@ public class DisplayWindow implements IMainloopTask //GLFW.glfwShowWindow(this.window); GL33.glEnable(GL33.GL_DEPTH_TEST); - GL33.glEnable(GL33.GL_BLEND); + //GL33.glEnable(GL33.GL_BLEND); environmentRenderer = new GraphicsShader("/resources/shader/environmentRenderer"); environmentRenderer.use(); diff --git a/src/projectzombie/init/Models.java b/src/projectzombie/init/Models.java index ebf6fc3..3933cbf 100755 --- a/src/projectzombie/init/Models.java +++ b/src/projectzombie/init/Models.java @@ -58,7 +58,7 @@ public class Models public static final Model UI_HEALTH_FG = new ModelGui(Resources.ATLAS.get("/gui/health_full.png")); public static final Model UI_HEALTH_BG = new ModelGui(Resources.ATLAS.get("/gui/health_empty.png")); - public static final Model UI_ITEM_SLOTS = new ModelGui(Resources.ATLAS.get("/gui/hotbar.png")); + public static final Model UI_ITEM_SLOTS = new ModelGui(Resources.ATLAS.get("/gui/hotbar.png"), new Vec2d(6, 1)); public static final Model UI_ACTIVE_SLOT = new ModelGui(Resources.ATLAS.get("/gui/hotbar_selected.png")); public static final Model UI_DEFENCE_LEVEL = new ModelGui(Resources.ATLAS.get("/gui/shield.png")); diff --git a/src/projectzombie/model/Model.java b/src/projectzombie/model/Model.java index 09b287f..64c62dd 100644 --- a/src/projectzombie/model/Model.java +++ b/src/projectzombie/model/Model.java @@ -28,17 +28,11 @@ public abstract class Model public abstract double getHeight(); public abstract int getSize(); - private TextureRef3D tex; - private void generate() { float[] verticies = this.getVerticies(); TextureRef3D[] refs = this.getTextures(); - if(refs.length != 0) { - tex = refs[0]; - } - if(verticies.length % SIZE != 0 || refs.length * 3 != verticies.length / SIZE) { System.err.println("Invalid model"); System.exit(1); @@ -91,19 +85,6 @@ public abstract class Model } } - public void texCoord(double x, double y) - { - if(!loaded) { - generate(); - } - - double k = 0.001; - x = MathHelpers.map(x, 0, 1, tex.sx + k, tex.ex - k); - y = MathHelpers.map(y, 0, 1, tex.sy + k, tex.ey - k); - - GL33.glTexCoord2d(x, y); - } - public void render() { GL33.glDrawArrays(GL33.GL_TRIANGLES, 0, getSize()); } diff --git a/src/projectzombie/model/ModelGui.java b/src/projectzombie/model/ModelGui.java index bc75b28..ea3940a 100644 --- a/src/projectzombie/model/ModelGui.java +++ b/src/projectzombie/model/ModelGui.java @@ -49,13 +49,13 @@ public class ModelGui extends Model height = y; return new float[] { - 0, 0, 0, 0, 0, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0x11, - x, 0, 0, 1, 0, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0x11, - x, y, 0, 1, 1, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0x11, + 0, 0, 0, 0, 0, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0x10, + x, 0, 0, 1, 0, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0x10, + x, y, 0, 1, 1, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0x10, - x, y, 0, 1, 1, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0x11, - 0, y, 0, 0, 1, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0x11, - 0, 0, 0, 0, 0, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0x11, + x, y, 0, 1, 1, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0x10, + 0, y, 0, 0, 1, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0x10, + 0, 0, 0, 0, 0, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0x10, }; }