Start work on lasguns
This commit is contained in:
@@ -14,19 +14,17 @@ import Data.Tuple
|
||||
--import Streaming
|
||||
--import qualified Streaming.Prelude as S
|
||||
|
||||
-- not sure why we need to keep a list of seen walls, but seems to loop
|
||||
-- infinitely when removed
|
||||
-- this needs to be tested with both reflections and refractions
|
||||
-- the distance of the laser should be limited
|
||||
reflectLaserAlong :: Float -> Point2 -> Point2 -> World
|
||||
-> (Maybe (Point2,Either Creature Wall),[Point2])
|
||||
reflectLaserAlong phasev sp ep w = case thingHit sp ep w of
|
||||
{-# INLINE reflectLaserAlong #-}
|
||||
reflectLaserAlong phasev sp ep w = case thingHitFilt (const True) _wlDraw sp ep w of
|
||||
Just (p,Right wl)
|
||||
| _wlReflect wl -> second (p:) $ reflectLaserAlong phasev
|
||||
(p +.+ unitVectorAtAngle (reflDirWall sp p wl))
|
||||
(p +.+ (dist p ep) *.* unitVectorAtAngle (reflDirWall sp p wl))
|
||||
w
|
||||
| wlIsSeeThrough wl && _wlSeen wl -> second (p:) $ reflectLaserAlong phasev
|
||||
| wlIsSeeThrough wl -> second (p:) $ reflectLaserAlong phasev
|
||||
(p +.+ normalizeV (refract sp ep wl p))
|
||||
(refract sp ep wl p)
|
||||
w
|
||||
|
||||
Reference in New Issue
Block a user