From c3d112e52e8930603140cd44061c0ebebd8b4350 Mon Sep 17 00:00:00 2001 From: justin Date: Tue, 1 Oct 2024 00:16:46 +0100 Subject: [PATCH] Commit before attempting to remove bottom and mid picture layers --- ghcidOutput | 12 +++++++++++- src/Dodge/Item/Draw/SPic.hs | 8 ++++++-- src/Dodge/Render.hs | 4 ++-- src/Picture/Arc.hs | 2 +- src/Picture/Base.hs | 10 +++++----- src/Picture/Test.hs | 2 +- src/Picture/Text.hs | 2 +- src/Polyhedra.hs | 2 +- 8 files changed, 28 insertions(+), 14 deletions(-) diff --git a/ghcidOutput b/ghcidOutput index 4b8b1e9bf..6e700010e 100644 --- a/ghcidOutput +++ b/ghcidOutput @@ -1,4 +1,14 @@ -/home/justin/Haskell/loop/src/Dodge/Item/Grammar.hs:12:1-20: warning: [-Wunused-imports] +/home/justin/Haskell/loop/src/Dodge/Item/Draw/SPic.hs:69:5-6: warning: [-Wunused-local-binds] + Defined but not used: ‘am’ + | +69 | am = fractionLoadedAmmo (it ^?! itUse . amagLoadStatus) + | ^^ +/home/justin/Haskell/loop/src/Dodge/Item/Draw/SPic.hs:75:1-19: warning: [-Wunused-top-binds] + Defined but not used: ‘fractionLoadedAmmo2’ + | +75 | fractionLoadedAmmo2 rs = + | ^^^^^^^^^^^^^^^^^^^ +/home/justin/Haskell/loop/src/Dodge/Item/Grammar.hs:12:1: warning: [-Wunused-imports] The import of ‘Geometry.Data’ is redundant | 12 | import Geometry.Data diff --git a/src/Dodge/Item/Draw/SPic.hs b/src/Dodge/Item/Draw/SPic.hs index 1c085c38b..2de48f163 100644 --- a/src/Dodge/Item/Draw/SPic.hs +++ b/src/Dodge/Item/Draw/SPic.hs @@ -59,13 +59,17 @@ ammoMagSPic it = \case TINMAG -> noPic $ upperPrismPolyTS 1 (reverse $ rectNSWE 0 (- y) (-1) 1) DRUMMAG -> noPic $ upperPrismPolyTS 1 (reverse $ rectNSWE 0 (- y) (-1) 1) CHEMFUELPOUCH -> (colorSH yellow (upperPrismPolyST 3 $ polyCirc 3 5) - , setLayer MidLayer . color black $ translate3 (V3 0 0 4) $ circleSolid (5 * am) + , mempty +-- , setLayer MidLayer . color black $ translate3 (V3 0 0 4) $ circleSolid (5 * am) ) _ -> noPic $ upperPrismPolyTS 1 (reverse $ rectNSWE 0 (- y) (-1) 1) where y = fromIntegral y' * 0.3 y' = fromMaybe 0 $ it ^? itUse . amagLoadStatus . iaLoaded - am = fractionLoadedAmmo2 (it ^?! itUse . amagLoadStatus) + am = fractionLoadedAmmo (it ^?! itUse . amagLoadStatus) + +fractionLoadedAmmo :: ReloadStatus -> Float +fractionLoadedAmmo rs = fromIntegral (_iaLoaded rs) / fromIntegral (_iaMax rs) fractionLoadedAmmo2 :: ReloadStatus -> Float fractionLoadedAmmo2 rs = diff --git a/src/Dodge/Render.hs b/src/Dodge/Render.hs index 3ada68203..5d7e5f95a 100644 --- a/src/Dodge/Render.hs +++ b/src/Dodge/Render.hs @@ -162,7 +162,7 @@ doDrawing' win pdata u = do 0 (fromIntegral trueNWalls) --draw object pictures onto base buffer (are there any?!) - renderLayer BottomLayer shadV layerCounts +-- renderLayer BottomLayer shadV layerCounts --draw object shapes onto base buffer let fs = _shapeShader pdata glUseProgram (_shaderUINT fs) @@ -251,7 +251,7 @@ doDrawing' win pdata u = do GL_COLOR 0 ptr - renderLayer MidLayer shadV layerCounts +-- renderLayer MidLayer shadV layerCounts glUseProgram (pdata ^. cloudShader . shaderUINT) glBindVertexArray $ pdata ^. cloudShader . shaderVAO . vaoName glDrawElements diff --git a/src/Picture/Arc.hs b/src/Picture/Arc.hs index 408611b99..aefc772b1 100644 --- a/src/Picture/Arc.hs +++ b/src/Picture/Arc.hs @@ -49,4 +49,4 @@ arcPart startA sw sc endA ew ec r centercol = (V2 xa ya) = rotateV startA (V2 r 0) (V2 xb yb) = rotateV (0.5 * (startA + endA)) (V2 (r * sqrt 2) 0) (V2 xc yc) = rotateV endA (V2 r 0) - f (pos, col, V3 a b c) = Verx pos col [a, b, c] BottomLayer ArcShad + f (pos, col, V3 a b c) = Verx pos col [a, b, c] minBound ArcShad diff --git a/src/Picture/Base.hs b/src/Picture/Base.hs index a833688c6..e42b3b30e 100644 --- a/src/Picture/Base.hs +++ b/src/Picture/Base.hs @@ -73,13 +73,13 @@ polygon :: [Point2] -> Picture {-# INLINE polygon #-} polygon = map f . polyToTris where - f (V2 x y) = Verx (V3 x y 0) black [] BottomLayer PolyShad + f (V2 x y) = Verx (V3 x y 0) black [] minBound PolyShad polygonCol :: [(Point2, RGBA)] -> Picture {-# INLINE polygonCol #-} polygonCol = polyToTris . map f where - f (V2 x y, col) = Verx (V3 x y 0) col [] BottomLayer PolyShad + f (V2 x y, col) = Verx (V3 x y 0) col [] minBound PolyShad poly3 :: [Point3] -> Picture {-# INLINE poly3 #-} @@ -89,7 +89,7 @@ poly3Col :: [(Point3, RGBA)] -> Picture {-# INLINE poly3Col #-} poly3Col = map f . polyToTris where - f (pos, col) = Verx pos col [] BottomLayer PolyShad + f (pos, col) = Verx pos col [] minBound PolyShad ---- given a one and two zeros of a linear function over x and y, ---- determine the function @@ -175,7 +175,7 @@ circleSolidCol colC colE r = , (V3 r (- r) 0, black) ] where - f (pos, col) = Verx pos col [] BottomLayer EllShad + f (pos, col) = Verx pos col [] minBound EllShad circle :: Float -> Picture {-# INLINE circle #-} @@ -221,7 +221,7 @@ drawText :: Float -> String -> [Verx] {-# INLINE drawText #-} drawText gap = map f . stringToList gap where - f (pos, col, V3 a b c) = Verx pos col [a, b, c, 1] BottomLayer TextShad + f (pos, col, V3 a b c) = Verx pos col [a, b, c, 1] minBound TextShad line :: [Point2] -> Picture {-# INLINE line #-} diff --git a/src/Picture/Test.hs b/src/Picture/Test.hs index a90da3a37..7e0b8d1d7 100644 --- a/src/Picture/Test.hs +++ b/src/Picture/Test.hs @@ -46,4 +46,4 @@ arcTest' startA sw sc endA ew ec r centercol = (V2 xa ya) = rotateV startA (V2 r 0) (V2 xb yb) = rotateV (0.5 * (startA + endA)) (V2 (r * sqrt 2) 0) (V2 xc yc) = rotateV endA (V2 r 0) - f (pos, col, V3 a b c) = Verx pos col [a, b, c] BottomLayer ArcShad + f (pos, col, V3 a b c) = Verx pos col [a, b, c] minBound ArcShad diff --git a/src/Picture/Text.hs b/src/Picture/Text.hs index dc9f54e2d..41de81ffd 100644 --- a/src/Picture/Text.hs +++ b/src/Picture/Text.hs @@ -6,7 +6,7 @@ textGrad :: Color -> Color -> String -> Picture {-# INLINE textGrad #-} textGrad topc botc = map f . stringToListGrad topc botc where - f (pos, col, V2 a b) = Verx pos col [a, b] BottomLayer TextShad + f (pos, col, V2 a b) = Verx pos col [a, b] minBound TextShad -- no premature optimisation, consider changing to use texture arrays stringToListGrad :: Color -> Color -> String -> [(Point3, Point4, Point2)] diff --git a/src/Polyhedra.hs b/src/Polyhedra.hs index 52d954fd4..8d7ecbd0f 100644 --- a/src/Polyhedra.hs +++ b/src/Polyhedra.hs @@ -124,7 +124,7 @@ polyToPics = map helpPoly3D . _pyFaces helpPoly3D :: [(Point3, Point4)] -> Picture helpPoly3D = picFormat . map f . polyToTris where - f (pos,col) = Verx pos col [] BottomLayer PolyShad + f (pos,col) = Verx pos col [] minBound PolyShad polysToPic :: [Polyhedra] -> Picture polysToPic = fold . concatMap polyToPics