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 =
let
val result = Real.fromInt num
val result = Real.toString result
val result = Real.fmt (StringCvt.FIX (SOME 15)) result
in
if String.isSubstring "." result then result else result ^ ".0"
end
@@ -509,7 +509,7 @@ struct
fun colToRealString col =
let
val result = Real.fromInt col / 255.0
val result = Real.toString result
val result = Real.fmt (StringCvt.FIX (SOME 15)) result
in
if String.isSubstring "." result then result else result ^ ".0"
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) =
let
val windowWidth = Real32.fromInt windowWidth
val windowHeight = Real32.fromInt windowHeight
val halfWidth = windowWidth / 2.0
val windowHeight = Real32.fromInt windowHeight
val halfHeight = windowHeight / 2.0
in
#[
xToNdc (xOffset, 0.0, scale, halfWidth),
yToNdc (yOffset, 4.0, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.0, scale, halfWidth), 4.0, scale, halfWidth),
yToNdc (yOffset, 4.0, scale, halfHeight),
xToNdc (xOffset, 0.0, scale, halfWidth),
yToNdc (yOffset, 0.0, scale, halfHeight),
xToNdc (xOffset, 0.0, scale, halfWidth),
yToNdc (yOffset, 0.0, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.0, scale, halfWidth), 4.0, scale, halfWidth),
yToNdc (yOffset, 4.0, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.0, scale, halfWidth), 4.0, scale, halfWidth),
yToNdc (yOffset, 0.0, scale, halfHeight),
xToNdc (xOffset, 0.0, scale, halfWidth),
yToNdc (yOffset, 50.0, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.0, scale, halfWidth), 4.0, scale, halfWidth),
yToNdc (yOffset, 50.0, scale, halfHeight),
xToNdc (xOffset, 0.0, scale, halfWidth),
yToNdc (yOffset, 45.0, scale, halfHeight),
xToNdc (xOffset, 0.0, scale, halfWidth),
yToNdc (yOffset, 45.0, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.0, scale, halfWidth), 4.0, scale, halfWidth),
yToNdc (yOffset, 50.0, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.0, scale, halfWidth), 4.0, scale, halfWidth),
yToNdc (yOffset, 45.0, scale, halfHeight),
xToNdc (xOffset, 45.0, scale, halfWidth),
yToNdc (yOffset, 4.0, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 45.0, scale, halfWidth), 49.0, scale, halfWidth),
yToNdc (yOffset, 4.0, scale, halfHeight),
xToNdc (xOffset, 45.0, scale, halfWidth),
yToNdc (yOffset, 0.0, scale, halfHeight),
xToNdc (xOffset, 45.0, scale, halfWidth),
yToNdc (yOffset, 0.0, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 45.0, scale, halfWidth), 49.0, scale, halfWidth),
yToNdc (yOffset, 4.0, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 45.0, scale, halfWidth), 49.0, scale, halfWidth),
yToNdc (yOffset, 0.0, scale, halfHeight),
xToNdc (xOffset, 45.0, scale, halfWidth),
yToNdc (yOffset, 50.0, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 45.0, scale, halfWidth), 49.0, scale, halfWidth),
yToNdc (yOffset, 50.0, scale, halfHeight),
xToNdc (xOffset, 45.0, scale, halfWidth),
yToNdc (yOffset, 45.0, scale, halfHeight),
xToNdc (xOffset, 45.0, scale, halfWidth),
yToNdc (yOffset, 45.0, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 45.0, scale, halfWidth), 49.0, scale, halfWidth),
yToNdc (yOffset, 50.0, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 45.0, scale, halfWidth), 49.0, scale, halfWidth),
yToNdc (yOffset, 45.0, scale, halfHeight)
xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 30.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 30.000000000000000, scale, halfHeight),
xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 30.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 30.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 30.000000000000000, scale, halfHeight),
xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 29.000000000000000, scale, halfHeight),
xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
yToNdc (yOffset, 29.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 30.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 0.000000000000000, scale, halfWidth), 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 29.000000000000000, scale, halfHeight),
xToNdc (xOffset, 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 30.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 29.000000000000000, scale, halfWidth), 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 30.000000000000000, scale, halfHeight),
xToNdc (xOffset, 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
xToNdc (xOffset, 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 29.000000000000000, scale, halfWidth), 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 30.000000000000000, scale, halfHeight),
endXToNdc (xOffset, xToNdc (xOffset, 29.000000000000000, scale, halfWidth), 29.000000000000000, scale, halfWidth),
yToNdc (yOffset, 0.000000000000000, scale, halfHeight)
]
end
end

View File

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