Cleanup compiler warnings
This commit is contained in:
+30
-23
@@ -1,39 +1,46 @@
|
||||
module Tile
|
||||
( tileTexCoords
|
||||
, makeTileFromPoly
|
||||
, baseFloorTileSize
|
||||
)
|
||||
where
|
||||
{-# OPTIONS -Wno-incomplete-uni-patterns #-}
|
||||
module Tile (
|
||||
tileTexCoords,
|
||||
makeTileFromPoly,
|
||||
baseFloorTileSize,
|
||||
) where
|
||||
|
||||
import Data.Tile
|
||||
import Geometry
|
||||
|
||||
tileTexCoords :: Tile -> [Point2]
|
||||
tileTexCoords t = map
|
||||
(calcTexCoord (_tileZero t) tangent (- vNormal tangent))
|
||||
(_tilePoly t)
|
||||
tileTexCoords t =
|
||||
map
|
||||
(calcTexCoord (_tileZero t) tangent (- vNormal tangent))
|
||||
(_tilePoly t)
|
||||
where
|
||||
tangent = _tileTangentPos t - _tileZero t
|
||||
|
||||
calcTexCoord
|
||||
:: Point2 -- ^ tile (0,0)
|
||||
-> Point2 -- ^ tile tangent
|
||||
-> Point2 -- ^ tile cotangent
|
||||
-> Point2 -- ^ world point
|
||||
-> Point2
|
||||
calcTexCoord ::
|
||||
-- | tile (0,0)
|
||||
Point2 ->
|
||||
-- | tile tangent
|
||||
Point2 ->
|
||||
-- | tile cotangent
|
||||
Point2 ->
|
||||
-- | world point
|
||||
Point2 ->
|
||||
Point2
|
||||
calcTexCoord zp tangent cotangent p = V2 (f tangent) (f cotangent)
|
||||
where
|
||||
f t = closestPointOnLineParam zp (zp + t) p
|
||||
|
||||
|
||||
-- # OPTIONS -Wno-incomplete-uni-patterns #-}
|
||||
makeTileFromPoly :: [Point2] -> Float -> Tile
|
||||
makeTileFromPoly poly z = Tile
|
||||
{ _tilePoly = poly
|
||||
, _tileZero = c
|
||||
, _tileTangentPos = c + (baseFloorTileSize *.* normalizeV (d -.- c))
|
||||
, _tileArrayZ = z
|
||||
}
|
||||
makeTileFromPoly poly z =
|
||||
Tile
|
||||
{ _tilePoly = poly
|
||||
, _tileZero = c
|
||||
, _tileTangentPos = c + (baseFloorTileSize *.* normalizeV (d -.- c))
|
||||
, _tileArrayZ = z
|
||||
}
|
||||
where
|
||||
(c:d:_) = poly
|
||||
(c : d : _) = poly
|
||||
|
||||
baseFloorTileSize :: Float
|
||||
baseFloorTileSize = 50
|
||||
|
||||
Reference in New Issue
Block a user