packages feed

luminance 0.3.1.2 → 0.4

raw patch · 5 files changed

+47/−41 lines, 5 filesdep +linear

Dependencies added: linear

Files

CHANGELOG.md view
@@ -1,3 +1,19 @@+# 0.4++#### Non-breaking changes++- Added .gitignore.++#### Breaking changes++- `V2`, `V3` and `V4` replaced by `vec2`, `vec3` and `vec4`.+- `V` is not anymore luminance’s. We use linear’s one, because it already has all the instances we+  need and is more generic. The interface is then impacted.++## 0.3.2++- Added Core.Tuple into the export liste of Luminance for easier uses in client code space.+ ### 0.3.1.2  - Fixed Geometry haddock documentation.
luminance.cabal view
@@ -1,5 +1,5 @@ name:                luminance-version:             0.3.1.2+version:             0.4 synopsis:            Type-safe, dependently-typed and stateless graphics framework description:         This package exposes several modules to work with /GPUs/ in a stateless and                      type-safe way. Currently, it uses __OpenGL__ as backend hardware technology but@@ -114,6 +114,7 @@   build-depends:       base           >= 4.8  && < 4.9                      , contravariant  >= 1.3  && < 1.4                      , gl             >= 0.7  && < 0.8+                     , linear         >= 1.20 && < 1.21                      , mtl            >= 2.2  && < 2.3                      , resourcet      >= 1.1  && < 1.2                      , semigroups     >= 0.16 && < 0.17
src/Graphics/Luminance.hs view
@@ -303,6 +303,7 @@   , module Graphics.Luminance.Blending   , module Graphics.Luminance.Buffer   , module Graphics.Luminance.Cmd+  , module Graphics.Luminance.Core.Tuple   , module Graphics.Luminance.Framebuffer   , module Graphics.Luminance.Geometry   , module Graphics.Luminance.Pixel@@ -318,6 +319,7 @@ import Graphics.Luminance.Blending import Graphics.Luminance.Buffer import Graphics.Luminance.Cmd+import Graphics.Luminance.Core.Tuple import Graphics.Luminance.Framebuffer import Graphics.Luminance.Geometry import Graphics.Luminance.Pixel
src/Graphics/Luminance/Core/Vertex.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE OverloadedLists #-}+ ----------------------------------------------------------------------------- -- | -- Copyright   : (C) 2015 Dimitri Sabadie@@ -8,55 +10,37 @@ -- Portability : portable ---------------------------------------------------------------------------- -module Graphics.Luminance.Core.Vertex where+module Graphics.Luminance.Core.Vertex (+    VertexAttribute(..)+  , Vertex(..)+  , vertexBindingIndex+  , module Linear.V+  , vec2+  , vec3+  , vec4+  ) where  import Control.Monad.IO.Class ( MonadIO(..) ) import Data.Int ( Int32 ) import Data.Proxy ( Proxy(..) ) import Data.Word ( Word32 )-import Foreign.Marshal.Array ( peekArray, pokeArray )-import Foreign.Ptr ( Ptr, castPtr )-import Foreign.Storable ( Storable(..) )-import GHC.TypeLits ( KnownNat, Nat, natVal )+import Foreign.Storable ( Storable )+import GHC.TypeLits ( KnownNat, natVal ) import Graphics.GL import Graphics.Luminance.Core.Tuple---- FIXME: use linear’s one?-data V :: Nat -> * -> * where-  V1 :: !a -> V 1 a-  V2 :: !a -> !a -> V 2 a-  V3 :: !a -> !a -> !a -> V 3 a-  V4 :: !a -> !a -> !a -> !a -> V 4 a--instance (Storable a) => Storable (V 1 a) where-  sizeOf _ = sizeOf (undefined :: a)-  alignment _ = alignment (undefined :: a)-  peek p = fmap V1 $ peek (castPtr p :: Ptr a)-  poke p (V1 x) = poke (castPtr p) x+import Linear.V -instance (Storable a) => Storable (V 2 a) where-  sizeOf _ = 2 * sizeOf (undefined :: a)-  alignment _ = alignment (undefined :: a)-  peek p = do-    [x,y] <- peekArray 2 (castPtr p :: Ptr a)-    pure $ V2 x y-  poke p (V2 x y) = pokeArray (castPtr p) [x,y]+-- |Create a new @'V' 2@.+vec2 :: a -> a -> V 2 a+vec2 x y = V [x,y] -instance (Storable a) => Storable (V 3 a) where-  sizeOf _ = 3 * sizeOf (undefined :: a)-  alignment _ = alignment (undefined :: a)-  peek p = do-    [x,y,z] <- peekArray 3 (castPtr p :: Ptr a)-    pure $ V3 x y z-  poke p (V3 x y z) = pokeArray (castPtr p) [x,y,z]+-- |Create a new @'V' 3@.+vec3 :: a -> a -> a -> V 3 a+vec3 x y z = V [x,y,z] -instance (Storable a) => Storable (V 4 a) where-  sizeOf _ = 4 * sizeOf (undefined :: a)-  alignment _ = alignment (undefined :: a)-  peek p = do-    [x,y,z,w] <- peekArray 4 (castPtr p :: Ptr a)-    pure $ V4 x y z w-  poke p (V4 x y z w) = pokeArray (castPtr p) [x,y,z,w]+-- |Create a new @'V' 3@.+vec4 :: a -> a -> a -> a -> V 4 a+vec4 x y z w = V [x,y,z,w]  -- |A vertex might have several attributes. The types of those attributes have to implement the -- 'VertexAttribute' typeclass in order to be used as vertex attributes.
src/Graphics/Luminance/Vertex.hs view
@@ -10,7 +10,10 @@  module Graphics.Luminance.Vertex (     -- * Vertex components-    V(..)+    V+  , vec2+  , vec3+  , vec4   , VertexAttribute     -- * Vertex   , Vertex