差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
cgfs:filled_triangles [2024/06/13 01:21] freemikancgfs:filled_triangles [2025/05/18 15:40] (現在) freemikan
行 1: 行 1:
-<codeprism lang=cpp el=true css=full>+====== DrawPixelだけで三角形を描く (2) 塗り潰す ====== 
 + 
 +{{:cgfs:filled_triangles-000.png?400|}} 
 + 
 +[[https://wiki.freemikan.com/doku.php?id=cgfs:vmath|vmath.h]] 
 + 
 +<file cpp>
 #include <raylib.h> #include <raylib.h>
  
行 115: 行 121:
     std::copy(x12.begin(), x12.end(), corner);     std::copy(x12.begin(), x12.end(), corner);
  
-    auto x_left = x012; +    auto &x_left = x012; 
-    auto x_right = x02;+    auto &x_right = x02;
     auto m = x012.size() / 2;     auto m = x012.size() / 2;
     if (x02[m] < x012[m]) {     if (x02[m] < x012[m]) {
-        x_left = x02; +        std::swap(x_leftx_right);
-        x_right = x012;+
     }     }
  
行 154: 行 159:
     }     }
 } }
-</codeprism>+</file>
  
文書の先頭へ