small rendering improvments and warning removal
parent
f34deaef65
commit
8eed7a60c5
|
@ -30,11 +30,9 @@ public class World implements BlockAccess, WorldGenConstants
|
||||||
int renderBound;
|
int renderBound;
|
||||||
int renderBoundVertical;
|
int renderBoundVertical;
|
||||||
private final BlockInstance dummy;
|
private final BlockInstance dummy;
|
||||||
private DynamicChunkLoader chunkLoader;
|
|
||||||
|
|
||||||
public World(long seed, int renderSize, Dimension<?> dim, LitecraftSave save)
|
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 = new BlockInstance(Blocks.ANDESITE, new Vector3f(0, 0, 0));
|
||||||
this.dummy.isVisible = false;
|
this.dummy.isVisible = false;
|
||||||
this.chunks = new Long2ObjectArrayMap<>();
|
this.chunks = new Long2ObjectArrayMap<>();
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.github.halotroop.litecraft.world.block;
|
||||||
import org.joml.Matrix4f;
|
import org.joml.Matrix4f;
|
||||||
import org.lwjgl.opengl.*;
|
import org.lwjgl.opengl.*;
|
||||||
|
|
||||||
import com.github.halotroop.litecraft.Litecraft;
|
|
||||||
import com.github.halotroop.litecraft.types.block.BlockInstance;
|
import com.github.halotroop.litecraft.types.block.BlockInstance;
|
||||||
import com.github.halotroop.litecraft.world.Chunk;
|
import com.github.halotroop.litecraft.world.Chunk;
|
||||||
import com.github.halotroop.litecraft.world.gen.WorldGenConstants;
|
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.io.Window;
|
||||||
import com.github.hydos.ginger.engine.math.Maths;
|
import com.github.hydos.ginger.engine.math.Maths;
|
||||||
import com.github.hydos.ginger.engine.render.Renderer;
|
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.shaders.StaticShader;
|
||||||
import com.github.hydos.ginger.engine.render.texture.ModelTexture;
|
|
||||||
|
|
||||||
public class BlockRenderer extends Renderer implements WorldGenConstants
|
public class BlockRenderer extends Renderer implements WorldGenConstants
|
||||||
{
|
{
|
||||||
|
@ -41,15 +39,6 @@ public class BlockRenderer extends Renderer implements WorldGenConstants
|
||||||
GL20.glEnableVertexAttribArray(0);
|
GL20.glEnableVertexAttribArray(0);
|
||||||
GL20.glEnableVertexAttribArray(1);
|
GL20.glEnableVertexAttribArray(1);
|
||||||
GL20.glEnableVertexAttribArray(2);
|
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()
|
public void unbindModel()
|
||||||
|
@ -65,10 +54,13 @@ public class BlockRenderer extends Renderer implements WorldGenConstants
|
||||||
shader.start();
|
shader.start();
|
||||||
shader.loadSkyColour(Window.getColour());
|
shader.loadSkyColour(Window.getColour());
|
||||||
shader.loadViewMatrix(GingerRegister.getInstance().game.data.camera);
|
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)
|
if (GingerRegister.getInstance().wireframe)
|
||||||
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
|
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
|
||||||
//
|
|
||||||
for (int x = 0; x < CHUNK_SIZE; x++)
|
for (int x = 0; x < CHUNK_SIZE; x++)
|
||||||
for (int y = 0; y < CHUNK_SIZE; y++)
|
for (int y = 0; y < CHUNK_SIZE; y++)
|
||||||
for (int z = 0; z < CHUNK_SIZE; z++)
|
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)
|
if (entity != null && entity.getModel() != null)
|
||||||
{
|
{
|
||||||
TexturedModel blockModel = entity.getModel();
|
TexturedModel blockModel = entity.getModel();
|
||||||
prepTexture(blockModel.getTexture(), blockModel.getTexture().getTextureID());
|
GL11.glBindTexture(GL11.GL_TEXTURE_2D, blockModel.getTexture().getTextureID());
|
||||||
prepBlockInstance(entity);
|
prepBlockInstance(entity);
|
||||||
GL11.glDrawElements(GL11.GL_TRIANGLES, blockModel.getRawModel().getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
|
GL11.glDrawElements(GL11.GL_TRIANGLES, blockModel.getRawModel().getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
shader.stop();
|
||||||
if (GingerRegister.getInstance().wireframe)
|
if (GingerRegister.getInstance().wireframe)
|
||||||
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
|
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
|
||||||
shader.stop();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,6 @@ public class MousePicker
|
||||||
float y = (2.0f * mouseY) / Window.height - 1f;
|
float y = (2.0f * mouseY) / Window.height - 1f;
|
||||||
return new Vector2f(x, y);
|
return new Vector2f(x, y);
|
||||||
}
|
}
|
||||||
//**********************************************************
|
|
||||||
|
|
||||||
private Vector3f getPointOnRay(Vector3f ray, float distance)
|
private Vector3f getPointOnRay(Vector3f ray, float distance)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue