diff options
author | Joe Crayne <joe@jerkface.net> | 2019-04-29 22:40:53 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-04-29 22:40:53 -0400 |
commit | c9d1da96a78c78f18ba0d995d6a0376a00452b80 (patch) | |
tree | fd31d856cdb884c011e8d302790e5a601278b7c8 /CubeMap.hs | |
parent | a1cf451ede392fae4a7c594f18b699128c6875fe (diff) |
WIP: Skybox for MeshSketch rework.
Diffstat (limited to 'CubeMap.hs')
-rw-r--r-- | CubeMap.hs | 34 |
1 files changed, 29 insertions, 5 deletions
@@ -1,20 +1,23 @@ | |||
1 | module CubeMap | 1 | module CubeMap |
2 | ( loadSkyboxes | 2 | ( loadSkyboxes |
3 | , Skyboxes(..) | 3 | , Skyboxes(..) |
4 | , cubeMesh | ||
4 | ) where | 5 | ) where |
5 | 6 | ||
6 | import LambdaCube.GL as LC | 7 | import LambdaCube.GL as LC |
7 | import LambdaCube.GL.Mesh as LC | ||
8 | import LambdaCube.GL.Data (uploadCubeMapToGPU) | 8 | import LambdaCube.GL.Data (uploadCubeMapToGPU) |
9 | import LambdaCube.GL.Mesh as LC | ||
9 | 10 | ||
10 | import Data.Maybe | 11 | import Codec.Archive.Zip |
12 | import Codec.Picture as Juicy | ||
11 | import Control.Monad | 13 | import Control.Monad |
14 | import qualified Data.ByteString.Lazy as Lazy | ||
12 | import Data.List | 15 | import Data.List |
16 | import qualified Data.Map as Map | ||
17 | import Data.Maybe | ||
18 | import qualified Data.Vector as V | ||
13 | import System.Directory | 19 | import System.Directory |
14 | import System.FilePath | 20 | import System.FilePath |
15 | import Codec.Archive.Zip | ||
16 | import qualified Data.ByteString.Lazy as Lazy | ||
17 | import Codec.Picture as Juicy | ||
18 | 21 | ||
19 | image_names_xyz_dir :: [String] | 22 | image_names_xyz_dir :: [String] |
20 | image_names_xyz_dir = | 23 | image_names_xyz_dir = |
@@ -70,3 +73,24 @@ loadSkyboxes = do | |||
70 | return $ sequence imgs | 73 | return $ sequence imgs |
71 | } | 74 | } |
72 | 75 | ||
76 | cubeMesh :: Mesh | ||
77 | cubeMesh = Mesh | ||
78 | { mAttributes = Map.singleton "position" $ A_V3F $ V.fromList | ||
79 | [ V3 1 (-1) (-1) -- 0 | ||
80 | , V3 1 (-1) 1 -- 1 | ||
81 | , V3 1 1 1 -- 2 | ||
82 | , V3 1 1 (-1) -- 3 | ||
83 | , V3 (-1) (-1) 1 -- 4 | ||
84 | , V3 (-1) (-1) (-1) -- 5 | ||
85 | , V3 (-1) 1 (-1) -- 6 | ||
86 | , V3 (-1) 1 1 -- 7 | ||
87 | ] | ||
88 | , mPrimitive = P_TrianglesI $ V.fromList | ||
89 | [ 0, 1, 2, 2, 3, 0 -- posx | ||
90 | , 4, 5, 6, 6, 7, 4 -- negx | ||
91 | , 6, 3, 2, 2, 7, 6 -- posy | ||
92 | , 4, 1, 0, 0, 5, 4 -- negy | ||
93 | , 1, 4, 7, 7, 2, 1 -- posz | ||
94 | , 5, 0, 3, 3, 6, 5 -- negz | ||
95 | ] | ||
96 | } | ||