add [r, g, b] field to triangle, so we can draw coloured objects (next: add ability to change current colour)

This commit is contained in:
2024-12-29 20:18:29 +00:00
parent cd1cef793e
commit 43eb5f4448
10 changed files with 197 additions and 65 deletions

View File

@@ -9,7 +9,7 @@ struct
fun helpToVector (lst, acc, windowWidth, windowHeight, halfWidth, halfHeight) =
case lst of
{x1, y1, x2, y2, x3, y3} :: tl =>
{x1, y1, x2, y2, x3, y3, r, g, b} :: tl =>
let
val x1 = Ndc.centreAlignX (x1, windowWidth, windowHeight, halfWidth)
val x2 = Ndc.centreAlignX (x2, windowWidth, windowHeight, halfWidth)
@@ -22,10 +22,19 @@ struct
val vec =
#[ x1 / halfWidth
, y1 / halfHeight
, r
, g
, b
, x2 / halfWidth
, y2 / halfHeight
, r
, g
, b
, x3 / halfWidth
, y3 / halfHeight
, r
, g
, b
]
val acc = vec :: acc
in