Permalink
Browse files

Split genTexture, mkTexture

  • Loading branch information...
1 parent aeaada3 commit 832e19ce44864945a622ddf30da2532e0127d8f1 @kfish committed Nov 22, 2011
Showing with 8 additions and 4 deletions.
  1. +7 −3 Graphics/TextureSynthesis.hs
  2. +1 −1 tools/texture-synthesis.hs
@@ -5,6 +5,7 @@
module Graphics.TextureSynthesis (
Texture(..)
, textureEmpty
+ , genTexture
, mkTexture
, flattenTexture
) where
@@ -37,9 +38,12 @@ data Texture a = Texture {
textureEmpty :: Texture Float
textureEmpty = Texture 0 0 0 0 QuadNil
-mkTexture :: Int -> IO (Texture Float)
-mkTexture !lim = do
- quad <- MWC.withSystemRandom (mkQuad lim 0 0 0 0 0 0.5 0.5)
+genTexture :: Int -> IO (Texture Float)
+genTexture = MWC.withSystemRandom . mkTexture
+
+mkTexture :: Int -> MWC.GenIO -> IO (Texture Float)
+mkTexture !lim gen = do
+ quad <- mkQuad lim 0 0 0 0 0 0.5 0.5 gen
return (Texture 0 0 0 0 quad)
mkQuad :: (Fractional a, MWC.Variate a)
@@ -6,5 +6,5 @@ import Graphics.TextureSynthesis
main :: IO ()
main = do
- ts <- mkTexture 8
+ ts <- genTexture 8
print ts

0 comments on commit 832e19c

Please sign in to comment.