not broken code

pull/12/head
valoeghese 2020-02-28 22:06:49 +13:00
parent 85ecd4e098
commit d1cc1443eb
3 changed files with 8 additions and 6 deletions

View File

@ -85,9 +85,9 @@ public class Chunk implements BlockAccess, WorldGenConstants, DataStorage
continue;
}
// check for air. Yes this is stupid, TODO fix this
if (getBlockEntity(x - 1, y, z) == null || getBlockEntity(x + 1, y, z) == null ||
getBlockEntity(x, y - 1, z) == null || getBlockEntity(x, y + 1, z) == null ||
getBlockEntity(x, y, z - 1) == null || getBlockEntity(x, y, z + 1) == null)
if (getBlockEntity(x - 1, y, z).getModel() == null || getBlockEntity(x + 1, y, z).getModel() == null ||
getBlockEntity(x, y - 1, z).getModel() == null || getBlockEntity(x, y + 1, z).getModel() == null ||
getBlockEntity(x, y, z - 1).getModel() == null || getBlockEntity(x, y, z + 1).getModel() == null)
{ renderedBlocks[index(x, y, z)] = block; }
}
}

View File

@ -66,7 +66,7 @@ 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();
// TexturedModel model = renderList[0].getModel();
if (GingerRegister.getInstance().wireframe)
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
//
@ -77,9 +77,10 @@ public class BlockRenderer extends Renderer implements WorldGenConstants
BlockInstance entity = renderList[Chunk.index(x, y, z)];
if (entity != null && entity.getModel() != null)
{
prepTexture(entity.getModel().getTexture(), entity.getModel().getTexture().getTextureID());
TexturedModel blockModel = entity.getModel();
prepTexture(blockModel.getTexture(), blockModel.getTexture().getTextureID());
prepBlockInstance(entity);
GL11.glDrawElements(GL11.GL_TRIANGLES, model.getRawModel().getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
GL11.glDrawElements(GL11.GL_TRIANGLES, blockModel.getRawModel().getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
}
}
if (GingerRegister.getInstance().wireframe)

View File

@ -1,6 +1,7 @@
package com.github.hydos.ginger.engine.api;
import org.joml.Vector2f;
import org.lwjgl.opengl.GL11;
import com.github.halotroop.litecraft.Litecraft;
import com.github.halotroop.litecraft.logic.Timer;