diff --git a/src/main/java/com/github/halotroop/litecraft/world/World.java b/src/main/java/com/github/halotroop/litecraft/world/World.java index 602c088..ae312de 100644 --- a/src/main/java/com/github/halotroop/litecraft/world/World.java +++ b/src/main/java/com/github/halotroop/litecraft/world/World.java @@ -30,11 +30,9 @@ public class World implements BlockAccess, WorldGenConstants int renderBound; int renderBoundVertical; private final BlockInstance dummy; - private DynamicChunkLoader chunkLoader; - public World(long seed, int renderSize, Dimension dim, LitecraftSave save) { - this.chunkLoader = new DynamicChunkLoader(0, 0, 0, this); + new DynamicChunkLoader(0, 0, 0, this); this.dummy = new BlockInstance(Blocks.ANDESITE, new Vector3f(0, 0, 0)); this.dummy.isVisible = false; this.chunks = new Long2ObjectArrayMap<>(); 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 b1b3911..d7d6017 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 @@ -3,7 +3,6 @@ package com.github.halotroop.litecraft.world.block; import org.joml.Matrix4f; import org.lwjgl.opengl.*; -import com.github.halotroop.litecraft.Litecraft; import com.github.halotroop.litecraft.types.block.BlockInstance; import com.github.halotroop.litecraft.world.Chunk; import com.github.halotroop.litecraft.world.gen.WorldGenConstants; @@ -12,9 +11,8 @@ import com.github.hydos.ginger.engine.elements.objects.RenderObject; import com.github.hydos.ginger.engine.io.Window; import com.github.hydos.ginger.engine.math.Maths; import com.github.hydos.ginger.engine.render.Renderer; -import com.github.hydos.ginger.engine.render.models.*; +import com.github.hydos.ginger.engine.render.models.TexturedModel; import com.github.hydos.ginger.engine.render.shaders.StaticShader; -import com.github.hydos.ginger.engine.render.texture.ModelTexture; public class BlockRenderer extends Renderer implements WorldGenConstants { @@ -41,15 +39,6 @@ public class BlockRenderer extends Renderer implements WorldGenConstants GL20.glEnableVertexAttribArray(0); GL20.glEnableVertexAttribArray(1); GL20.glEnableVertexAttribArray(2); - Litecraft.getInstance().binds++; - } - - private void prepTexture(ModelTexture texture, int textureID) - { - shader.loadFakeLightingVariable(texture.isUseFakeLighting()); - shader.loadShine(texture.getShineDamper(), texture.getReflectivity()); - GL13.glActiveTexture(GL13.GL_TEXTURE0); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID); } public void unbindModel() @@ -65,10 +54,13 @@ public class BlockRenderer extends Renderer implements WorldGenConstants shader.start(); shader.loadSkyColour(Window.getColour()); shader.loadViewMatrix(GingerRegister.getInstance().game.data.camera); -// TexturedModel model = renderList[0].getModel(); + shader.loadFakeLightingVariable(true); + shader.loadShine(1, 1); + GL13.glActiveTexture(GL13.GL_TEXTURE0); + if (GingerRegister.getInstance().wireframe) GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); - // + for (int x = 0; x < CHUNK_SIZE; x++) for (int y = 0; y < CHUNK_SIZE; y++) for (int z = 0; z < CHUNK_SIZE; z++) @@ -77,13 +69,13 @@ public class BlockRenderer extends Renderer implements WorldGenConstants if (entity != null && entity.getModel() != null) { TexturedModel blockModel = entity.getModel(); - prepTexture(blockModel.getTexture(), blockModel.getTexture().getTextureID()); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, blockModel.getTexture().getTextureID()); prepBlockInstance(entity); GL11.glDrawElements(GL11.GL_TRIANGLES, blockModel.getRawModel().getVertexCount(), GL11.GL_UNSIGNED_INT, 0); } } + shader.stop(); if (GingerRegister.getInstance().wireframe) GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); - shader.stop(); } } diff --git a/src/main/java/com/github/hydos/ginger/engine/render/tools/MousePicker.java b/src/main/java/com/github/hydos/ginger/engine/render/tools/MousePicker.java index f4db2d8..3bbccad 100644 --- a/src/main/java/com/github/hydos/ginger/engine/render/tools/MousePicker.java +++ b/src/main/java/com/github/hydos/ginger/engine/render/tools/MousePicker.java @@ -61,7 +61,6 @@ public class MousePicker float y = (2.0f * mouseY) / Window.height - 1f; return new Vector2f(x, y); } - //********************************************************** private Vector3f getPointOnRay(Vector3f ray, float distance) {