not-gloss 0.7.3.0 → 0.7.4.0
raw patch · 2 files changed
+21/−7 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Vis: Line :: [V3 a] -> Color -> VisObject a
+ Vis: Line :: (Maybe a) -> [V3 a] -> Color -> VisObject a
- Vis: Line' :: [(V3 a, Color)] -> VisObject a
+ Vis: Line' :: (Maybe a) -> [(V3 a, Color)] -> VisObject a
- Vis.VisObject: Line :: [V3 a] -> Color -> VisObject a
+ Vis.VisObject: Line :: (Maybe a) -> [V3 a] -> Color -> VisObject a
- Vis.VisObject: Line' :: [(V3 a, Color)] -> VisObject a
+ Vis.VisObject: Line' :: (Maybe a) -> [(V3 a, Color)] -> VisObject a
Files
- not-gloss.cabal +1/−1
- src/Vis/VisObject.hs +20/−6
not-gloss.cabal view
@@ -1,5 +1,5 @@ name: not-gloss-version: 0.7.3.0+version: 0.7.4.0 stability: Experimental synopsis: Painless 3D graphics, no affiliation with gloss description:{
src/Vis/VisObject.hs view
@@ -57,8 +57,8 @@ | Cube a Flavour GlossColor.Color | Sphere a Flavour GlossColor.Color | Ellipsoid (a,a,a) Flavour GlossColor.Color- | Line [V3 a] GlossColor.Color- | Line' [(V3 a,GlossColor.Color)]+ | Line (Maybe a) [V3 a] GlossColor.Color+ | Line' (Maybe a) [(V3 a,GlossColor.Color)] | Arrow (a,a) (V3 a) GlossColor.Color | Axes (a,a) | Plane (V3 a) GlossColor.Color GlossColor.Color@@ -285,18 +285,29 @@ GLUT.renderObject flav (GLUT.Cube (realToFrac r)) -- line-drawObject (Line path col) =+drawObject (Line width path col) = GLUT.preservingMatrix $ do GLUT.lighting $= Disabled setColor col+ lineWidth0 <- GLUT.get GLUT.lineWidth+ case width of+ Just w -> GLUT.lineWidth $= realToFrac w+ Nothing -> return ()+ GLUT.renderPrimitive LineStrip $ mapM_ (\(V3 x' y' z') -> GLUT.vertex $ Vertex3 x' y' z') path+ GLUT.lineWidth $= lineWidth0 GLUT.lighting $= Enabled -- line where you set the color at each vertex-drawObject (Line' pathcols) =+drawObject (Line' width pathcols) = GLUT.preservingMatrix $ do GLUT.lighting $= Disabled + lineWidth0 <- GLUT.get GLUT.lineWidth+ case width of+ Just w -> GLUT.lineWidth $= realToFrac w+ Nothing -> return ()+ glBegin gl_LINE_STRIP let f (xyz, col) = do let V3 x y z = fmap realToFrac xyz@@ -305,6 +316,7 @@ glVertex3f x y z mapM_ f pathcols glEnd+ GLUT.lineWidth $= lineWidth0 GLUT.lighting $= Enabled -- plane@@ -331,10 +343,12 @@ glDisable gl_BLEND let drawWithEps eps' = do- mapM_ drawObject $ concat [[ Line [ V3 (-r) y0 eps'+ mapM_ drawObject $ concat [[ Line Nothing+ [ V3 (-r) y0 eps' , V3 r y0 eps' ] col1- , Line [ V3 x0 (-r) eps',+ , Line Nothing+ [ V3 x0 (-r) eps', V3 x0 r eps' ] col1 ] | x0 <- [-r,-r+r/n..r], y0 <- [-r,-r+r/n..r]]