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