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,29 +1,39 @@
from OpenGL.GL import *
from editortool.map.mapdefs import TILE_WIDTH, TILE_HEIGHT, TILE_DEPTH
from editortool.map.mapdefs import TILE_WIDTH, TILE_HEIGHT, TILE_DEPTH, CHUNK_WIDTH, CHUNK_HEIGHT, CHUNK_DEPTH
class Tile:
def __init__(self):
self.tile_id = 0
def __init__(self, chunk, x, y, z, tileIndex):
self.tileId = 0
self.chunk = chunk
self.x = x
self.y = y
self.z = z
self.posX = x * TILE_WIDTH + chunk.x * CHUNK_WIDTH * TILE_WIDTH
self.posY = y * TILE_HEIGHT + chunk.y * CHUNK_HEIGHT * TILE_HEIGHT
self.posZ = z * TILE_DEPTH + chunk.z * CHUNK_DEPTH * TILE_DEPTH
def draw(self, x, y, z):
def buffer(self, vertexBuffer):
if self.z != 0:
return
# if self.x != 0 or self.y != 0 or self.z != 0:
# return # Only buffer the tile at (0,0,0)
# Center tile.
x = self.posX - TILE_WIDTH / 2.0
y = self.posY - TILE_HEIGHT / 2.0
z = self.posZ - TILE_DEPTH / 2.0
w = TILE_WIDTH
h = TILE_HEIGHT
d = TILE_DEPTH
x = x * w
y = y * h
z = z * d
# Quad on the XY plane at z
vertexBuffer.vertices.extend([
x, y, z, # bottom left
x + w, y, z, # bottom right
x + w, y + h, z, # top right
# Center tile.
x -= w / 2.0
y -= h / 2.0
z -= d / 2.0
# Draw the tile as a flat square on the X-Y plane at depth z.
glColor3f(1.0, 0.0, 0.0) # Red color
glBegin(GL_QUADS)
glVertex3f(x, y, z) # Bottom-left
glVertex3f(x + w, y, z) # Bottom-right
glVertex3f(x + w, y + h, z) # Top-right
glVertex3f(x, y + h, z) # Top-left
glEnd()
x, y, z, # bottom left
x + w, y + h, z, # top right
x, y + h, z # top left
])