Various cleanups

This commit is contained in:
2021-10-29 18:40:28 +01:00
parent 4480d0f7c7
commit d5d4c93007
8 changed files with 25 additions and 116 deletions
+4 -10
View File
@@ -1,8 +1,9 @@
module Tile
where
( tToRender
, makeTileFromPoly
) where
import Data.Tile
import Geometry
--import Geometry.Data
tToRender :: Tile -> [(Point3,Point3)]
tToRender t = polyToTris $ zip ps3 coords3
@@ -15,9 +16,6 @@ tToRender t = polyToTris $ zip ps3 coords3
addToV2 :: a -> V2 a -> V3 a
addToV2 z (V2 x y) = V3 x y z
mkTrip :: c -> (a,b) -> (a,b,c)
mkTrip z (x,y) = (x,y,z)
calcTexCoord
:: Point2 -- ^ tile (0,0)
-> Point2 -- ^ tile (1,0)
@@ -28,14 +26,10 @@ calcTexCoord c p x = V2 (0.02 * dotV (p -.- c) xdir) (0.02 * dotV (p -.- c) ydir
xdir = x -.- c
ydir = vNormal xdir
makeTileFromPoly
:: [Point2]
-> Float
-> Tile
makeTileFromPoly :: [Point2] -> Float -> Tile
makeTileFromPoly poly z = Tile
{ _tilePoly = poly
, _tileZero = c
--, _tileXY = c +.+ xdir +.+ vNormal xdir
, _tileX = c +.+ normalizeV ((poly !! 1) -.- c)
, _tileZ = z
}