29 lines
805 B
Haskell
29 lines
805 B
Haskell
module Dodge.TractorBeam.Draw where
|
|
|
|
import Dodge.Data.TractorBeam
|
|
import Geometry
|
|
import Picture
|
|
|
|
drawTractorBeam :: TractorBeam -> Picture
|
|
drawTractorBeam = tractorSPic
|
|
|
|
tractorSPic :: TractorBeam -> Picture
|
|
tractorSPic pj =
|
|
setLayer BloomNoZWrite $
|
|
setDepth 20 $
|
|
color (withAlpha 0.5 col) $
|
|
polygon
|
|
[ spos -- not sure if this is anticlockwise...
|
|
, spos +.+ size *.* (d +.+ n)
|
|
, xpos +.+ size *.* n
|
|
, xpos -.- size *.* n
|
|
, spos +.+ size *.* (d -.- n)
|
|
]
|
|
where
|
|
size = fromIntegral (_tbTime pj)
|
|
spos = _tbPos pj
|
|
xpos = _tbStartPos pj
|
|
d = squashNormalizeV $ spos -.- xpos
|
|
n = vNormal d
|
|
col = mixColors 0.5 0.5 white blue
|