|
10 | 10 |
|
11 | 11 | from ..declarations import Operators
|
12 | 12 | from .. import global_data
|
13 |
| -from ..utilities.draw import draw_rect_2d |
| 13 | +from ..utilities.draw import draw_rect_2d, draw_thick_line_3d, draw_thick_dashed_line_3d |
14 | 14 | from ..shaders import Shaders
|
15 | 15 | from ..utilities import preferences
|
16 | 16 | from ..solver import Solver
|
@@ -44,15 +44,35 @@ def update(self):
|
44 | 44 | if bpy.app.background:
|
45 | 45 | return
|
46 | 46 |
|
47 |
| - p1, nm = self.p1, self.nm |
| 47 | + # Create thick line geometry for workplane edges (Vulkan compatible) |
| 48 | + rect_coords = draw_rect_2d(0, 0, self.size, self.size) |
| 49 | + rect_coords = [Vector(co) for co in rect_coords] |
48 | 50 |
|
49 |
| - coords = draw_rect_2d(0, 0, self.size, self.size) |
50 |
| - coords = [(Vector(co))[:] for co in coords] |
| 51 | + # Use a much smaller width for workplane edges (accounting for view distance scaling) |
| 52 | + line_width = 0.2 |
| 53 | + |
| 54 | + all_coords = [] |
| 55 | + all_indices = [] |
| 56 | + vertex_offset = 0 |
| 57 | + |
| 58 | + # Draw each edge as thick line |
| 59 | + edges = [(0, 1), (1, 2), (2, 3), (3, 0)] |
| 60 | + for start_idx, end_idx in edges: |
| 61 | + start_point = rect_coords[start_idx] |
| 62 | + end_point = rect_coords[end_idx] |
| 63 | + |
| 64 | + line_coords, line_indices = draw_thick_line_3d(start_point, end_point, line_width) |
| 65 | + all_coords.extend(line_coords) |
| 66 | + |
| 67 | + # Adjust indices for current vertex offset |
| 68 | + adjusted_indices = [(idx[0] + vertex_offset, idx[1] + vertex_offset, idx[2] + vertex_offset) for idx in line_indices] |
| 69 | + all_indices.extend(adjusted_indices) |
| 70 | + vertex_offset += len(line_coords) |
51 | 71 |
|
52 |
| - indices = ((0, 1), (1, 2), (2, 3), (3, 0)) |
53 | 72 | self._batch = batch_for_shader(
|
54 |
| - self._shader, "LINES", {"pos": coords}, indices=indices |
| 73 | + self._shader, "TRIS", {"pos": all_coords}, indices=all_indices |
55 | 74 | )
|
| 75 | + |
56 | 76 | self.is_dirty = False
|
57 | 77 |
|
58 | 78 | # NOTE: probably better to avoid overwriting draw func..
|
|
0 commit comments