gloss-examples 1.9.1.1 → 1.9.2.1
raw patch · 13 files changed
+65/−64 lines, 13 filesdep +gloss-algorithmsdep ~glossdep ~gloss-rasterdep ~gloss-rendering
Dependencies added: gloss-algorithms
Dependency ranges changed: gloss, gloss-raster, gloss-rendering
Files
- gloss-examples.cabal +39/−37
- picture/Graph/Main.hs +2/−1
- picture/Render/Main.hs +3/−4
- picture/Styrene/Advance.hs +2/−1
- picture/Styrene/Collide.hs +4/−3
- picture/Styrene/Contact.hs +1/−0
- picture/Styrene/Main.hs +2/−1
- picture/Tree/Main.hs +1/−1
- raster/Crystal/Main.hs +4/−3
- raster/Mandel/Solver.hs +4/−10
- raster/Ray/Main.hs +1/−1
- raster/Snow/Main.hs +1/−1
- raster/Wave/Main.hs +1/−1
gloss-examples.cabal view
@@ -1,5 +1,5 @@ Name: gloss-examples-Version: 1.9.1.1+Version: 1.9.2.1 License: MIT License-file: LICENSE Author: Ben Lippmeier@@ -23,10 +23,10 @@ Executable gloss-bitmap Build-depends:- base == 4.7.*,- bytestring == 0.10.*,- bmp == 1.2.*,- gloss == 1.9.1.*+ base == 4.7.*,+ bytestring == 0.10.*,+ bmp == 1.2.*,+ gloss == 1.9.2.* Main-is: Main.hs hs-source-dirs: picture/Bitmap ghc-options: -threaded -O2@@ -34,8 +34,8 @@ Executable gloss-boids Build-depends:- base == 4.7.*,- gloss == 1.9.1.*+ base == 4.7.*,+ gloss == 1.9.2.* Main-is: Main.hs other-modules: KDTree2d Vec2 hs-source-dirs: picture/Boids@@ -45,7 +45,7 @@ Executable gloss-clock Build-depends: base == 4.7.*,- gloss == 1.9.1.*+ gloss == 1.9.2.* Main-is: Main.hs hs-source-dirs: picture/Clock ghc-options: -threaded -O2@@ -55,7 +55,7 @@ Build-depends: base == 4.7.*, vector == 0.10.*,- gloss == 1.9.1.*+ gloss == 1.9.2.* Main-is: Main.hs other-modules: Cell World hs-source-dirs: picture/Conway@@ -65,7 +65,7 @@ Executable gloss-draw Build-depends: base == 4.7.*,- gloss == 1.9.1.*+ gloss == 1.9.2.* Main-is: Main.hs hs-source-dirs: picture/Draw ghc-options: -threaded -O2@@ -74,7 +74,7 @@ Executable gloss-easy Build-depends: base == 4.7.*,- gloss == 1.9.1.*+ gloss == 1.9.2.* Main-is: Main.hs hs-source-dirs: picture/Easy ghc-options: -threaded -O2@@ -84,7 +84,7 @@ Build-depends: base == 4.7.*, random == 1.1.*,- gloss == 1.9.1.*+ gloss == 1.9.2.* Main-is: Main.hs other-modules: Cell Community World hs-source-dirs: picture/Eden@@ -94,7 +94,7 @@ Executable gloss-flake Build-depends: base == 4.7.*,- gloss == 1.9.1.*+ gloss == 1.9.2.* Main-is: Main.hs hs-source-dirs: picture/Flake ghc-options: -threaded -O2@@ -103,7 +103,7 @@ Executable gloss-gameevent Build-depends: base == 4.7.*,- gloss == 1.9.1.*+ gloss == 1.9.2.* Main-is: Main.hs hs-source-dirs: picture/GameEvent ghc-options: -threaded -O2@@ -112,7 +112,7 @@ Executable gloss-hello Build-depends: base == 4.7.*, - gloss == 1.9.1.*+ gloss == 1.9.2.* Main-is: Main.hs hs-source-dirs: picture/Hello ghc-options: -threaded -O2@@ -121,7 +121,7 @@ Executable gloss-lifespan Build-depends: base == 4.7.*, - gloss == 1.9.1.*,+ gloss == 1.9.2.*, random == 1.1.* Main-is: Main.hs other-modules: Cell Community World@@ -132,7 +132,7 @@ Executable gloss-machina Build-depends: base == 4.7.*, - gloss == 1.9.1.*+ gloss == 1.9.2.* Main-is: Main.hs hs-source-dirs: picture/Machina ghc-options: -threaded -O2@@ -140,9 +140,9 @@ Executable gloss-occlusion Build-depends: - base == 4.7.*, - gloss == 1.9.1.*,- gloss-rendering == 1.9.1.*+ base == 4.7.*, + gloss == 1.9.2.*,+ gloss-algorithms == 1.9.2.* Main-is: Main.hs other-modules: Cell World State Data hs-source-dirs: picture/Occlusion@@ -154,7 +154,7 @@ base == 4.7.*, ghc-prim == 0.3.*, containers == 0.5.*,- gloss == 1.9.1.*+ gloss == 1.9.2.* Main-is: Main.hs other-modules: Actor Advance Collide Config Contact QuadTree World hs-source-dirs: picture/Styrene@@ -164,7 +164,7 @@ Executable gloss-tree Build-depends: base == 4.7.*, - gloss == 1.9.1.*+ gloss == 1.9.2.* Main-is: Main.hs hs-source-dirs: picture/Tree ghc-options: -threaded -O2@@ -174,7 +174,7 @@ Build-depends: base == 4.7.*, vector == 0.10.*,- gloss == 1.9.1.*+ gloss == 1.9.2.* Main-is: Main.hs other-modules: Draw Interface State World Geometry.Randomish Geometry.Segment hs-source-dirs: picture/Visibility @@ -184,7 +184,7 @@ Executable gloss-zen Build-depends: base == 4.7.*, - gloss == 1.9.1.*+ gloss == 1.9.2.* Main-is: Main.hs hs-source-dirs: picture/Zen ghc-options: -threaded -O2@@ -193,8 +193,8 @@ Executable gloss-crystal Build-depends: base == 4.7.*,- gloss == 1.9.1.*,- gloss-raster == 1.9.1.*+ gloss == 1.9.2.*,+ gloss-raster == 1.9.2.* Main-is: Main.hs hs-source-dirs: raster/Crystal ghc-options: @@ -211,8 +211,8 @@ Executable gloss-ray Build-depends: base == 4.7.*,- gloss == 1.9.1.*,- gloss-raster == 1.9.1.*+ gloss == 1.9.2.*,+ gloss-raster == 1.9.2.* Main-is: Main.hs other-modules: Light Object Trace Vec3 World hs-source-dirs: raster/Ray@@ -227,8 +227,8 @@ Executable gloss-pulse Build-depends: base == 4.7.*,- gloss == 1.9.1.*,- gloss-raster == 1.9.1.*+ gloss == 1.9.2.*,+ gloss-raster == 1.9.2.* Main-is: Main.hs hs-source-dirs: raster/Pulse ghc-options:@@ -244,8 +244,8 @@ base == 4.7.*, ghc-prim == 0.3.*, vector == 0.10.*,- gloss == 1.9.1.*,- gloss-raster == 1.9.1.*+ gloss == 1.9.2.*,+ gloss-raster == 1.9.2.* Main-is: Main.hs hs-source-dirs: raster/Wave ghc-options:@@ -263,7 +263,7 @@ repa == 3.3.*, repa-io == 3.3.*, repa-algorithms == 3.3.*,- gloss == 1.9.1.*+ gloss == 1.9.2.* Main-is: Main.hs other-modules: Args Config FieldElt Model UserEvent@@ -285,7 +285,7 @@ Build-depends: base == 4.7.*, repa == 3.3.*,- gloss == 1.9.1.*+ gloss == 1.9.2.* Main-is: Main.hs hs-source-dirs: raster/Snow ghc-options:@@ -300,7 +300,7 @@ Build-depends: base == 4.7.*, repa == 3.3.*,- gloss == 1.9.1.*+ gloss == 1.9.2.* Main-is: Main.hs other-modules: Solver hs-source-dirs: raster/Mandel@@ -318,17 +318,19 @@ Build-depends: base == 4.7.*, containers == 0.5.*,- gloss == 1.9.1.*+ gloss == 1.9.2.* Main-is: Main.hs hs-source-dirs: picture/Graph ghc-options: -Wall -O2 + Executable gloss-render Build-depends: base == 4.7.*, containers == 0.5.*,- gloss == 1.9.1.*,+ gloss == 1.9.2.*,+ gloss-rendering == 1.9.2.*, GLFW-b Main-is: Main.hs hs-source-dirs: picture/Render
picture/Graph/Main.hs view
@@ -9,6 +9,7 @@ import Graphics.Gloss import Graphics.Gloss.Data.Vector+import Graphics.Gloss.Data.ViewPort import Graphics.Gloss.Data.ViewState import Graphics.Gloss.Interface.Pure.Game @@ -160,7 +161,7 @@ pushForce v1 v2 = -- If we are analysing the same vertex, l = 0- if l > 0 then (charge / l) `mulSV` normaliseV d + if l > 0 then (charge / l) `mulSV` normalizeV d else 0 where d = v1 - v2 l = magV d ** 2
picture/Render/Main.hs view
@@ -2,7 +2,7 @@ import "GLFW-b" Graphics.UI.GLFW as GLFW import Control.Concurrent (threadDelay) import Control.Monad (when, unless)-import Graphics.Gloss.Render+import Graphics.Gloss.Rendering import Graphics.Gloss @@ -11,16 +11,15 @@ let width = 200 height = 200 - state <- stateInit+ state <- initState withWindow width height "Render" $ \win -> do loop state win (width, height) - where loop state window (w, h) = do threadDelay 20000 pollEvents- render state (w, h) white (Circle 80)+ displayPicture (w, h) white state 1.0 (Circle 80) swapBuffers window k <- keyIsPressed window Key'Escape unless k $ loop state window (w, h)
picture/Styrene/Advance.hs view
@@ -9,8 +9,9 @@ import Actor import Config -import Graphics.Gloss.Geometry import Graphics.Gloss.Interface.Pure.Simulate+import Graphics.Gloss.Geometry.Line+import Graphics.Gloss.Geometry.Angle import Graphics.Gloss.Data.Point import Graphics.Gloss.Data.Vector
picture/Styrene/Collide.hs view
@@ -4,7 +4,8 @@ import Actor import Graphics.Gloss.Data.Point import Graphics.Gloss.Data.Vector-import Graphics.Gloss.Geometry+import Graphics.Gloss.Geometry.Line+import Graphics.Gloss.Geometry.Angle -- Config ----------------------------------------------------------------------------------------- -- How bouncy the beads are@@ -50,7 +51,7 @@ mass2 = 1 -- the axis of collision (towards p2)- vCollision@(cX, cY) = normaliseV (p2 - p1)+ vCollision@(cX, cY) = normalizeV (p2 - p1) vCollisionR = (cY, -cX) -- the velocity component of each bead along the axis of collision@@ -125,7 +126,7 @@ = let -- take a normal vector from the wall to the bead. -- this vector is at a right angle to the wall.- vNormal = normaliseV (pBead - pCollision)+ vNormal = normalizeV (pBead - pCollision) -- the bead at pBead is overlapping with what it collided with, but we don't want that. -- place the bead so it's surface is just next to the point of collision.
picture/Styrene/Contact.hs view
@@ -7,6 +7,7 @@ import Actor import Graphics.Gloss.Data.Point import Graphics.Gloss.Geometry.Line+import Graphics.Gloss.Geometry.Angle import Data.Maybe import Data.List import GHC.Exts
picture/Styrene/Main.hs view
@@ -8,7 +8,8 @@ import Config import Graphics.Gloss-import Graphics.Gloss.Geometry+import Graphics.Gloss.Geometry.Line+import Graphics.Gloss.Geometry.Angle import Graphics.Gloss.Interface.Pure.Simulate import Graphics.Gloss.Data.Vector
picture/Tree/Main.hs view
@@ -45,7 +45,7 @@ -- A starting colour for the stump brown :: Color-brown = makeColor8 139 100 35 255+brown = makeColorI 139 100 35 255 -- Make this color a little greener
raster/Crystal/Main.hs view
@@ -166,12 +166,13 @@ -- | Convert an image point to a point on our wave plane. point :: Scale -> Point -> Point-point !scale (x, y) = (x * scale, y * scale)+point !scale (x, y) + = (x * scale, y * scale) -- | Color ramp from blue to white. rampColor :: Float -> Color-rampColor v- = rawColor v (0.4 + (v * 0.6)) 1 1+rampColor v + = rgb' v (0.4 + (v * 0.6)) 1
raster/Mandel/Solver.hs view
@@ -5,7 +5,8 @@ , f2d , d2f) where-import Graphics.Gloss.Data.Color+import Graphics.Gloss.Raster.Array+import Graphics.Gloss.Data.Bitmap import Graphics.Gloss.Data.Picture import Data.Word import System.IO.Unsafe@@ -40,7 +41,6 @@ {-# NOINLINE mandelPicture #-} - mandelArray :: Int -- Window Size X -> Int -- Window Size Y@@ -171,9 +171,9 @@ !v = fromIntegral count / fromIntegral cMax color'- | v > 0.99 = rgb 0 0 0+ | v > 0.99 = rgb' 0 0 0 | (r, g, b) <- rampColorHotToCold 0 1 v- = rgb r g b+ = rgb' r g b in color' {-# INLINE mandelPixel #-} @@ -205,12 +205,6 @@ d2f :: Double -> Float d2f = double2Float {-# INLINE d2f #-}----- | Construct a color from red, green, blue components.-rgb :: Float -> Float -> Float -> Color-rgb r g b = makeColor' r g b 1.0-{-# INLINE rgb #-} -- | Float to Word8 conversion because the one in the GHC libraries
raster/Ray/Main.hs view
@@ -204,7 +204,7 @@ eyePos eyeDir bounces - in G.rawColor r g b 1.0+ in G.rgb' r g b {-# INLINE tracePixel #-}
raster/Snow/Main.hs view
@@ -38,7 +38,7 @@ makePixel i j = let x = i + j x' = x .&. 0x0ff- in rgb8 x' x' x'+ in rgbI' x' x' x' in R.zipWith makePixel arr1 arr2
raster/Wave/Main.hs view
@@ -25,7 +25,7 @@ !y' = abs $ y + 1 !r1 = abs $ 0.5 * (usin (x' + 0.2 * (usin t)) + ucos y') !r2 = abs $ 0.5 * (usin y' + usin (0.3 * t))- in makeColor' r1 0 r2 1.0+ in rgb' r1 0 r2 {-# INLINE get #-} in animateField