add function to convert from absolute pixel value to NDC
This commit is contained in:
@@ -24,7 +24,7 @@ struct
|
||||
|
||||
fun fromPixelX (xpos, windowWidth, windowHeight) =
|
||||
let
|
||||
val halfWidth = (Real32.fromInt windowWidth) / 2.0
|
||||
val halfWidth = Real32.fromInt (windowWidth div 2)
|
||||
val xpos = xpos - halfWidth
|
||||
in
|
||||
if windowWidth > windowHeight then
|
||||
@@ -40,7 +40,7 @@ struct
|
||||
|
||||
fun fromPixelY (ypos, windowWidth, windowHeight) =
|
||||
let
|
||||
val halfHeight = (Real32.fromInt windowHeight) / 2.0
|
||||
val halfHeight = Real32.fromInt (windowHeight div 2)
|
||||
val ypos = ~(ypos - halfHeight)
|
||||
in
|
||||
if windowHeight > windowWidth then
|
||||
|
||||
Reference in New Issue
Block a user