Improve bezier curve rendering
This commit is contained in:
+2
-2
@@ -22,7 +22,7 @@ import Data.Traversable
|
||||
|
||||
data RenderType
|
||||
= RenderPoly [(Point3,Point4)]
|
||||
| RenderBezQ [(Point3,Point4,Float)]
|
||||
| RenderBezQ [(Point3,Point4,Point3)]
|
||||
| RenderText [(Point3,Point4,Point3)]
|
||||
| RenderArc (Point3,Point4,Point4)
|
||||
| RenderLine [(Point3,Point4)]
|
||||
@@ -75,7 +75,7 @@ data Picture
|
||||
= Blank
|
||||
| Text Int String
|
||||
| Polygon Int [Point2]
|
||||
| BezierQuad Int [(Point2,RGBA,Float)]
|
||||
| BezierQuad Int [(Point2,RGBA,Point2,Float)]
|
||||
| PolygonCol Int [(Point2,RGBA)]
|
||||
| Circle Int RGBA RGBA Float
|
||||
| ThickArc Int Float Float Float Float
|
||||
|
||||
@@ -50,7 +50,7 @@ preloadRender = do
|
||||
"data/texture/charMap.png"
|
||||
|
||||
bezierQuadShader
|
||||
<- makeShader "bezierQuad" [vert,geom,frag] [(0,3),(1,4),(2,1)] Triangles pokeBezQStrat
|
||||
<- makeShader "bezierQuad" [vert,geom,frag] [(0,3),(1,4),(2,3)] Triangles pokeBezQStrat
|
||||
|
||||
--the following vbo is set up to contain one fixed vertex
|
||||
dummyvbo <- genObjectName
|
||||
@@ -84,7 +84,7 @@ cleanUpRenderPreload pd = do
|
||||
|
||||
{-# INLINE pokeBezQStrat #-}
|
||||
pokeBezQStrat :: RenderType -> [[[Float]]]
|
||||
pokeBezQStrat (RenderBezQ vs) = fmap (\((x,y,z),(r,g,b,a),s) -> [[x,y,z],[r,g,b,a],[s]]) vs
|
||||
pokeBezQStrat (RenderBezQ vs) = fmap (\((x,y,z),(r,g,b,a),(s,t,v)) -> [[x,y,z],[r,g,b,a],[s,t,v]]) vs
|
||||
pokeBezQStrat _ = []
|
||||
|
||||
{-# INLINE pokeTriStrat #-}
|
||||
|
||||
+2
-1
@@ -19,7 +19,8 @@ picToLTree mx (PolygonCol i vs)
|
||||
where (ps,cs) = unzip vs
|
||||
picToLTree mx (BezierQuad i vs)
|
||||
= filtB mx i $ LLeaf $ RenderBezQ $ zip3 (map zeroZ ps) cols rs
|
||||
where (ps,cols,rs) = unzip3 vs
|
||||
where (ps,cols,offps,rads) = unzip4 vs
|
||||
rs = zipWith (\(x,y) z -> (x,y,z)) offps rads
|
||||
|
||||
picToLTree mx (Circle i colC colE r)
|
||||
= filtB mx i $ LLeaf $ RenderEllipse [( (-r, r,0), colC)
|
||||
|
||||
Reference in New Issue
Block a user