not-gloss 0.4.2 → 0.4.3
raw patch · 3 files changed
+24/−7 lines, 3 filesdep ~basedep ~gloss
Dependency ranges changed: base, gloss
Files
- Vis/Vis.hs +5/−3
- Vis/VisObject.hs +15/−0
- not-gloss.cabal +4/−4
Vis/Vis.hs view
@@ -20,11 +20,13 @@ myGlInit :: String -> IO () myGlInit progName = do initialDisplayMode $= [ DoubleBuffered, RGBAMode, WithDepthBuffer ]- Size x y <- get screenSize+-- Size x y <- get screenSize+ let x = 1600 :: Int+ y = 1080 :: Int putStrLn $ "screen resolution " ++ show x ++ "x" ++ show y let intScale d i = round $ d*(realToFrac i :: Double)- x0 = intScale 0.3 x- xf = intScale 0.95 x+ x0 = 1400 + intScale 0.3 x+ xf = 1400 + intScale 0.95 x y0 = intScale 0.05 y yf = intScale 0.95 y initialWindowSize $= Size (xf - x0) (yf - y0)
Vis/VisObject.hs view
@@ -5,6 +5,8 @@ , setPerspectiveMode ) where +import Control.Monad ( when )+import Data.Maybe ( fromJust, isJust ) import Graphics.Rendering.OpenGL.Raw import qualified Graphics.Gloss.Data.Color as Gloss import Graphics.UI.GLUT@@ -35,6 +37,7 @@ | VisCustom (IO ()) | Vis3dText String (Xyz a) BitmapFont Gloss.Color | Vis2dText String (a,a) BitmapFont Gloss.Color+ | VisPoints [Xyz a] (Maybe GLfloat) Gloss.Color instance Functor VisObject where fmap f (VisObjects xs) = VisObjects $ map (fmap f) xs@@ -51,6 +54,7 @@ fmap f (VisQuad x0 x1 x2 x3 col) = VisQuad (fmap f x0) (fmap f x1) (fmap f x2) (fmap f x3) col fmap f (Vis3dText t xyz bmf col) = Vis3dText t (fmap f xyz) bmf col fmap f (Vis2dText t (x,y) bmf col) = Vis2dText t (f x, f y) bmf col+ fmap f (VisPoints xyz s col) = VisPoints (map (fmap f) xyz) s col fmap _ (VisCustom f) = VisCustom f setPerspectiveMode :: IO ()@@ -283,3 +287,14 @@ setPerspectiveMode lighting $= Enabled++drawObject (VisPoints xyzs ps col) =+ preservingMatrix $ do+ lighting $= Disabled+ setColor col+ s' <- get pointSize+ when (isJust ps) $ pointSize $= (fromJust ps)+ renderPrimitive Points $ mapM_ (\(Xyz x' y' z') -> vertex$Vertex3 x' y' z') xyzs+ pointSize $= s'+ lighting $= Enabled+
not-gloss.cabal view
@@ -1,5 +1,5 @@ name: not-gloss-version: 0.4.2+version: 0.4.3 stability: Experimental synopsis: Painless 3D graphics, no affiliation with gloss description:{@@ -28,14 +28,14 @@ other-modules: - build-depends: base == 4.5.*,+ build-depends: base >= 4.5 && < 5, GLUT == 2.3.*, time == 1.4.*, OpenGLRaw == 1.2.*, spatial-math >= 0.1.2 && < 0.2,- gloss >= 1.7.4 && < 1.7.5+ gloss - ghc-options:+ ghc-options: -O2 source-repository head type: git