This commit is contained in:
2024-10-11 02:54:35 -04:00
parent a663e45131
commit 0a45b81085
2 changed files with 15 additions and 6 deletions

View File

@@ -11,9 +11,6 @@ draw_line :: (screen: *Screen, p1: Vec2s64, p2: Vec2s64, char: u8 = DEFAULT_PIXE
p1_c := p1;
p2_c := p2;
// p1_c.y /= 2;
// p2_c.y /= 2;
dx := abs(p2_c.x - p1_c.x);
dy := -abs(p2_c.y - p1_c.y);
sx := ifx p1_c.x < p2_c.x then 1 else -1;

View File

@@ -52,20 +52,32 @@ cool_demo_1 :: (screen: *Screen, offset: s64, theta: s64) {
};
scale(.{0.5, 0.8}, *t1);
translate(.{0, 20}, *t1);
translate(.{50, 5}, *t1);
translate(.{50, 20}, *t1);
rotate(theta, get_triangle_centroid(t1), *t1);
draw_triangle(screen, t1, #char "%");
t2 := t1;
scale(.{0.5, 0.5}, *t1);
scale(.{0.2, 0.2}, *t1);
draw_triangle(screen, t1, #char "%");
// draw centroid lines
// draw_line(screen, get_triangle_centroid(t1), get_triangle_centroid(t2), #char ".");
// draw_line(screen, get_triangle_centroid(t1), t1.p1, #char ".");
// draw_line(screen, get_triangle_centroid(t1), t1.p2, #char ".");
// draw_line(screen, get_triangle_centroid(t1), t1.p3, #char ".");
// draw_line(screen, get_triangle_centroid(t2), t2.p1, #char ".");
// draw_line(screen, get_triangle_centroid(t2), t2.p2, #char ".");
// draw_line(screen, get_triangle_centroid(t2), t2.p3, #char ".");
// connect triangles to eachother for fake 3d effect
draw_line(screen, t1.p1, t2.p1, #char "%");
draw_line(screen, t1.p2, t2.p2, #char "%");
draw_line(screen, t1.p3, t2.p3, #char "%");
}
cool_demo_2 :: (screen: *Screen, offset: s64, theta: s64) {