summaryrefslogtreecommitdiff
path: root/CubeMap.hs
diff options
context:
space:
mode:
Diffstat (limited to 'CubeMap.hs')
-rw-r--r--CubeMap.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/CubeMap.hs b/CubeMap.hs
index 73fb1a9..e71892a 100644
--- a/CubeMap.hs
+++ b/CubeMap.hs
@@ -8,6 +8,7 @@ import LambdaCube.GL as LC
8import LambdaCube.GL.Data (uploadCubeMapToGPU) 8import LambdaCube.GL.Data (uploadCubeMapToGPU)
9import LambdaCube.GL.Mesh as LC 9import LambdaCube.GL.Mesh as LC
10 10
11import Control.DeepSeq
11import Codec.Archive.Zip 12import Codec.Archive.Zip
12import Codec.Picture as Juicy 13import Codec.Picture as Juicy
13import Control.Monad 14import 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