fix bug im output of export string: previously had 'endXToNdc' and 'endYToNdc' functions (which sometimes produced incorrect/pixelated output), but it turns out that I was meant to use only 'xToNdc' and 'yToNdc' for correct output.

This commit is contained in:
2025-08-01 06:32:07 +01:00
parent 8cc2adcbf0
commit 1fe07149c7

View File

@@ -519,21 +519,11 @@ struct
in "xToNdc (xOffset, " ^ x ^ ", scale, halfWidth)"
end
fun makeEndXString (startX, endX) =
let val endX = intToRealString endX
in "endXToNdc (xOffset, " ^ startX ^ ", " ^ endX ^ ", scale, halfWidth)"
end
fun makeYString y =
let val y = intToRealString y
in "yToNdc (yOffset, " ^ y ^ ", scale, halfHeight)"
end
fun makeEndYString (startY, endY) =
let val endY = intToRealString endY
in "endYToNdc (yOffset, " ^ startY ^ ", " ^ endY ^ ", scale, halfHeight)"
end
fun toExportStringFolder (maxWidth, maxHeight)
({x, ex, y, ey, data = {r, g, b, a}}, acc) =
let
@@ -542,8 +532,8 @@ struct
val x = makeXString x
val y = makeYString y
val ex = makeEndXString (x, ex)
val ey = makeEndYString (y, ey)
val ex = makeXString ex
val ey = makeYString ey
val r = colToRealString r
val g = colToRealString g
val b = colToRealString b
@@ -601,15 +591,9 @@ struct
, " fun xToNdc (xOffset, xpos, scale, halfWidth) =\n"
, " ((xpos * scale + xOffset) - halfWidth) / halfWidth\n\n"
, " fun endXToNdc (xOffset, startX, endX, scale, halfWidth) =\n"
, " (((endX - startX) * scale + xOffset) - halfWidth) / halfWidth\n\n"
, " fun yToNdc (yOffset, ypos, scale, halfHeight) =\n"
, " ~(((ypos * scale + yOffset) - halfHeight) / halfHeight)\n\n"
, " fun endYToNdc (yOffset, startY, endY, scale, halfHeight) =\n"
, " ~((((endY - startY) * scale + yOffset) - halfHeight) / halfHeight)\n\n"
, " fun lerp (xOffset, yOffset, scale, windowWidth, windowHeight) =\n"
, " let\n"
, " val windowWidth = Real32.fromInt windowWidth\n"