Add 'shf/' from commit 'b6c5a95b664aeb861d7b33ffc9eefe447ba99dd7'
git-subtree-dir: shf git-subtree-mainline:401408448fgit-subtree-split:b6c5a95b66
This commit is contained in:
41
shf/fcore/pipe-cursor.sml
Normal file
41
shf/fcore/pipe-cursor.sml
Normal file
@@ -0,0 +1,41 @@
|
||||
structure PipeCursor =
|
||||
struct
|
||||
fun xToNdc (xOffset, xpos, scale, halfWidth) =
|
||||
((xpos * scale + xOffset) - halfWidth) / halfWidth
|
||||
|
||||
fun yToNdc (yOffset, ypos, scale, halfHeight) =
|
||||
~(((ypos * scale + yOffset) - halfHeight) / halfHeight)
|
||||
|
||||
fun lerp (xOffset: Real32.real, yOffset, z, scale, windowWidth, windowHeight, r, g, b) =
|
||||
let
|
||||
val halfWidth = windowWidth / 2.0
|
||||
val halfHeight = windowHeight / 2.0
|
||||
in
|
||||
#[
|
||||
xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
|
||||
yToNdc (yOffset, 13.000000000000000, scale, halfHeight),
|
||||
z,
|
||||
r, g, b,
|
||||
xToNdc (xOffset, 1.000000000000000, scale, halfWidth),
|
||||
yToNdc (yOffset, 13.000000000000000, scale, halfHeight),
|
||||
z,
|
||||
r, g, b,
|
||||
xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
|
||||
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
|
||||
z,
|
||||
r, g, b,
|
||||
xToNdc (xOffset, 0.000000000000000, scale, halfWidth),
|
||||
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
|
||||
z,
|
||||
r, g, b,
|
||||
xToNdc (xOffset, 1.000000000000000, scale, halfWidth),
|
||||
yToNdc (yOffset, 13.000000000000000, scale, halfHeight),
|
||||
z,
|
||||
r, g, b,
|
||||
xToNdc (xOffset, 1.000000000000000, scale, halfWidth),
|
||||
yToNdc (yOffset, 0.000000000000000, scale, halfHeight),
|
||||
z,
|
||||
r, g, b
|
||||
]
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user