diff options
Diffstat (limited to 'CubeMap.hs')
-rw-r--r-- | CubeMap.hs | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -8,6 +8,7 @@ import LambdaCube.GL as LC | |||
8 | import LambdaCube.GL.Data (uploadCubeMapToGPU) | 8 | import LambdaCube.GL.Data (uploadCubeMapToGPU) |
9 | import LambdaCube.GL.Mesh as LC | 9 | import LambdaCube.GL.Mesh as LC |
10 | 10 | ||
11 | import Control.DeepSeq | ||
11 | import Codec.Archive.Zip | 12 | import Codec.Archive.Zip |
12 | import Codec.Picture as Juicy | 13 | import Codec.Picture as Juicy |
13 | import Control.Monad | 14 | import Control.Monad |
@@ -68,16 +69,18 @@ loadSkyboxes = do | |||
68 | , skyboxNames = zips | 69 | , skyboxNames = zips |
69 | , skyboxLoad = \n -> do | 70 | , skyboxLoad = \n -> do |
70 | let fn = zips !! mod n len | 71 | let fn = zips !! mod n len |
72 | putStrLn $ "Loading skybox " ++ show n ++ ": " ++ fn ++ "..." | ||
71 | archive <- toArchive <$> Lazy.readFile (dir </> fn) | 73 | archive <- toArchive <$> Lazy.readFile (dir </> fn) |
72 | let es = mapMaybe (`findEntryByPath` archive) $ filterImageNames (filesInArchive archive) | 74 | let es = mapMaybe (`findEntryByPath` archive) $ filterImageNames (filesInArchive archive) |
73 | imgs <- forM es $ \entry -> do | 75 | imgs <- fmap sequence $ forM es $ \entry -> do |
74 | return $ Juicy.decodeImage $ Lazy.toStrict $ fromEntry entry | 76 | return $ Juicy.decodeImage $ Lazy.toStrict $ fromEntry entry |
75 | return $ sequence imgs | 77 | deepseq imgs $ putStrLn $ "Finished loading skybox " ++ show n ++ ": " ++ fn ++ "." |
78 | return imgs | ||
76 | } | 79 | } |
77 | `catchIOError` \e -> do | 80 | `catchIOError` \e -> do |
78 | hPutStrLn stderr $ unlines | 81 | hPutStrLn stderr $ unlines |
79 | [ "Unable to load skybox." | 82 | [ "Unable to load skybox." |
80 | , "Download a .zip archive from http://www.humus.name/index.php?page=Textures&start=0" | 83 | , "Download one of the .zip archive at http://www.humus.name/index.php?page=Textures&start=0" |
81 | , "and save it into the ./skyboxes directory." | 84 | , "and save it into the ./skyboxes directory." |
82 | ] | 85 | ] |
83 | return Skyboxes | 86 | return Skyboxes |