Permalink
Browse files

add genTextureDefault, generate in ST

  • Loading branch information...
kfish committed Nov 23, 2011
1 parent 9993021 commit 52c3f71f80fa7570dcaf14bc82a8ec7e0ad6a421
Showing with 8 additions and 0 deletions.
  1. +8 −0 Graphics/TextureSynthesis.hs
@@ -6,11 +6,13 @@ module Graphics.TextureSynthesis (
Texture(..)
, textureEmpty
, genTexture
+ , genTextureDefault
, mkTexture
, flattenTexture
) where
import Control.Monad.Primitive (PrimMonad, PrimState)
+import Control.Monad.ST (runST)
import Control.Parallel
import Data.Map (Map)
import qualified Data.Map as Map
@@ -42,6 +44,12 @@ textureEmpty = Texture 0 0 0 0 QuadNil
genTexture :: Int -> IO (Texture Float)
genTexture = MWC.withSystemRandom . mkTextureIO
+-- | Generate a texture using the default seed
+genTextureDefault :: Int -> Texture Float
+genTextureDefault lim = runST $ do
+ gen <- MWC.create
+ mkTexture lim gen
+
mkTextureIO :: Int -> MWC.GenIO -> IO (Texture Float)
mkTextureIO = mkTexture

0 comments on commit 52c3f71

Please sign in to comment.