progress fixing bugs in generated export string
This commit is contained in:
73
green.sml
Normal file
73
green.sml
Normal file
@@ -0,0 +1,73 @@
|
||||
structure AAA =
|
||||
struct
|
||||
fun xToNdc (xOffset, xpos, scale, halfWidth) =
|
||||
((xpos * scale + xOffset) - halfWidth) / halfWidth
|
||||
|
||||
fun endXToNdc (xOffset, startX, endX, scale, halfWidth) =
|
||||
(((endX - startX) * scale + xOffset) - halfWidth) / halfWidth
|
||||
|
||||
fun yToNdc (yOffset, ypos, scale, halfHeight) =
|
||||
~(((ypos * scale + yOffset) - halfHeight) / halfHeight)
|
||||
|
||||
fun endYToNdc (yOffset, startY, endY, scale, halfHeight) =
|
||||
~((((endY - startY) * scale + yOffset) - halfHeight) / halfHeight)
|
||||
|
||||
fun lerp (xOffset, yOffset, scale, windowWidth, windowHeight) =
|
||||
let
|
||||
val windowWidth = Real32.fromInt windowWidth
|
||||
val windowHeight = Real32.fromInt windowHeight
|
||||
val halfWidth = windowWidth / 2.0
|
||||
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)
|
||||
]
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user