Cleanup
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
|||||||
All good (607 modules, at 21:11:41)
|
All good (607 modules, at 21:29:51)
|
||||||
|
|||||||
+1
-1
@@ -49,4 +49,4 @@ arcPart startA sw sc endA ew ec r centercol =
|
|||||||
(V2 xa ya) = rotateV startA (V2 r 0)
|
(V2 xa ya) = rotateV startA (V2 r 0)
|
||||||
(V2 xb yb) = rotateV (0.5 * (startA + endA)) (V2 (r * sqrt 2) 0)
|
(V2 xb yb) = rotateV (0.5 * (startA + endA)) (V2 (r * sqrt 2) 0)
|
||||||
(V2 xc yc) = rotateV endA (V2 r 0)
|
(V2 xc yc) = rotateV endA (V2 r 0)
|
||||||
f (pos, col, V3 a b c) = Verx pos col [a, b, c] BottomLayer arcNum
|
f (pos, col, V3 a b c) = Verx pos col [a, b, c] BottomLayer ArcShad
|
||||||
|
|||||||
+5
-5
@@ -73,13 +73,13 @@ polygon :: [Point2] -> Picture
|
|||||||
{-# INLINE polygon #-}
|
{-# INLINE polygon #-}
|
||||||
polygon = map f . polyToTris
|
polygon = map f . polyToTris
|
||||||
where
|
where
|
||||||
f (V2 x y) = Verx (V3 x y 0) black [] BottomLayer polyNum
|
f (V2 x y) = Verx (V3 x y 0) black [] BottomLayer PolyShad
|
||||||
|
|
||||||
polygonCol :: [(Point2, RGBA)] -> Picture
|
polygonCol :: [(Point2, RGBA)] -> Picture
|
||||||
{-# INLINE polygonCol #-}
|
{-# INLINE polygonCol #-}
|
||||||
polygonCol = polyToTris . map f
|
polygonCol = polyToTris . map f
|
||||||
where
|
where
|
||||||
f (V2 x y, col) = Verx (V3 x y 0) col [] BottomLayer polyNum
|
f (V2 x y, col) = Verx (V3 x y 0) col [] BottomLayer PolyShad
|
||||||
|
|
||||||
poly3 :: [Point3] -> Picture
|
poly3 :: [Point3] -> Picture
|
||||||
{-# INLINE poly3 #-}
|
{-# INLINE poly3 #-}
|
||||||
@@ -89,7 +89,7 @@ poly3Col :: [(Point3, RGBA)] -> Picture
|
|||||||
{-# INLINE poly3Col #-}
|
{-# INLINE poly3Col #-}
|
||||||
poly3Col = map f . polyToTris
|
poly3Col = map f . polyToTris
|
||||||
where
|
where
|
||||||
f (pos, col) = Verx pos col [] BottomLayer polyNum
|
f (pos, col) = Verx pos col [] BottomLayer PolyShad
|
||||||
|
|
||||||
---- given a one and two zeros of a linear function over x and y,
|
---- given a one and two zeros of a linear function over x and y,
|
||||||
---- determine the function
|
---- determine the function
|
||||||
@@ -175,7 +175,7 @@ circleSolidCol colC colE r =
|
|||||||
, (V3 r (- r) 0, black)
|
, (V3 r (- r) 0, black)
|
||||||
]
|
]
|
||||||
where
|
where
|
||||||
f (pos, col) = Verx pos col [] BottomLayer ellNum
|
f (pos, col) = Verx pos col [] BottomLayer EllShad
|
||||||
|
|
||||||
circle :: Float -> Picture
|
circle :: Float -> Picture
|
||||||
{-# INLINE circle #-}
|
{-# INLINE circle #-}
|
||||||
@@ -221,7 +221,7 @@ drawText :: Float -> String -> [Verx]
|
|||||||
{-# INLINE drawText #-}
|
{-# INLINE drawText #-}
|
||||||
drawText gap = map f . stringToList gap
|
drawText gap = map f . stringToList gap
|
||||||
where
|
where
|
||||||
f (pos, col, V3 a b c) = Verx pos col [a, b, c, 1] BottomLayer textNum
|
f (pos, col, V3 a b c) = Verx pos col [a, b, c, 1] BottomLayer TextShad
|
||||||
|
|
||||||
line :: [Point2] -> Picture
|
line :: [Point2] -> Picture
|
||||||
{-# INLINE line #-}
|
{-# INLINE line #-}
|
||||||
|
|||||||
+14
-39
@@ -28,9 +28,6 @@ data Layer
|
|||||||
| FixedCoordLayer
|
| FixedCoordLayer
|
||||||
deriving (Eq, Ord, Enum, Bounded, Show, Read) --Generic, Flat)
|
deriving (Eq, Ord, Enum, Bounded, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
layerNum :: Layer -> Int
|
|
||||||
layerNum = fromEnum
|
|
||||||
|
|
||||||
numLayers :: Int
|
numLayers :: Int
|
||||||
numLayers = length [minBound :: Layer .. maxBound]
|
numLayers = length [minBound :: Layer .. maxBound]
|
||||||
|
|
||||||
@@ -44,53 +41,31 @@ data ShadNum
|
|||||||
numShads :: Int
|
numShads :: Int
|
||||||
numShads = length [minBound :: ShadNum .. maxBound]
|
numShads = length [minBound :: ShadNum .. maxBound]
|
||||||
|
|
||||||
_unShadNum :: ShadNum -> Int
|
|
||||||
_unShadNum = fromEnum
|
|
||||||
|
|
||||||
toShadNum :: Int -> ShadNum
|
|
||||||
toShadNum = toEnum
|
|
||||||
|
|
||||||
polyNum, textNum, arcNum, ellNum :: ShadNum
|
|
||||||
{-# INLINE polyNum #-}
|
|
||||||
{-# INLINE textNum #-}
|
|
||||||
{-# INLINE arcNum #-}
|
|
||||||
{-# INLINE ellNum #-}
|
|
||||||
polyNum = toShadNum 0
|
|
||||||
textNum = toShadNum 1
|
|
||||||
arcNum = toShadNum 2
|
|
||||||
ellNum = toShadNum 3
|
|
||||||
|
|
||||||
type Picture = [Verx]
|
type Picture = [Verx]
|
||||||
|
|
||||||
flatV2 :: V2 a -> [a]
|
--flatV2 :: V2 a -> [a]
|
||||||
flatV2 (V2 x y) = [x, y]
|
--{-# INLINE flatV2 #-}
|
||||||
|
--flatV2 (V2 x y) = [x, y]
|
||||||
flatV3 :: V3 a -> [a]
|
--
|
||||||
flatV3 (V3 x y z) = [x, y, z]
|
--flatV3 :: V3 a -> [a]
|
||||||
|
--{-# INLINE flatV3 #-}
|
||||||
flatV4 :: V4 a -> [a]
|
--flatV3 (V3 x y z) = [x, y, z]
|
||||||
flatV4 (V4 x y z w) = [x, y, z, w]
|
--
|
||||||
|
--flatV4 :: V4 a -> [a]
|
||||||
{-# INLINE flatV2 #-}
|
--{-# INLINE flatV4 #-}
|
||||||
|
--flatV4 (V4 x y z w) = [x, y, z, w]
|
||||||
{-# INLINE flatV3 #-}
|
|
||||||
|
|
||||||
{-# INLINE flatV4 #-}
|
|
||||||
|
|
||||||
tflat2 :: (a, a) -> [a]
|
tflat2 :: (a, a) -> [a]
|
||||||
|
{-# INLINE tflat2 #-}
|
||||||
tflat2 (x, y) = [x, y]
|
tflat2 (x, y) = [x, y]
|
||||||
|
|
||||||
tflat3 :: (a, a, a) -> [a]
|
tflat3 :: (a, a, a) -> [a]
|
||||||
|
{-# INLINE tflat3 #-}
|
||||||
tflat3 (x, y, z) = [x, y, z]
|
tflat3 (x, y, z) = [x, y, z]
|
||||||
|
|
||||||
tflat4 :: (a, a, a, a) -> [a]
|
tflat4 :: (a, a, a, a) -> [a]
|
||||||
tflat4 (x, y, z, w) = [x, y, z, w]
|
|
||||||
|
|
||||||
{-# INLINE tflat2 #-}
|
|
||||||
|
|
||||||
{-# INLINE tflat3 #-}
|
|
||||||
|
|
||||||
{-# INLINE tflat4 #-}
|
{-# INLINE tflat4 #-}
|
||||||
|
tflat4 (x, y, z, w) = [x, y, z, w]
|
||||||
|
|
||||||
makeLenses ''Verx
|
makeLenses ''Verx
|
||||||
deriveJSON defaultOptions ''Layer
|
deriveJSON defaultOptions ''Layer
|
||||||
|
|||||||
+1
-1
@@ -46,4 +46,4 @@ arcTest' startA sw sc endA ew ec r centercol =
|
|||||||
(V2 xa ya) = rotateV startA (V2 r 0)
|
(V2 xa ya) = rotateV startA (V2 r 0)
|
||||||
(V2 xb yb) = rotateV (0.5 * (startA + endA)) (V2 (r * sqrt 2) 0)
|
(V2 xb yb) = rotateV (0.5 * (startA + endA)) (V2 (r * sqrt 2) 0)
|
||||||
(V2 xc yc) = rotateV endA (V2 r 0)
|
(V2 xc yc) = rotateV endA (V2 r 0)
|
||||||
f (pos, col, V3 a b c) = Verx pos col [a, b, c] BottomLayer arcNum
|
f (pos, col, V3 a b c) = Verx pos col [a, b, c] BottomLayer ArcShad
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ textGrad :: Color -> Color -> String -> Picture
|
|||||||
{-# INLINE textGrad #-}
|
{-# INLINE textGrad #-}
|
||||||
textGrad topc botc = map f . stringToListGrad topc botc
|
textGrad topc botc = map f . stringToListGrad topc botc
|
||||||
where
|
where
|
||||||
f (pos, col, V2 a b) = Verx pos col [a, b] BottomLayer textNum
|
f (pos, col, V2 a b) = Verx pos col [a, b] BottomLayer TextShad
|
||||||
|
|
||||||
-- no premature optimisation, consider changing to use texture arrays
|
-- no premature optimisation, consider changing to use texture arrays
|
||||||
stringToListGrad :: Color -> Color -> String -> [(Point3, Point4, Point2)]
|
stringToListGrad :: Color -> Color -> String -> [(Point3, Point4, Point2)]
|
||||||
|
|||||||
+1
-1
@@ -124,7 +124,7 @@ polyToPics = map helpPoly3D . _pyFaces
|
|||||||
helpPoly3D :: [(Point3, Point4)] -> Picture
|
helpPoly3D :: [(Point3, Point4)] -> Picture
|
||||||
helpPoly3D = picFormat . map f . polyToTris
|
helpPoly3D = picFormat . map f . polyToTris
|
||||||
where
|
where
|
||||||
f (pos,col) = Verx pos col [] BottomLayer polyNum
|
f (pos,col) = Verx pos col [] BottomLayer PolyShad
|
||||||
|
|
||||||
polysToPic :: [Polyhedra] -> Picture
|
polysToPic :: [Polyhedra] -> Picture
|
||||||
polysToPic = fold . concatMap polyToPics
|
polysToPic = fold . concatMap polyToPics
|
||||||
|
|||||||
+1
-1
@@ -239,7 +239,7 @@ renderLayer layer shads counts = do
|
|||||||
let layerCounts = UMV.slice (ln * numLayers) 6 counts
|
let layerCounts = UMV.slice (ln * numLayers) 6 counts
|
||||||
MV.imapM_ (drawShaderLay ln layerCounts) shads
|
MV.imapM_ (drawShaderLay ln layerCounts) shads
|
||||||
where
|
where
|
||||||
ln = layerNum layer
|
ln = fromEnum layer
|
||||||
|
|
||||||
bindFBO :: FBO -> IO ()
|
bindFBO :: FBO -> IO ()
|
||||||
bindFBO fb =
|
bindFBO fb =
|
||||||
|
|||||||
+3
-3
@@ -45,7 +45,7 @@ pokeVerx vbos offsets Verx{_vxPos = thePos, _vxCol = theCol, _vxExt = ext, _vxSh
|
|||||||
pokeArrayOff thePtr 7 ext
|
pokeArrayOff thePtr 7 ext
|
||||||
UMV.unsafeModify offsets (+ 1) sn
|
UMV.unsafeModify offsets (+ 1) sn
|
||||||
where
|
where
|
||||||
sn = _unShadNum shadnum
|
sn = fromEnum shadnum
|
||||||
|
|
||||||
pokeWallsWindows ::
|
pokeWallsWindows ::
|
||||||
Ptr Float ->
|
Ptr Float ->
|
||||||
@@ -497,10 +497,10 @@ pokeLayVerx vbos counts vx = do
|
|||||||
pokeArrayOff thePtr 7 (_vxExt vx)
|
pokeArrayOff thePtr 7 (_vxExt vx)
|
||||||
UMV.unsafeModify counts (+ 1) vecPos
|
UMV.unsafeModify counts (+ 1) vecPos
|
||||||
where
|
where
|
||||||
sn = _unShadNum shadnum
|
sn = fromEnum shadnum
|
||||||
shadnum = _vxShadNum vx
|
shadnum = _vxShadNum vx
|
||||||
vecPos = theLayer * numLayers + sn
|
vecPos = theLayer * numLayers + sn
|
||||||
theLayer = layerNum $ _vxLayer vx
|
theLayer = fromEnum $ _vxLayer vx
|
||||||
thePos = _vxPos vx
|
thePos = _vxPos vx
|
||||||
theCol = _vxCol vx
|
theCol = _vxCol vx
|
||||||
layOff = theLayer * numSubElements
|
layOff = theLayer * numSubElements
|
||||||
|
|||||||
Reference in New Issue
Block a user