Bläddra i källkod

For FTDI800 compatibility, remove VERTEX_FORMAT dependency (#18982)

Marcio T 4 år sedan
förälder
incheckning
f62578efec
Inget konto är kopplat till bidragsgivarens mejladress
1 ändrade filer med 14 tillägg och 3 borttagningar
  1. 14
    3
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp

+ 14
- 3
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp Visa fil

@@ -88,7 +88,15 @@ void BedMeshScreen::drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI::
88 88
 
89 89
   const float scale_z = ((val_max == val_min) ? 1 : 1/(val_max - val_min)) * autoscale_max;
90 90
 
91
-  // These equations determine the appearance of the grid on the screen.
91
+  /**
92
+   * The 3D points go through a 3D graphics pipeline to determine the final 2D point on the screen.
93
+   * This is written out as a stack of macros that each apply an affine transformation to the point.
94
+   * At compile time, the compiler should be able to reduce these expressions.
95
+   *
96
+   * The last transformation in the chain (TRANSFORM_5) is initially set to a no-op so we can measure
97
+   * the dimensions of the grid, but is later replaced with a scaling transform that scales the grid
98
+   * to fit.
99
+   */
92 100
 
93 101
   #define TRANSFORM_5(X,Y,Z)  (X), (Y)                                                                   // No transform
94 102
   #define TRANSFORM_4(X,Y,Z)  TRANSFORM_5((X)/(Z),(Y)/-(Z), 0)                                           // Perspective
@@ -119,8 +127,12 @@ void BedMeshScreen::drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI::
119 127
   const float center_x         = x + w/2;
120 128
   const float center_y         = y + h/2;
121 129
 
130
+  // Now replace the last transformation in the chain with a scaling operation.
131
+
122 132
   #undef  TRANSFORM_5
123
-  #define TRANSFORM_5(X,Y,Z)  center_x + (X - grid_cx) * scale_x, center_y + (Y - grid_cy) * scale_y      // Fit to bounds
133
+  #define TRANSFORM_6(X,Y,Z)  (X)*16, (Y)*16                                                  // Scale to 1/16 pixel units
134
+  #define TRANSFORM_5(X,Y,Z)  TRANSFORM_6( center_x + ((X) - grid_cx) * scale_x, \
135
+                                           center_y + ((Y) - grid_cy) * scale_y, 0)           // Scale to bounds
124 136
 
125 137
   // Draw the grid
126 138
 
@@ -128,7 +140,6 @@ void BedMeshScreen::drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI::
128 140
 
129 141
   CommandProcessor cmd;
130 142
   cmd.cmd(SAVE_CONTEXT())
131
-     .cmd(VERTEX_FORMAT(0))
132 143
      .cmd(TAG_MASK(false))
133 144
      .cmd(SAVE_CONTEXT());
134 145
 

Laddar…
Avbryt
Spara