pls hydos add rendering to chunks

pull/4/head
valoeghese 2020-02-24 20:17:39 +13:00
parent e61ad114ca
commit 1e9d71388e
2 changed files with 20 additions and 1 deletions

View File

@ -10,7 +10,7 @@ import com.github.hydos.ginger.engine.math.vectors.Vector3f;
import it.unimi.dsi.fastutil.longs.Long2ObjectArrayMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
public class Chunk
public class Chunk implements TileAccess
{
public Chunk(int chunkX, int chunkY, int chunkZ)
{
@ -29,6 +29,7 @@ public class Chunk
public final int chunkX, chunkY, chunkZ;
private final int chunkStartX, chunkStartY, chunkStartZ;
@Override
public void setBlock(int x, int y, int z, Block block)
{
if (x > 7) x = 7;
@ -46,6 +47,7 @@ public class Chunk
}
}
@Override
public Block getBlock(int x, int y, int z)
{
long hash = posHash(x, y, z);
@ -86,6 +88,14 @@ public class Chunk
this.render = render;
}
public void render()
{
if (this.render) {
// TODO @hydos pls do this
// TODO @hydos culling good
}
}
public boolean doRender()
{ return this.render; }

View File

@ -0,0 +1,9 @@
package com.github.halotroop.litecraft.world;
import com.github.halotroop.litecraft.types.block.Block;
public interface TileAccess
{
Block getBlock(int x, int y, int z);
void setBlock(int x, int y, int z, Block block);
}