not-gloss 0.7.1.1 → 0.7.2.0
raw patch · 6 files changed
+24/−12 lines, 6 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Vis: Camera0 :: GLdouble -> GLdouble -> GLdouble -> Camera0
+ Vis: data Camera0
+ Vis: optInitialCamera :: Options -> Maybe Camera0
+ Vis: phi0 :: Camera0 -> GLdouble
+ Vis: rho0 :: Camera0 -> GLdouble
+ Vis: theta0 :: Camera0 -> GLdouble
+ Vis.Camera: instance Show Camera0
+ Vis.Vis: optInitialCamera :: Options -> Maybe Camera0
- Vis: Options :: Maybe Color -> Maybe (Int, Int) -> Maybe (Int, Int) -> String -> Options
+ Vis: Options :: Maybe Color -> Maybe (Int, Int) -> Maybe (Int, Int) -> String -> Maybe Camera0 -> Options
- Vis.Vis: Options :: Maybe Color -> Maybe (Int, Int) -> Maybe (Int, Int) -> String -> Options
+ Vis.Vis: Options :: Maybe Color -> Maybe (Int, Int) -> Maybe (Int, Int) -> String -> Maybe Camera0 -> Options
Files
- changelog.txt +3/−0
- not-gloss.cabal +2/−2
- src/Vis.hs +3/−0
- src/Vis/Camera.hs +1/−1
- src/Vis/Interface.hs +12/−7
- src/Vis/Vis.hs +3/−2
changelog.txt view
@@ -1,3 +1,6 @@+0.7.2.0:+- add option to set initial camera position+ 0.7.1.0: - add an interface which makes a movie
not-gloss.cabal view
@@ -1,5 +1,5 @@ name: not-gloss-version: 0.7.1.1+version: 0.7.2.0 stability: Experimental synopsis: Painless 3D graphics, no affiliation with gloss description:{@@ -20,7 +20,7 @@ license-file: LICENSE author: Greg Horn maintainer: gregmainland@gmail.com-copyright: (c) Greg Horn 2012-2014+copyright: (c) Greg Horn 2012-2015 category: Graphics build-type: Simple cabal-version: >=1.8
src/Vis.hs view
@@ -1,6 +1,7 @@ {-# OPTIONS_GHC -Wall #-} module Vis ( Options(..)+ , Camera0(..) , defaultOpts , display , animate@@ -20,6 +21,7 @@ import Graphics.UI.GLUT ( SpecialKey(..), BitmapFont(..), Flavour(..) ) import Vis.Vis ( Options(..), visMovie )+import Vis.Camera ( Camera0(..) ) import Vis.Interface ( display, animate, simulate, play, animateIO, simulateIO, playIO ) import Vis.VisObject ( VisObject(..) ) import Vis.GlossColor@@ -35,4 +37,5 @@ , optWindowSize = Nothing , optWindowPosition = Nothing , optWindowName = "not-gloss"+ , optInitialCamera = Nothing }
src/Vis/Camera.hs view
@@ -19,7 +19,7 @@ data Camera0 = Camera0 { phi0 :: GLdouble , theta0 :: GLdouble , rho0 :: GLdouble- }+ } deriving Show data Camera = Camera { phi :: GLdouble , theta :: GLdouble
src/Vis/Interface.hs view
@@ -9,9 +9,10 @@ , playIO ) where +import Data.Maybe ( fromMaybe ) import Graphics.UI.GLUT ( Key, KeyState, Position, Modifiers, Cursor(..) ) -import Vis.Vis ( Options, vis )+import Vis.Vis ( Options(..), vis ) import Vis.Camera ( Camera, Camera0(..), makeCamera, setCamera, cameraMotion, cameraKeyboardMouse ) import Vis.VisObject ( VisObject(..) ) @@ -39,9 +40,7 @@ where ts = 0.01 userState0 = ()- cameraState0 = makeCamera $ Camera0 { phi0 = 60- , theta0 = 20- , rho0 = 7}+ cameraState0 = makeCamera $ fromMaybe defaultCamera (optInitialCamera opts) drawFun (_,time) = do obs <- userDrawFun time return (obs, Nothing)@@ -81,9 +80,7 @@ simFun ((userState,cameraState),time) = do nextUserState <- userSimFun time userState return (nextUserState, cameraState)- cameraState0 = makeCamera $ Camera0 { phi0 = 60- , theta0 = 20- , rho0 = 7}+ cameraState0 = makeCamera $ fromMaybe defaultCamera (optInitialCamera opts) kmCallback (state, camState) k0 k1 _ _ = (state, cameraKeyboardMouse camState k0 k1) motionCallback (state, cameraState) pos = (state, cameraMotion cameraState pos) setCameraFun (_,cameraState) = setCamera cameraState@@ -125,3 +122,11 @@ where drawFun (userState, _) = userDrawFun userState simFun (userState,time) = userSimFun time userState+++defaultCamera :: Camera0+defaultCamera =+ Camera0+ { phi0 = 60+ , theta0 = 20+ , rho0 = 7}
src/Vis/Vis.hs view
@@ -45,6 +45,7 @@ , optWindowSize :: Maybe (Int,Int) -- ^ optional (x,y) window size in pixels , optWindowPosition :: Maybe (Int,Int) -- ^ optional (x,y) window origin in pixels , optWindowName :: String -- ^ window name+ , optInitialCamera :: Maybe Camera0 -- ^ initial camera position } deriving Show myGlInit :: Options -> IO ()@@ -283,11 +284,11 @@ myGlInit opts - let cameraState0 =- makeCamera $+ let defaultCam = Camera0 { phi0 = 60 , theta0 = 20 , rho0 = 7}+ cameraState0 = makeCamera $ fromMaybe defaultCam (optInitialCamera opts) -- create internal state areWeDrawingRef <- newIORef False