Fix normal map transformations for floor
This commit is contained in:
@@ -8,12 +8,13 @@ import Data.Tile
|
||||
import Foreign
|
||||
|
||||
pokeTile :: Ptr Float -> Int -> Tile -> IO Int
|
||||
pokeTile ptr i t@Tile { _tilePoly = ps , _tileX = ttan } = do
|
||||
let coords = map (calcTexCoord (_tileZero t) ttan) ps
|
||||
coords3 = map (addZ (_tileZ t)) coords
|
||||
foldM (pokeTileVerx ttan ptr) i $ triangulate $ zip ps coords3
|
||||
pokeTile ptr i t@Tile { _tilePoly = ps } = do
|
||||
foldM (pokeTileVerx ttan (_tileZ t) ptr) i $ triangulate $ zip ps (tileTexCoords t)
|
||||
where
|
||||
ttan = _tileTangentPos t - _tileZero t
|
||||
|
||||
pokeTileVerx :: Point2 -> Ptr Float -> Int -> (Point2,Point3) -> IO Int
|
||||
pokeTileVerx (V2 t s) ptr i (V2 x y,V3 u v w) = do
|
||||
zipWithM_ (\off -> pokeElemOff ptr (i*8 + off)) [0..] [x,y,s,t,u,v,w,1]
|
||||
pokeTileVerx :: Point2 -> Float -> Ptr Float -> Int -> (Point2,Point2) -> IO Int
|
||||
pokeTileVerx tangent tilez ptr i (V2 x y,V2 s t) = do
|
||||
let a = argV tangent
|
||||
zipWithM_ (\off -> pokeElemOff ptr (i*8 + off)) [0..] [x,y,1,1,s,t,tilez,a]
|
||||
return $ i + 1
|
||||
|
||||
Reference in New Issue
Block a user