Add separate color type for alpha
This commit is contained in:
parent
454deed731
commit
f3bda5d40c
|
@ -7,4 +7,17 @@ import Data.Vect
|
||||||
|
|
||||||
public export
|
public export
|
||||||
Color : Type
|
Color : Type
|
||||||
Color = Vect 4 Bits8
|
Color = Vect 3 Double
|
||||||
|
|
||||||
|
public export
|
||||||
|
ColorAlpha : Type
|
||||||
|
ColorAlpha = Vect 4 Double
|
||||||
|
|
||||||
|
export
|
||||||
|
withAlpha : Double -> Color -> ColorAlpha
|
||||||
|
withAlpha a [r,g,b] = [r,g,b,a]
|
||||||
|
|
||||||
|
export
|
||||||
|
toAlpha : Color -> ColorAlpha
|
||||||
|
toAlpha = withAlpha 1
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,9 @@ import Render.Color
|
||||||
|
|
||||||
public export
|
public export
|
||||||
interface Object' obj where
|
interface Object' obj where
|
||||||
draw : obj -> Camera -> List (Integer, Integer, Color)
|
draw : obj -> Camera -> List (Integer, Integer, ColorAlpha)
|
||||||
|
|
||||||
|
|
||||||
export
|
public export
|
||||||
data Object : Type where
|
data Object : Type where
|
||||||
MkObject : Object' obj => obj -> Object
|
MkObject : Object' obj => obj -> Object
|
||||||
|
|
|
@ -14,9 +14,10 @@ public export
|
||||||
record Point where
|
record Point where
|
||||||
constructor MkPoint
|
constructor MkPoint
|
||||||
pos : (Double, Double)
|
pos : (Double, Double)
|
||||||
color : Color
|
color : ColorAlpha
|
||||||
|
|
||||||
|
|
||||||
|
export
|
||||||
Object' Point where
|
Object' Point where
|
||||||
draw (MkPoint pos col) cam =
|
draw (MkPoint pos col) cam =
|
||||||
let (px,py) = pointToPix cam pos
|
let (px,py) = pointToPix cam pos
|
||||||
|
|
|
@ -11,10 +11,8 @@ import Render.Object
|
||||||
public export
|
public export
|
||||||
record Scene where
|
record Scene where
|
||||||
constructor MkScene
|
constructor MkScene
|
||||||
|
|
||||||
camera : Camera
|
|
||||||
objects : List Object
|
objects : List Object
|
||||||
bgcolor : Vect 3 Bits8
|
bgcolor : Color
|
||||||
|
|
||||||
|
|
||||||
public export
|
public export
|
||||||
|
|
Loading…
Reference in a new issue