差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
cgfs:shaded_triangles [2024/06/14 00:52] – freemikan | cgfs:shaded_triangles [2025/05/18 15:41] (現在) – freemikan | ||
---|---|---|---|
行 1: | 行 1: | ||
- | < | + | ====== DrawPixelだけで三角形を描く (3) 明暗をつける ====== |
+ | |||
+ | {{: | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | <file cpp> | ||
#include < | #include < | ||
行 119: | 行 125: | ||
auto x_r = static_cast< | auto x_r = static_cast< | ||
- | //~ h_segment.resize(x_r - x_l + 1); | ||
h_segment.clear(); | h_segment.clear(); | ||
Interpolate(x_l, | Interpolate(x_l, | ||
行 125: | 行 130: | ||
for (int x = x_l; x <= x_r; ++x) { | for (int x = x_l; x <= x_r; ++x) { | ||
- | | + | |
- | PutPixel(x, y, shaded_color); | + | PutPixel(x, y, color_scaled(color, |
} | } | ||
} | } | ||
行 132: | 行 137: | ||
int main() { | int main() { | ||
- | InitWindow(Cw, | + | InitWindow(Cw, |
VertexPositionIntensity p0{-100, 200, 1.0}; | VertexPositionIntensity p0{-100, 200, 1.0}; | ||
行 148: | 行 153: | ||
} | } | ||
} | } | ||
- | </codeprism> | + | </file> |