1.1.3: Use fractional from vmath.

This commit is contained in:
treeform 2021-04-18 16:53:27 -07:00
parent 9104dc0bad
commit a781580ac8
2 changed files with 2 additions and 8 deletions

View file

@ -1,4 +1,4 @@
version = "1.1.2" version = "1.1.3"
author = "Andre von Houck and Ryan Oldenburg" author = "Andre von Houck and Ryan Oldenburg"
description = "Full-featured 2d graphics library for Nim." description = "Full-featured 2d graphics library for Nim."
license = "MIT" license = "MIT"
@ -6,7 +6,7 @@ license = "MIT"
srcDir = "src" srcDir = "src"
requires "nim >= 1.2.6" requires "nim >= 1.2.6"
requires "vmath >= 1.0.0" requires "vmath >= 1.0.3"
requires "chroma >= 0.2.5" requires "chroma >= 0.2.5"
requires "zippy >= 0.3.5" requires "zippy >= 0.3.5"
requires "flatty >= 0.1.3" requires "flatty >= 0.1.3"

View file

@ -3,12 +3,6 @@ import chroma, vmath
type type
PixieError* = object of ValueError ## Raised if an operation fails. PixieError* = object of ValueError ## Raised if an operation fails.
proc fractional*(v: float32): float32 {.inline.} =
## Returns unsigned fraction part of the float.
## -13.7868723 -> 0.7868723
result = abs(v)
result = result - floor(result)
proc lerp*(a, b: uint8, t: float32): uint8 {.inline.} = proc lerp*(a, b: uint8, t: float32): uint8 {.inline.} =
## Linearly interpolate between a and b using t. ## Linearly interpolate between a and b using t.
let t = round(t * 255).uint32 let t = round(t * 255).uint32