Chunk loading improvements
This commit is contained in:
@@ -14,16 +14,13 @@ TILE_WIDTH = 16.0
|
||||
TILE_HEIGHT = 16.0
|
||||
TILE_DEPTH = 11.36
|
||||
|
||||
def createQuadForTile(tileIndex, x=0, y=0, z=0):
|
||||
def processTile(tileIndex, x=0, y=0, z=0):
|
||||
vertices = []
|
||||
indices = []
|
||||
|
||||
# Tile 0, nothing
|
||||
if tileIndex == 0:
|
||||
return {
|
||||
'vertices': vertices,
|
||||
'indices': indices
|
||||
}
|
||||
return None
|
||||
|
||||
# Determine color for checkerboard pattern
|
||||
color = (255,255,255) if (x + y) % 2 == 0 else (0,0,0)
|
||||
@@ -82,8 +79,8 @@ def processChunk(path):
|
||||
z = i // (CHUNK_WIDTH * CHUNK_HEIGHT)
|
||||
|
||||
# Add tile 3D model
|
||||
result = createQuadForTile(tile, x, y, z)
|
||||
if len(result['vertices']) > 0:
|
||||
result = processTile(tile, x, y, z)
|
||||
if result is not None and len(result['vertices']) > 0:
|
||||
base = len(baseModel['vertices'])
|
||||
quad_indices = [base + idx for idx in result['indices']]
|
||||
baseModel['vertices'].extend(result['vertices'])
|
||||
|
||||
Reference in New Issue
Block a user