summaryrefslogtreecommitdiff
path: root/CubeMap.hs
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-04-29 22:40:53 -0400
committerJoe Crayne <joe@jerkface.net>2019-04-29 22:40:53 -0400
commitc9d1da96a78c78f18ba0d995d6a0376a00452b80 (patch)
treefd31d856cdb884c011e8d302790e5a601278b7c8 /CubeMap.hs
parenta1cf451ede392fae4a7c594f18b699128c6875fe (diff)
WIP: Skybox for MeshSketch rework.
Diffstat (limited to 'CubeMap.hs')
-rw-r--r--CubeMap.hs34
1 files changed, 29 insertions, 5 deletions
diff --git a/CubeMap.hs b/CubeMap.hs
index 337881f..10ba9e0 100644
--- a/CubeMap.hs
+++ b/CubeMap.hs
@@ -1,20 +1,23 @@
1module CubeMap 1module CubeMap
2 ( loadSkyboxes 2 ( loadSkyboxes
3 , Skyboxes(..) 3 , Skyboxes(..)
4 , cubeMesh
4 ) where 5 ) where
5 6
6import LambdaCube.GL as LC 7import LambdaCube.GL as LC
7import LambdaCube.GL.Mesh as LC
8import LambdaCube.GL.Data (uploadCubeMapToGPU) 8import LambdaCube.GL.Data (uploadCubeMapToGPU)
9import LambdaCube.GL.Mesh as LC
9 10
10import Data.Maybe 11import Codec.Archive.Zip
12import Codec.Picture as Juicy
11import Control.Monad 13import Control.Monad
14import qualified Data.ByteString.Lazy as Lazy
12import Data.List 15import Data.List
16import qualified Data.Map as Map
17import Data.Maybe
18import qualified Data.Vector as V
13import System.Directory 19import System.Directory
14import System.FilePath 20import System.FilePath
15import Codec.Archive.Zip
16import qualified Data.ByteString.Lazy as Lazy
17import Codec.Picture as Juicy
18 21
19image_names_xyz_dir :: [String] 22image_names_xyz_dir :: [String]
20image_names_xyz_dir = 23image_names_xyz_dir =
@@ -70,3 +73,24 @@ loadSkyboxes = do
70 return $ sequence imgs 73 return $ sequence imgs
71 } 74 }
72 75
76cubeMesh :: Mesh
77cubeMesh = 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 }