Remove dedicated line shader
This commit is contained in:
@@ -21,10 +21,8 @@ data RenderType
|
|||||||
| RenderBezQ [(Point3,Point4,Point4)]
|
| RenderBezQ [(Point3,Point4,Point4)]
|
||||||
| RenderText [(Point3,Point4,Point2)]
|
| RenderText [(Point3,Point4,Point2)]
|
||||||
| RenderArc [(Point3,Point4,Point3)]
|
| RenderArc [(Point3,Point4,Point3)]
|
||||||
| RenderLine [(Point3,Point4)]
|
|
||||||
| RenderEllipse [(Point3,Point4)]
|
| RenderEllipse [(Point3,Point4)]
|
||||||
| Render3 [Point3]
|
| Render3 [Point3]
|
||||||
| RenderConst
|
|
||||||
| Render1111 {_unRender1111 :: (Float,Float,Float,Float)}
|
| Render1111 {_unRender1111 :: (Float,Float,Float,Float)}
|
||||||
| Render22 {_unRender22 :: (Point2,Point2)}
|
| Render22 {_unRender22 :: (Point2,Point2)}
|
||||||
| Render2221 {_unRender2221 :: (Point2,Point2,Point2,Float)}
|
| Render2221 {_unRender2221 :: (Point2,Point2,Point2,Float)}
|
||||||
@@ -99,8 +97,6 @@ data Picture
|
|||||||
| Poly3D [(Point3,RGBA)]
|
| Poly3D [(Point3,RGBA)]
|
||||||
| Circle RGBA RGBA Float
|
| Circle RGBA RGBA Float
|
||||||
| ThickArc Float Float Float Float
|
| ThickArc Float Float Float Float
|
||||||
| Line [Point2]
|
|
||||||
| LineCol [(Point2,RGBA)]
|
|
||||||
| Pictures [Picture]
|
| Pictures [Picture]
|
||||||
| OverPic (Point3 -> Point3) (Point4 -> Point4) Picture
|
| OverPic (Point3 -> Point3) (Point4 -> Point4) Picture
|
||||||
| OnLayer Int Picture
|
| OnLayer Int Picture
|
||||||
|
|||||||
@@ -52,11 +52,6 @@ picToLTree _ (ThickArc startA endA rad wdth) = LLeaf $ RenderArc
|
|||||||
(xa,ya) = rotateV startA (rad,0)
|
(xa,ya) = rotateV startA (rad,0)
|
||||||
(xb,yb) = rotateV (0.5 * (startA + endA)) (rad * sqrt 2,0)
|
(xb,yb) = rotateV (0.5 * (startA + endA)) (rad * sqrt 2,0)
|
||||||
(xc,yc) = rotateV endA (rad,0)
|
(xc,yc) = rotateV endA (rad,0)
|
||||||
picToLTree _ (Line ps)
|
|
||||||
= LLeaf $ RenderLine $ zip (map zeroZ $ doubleLine ps) $ repeat white
|
|
||||||
picToLTree _ (LineCol vs)
|
|
||||||
= LLeaf $ RenderLine $ zip (map zeroZ $ doubleLine ps) $ doubleLine cs
|
|
||||||
where (ps,cs) = unzip vs
|
|
||||||
picToLTree _ (Text s) = LLeaf $ RenderText $ stringToList s
|
picToLTree _ (Text s) = LLeaf $ RenderText $ stringToList s
|
||||||
picToLTree _ Blank = LBranches []
|
picToLTree _ Blank = LBranches []
|
||||||
picToLTree j (Pictures pics) = LBranches $ map (picToLTree j) pics
|
picToLTree j (Pictures pics) = LBranches $ map (picToLTree j) pics
|
||||||
@@ -135,11 +130,6 @@ picToRenderType (ThickArc startA endA rad wdth) = RenderArc
|
|||||||
(xa,ya) = rotateV startA (rad,0)
|
(xa,ya) = rotateV startA (rad,0)
|
||||||
(xb,yb) = rotateV (0.5 * (startA + endA)) (rad * sqrt 2,0)
|
(xb,yb) = rotateV (0.5 * (startA + endA)) (rad * sqrt 2,0)
|
||||||
(xc,yc) = rotateV endA (rad,0)
|
(xc,yc) = rotateV endA (rad,0)
|
||||||
picToRenderType (Line ps)
|
|
||||||
= RenderLine $ zip (map zeroZ $ doubleLine ps) $ repeat white
|
|
||||||
picToRenderType (LineCol vs)
|
|
||||||
= RenderLine $ zip (map zeroZ $ doubleLine ps) $ doubleLine cs
|
|
||||||
where (ps,cs) = unzip vs
|
|
||||||
picToRenderType (Text s) = RenderText $ stringToList s
|
picToRenderType (Text s) = RenderText $ stringToList s
|
||||||
picToRenderType _ = error "Tried to make a render type from a tree picture"
|
picToRenderType _ = error "Tried to make a render type from a tree picture"
|
||||||
--
|
--
|
||||||
@@ -151,12 +141,6 @@ picToRenderType _ = error "Tried to make a render type from a tree picture"
|
|||||||
--picToAlternative _ Blank = empty
|
--picToAlternative _ Blank = empty
|
||||||
--picToAlternative j (Pictures pics) = undefined
|
--picToAlternative j (Pictures pics) = undefined
|
||||||
|
|
||||||
|
|
||||||
doubleLine :: [a] -> [a]
|
|
||||||
{-# INLINE doubleLine #-}
|
|
||||||
doubleLine (x:y:xs) = concat $ zipWith (:) (init (x:y:xs)) $ map (: []) (y:xs)
|
|
||||||
doubleLine _ = []
|
|
||||||
|
|
||||||
white, black :: Color
|
white, black :: Color
|
||||||
white = (1,1,1,1)
|
white = (1,1,1,1)
|
||||||
black = (0,0,0,1)
|
black = (0,0,0,1)
|
||||||
@@ -164,7 +148,6 @@ black = (0,0,0,1)
|
|||||||
overPos :: (Point3 -> Point3) -> RenderType -> RenderType
|
overPos :: (Point3 -> Point3) -> RenderType -> RenderType
|
||||||
--{-# INLINE overPos #-}
|
--{-# INLINE overPos #-}
|
||||||
overPos f (RenderPoly vs) = RenderPoly $ map (first f) vs
|
overPos f (RenderPoly vs) = RenderPoly $ map (first f) vs
|
||||||
overPos f (RenderLine vs) = RenderLine $ map (first f) vs
|
|
||||||
overPos f (RenderText vs) = RenderText $ map (\(a,b,c) -> (f a,b,c)) vs
|
overPos f (RenderText vs) = RenderText $ map (\(a,b,c) -> (f a,b,c)) vs
|
||||||
overPos f (RenderBezQ vs) = RenderBezQ $ map (\(a,b,c) -> (f a,b,c)) vs
|
overPos f (RenderBezQ vs) = RenderBezQ $ map (\(a,b,c) -> (f a,b,c)) vs
|
||||||
overPos f (RenderEllipse vs) = RenderEllipse $ map (first f) vs
|
overPos f (RenderEllipse vs) = RenderEllipse $ map (first f) vs
|
||||||
@@ -175,7 +158,6 @@ overPos _ _ = undefined
|
|||||||
overCol :: (Point4 -> Point4) -> RenderType -> RenderType
|
overCol :: (Point4 -> Point4) -> RenderType -> RenderType
|
||||||
--{-# INLINE overCol #-}
|
--{-# INLINE overCol #-}
|
||||||
overCol f (RenderPoly vs) = RenderPoly $ map (second f) vs
|
overCol f (RenderPoly vs) = RenderPoly $ map (second f) vs
|
||||||
overCol f (RenderLine vs) = RenderLine $ map (second f) vs
|
|
||||||
overCol f (RenderEllipse vs) = RenderEllipse $ map (second f) vs
|
overCol f (RenderEllipse vs) = RenderEllipse $ map (second f) vs
|
||||||
overCol f (RenderText vs) = RenderText $ map (\(a,b,c) -> (a,f b,c)) vs
|
overCol f (RenderText vs) = RenderText $ map (\(a,b,c) -> (a,f b,c)) vs
|
||||||
overCol f (RenderBezQ vs) = RenderBezQ $ map (\(a,b,c) -> (a,f b,c)) vs
|
overCol f (RenderBezQ vs) = RenderBezQ $ map (\(a,b,c) -> (a,f b,c)) vs
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ preloadRender = do
|
|||||||
>>= addUniforms ["lightPos"]
|
>>= addUniforms ["lightPos"]
|
||||||
-- 2D draw shaders
|
-- 2D draw shaders
|
||||||
bslist <- makeShader "twoD/basic" [vert,frag] [3,4] ETriangles pokeTriStrat
|
bslist <- makeShader "twoD/basic" [vert,frag] [3,4] ETriangles pokeTriStrat
|
||||||
lslist <- makeShader "twoD/basic" [vert,frag] [3,4] ELines pokeLineStrat
|
|
||||||
aslist <- makeShader "twoD/arc" [vert,frag] [3,4,3] ETriangles pokeArcStrat
|
aslist <- makeShader "twoD/arc" [vert,frag] [3,4,3] ETriangles pokeArcStrat
|
||||||
eslist <- makeShader "twoD/ellipse" [vert,geom,frag] [3,4] ETriangles pokeEllStrat
|
eslist <- makeShader "twoD/ellipse" [vert,geom,frag] [3,4] ETriangles pokeEllStrat
|
||||||
bezierQuadShader <- makeShader "twoD/bezierQuad" [vert,frag] [3,4,4] ETriangleStrip pokeBezQStrat
|
bezierQuadShader <- makeShader "twoD/bezierQuad" [vert,frag] [3,4,4] ETriangleStrip pokeBezQStrat
|
||||||
@@ -118,7 +117,7 @@ preloadRender = do
|
|||||||
|
|
||||||
return $ RenderData
|
return $ RenderData
|
||||||
{ _pictureShaders =
|
{ _pictureShaders =
|
||||||
[bslist,lslist,cslist,aslist,eslist,bezierQuadShader,basicTweakZShad]
|
[bslist,cslist,aslist,eslist,bezierQuadShader,basicTweakZShad]
|
||||||
, _lightingSurfaceShader = lightingSurfaceShad
|
, _lightingSurfaceShader = lightingSurfaceShad
|
||||||
, _lightingLineShadowShader = lightingLineShadowShad
|
, _lightingLineShadowShader = lightingLineShadowShad
|
||||||
, _lightingOccludeShader = wsShad {_shaderVAO = wpVAO}
|
, _lightingOccludeShader = wsShad {_shaderVAO = wpVAO}
|
||||||
@@ -223,7 +222,7 @@ pokeTriTweakZ (RenderPolyZ vs) = fmap (\(p,co,z) -> flat3 p ++ [z] ++ flat4 co)
|
|||||||
pokeTriTweakZ _ = []
|
pokeTriTweakZ _ = []
|
||||||
|
|
||||||
{-# INLINE pokeTriStrat #-}
|
{-# INLINE pokeTriStrat #-}
|
||||||
pokeTriStrat,pokeCharStrat,pokeArcStrat,pokeLineStrat,pokeEllStrat :: RenderType -> [[Float]]
|
pokeTriStrat,pokeCharStrat,pokeArcStrat,pokeEllStrat :: RenderType -> [[Float]]
|
||||||
pokeTriStrat (RenderPoly vs) = fmap (\(p,co) -> flat3 p ++ flat4 co) vs
|
pokeTriStrat (RenderPoly vs) = fmap (\(p,co) -> flat3 p ++ flat4 co) vs
|
||||||
pokeTriStrat _ = []
|
pokeTriStrat _ = []
|
||||||
|
|
||||||
@@ -233,9 +232,6 @@ pokeCharStrat _ = []
|
|||||||
pokeArcStrat (RenderArc vs) = fmap (\(a,b,c) -> concat [flat3 a, flat4 b, flat3 c]) vs
|
pokeArcStrat (RenderArc vs) = fmap (\(a,b,c) -> concat [flat3 a, flat4 b, flat3 c]) vs
|
||||||
pokeArcStrat _ = []
|
pokeArcStrat _ = []
|
||||||
|
|
||||||
pokeLineStrat (RenderLine vs) = fmap (\((x,y,z),(r,g,b,a)) -> [x,y,z,r,g,b,a]) vs
|
|
||||||
pokeLineStrat _ = []
|
|
||||||
|
|
||||||
pokeEllStrat (RenderEllipse vs) = fmap (\((x,y,z),(r,g,b,a)) -> [x,y,z,r,g,b,a]) vs
|
pokeEllStrat (RenderEllipse vs) = fmap (\((x,y,z),(r,g,b,a)) -> [x,y,z,r,g,b,a]) vs
|
||||||
pokeEllStrat _ = []
|
pokeEllStrat _ = []
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user