small rendering improvments and warning removal

pull/12/head
hYdos 2020-02-29 11:44:33 +10:00
parent f34deaef65
commit 8eed7a60c5
3 changed files with 9 additions and 20 deletions

View File

@ -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<>();

View File

@ -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();
}
}

View File

@ -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)
{