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) =
|
fun fromPixelX (xpos, windowWidth, windowHeight) =
|
||||||
let
|
let
|
||||||
val halfWidth = (Real32.fromInt windowWidth) / 2.0
|
val halfWidth = Real32.fromInt (windowWidth div 2)
|
||||||
val xpos = xpos - halfWidth
|
val xpos = xpos - halfWidth
|
||||||
in
|
in
|
||||||
if windowWidth > windowHeight then
|
if windowWidth > windowHeight then
|
||||||
@@ -40,7 +40,7 @@ struct
|
|||||||
|
|
||||||
fun fromPixelY (ypos, windowWidth, windowHeight) =
|
fun fromPixelY (ypos, windowWidth, windowHeight) =
|
||||||
let
|
let
|
||||||
val halfHeight = (Real32.fromInt windowHeight) / 2.0
|
val halfHeight = Real32.fromInt (windowHeight div 2)
|
||||||
val ypos = ~(ypos - halfHeight)
|
val ypos = ~(ypos - halfHeight)
|
||||||
in
|
in
|
||||||
if windowHeight > windowWidth then
|
if windowHeight > windowWidth then
|
||||||
|
|||||||
Reference in New Issue
Block a user