improvements to generated export string (matches more closely to expected result)

This commit is contained in:
2025-07-13 04:03:44 +01:00
parent 0e141174b2
commit a60d13c5ef
5 changed files with 53 additions and 53 deletions

BIN
dotscape

Binary file not shown.

View File

@@ -501,7 +501,7 @@ struct
fun intToRealString num = fun intToRealString num =
let let
val result = Real.fromInt num val result = Real.fromInt num
val result = Real.toString result val result = Real.fmt (StringCvt.FIX (SOME 15)) result
in in
if String.isSubstring "." result then result else result ^ ".0" if String.isSubstring "." result then result else result ^ ".0"
end end
@@ -509,7 +509,7 @@ struct
fun colToRealString col = fun colToRealString col =
let let
val result = Real.fromInt col / 255.0 val result = Real.fromInt col / 255.0
val result = Real.toString result val result = Real.fmt (StringCvt.FIX (SOME 15)) result
in in
if String.isSubstring "." result then result else result ^ ".0" if String.isSubstring "." result then result else result ^ ".0"
end end

View File

@@ -1 +1 @@
50 50 { {0 0 4 4 0 0 0 1 } {0 45 4 50 0 0 0 1 } {45 0 49 4 0 0 0 1 } {45 45 49 50 0 0 0 1 } } 30 30 { {0 0 0 29 0 0 0 1 } {0 0 29 0 0 0 0 1 } {0 29 29 29 0 0 0 1 } {29 0 29 29 0 0 0 1 } }

View File

@@ -15,59 +15,59 @@ struct
fun lerp (xOffset, yOffset, scale, windowWidth, windowHeight) = fun lerp (xOffset, yOffset, scale, windowWidth, windowHeight) =
let let
val windowWidth = Real32.fromInt windowWidth val windowWidth = Real32.fromInt windowWidth
val windowHeight = Real32.fromInt windowHeight
val halfWidth = windowWidth / 2.0 val halfWidth = windowWidth / 2.0
val windowHeight = Real32.fromInt windowHeight
val halfHeight = windowHeight / 2.0 val halfHeight = windowHeight / 2.0
in in
#[ #[
xToNdc (xOffset, 0.0, scale, halfWidth), xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 4.0, scale, halfHeight), yToNdc (yOffset, 30.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.0, scale, halfWidth), 4.0, scale, halfWidth), endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 4.0, scale, halfHeight), yToNdc (yOffset, 30.000000000000000, scale, halfHeight),
xToNdc (xOffset, 0.0, scale, halfWidth), xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 0.0, scale, halfHeight), yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
xToNdc (xOffset, 0.0, scale, halfWidth), xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 0.0, scale, halfHeight), yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.0, scale, halfWidth), 4.0, scale, halfWidth), endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 4.0, scale, halfHeight), yToNdc (yOffset, 30.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.0, scale, halfWidth), 4.0, scale, halfWidth), endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 0.0, scale, halfHeight), yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
xToNdc (xOffset, 0.0, scale, halfWidth), xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 50.0, scale, halfHeight), yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.0, scale, halfWidth), 4.0, scale, halfWidth), endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 50.0, scale, halfHeight), yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
xToNdc (xOffset, 0.0, scale, halfWidth), xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 45.0, scale, halfHeight), yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
xToNdc (xOffset, 0.0, scale, halfWidth), xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 45.0, scale, halfHeight), yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.0, scale, halfWidth), 4.0, scale, halfWidth), endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 50.0, scale, halfHeight), yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.0, scale, halfWidth), 4.0, scale, halfWidth), endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 45.0, scale, halfHeight), yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
xToNdc (xOffset, 45.0, scale, halfWidth), xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 4.0, scale, halfHeight), yToNdc (yOffset, 30.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 45.0, scale, halfWidth), 49.0, scale, halfWidth), endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 4.0, scale, halfHeight), yToNdc (yOffset, 30.000000000000000, scale, halfHeight),
xToNdc (xOffset, 45.0, scale, halfWidth), xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 0.0, scale, halfHeight), yToNdc (yOffset, 29.000000000000000, scale, halfHeight),
xToNdc (xOffset, 45.0, scale, halfWidth), xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 0.0, scale, halfHeight), yToNdc (yOffset, 29.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 45.0, scale, halfWidth), 49.0, scale, halfWidth), endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 4.0, scale, halfHeight), yToNdc (yOffset, 30.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 45.0, scale, halfWidth), 49.0, scale, halfWidth), endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 0.0, scale, halfHeight), yToNdc (yOffset, 29.000000000000000, scale, halfHeight),
xToNdc (xOffset, 45.0, scale, halfWidth), xToNdc (xOffset, 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 50.0, scale, halfHeight), yToNdc (yOffset, 30.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 45.0, scale, halfWidth), 49.0, scale, halfWidth), endXToNdc (xOffset, xToNdc (xOffset, 29.000000000000000, scale, halfWidth), 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 50.0, scale, halfHeight), yToNdc (yOffset, 30.000000000000000, scale, halfHeight),
xToNdc (xOffset, 45.0, scale, halfWidth), xToNdc (xOffset, 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 45.0, scale, halfHeight), yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
xToNdc (xOffset, 45.0, scale, halfWidth), xToNdc (xOffset, 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 45.0, scale, halfHeight), yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 45.0, scale, halfWidth), 49.0, scale, halfWidth), endXToNdc (xOffset, xToNdc (xOffset, 29.000000000000000, scale, halfWidth), 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 50.0, scale, halfHeight), yToNdc (yOffset, 30.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 45.0, scale, halfWidth), 49.0, scale, halfWidth), endXToNdc (xOffset, xToNdc (xOffset, 29.000000000000000, scale, halfWidth), 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 45.0, scale, halfHeight) yToNdc (yOffset, 0.000000000000000, scale, halfHeight)
] ]
end end
end end

View File

@@ -8,7 +8,7 @@ struct
val _ = Glfw.init () val _ = Glfw.init ()
val _ = Glfw.windowHint (Glfw.CONTEXT_VERSION_MAJOR (), 3) val _ = Glfw.windowHint (Glfw.CONTEXT_VERSION_MAJOR (), 3)
val _ = Glfw.windowHint (Glfw.DEPRECATED (), Glfw.FALSE ()) val _ = Glfw.windowHint (Glfw.DEPRECATED (), Glfw.FALSE ())
val _ = Glfw.windowHint (Glfw.SAMPLES (), 4) val _ = Glfw.windowHint (Glfw.SAMPLES (), 0)
val window = val window =
Glfw.createWindow Glfw.createWindow
(Constants.windowWidth, Constants.windowHeight, "Dotscape") (Constants.windowWidth, Constants.windowHeight, "Dotscape")