Use tasty for tests, fix bug in circOnLine
This commit is contained in:
+4
-6
@@ -10,19 +10,17 @@ tileToRenderList t = polyToTris $ zip ps3 coords3
|
||||
where
|
||||
ps = _tilePoly t
|
||||
coords = map (calcTexCoord (_tileZero t) (_tileX t)) ps
|
||||
ps3 = map (addToV2 0) ps
|
||||
coords3 = map (addToV2 (_tileZ t)) coords
|
||||
|
||||
addToV2 :: a -> V2 a -> V3 a
|
||||
addToV2 z (V2 x y) = V3 x y z
|
||||
ps3 = map (addZ 0) ps
|
||||
coords3 = map (addZ (_tileZ t)) coords
|
||||
|
||||
calcTexCoord
|
||||
:: Point2 -- ^ tile (0,0)
|
||||
-> Point2 -- ^ tile (1,0)
|
||||
-> Point2 -- ^ world point
|
||||
-> Point2
|
||||
calcTexCoord c p x = V2 (0.02 * dotV (p -.- c) xdir) (0.02 * dotV (p -.- c) ydir)
|
||||
calcTexCoord c p x = V2 (vectorAmountIn xdir) (vectorAmountIn ydir)
|
||||
where
|
||||
vectorAmountIn dir = 0.02 * dotV (p -.- c) dir
|
||||
xdir = x -.- c
|
||||
ydir = vNormal xdir
|
||||
|
||||
|
||||
Reference in New Issue
Block a user