Closer to actually editing
All checks were successful
Build Dusk / build-linux (push) Successful in 50s
Build Dusk / build-psp (push) Successful in 59s

This commit is contained in:
2025-11-16 10:40:20 -06:00
parent 7c194ab4b4
commit cf59989167
10 changed files with 306 additions and 120 deletions

View File

@@ -1,38 +1,36 @@
import OpenGL.GL as gl
from dusk.defs import defs
import colorsys
from editortool.map.map import map
hue = [0.0] # Mutable container for static hue
def drawSelectBox(x, y, z):
def drawSelectBox():
w = float(defs.get('TILE_WIDTH'))
h = float(defs.get('TILE_HEIGHT'))
d = float(defs.get('TILE_DEPTH'))
x = x * w
y = y * h
z = z * d
# Center box.
x -= w / 2.0
y -= h / 2.0
z -= d / 2.0
position = [
map.position[0] * w - (w / 2.0),
map.position[1] * h - (h / 2.0),
map.position[2] * d - (d / 2.0)
]
# Define the 8 vertices of the cube with w=h=d=1
vertices = [
(x, y, z), # 0: min corner
(x+w, y, z), # 1
(x+w, y+h, z), # 2
(x, y+h, z), # 3
(x, y, z+d), # 4
(x+w, y, z+d), # 5
(x+w, y+h, z+d), # 6
(x, y+h, z+d) # 7
(position[0], position[1], position[2]), # 0: min corner
(position[0]+w, position[1], position[2]), # 1
(position[0]+w, position[1]+h, position[2]), # 2
(position[0], position[1]+h, position[2]), # 3
(position[0], position[1], position[2]+d), # 4
(position[0]+w, position[1], position[2]+d), # 5
(position[0]+w, position[1]+h, position[2]+d), # 6
(position[0], position[1]+h, position[2]+d) # 7
]
# List of edges as pairs of vertex indices
edges = [
(0, 1), (1, 2), (2, 3), (3, 0), # bottom face
(4, 5), (5, 6), (6, 7), (7, 4), # top face
(4, 5), (5, 6), (6, 7), (7, 4), # top face
(0, 4), (1, 5), (2, 6), (3, 7) # vertical edges
]