@@ -542,8 +542,6 @@ def rbe_entities_to_map(entities, sx, sy, sz, opaque_tex="turnt/turnt_concrete")
542542 # All coords in DBT world-units (1 block = 40 X/Z, 20 Y).
543543 # box / box_corner: 100u per axis at scale 1.
544544 # diagonal: 40u per axis at scale 1.
545- ang = e .get ("yrot" , 0.0 ) % (2 * math .pi )
546-
547545 if prop_shape in ("box" , "box_corner" ):
548546 BASE = 100.0
549547 fx = max (MIN_HALF , abs (e .get ("xscale" , 1.0 )) * BASE * EFX )
@@ -630,36 +628,33 @@ def _rotated_box(ox, oy, oz, hx, hy, hz, tex, label):
630628 prop_tex , f"prop_box_corner { nm } " ))
631629
632630 # ── diagonal: 5-face wedge, anchor at corner ─────────────
631+ # Local-space wedge (before rotation):
632+ # Base triangle in XY at Z=0, extruded to Z=fz.
633+ # Vertices: A(0,0,0) B(fx,0,0) C(0,fy,0) + top copies.
634+ # The sloped face goes from edge AB(z=0) to C(z=fz).
633635 elif prop_shape == "diagonal" :
634- z0 , z1 = qz , qz + fz
635- if ang < math .pi / 4 or ang >= 7 * math .pi / 4 :
636- x0 , x1 = qx , qx + fx
637- y0 , y1 = qy , qy + fy
638- f_w1 = face ((x0 , y0 , z0 ), (x0 , y1 , z0 ), (x0 , y0 , z1 ), prop_tex )
639- f_w2 = face ((x1 , y1 , z1 ), (x0 , y1 , z1 ), (x1 , y1 , z0 ), prop_tex )
640- f_dia = face ((x0 , y0 , z1 ), (x1 , y1 , z1 + 1 ), (x1 , y1 , z1 ), prop_tex )
641- elif ang < 3 * math .pi / 4 :
642- x0 , x1 = qx , qx + fx
643- y0 , y1 = qy - fy , qy
644- f_w1 = face ((x1 , y1 , z1 ), (x1 , y1 , z0 ), (x1 , y0 , z1 ), prop_tex )
645- f_w2 = face ((x1 , y1 , z1 ), (x0 , y1 , z1 ), (x1 , y1 , z0 ), prop_tex )
646- f_dia = face ((x0 , y1 , z1 ), (x1 , y0 , z1 + 1 ), (x1 , y0 , z1 ), prop_tex )
647- elif ang < 5 * math .pi / 4 :
648- x0 , x1 = qx - fx , qx
649- y0 , y1 = qy - fy , qy
650- f_w1 = face ((x1 , y1 , z1 ), (x1 , y1 , z0 ), (x1 , y0 , z1 ), prop_tex )
651- f_w2 = face ((x0 , y0 , z0 ), (x0 , y0 , z1 ), (x1 , y0 , z0 ), prop_tex )
652- f_dia = face ((x1 , y1 , z1 ), (x0 , y0 , z1 + 1 ), (x0 , y0 , z1 ), prop_tex )
653- else :
654- x0 , x1 = qx - fx , qx
655- y0 , y1 = qy , qy + fy
656- f_w1 = face ((x0 , y0 , z0 ), (x0 , y1 , z0 ), (x0 , y0 , z1 ), prop_tex )
657- f_w2 = face ((x0 , y0 , z0 ), (x0 , y0 , z1 ), (x1 , y0 , z0 ), prop_tex )
658- f_dia = face ((x0 , y1 , z1 ), (x1 , y0 , z1 ), (x1 , y0 , z1 + 1 ), prop_tex )
659- f_bot = face ((x0 , y0 , z0 ), (x1 , y0 , z0 ), (x0 , y1 , z0 ), prop_tex )
660- f_top = face ((x1 , y1 , z1 ), (x1 , y0 , z1 ), (x0 , y0 , z1 ), prop_tex )
636+ # 6 local-space vertices of the wedge (anchor at corner)
637+ local_verts = [
638+ (0 , 0 , 0 ), # 0: base-A
639+ (fx , 0 , 0 ), # 1: base-B
640+ (0 , fy , 0 ), # 2: base-C
641+ (0 , 0 , fz ), # 3: top-A
642+ (fx , 0 , fz ), # 4: top-B
643+ (0 , fy , fz ), # 5: top-C
644+ ]
645+ # Rotate all vertices and offset to world position
646+ c = []
647+ for lx_ , ly_ , lz_ in local_verts :
648+ dx , dy , dz = _rot3d (lx_ , ly_ , lz_ )
649+ c .append ((qx + dx , qy + dy , qz + dz ))
650+ # 5 faces (triangulated quads where needed)
651+ f_bot = face (c [0 ], c [1 ], c [2 ], prop_tex ) # bottom tri
652+ f_top = face (c [5 ], c [4 ], c [3 ], prop_tex ) # top tri
653+ f_back = face (c [0 ], c [3 ], c [1 ], prop_tex ) # quad: A-D-E-B (Y=0 side)
654+ f_left = face (c [0 ], c [2 ], c [3 ], prop_tex ) # quad: A-C-F-D (X=0 side)
655+ f_dia = face (c [1 ], c [4 ], c [2 ], prop_tex ) # slope: B-E-F-C
661656 brushes .append (write_brush (
662- [f_bot , f_top , f_w1 , f_w2 , f_dia ], f"diag_prop { nm } " ))
657+ [f_bot , f_top , f_back , f_left , f_dia ], f"diag_prop { nm } " ))
663658
664659 # ── cylinder ─────────────────────────────────────────────
665660 elif prop_shape == "cylinder" :
0 commit comments