diff --git a/src/main/java/com/github/halotroop/litecraft/Litecraft.java b/src/main/java/com/github/halotroop/litecraft/Litecraft.java index 7235915..ce0a96c 100644 --- a/src/main/java/com/github/halotroop/litecraft/Litecraft.java +++ b/src/main/java/com/github/halotroop/litecraft/Litecraft.java @@ -12,11 +12,11 @@ import com.github.hydos.ginger.engine.common.api.GingerRegister; import com.github.hydos.ginger.engine.common.api.game.*; import com.github.hydos.ginger.engine.common.cameras.*; import com.github.hydos.ginger.engine.common.elements.objects.*; +import com.github.hydos.ginger.engine.common.font.FontType; import com.github.hydos.ginger.engine.common.io.Window; import com.github.hydos.ginger.engine.common.obj.ModelLoader; import com.github.hydos.ginger.engine.common.obj.shapes.StaticCube; import com.github.hydos.ginger.engine.opengl.api.*; -import com.github.hydos.ginger.engine.opengl.font.FontType; import com.github.hydos.ginger.engine.opengl.render.MasterRenderer; import com.github.hydos.ginger.engine.opengl.render.models.TexturedModel; import com.github.hydos.ginger.engine.opengl.utils.GlLoader; diff --git a/src/main/java/com/github/halotroop/litecraft/screens/ExitGameScreen.java b/src/main/java/com/github/halotroop/litecraft/screens/ExitGameScreen.java index a46f1dd..e41fb08 100644 --- a/src/main/java/com/github/halotroop/litecraft/screens/ExitGameScreen.java +++ b/src/main/java/com/github/halotroop/litecraft/screens/ExitGameScreen.java @@ -2,10 +2,10 @@ package com.github.halotroop.litecraft.screens; import org.joml.*; +import com.github.hydos.ginger.engine.common.font.GUIText; import com.github.hydos.ginger.engine.common.io.Window; +import com.github.hydos.ginger.engine.common.screen.Screen; import com.github.hydos.ginger.engine.opengl.api.*; -import com.github.hydos.ginger.engine.opengl.font.GUIText; -import com.github.hydos.ginger.engine.opengl.screen.Screen; public class ExitGameScreen extends Screen { diff --git a/src/main/java/com/github/halotroop/litecraft/screens/IngameHUD.java b/src/main/java/com/github/halotroop/litecraft/screens/IngameHUD.java index 7330792..236e2b0 100644 --- a/src/main/java/com/github/halotroop/litecraft/screens/IngameHUD.java +++ b/src/main/java/com/github/halotroop/litecraft/screens/IngameHUD.java @@ -4,9 +4,9 @@ import org.joml.*; import com.github.halotroop.litecraft.Litecraft; import com.github.hydos.ginger.engine.common.api.GingerRegister; +import com.github.hydos.ginger.engine.common.font.GUIText; +import com.github.hydos.ginger.engine.common.screen.Screen; import com.github.hydos.ginger.engine.opengl.api.*; -import com.github.hydos.ginger.engine.opengl.font.GUIText; -import com.github.hydos.ginger.engine.opengl.screen.Screen; public class IngameHUD extends Screen { diff --git a/src/main/java/com/github/halotroop/litecraft/screens/TitleScreen.java b/src/main/java/com/github/halotroop/litecraft/screens/TitleScreen.java index c33c0d1..9ced4bf 100644 --- a/src/main/java/com/github/halotroop/litecraft/screens/TitleScreen.java +++ b/src/main/java/com/github/halotroop/litecraft/screens/TitleScreen.java @@ -9,10 +9,10 @@ import com.github.halotroop.litecraft.save.LitecraftSave; import com.github.halotroop.litecraft.world.dimension.Dimensions; import com.github.hydos.ginger.engine.common.elements.GuiTexture; import com.github.hydos.ginger.engine.common.elements.buttons.TextureButton; +import com.github.hydos.ginger.engine.common.font.GUIText; import com.github.hydos.ginger.engine.common.io.Window; +import com.github.hydos.ginger.engine.common.screen.Screen; import com.github.hydos.ginger.engine.opengl.api.GingerGL; -import com.github.hydos.ginger.engine.opengl.font.GUIText; -import com.github.hydos.ginger.engine.opengl.screen.Screen; /** * YeS diff --git a/src/main/java/com/github/halotroop/litecraft/world/block/BlockRenderer.java b/src/main/java/com/github/halotroop/litecraft/world/block/BlockRenderer.java index d1830b2..7cdefda 100644 --- a/src/main/java/com/github/halotroop/litecraft/world/block/BlockRenderer.java +++ b/src/main/java/com/github/halotroop/litecraft/world/block/BlockRenderer.java @@ -17,11 +17,9 @@ import com.github.hydos.ginger.engine.opengl.utils.GlLoader; public class BlockRenderer extends Renderer implements WorldGenConstants { - private StaticShader shader; - public int atlasID; - + public BlockRenderer(StaticShader shader, Matrix4f projectionMatrix) { this.shader = shader; @@ -33,7 +31,8 @@ public class BlockRenderer extends Renderer implements WorldGenConstants private void prepBlockInstance(RenderObject entity) { - Matrix4f transformationMatrix = Maths.createTransformationMatrix(entity.getPosition(), entity.getRotX(), entity.getRotY(), entity.getRotZ(), entity.getScale()); + Matrix4f transformationMatrix = Maths.createTransformationMatrix(entity.getPosition(), entity.getRotX(), + entity.getRotY(), entity.getRotZ(), entity.getScale()); shader.loadTransformationMatrix(transformationMatrix); } @@ -52,19 +51,18 @@ public class BlockRenderer extends Renderer implements WorldGenConstants GL20.glDisableVertexAttribArray(2); GL30.glBindVertexArray(0); } - - public void enableWireframe() { - if (GingerRegister.getInstance().wireframe) - GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); - } - - public void disableWireframe() { - if (GingerRegister.getInstance().wireframe) - GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); - } - - public void prepareRender() { - //TODO: combine VBOS + + public void enableWireframe() + { if (GingerRegister.getInstance().wireframe) + GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); } + + public void disableWireframe() + { if (GingerRegister.getInstance().wireframe) + GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); } + + public void prepareRender() + { + // TODO: combine VBOS shader.start(); shader.loadSkyColour(Window.getColour()); shader.loadViewMatrix(GingerRegister.getInstance().game.data.camera); @@ -81,18 +79,18 @@ public class BlockRenderer extends Renderer implements WorldGenConstants for (int x = 0; x < CHUNK_SIZE; x++) for (int y = 0; y < CHUNK_SIZE; y++) for (int z = 0; z < CHUNK_SIZE; z++) - { - BlockInstance entity = renderList[Chunk.index(x, y, z)]; - if (entity != null && entity.getModel() != null) - { - TexturedModel blockModel = entity.getModel(); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, blockModel.getTexture().getTextureID()); - prepBlockInstance(entity); - GL11.glDrawElements(GL11.GL_TRIANGLES, blockModel.getRawModel().getVertexCount(), GL11.GL_UNSIGNED_INT, 0); - } - } + { + BlockInstance entity = renderList[Chunk.index(x, y, z)]; + if (entity != null && entity.getModel() != null) + { + TexturedModel blockModel = entity.getModel(); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, blockModel.getTexture().getTextureID()); + prepBlockInstance(entity); + GL11.glDrawElements(GL11.GL_TRIANGLES, blockModel.getRawModel().getVertexCount(), + GL11.GL_UNSIGNED_INT, 0); + } + } disableWireframe(); shader.stop(); - } } diff --git a/src/main/java/com/github/hydos/ginger/engine/common/api/GingerRegister.java b/src/main/java/com/github/hydos/ginger/engine/common/api/GingerRegister.java index fd5973c..e4a8a4e 100644 --- a/src/main/java/com/github/hydos/ginger/engine/common/api/GingerRegister.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/api/GingerRegister.java @@ -4,10 +4,10 @@ import java.util.*; import com.github.hydos.ginger.engine.common.api.game.Game; import com.github.hydos.ginger.engine.common.elements.buttons.TextureButton; -import com.github.hydos.ginger.engine.opengl.font.GUIText; +import com.github.hydos.ginger.engine.common.font.GUIText; +import com.github.hydos.ginger.engine.common.screen.Screen; import com.github.hydos.ginger.engine.opengl.postprocessing.Fbo; import com.github.hydos.ginger.engine.opengl.render.MasterRenderer; -import com.github.hydos.ginger.engine.opengl.screen.Screen; import com.github.hydos.multithreading.GingerThreading; /** Used if a game wants to access engine variables safely */ diff --git a/src/main/java/com/github/hydos/ginger/engine/opengl/fbo/FboCallbackHandler.java b/src/main/java/com/github/hydos/ginger/engine/common/fbo/FboCallbackHandler.java similarity index 73% rename from src/main/java/com/github/hydos/ginger/engine/opengl/fbo/FboCallbackHandler.java rename to src/main/java/com/github/hydos/ginger/engine/common/fbo/FboCallbackHandler.java index fb50251..8281895 100644 --- a/src/main/java/com/github/hydos/ginger/engine/opengl/fbo/FboCallbackHandler.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/fbo/FboCallbackHandler.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.opengl.fbo; +package com.github.hydos.ginger.engine.common.fbo; public abstract class FboCallbackHandler { diff --git a/src/main/java/com/github/hydos/ginger/engine/opengl/font/Character.java b/src/main/java/com/github/hydos/ginger/engine/common/font/Character.java similarity index 98% rename from src/main/java/com/github/hydos/ginger/engine/opengl/font/Character.java rename to src/main/java/com/github/hydos/ginger/engine/common/font/Character.java index a78190b..daf9fea 100644 --- a/src/main/java/com/github/hydos/ginger/engine/opengl/font/Character.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/font/Character.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.opengl.font; +package com.github.hydos.ginger.engine.common.font; /** Simple data structure class holding information about a certain glyph in the * font texture atlas. All sizes are for a font-size of 1. */ diff --git a/src/main/java/com/github/hydos/ginger/engine/opengl/font/FontType.java b/src/main/java/com/github/hydos/ginger/engine/common/font/FontType.java similarity index 96% rename from src/main/java/com/github/hydos/ginger/engine/opengl/font/FontType.java rename to src/main/java/com/github/hydos/ginger/engine/common/font/FontType.java index c3545b3..f98d74c 100644 --- a/src/main/java/com/github/hydos/ginger/engine/opengl/font/FontType.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/font/FontType.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.opengl.font; +package com.github.hydos.ginger.engine.common.font; /** Represents a font. It holds the font's texture atlas as well as having the * ability to create the quad vertices for any text using this font. */ diff --git a/src/main/java/com/github/hydos/ginger/engine/opengl/font/GUIText.java b/src/main/java/com/github/hydos/ginger/engine/common/font/GUIText.java similarity index 99% rename from src/main/java/com/github/hydos/ginger/engine/opengl/font/GUIText.java rename to src/main/java/com/github/hydos/ginger/engine/common/font/GUIText.java index e4aff05..13ca683 100644 --- a/src/main/java/com/github/hydos/ginger/engine/opengl/font/GUIText.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/font/GUIText.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.opengl.font; +package com.github.hydos.ginger.engine.common.font; import org.joml.*; diff --git a/src/main/java/com/github/hydos/ginger/engine/opengl/font/Line.java b/src/main/java/com/github/hydos/ginger/engine/common/font/Line.java similarity index 97% rename from src/main/java/com/github/hydos/ginger/engine/opengl/font/Line.java rename to src/main/java/com/github/hydos/ginger/engine/common/font/Line.java index 7fd25cd..d610a5e 100644 --- a/src/main/java/com/github/hydos/ginger/engine/opengl/font/Line.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/font/Line.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.opengl.font; +package com.github.hydos.ginger.engine.common.font; import java.util.*; diff --git a/src/main/java/com/github/hydos/ginger/engine/opengl/font/MetaFile.java b/src/main/java/com/github/hydos/ginger/engine/common/font/MetaFile.java similarity index 99% rename from src/main/java/com/github/hydos/ginger/engine/opengl/font/MetaFile.java rename to src/main/java/com/github/hydos/ginger/engine/common/font/MetaFile.java index 1d13845..42646e4 100644 --- a/src/main/java/com/github/hydos/ginger/engine/opengl/font/MetaFile.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/font/MetaFile.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.opengl.font; +package com.github.hydos.ginger.engine.common.font; import java.io.*; import java.util.*; diff --git a/src/main/java/com/github/hydos/ginger/engine/opengl/font/TextMaster.java b/src/main/java/com/github/hydos/ginger/engine/common/font/TextMaster.java similarity index 96% rename from src/main/java/com/github/hydos/ginger/engine/opengl/font/TextMaster.java rename to src/main/java/com/github/hydos/ginger/engine/common/font/TextMaster.java index 6f665da..0aad404 100644 --- a/src/main/java/com/github/hydos/ginger/engine/opengl/font/TextMaster.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/font/TextMaster.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.opengl.font; +package com.github.hydos.ginger.engine.common.font; import java.util.*; diff --git a/src/main/java/com/github/hydos/ginger/engine/opengl/font/TextMeshCreator.java b/src/main/java/com/github/hydos/ginger/engine/common/font/TextMeshCreator.java similarity index 98% rename from src/main/java/com/github/hydos/ginger/engine/opengl/font/TextMeshCreator.java rename to src/main/java/com/github/hydos/ginger/engine/common/font/TextMeshCreator.java index 28f3675..83e01df 100644 --- a/src/main/java/com/github/hydos/ginger/engine/opengl/font/TextMeshCreator.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/font/TextMeshCreator.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.opengl.font; +package com.github.hydos.ginger.engine.common.font; import java.util.*; diff --git a/src/main/java/com/github/hydos/ginger/engine/opengl/font/TextMeshData.java b/src/main/java/com/github/hydos/ginger/engine/common/font/TextMeshData.java similarity index 91% rename from src/main/java/com/github/hydos/ginger/engine/opengl/font/TextMeshData.java rename to src/main/java/com/github/hydos/ginger/engine/common/font/TextMeshData.java index da65526..ae95597 100644 --- a/src/main/java/com/github/hydos/ginger/engine/opengl/font/TextMeshData.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/font/TextMeshData.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.opengl.font; +package com.github.hydos.ginger.engine.common.font; /** Stores the vertex data for all the quads on which a text will be rendered. */ public class TextMeshData diff --git a/src/main/java/com/github/hydos/ginger/engine/opengl/font/Word.java b/src/main/java/com/github/hydos/ginger/engine/common/font/Word.java similarity index 94% rename from src/main/java/com/github/hydos/ginger/engine/opengl/font/Word.java rename to src/main/java/com/github/hydos/ginger/engine/common/font/Word.java index d983674..fb55f06 100644 --- a/src/main/java/com/github/hydos/ginger/engine/opengl/font/Word.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/font/Word.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.opengl.font; +package com.github.hydos.ginger.engine.common.font; import java.util.*; diff --git a/src/main/java/com/github/hydos/ginger/engine/opengl/screen/Screen.java b/src/main/java/com/github/hydos/ginger/engine/common/screen/Screen.java similarity index 84% rename from src/main/java/com/github/hydos/ginger/engine/opengl/screen/Screen.java rename to src/main/java/com/github/hydos/ginger/engine/common/screen/Screen.java index a3e48ae..c60d227 100644 --- a/src/main/java/com/github/hydos/ginger/engine/opengl/screen/Screen.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/screen/Screen.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.opengl.screen; +package com.github.hydos.ginger.engine.common.screen; import java.util.List; diff --git a/src/main/java/com/github/hydos/ginger/engine/opengl/api/GingerGL.java b/src/main/java/com/github/hydos/ginger/engine/opengl/api/GingerGL.java index 7d8002b..bbc65e7 100644 --- a/src/main/java/com/github/hydos/ginger/engine/opengl/api/GingerGL.java +++ b/src/main/java/com/github/hydos/ginger/engine/opengl/api/GingerGL.java @@ -9,12 +9,12 @@ import com.github.hydos.ginger.engine.common.api.GingerRegister; import com.github.hydos.ginger.engine.common.api.game.*; import com.github.hydos.ginger.engine.common.elements.buttons.TextureButton; import com.github.hydos.ginger.engine.common.elements.objects.Player; +import com.github.hydos.ginger.engine.common.font.*; import com.github.hydos.ginger.engine.common.io.Window; -import com.github.hydos.ginger.engine.opengl.font.*; +import com.github.hydos.ginger.engine.common.screen.Screen; import com.github.hydos.ginger.engine.opengl.postprocessing.*; import com.github.hydos.ginger.engine.opengl.render.MasterRenderer; import com.github.hydos.ginger.engine.opengl.render.tools.MousePicker; -import com.github.hydos.ginger.engine.opengl.screen.Screen; import com.github.hydos.ginger.engine.opengl.utils.GlLoader; import com.github.hydos.multithreading.GingerThreading; diff --git a/src/main/java/com/github/hydos/ginger/engine/opengl/api/GingerUtils.java b/src/main/java/com/github/hydos/ginger/engine/opengl/api/GingerUtils.java index e5a52e7..23e00fe 100644 --- a/src/main/java/com/github/hydos/ginger/engine/opengl/api/GingerUtils.java +++ b/src/main/java/com/github/hydos/ginger/engine/opengl/api/GingerUtils.java @@ -1,8 +1,8 @@ package com.github.hydos.ginger.engine.opengl.api; +import com.github.hydos.ginger.engine.common.font.TextMaster; import com.github.hydos.ginger.engine.common.obj.ModelLoader; import com.github.hydos.ginger.engine.common.obj.normals.NormalMappedObjLoader; -import com.github.hydos.ginger.engine.opengl.font.TextMaster; import com.github.hydos.ginger.engine.opengl.render.MasterRenderer; import com.github.hydos.ginger.engine.opengl.render.models.*; import com.github.hydos.ginger.engine.opengl.render.texture.ModelTexture; diff --git a/src/main/java/com/github/hydos/ginger/engine/opengl/postprocessing/ContrastChanger.java b/src/main/java/com/github/hydos/ginger/engine/opengl/postprocessing/ContrastChanger.java index de7a1ac..1e8b5bd 100644 --- a/src/main/java/com/github/hydos/ginger/engine/opengl/postprocessing/ContrastChanger.java +++ b/src/main/java/com/github/hydos/ginger/engine/opengl/postprocessing/ContrastChanger.java @@ -2,7 +2,7 @@ package com.github.hydos.ginger.engine.opengl.postprocessing; import org.lwjgl.opengl.*; -import com.github.hydos.ginger.engine.opengl.fbo.FboCallbackHandler; +import com.github.hydos.ginger.engine.common.fbo.FboCallbackHandler; public class ContrastChanger extends FboCallbackHandler { diff --git a/src/main/java/com/github/hydos/ginger/engine/opengl/postprocessing/Fbo.java b/src/main/java/com/github/hydos/ginger/engine/opengl/postprocessing/Fbo.java index ec41b83..38bd3de 100644 --- a/src/main/java/com/github/hydos/ginger/engine/opengl/postprocessing/Fbo.java +++ b/src/main/java/com/github/hydos/ginger/engine/opengl/postprocessing/Fbo.java @@ -8,8 +8,8 @@ import java.nio.ByteBuffer; import org.lwjgl.glfw.*; import org.lwjgl.system.Callback; +import com.github.hydos.ginger.engine.common.fbo.FboCallbackHandler; import com.github.hydos.ginger.engine.common.io.Window; -import com.github.hydos.ginger.engine.opengl.fbo.FboCallbackHandler; public class Fbo { diff --git a/src/main/java/com/github/hydos/ginger/engine/opengl/render/renderers/FontRenderer.java b/src/main/java/com/github/hydos/ginger/engine/opengl/render/renderers/FontRenderer.java index 26dda53..90c4629 100644 --- a/src/main/java/com/github/hydos/ginger/engine/opengl/render/renderers/FontRenderer.java +++ b/src/main/java/com/github/hydos/ginger/engine/opengl/render/renderers/FontRenderer.java @@ -4,7 +4,7 @@ import java.util.*; import org.lwjgl.opengl.*; -import com.github.hydos.ginger.engine.opengl.font.*; +import com.github.hydos.ginger.engine.common.font.*; import com.github.hydos.ginger.engine.opengl.render.Renderer; import com.github.hydos.ginger.engine.opengl.render.shaders.FontShader; diff --git a/src/main/java/com/github/hydos/ginger/engine/opengl/render/shaders/FontShader.java b/src/main/java/com/github/hydos/ginger/engine/opengl/render/shaders/FontShader.java index aeb7f85..9e01c00 100644 --- a/src/main/java/com/github/hydos/ginger/engine/opengl/render/shaders/FontShader.java +++ b/src/main/java/com/github/hydos/ginger/engine/opengl/render/shaders/FontShader.java @@ -2,7 +2,7 @@ package com.github.hydos.ginger.engine.opengl.render.shaders; import org.joml.*; -import com.github.hydos.ginger.engine.opengl.font.GUIText; +import com.github.hydos.ginger.engine.common.font.GUIText; public class FontShader extends ShaderProgram { diff --git a/src/main/java/com/github/hydos/ginger/engine/opengl/voxelutils/BlockMesher.java b/src/main/java/com/github/hydos/ginger/engine/opengl/voxelutils/BlockMesher.java deleted file mode 100644 index 5bd785d..0000000 --- a/src/main/java/com/github/hydos/ginger/engine/opengl/voxelutils/BlockMesher.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.github.hydos.ginger.engine.opengl.voxelutils; - -public class BlockMesher -{ - //TODO: supercoder i ask you that you figure a way to cull inner faces and not just whole blocks :) -}