From c448d21a8e152e8dca3aa4fd87586feee954cff8 Mon Sep 17 00:00:00 2001 From: hYdos Date: Tue, 25 Feb 2020 07:55:32 +1000 Subject: [PATCH] Extra update --- .../ginger/engine/render/MasterRenderer.java | 22 +++++-------------- .../hydos/ginger/engine/utils/Loader.java | 8 +++---- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/github/hydos/ginger/engine/render/MasterRenderer.java b/src/main/java/com/github/hydos/ginger/engine/render/MasterRenderer.java index ca1fd5b..c88a4ec 100644 --- a/src/main/java/com/github/hydos/ginger/engine/render/MasterRenderer.java +++ b/src/main/java/com/github/hydos/ginger/engine/render/MasterRenderer.java @@ -20,10 +20,7 @@ public class MasterRenderer { private StaticShader entityShader; private EntityRenderer entityRenderer; - - private TerrainShader terrainShader; - private TerrainRenderer terrainRenderer; - + private GuiShader guiShader; private GuiRenderer guiRenderer; @@ -53,10 +50,7 @@ public class MasterRenderer { guiRenderer = new GuiRenderer(guiShader); normalRenderer = new NormalMappingRenderer(projectionMatrix); - - terrainShader = new TerrainShader(); - terrainRenderer = new TerrainRenderer(terrainShader, projectionMatrix); - + shadowMapRenderer = new ShadowMapMasterRenderer(camera); } @@ -73,7 +67,8 @@ public class MasterRenderer { public void prepare() { GL13.glActiveTexture(GL13.GL_TEXTURE5); GL11.glBindTexture(GL11.GL_TEXTURE_2D, shadowMapRenderer.getShadowMap()); - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); } public void renderScene(List entities, List normalEntities, List terrains, List lights, Camera camera, Vector4f clipPlane) { @@ -97,13 +92,7 @@ public class MasterRenderer { guiRenderer.render(guis); } - private void renderTerrains(List terrains, List lights, Camera camera) { - terrainShader.start(); - terrainShader.loadSkyColour(Window.getColour()); - terrainShader.loadLights(lights); - terrainShader.loadViewMatrix(camera); - terrainRenderer.render(terrains, shadowMapRenderer.getToShadowMapSpaceMatrix()); - terrainShader.stop(); + private void renderTerrains(List terrains, List lights, Camera camera) { } private void renderEntities(List entities, Camera camera, List lights) { @@ -158,7 +147,6 @@ public class MasterRenderer { public void cleanUp() { entityShader.cleanUp(); - terrainShader.cleanUp(); guiRenderer.cleanUp(); shadowMapRenderer.cleanUp(); normalRenderer.cleanUp(); diff --git a/src/main/java/com/github/hydos/ginger/engine/utils/Loader.java b/src/main/java/com/github/hydos/ginger/engine/utils/Loader.java index bda170c..ebe3a46 100644 --- a/src/main/java/com/github/hydos/ginger/engine/utils/Loader.java +++ b/src/main/java/com/github/hydos/ginger/engine/utils/Loader.java @@ -180,8 +180,8 @@ public class Loader { GL11.glTexParameterf(GL11.GL_TEXTURE_2D, 10240, 9729.0f); GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, texture.getWidth(), texture.getHeight(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, texture.getImage()); GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0); - GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, -1f); - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); if(Window.glContext.GL_EXT_texture_filter_anisotropic) {//TODO: add option to use or disable float amount = Math.min(4f, GL11.glGetFloat(EXTTextureFilterAnisotropic.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT)); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT, amount); @@ -199,8 +199,8 @@ public class Loader { GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, texture.getWidth(), texture.getHeight(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, texture.getImage()); GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0); GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D); - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR); - GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, -0f); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); return textureID; }