changed map a bit
This commit is contained in:
parent
ae304ddc5c
commit
1bbf900ec4
@ -3,5 +3,32 @@ where
|
||||
|
||||
import Map.Types
|
||||
|
||||
-- | Generate a new Map of given Type and Size
|
||||
--
|
||||
-- TODO:
|
||||
-- 1. Should take Size -> Type -> Playmap
|
||||
-- 2. plug together helper-functions for that terraintype
|
||||
newMap :: Int -> Int -> PlayMap
|
||||
newMap = undefined
|
||||
|
||||
|
||||
-- | Basic Terrain-Generator. Will not implement "abnormal" Stuff for given Biome
|
||||
-- (like Deserts on Grass-Islands or Grass on Deserts)
|
||||
--
|
||||
-- TODO: Implement Desert-Generator
|
||||
heightToTerrain :: MapType -> YCoord -> TileType
|
||||
heightToTerrain GrassIslandMap y
|
||||
| y < 0.1 = Ocean
|
||||
| y < 1 = Beach
|
||||
| y < 5 = Grass
|
||||
| y < 10 = Hill
|
||||
| otherwise = Mountain
|
||||
heightToTerrain _ _ = undefined
|
||||
|
||||
type Seed = (XCoord, ZCoord)
|
||||
|
||||
-- | Add lakes on generated Map from (possible) Seeds noted before.
|
||||
--
|
||||
-- TODO: implement and erode terrain on the way down.
|
||||
addLakes :: PlayMap -> [Seeds] -> PlayMap
|
||||
addLakes m s = undefined
|
||||
|
@ -88,7 +88,7 @@ fgVertexIndex = (ToFloat, mapVertexArrayDescriptor 3 7) --vertex after normal
|
||||
|
||||
getMapBufferObject :: IO (BufferObject, NumArrayIndices)
|
||||
getMapBufferObject = do
|
||||
myMap' <- return $ convertToGraphicsMap $ convertToStripeMap mapCenterMountain
|
||||
myMap' <- return $ convertToGraphicsMap $ convertToStripeMap mapNoise
|
||||
! myMap <- return $ generateTriangles myMap'
|
||||
len <- return $ fromIntegral $ P.length myMap `div` numComponents
|
||||
putStrLn $ P.unwords ["num verts in map:",show len]
|
||||
|
@ -3,6 +3,7 @@ where
|
||||
|
||||
import Map.Types
|
||||
import Data.Array
|
||||
import Map.Creation (heightToTerrain)
|
||||
|
||||
-- general 3D-Gaussian
|
||||
gauss3Dgeneral :: Floating q =>
|
||||
@ -47,3 +48,28 @@ mapCenterMountain = array ((0,0),(199,199)) nodes
|
||||
|
||||
m2d :: (Int,Int) -> Int
|
||||
m2d (x,y) = mnh2D (x,y) (100,100)
|
||||
|
||||
-- small helper for some hills. Should be replaced by multi-layer perlin-noise
|
||||
-- TODO: Replace as given in comment.
|
||||
_noisyMap :: (Floating q) => q -> q -> q
|
||||
_noisyMap = \x y -> gauss3Dgeneral 15 100.0 100.0 15.0 15.0 x y
|
||||
+ gauss3Dgeneral 5 10.0 10.0 10.0 10.0 x y
|
||||
+ gauss3Dgeneral 5 150.0 120.0 10.0 10.0 x y
|
||||
+ gauss3Dgeneral 5 50.0 75.0 10.0 10.0 x y
|
||||
|
||||
-- generates a noisy map
|
||||
-- TODO: add real noise to a simple pattern
|
||||
mapNoise :: PlayMap
|
||||
mapNoise = array ((0,0),(199,199)) nodes
|
||||
where
|
||||
nodes = [((a,b), (Full
|
||||
(a,b)
|
||||
(height a b)
|
||||
(heightToTerrain GrassIslandMap $ height a b)
|
||||
BNothing
|
||||
NoPlayer
|
||||
NoPath
|
||||
Plain
|
||||
[])) | a <- [0..199], b <- [0..199]]
|
||||
where
|
||||
height a b = (_noisyMap (fromIntegral a) (fromIntegral b))
|
||||
|
Loading…
Reference in New Issue
Block a user