Finally ready to merge the two tool codebases
All checks were successful
Build Dusk / build-linux (push) Successful in 54s
Build Dusk / build-psp (push) Successful in 1m3s

This commit is contained in:
2025-11-16 23:52:52 -06:00
parent ae941a0fdb
commit 69b37b30bc
7 changed files with 146 additions and 22 deletions

View File

@@ -1,6 +1,10 @@
import json
import os
from dusk.event import Event
from editortool.map.mapdefs import CHUNK_WIDTH, CHUNK_HEIGHT, CHUNK_DEPTH, CHUNK_VERTEX_COUNT_MAX
from editortool.map.tile import Tile
from editortool.map.vertexbuffer import VertexBuffer
from OpenGL.GL import *
class Chunk:
def __init__(self, map, x, y, z):
@@ -12,6 +16,25 @@ class Chunk:
self.original = {}
self.onChunkData = Event()
self.tiles = {}
self.vertexBuffer = VertexBuffer()
tileIndex = 0
for tx in range(CHUNK_WIDTH):
for ty in range(CHUNK_HEIGHT):
for tz in range(CHUNK_DEPTH):
self.tiles[tileIndex] = Tile(self, tx, ty, tz, tileIndex)
tileIndex += 1
# Update vertices
self.tileUpdateVertices()
def tileUpdateVertices(self):
self.vertexBuffer.clear()
for tile in self.tiles.values():
tile.buffer(self.vertexBuffer)
self.vertexBuffer.buildData()
def load(self):
fname = self.getFilename()
if not fname or not os.path.exists(fname):
@@ -51,3 +74,7 @@ class Chunk:
if dir_path is None:
return None
return f"{dir_path}/{self.x}_{self.y}_{self.z}.json"
def draw(self):
glColor3f(0.0, 1.0, 1.0)
self.vertexBuffer.draw()