diff options
author | Joe Crayne <joe@jerkface.net> | 2019-05-26 00:59:50 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-05-26 00:59:50 -0400 |
commit | 8e735080a3f45a90f9952f1ff883260b1230fdf1 (patch) | |
tree | 3749f150caf6f3e1822a252e6c173aa9bd7e80a5 | |
parent | 1595a9ea3ca1080ebf7d060ea28aecf19df8f968 (diff) |
Render curve points as line strips rather than points.
-rw-r--r-- | MeshSketch.hs | 2 | ||||
-rw-r--r-- | PointPrimitiveRing.hs | 3 | ||||
-rw-r--r-- | hello_obj2.lc | 6 |
3 files changed, 6 insertions, 5 deletions
diff --git a/MeshSketch.hs b/MeshSketch.hs index 6475d27..d598bbd 100644 --- a/MeshSketch.hs +++ b/MeshSketch.hs | |||
@@ -330,7 +330,7 @@ new = do | |||
330 | "uvw" @: Attribute_V3F | 330 | "uvw" @: Attribute_V3F |
331 | defObjectArray "plane" Triangles $ do | 331 | defObjectArray "plane" Triangles $ do |
332 | "position" @: Attribute_V4F | 332 | "position" @: Attribute_V4F |
333 | defObjectArray "Points" Points $ do | 333 | defObjectArray "Points" Lines $ do |
334 | "position" @: Attribute_V3F | 334 | "position" @: Attribute_V3F |
335 | "color" @: Attribute_V3F | 335 | "color" @: Attribute_V3F |
336 | defUniforms $ do | 336 | defUniforms $ do |
diff --git a/PointPrimitiveRing.hs b/PointPrimitiveRing.hs index 54405e4..d4fafae 100644 --- a/PointPrimitiveRing.hs +++ b/PointPrimitiveRing.hs | |||
@@ -54,7 +54,8 @@ newRing storage sz toAttr = fix $ \retProxy -> do | |||
54 | sizeRef <- newIORef 0 | 54 | sizeRef <- newIORef 0 |
55 | let ps = fieldParameters paramProxy toAttr | 55 | let ps = fieldParameters paramProxy toAttr |
56 | putStrLn $ "Ring params: " ++ show ps | 56 | putStrLn $ "Ring params: " ++ show ps |
57 | gd <- uploadDynamicBuffer sz ps | 57 | gd0 <- uploadDynamicBuffer sz ps |
58 | let gd = gd0 { dPrimitive = LineStrip } | ||
58 | Just keys <- return $ lookupAttrKeys (lookupAttributeKey gd . toAttr) | 59 | Just keys <- return $ lookupAttrKeys (lookupAttributeKey gd . toAttr) |
59 | obj <- addToObjectArray storage "Points" [] gd | 60 | obj <- addToObjectArray storage "Points" [] gd |
60 | readIORef (objCommands obj) >>= mapM_ print | 61 | readIORef (objCommands obj) >>= mapM_ print |
diff --git a/hello_obj2.lc b/hello_obj2.lc index 7b3d4a2..b68a04d 100644 --- a/hello_obj2.lc +++ b/hello_obj2.lc | |||
@@ -19,7 +19,7 @@ makeFrame (cubemap :: TextureCube) | |||
19 | (texture :: Texture) | 19 | (texture :: Texture) |
20 | (prims :: PrimitiveStream Triangle (Vec 4 Float, Vec 3 Float, Vec 3 Float)) | 20 | (prims :: PrimitiveStream Triangle (Vec 4 Float, Vec 3 Float, Vec 3 Float)) |
21 | (plane :: PrimitiveStream Triangle ((Vec 4 Float))) | 21 | (plane :: PrimitiveStream Triangle ((Vec 4 Float))) |
22 | (points :: PrimitiveStream Point (Vec 3 Float, Vec 3 Float)) | 22 | (points :: PrimitiveStream Line (Vec 3 Float, Vec 3 Float)) |
23 | (plane_mat :: Mat 4 4 Float) | 23 | (plane_mat :: Mat 4 4 Float) |
24 | 24 | ||
25 | = imageFrame (emptyDepthImage 1, emptyColorImage (V4 0 0 0.4 1)) | 25 | = imageFrame (emptyDepthImage 1, emptyColorImage (V4 0 0 0.4 1)) |
@@ -59,12 +59,12 @@ makeFrame (cubemap :: TextureCube) | |||
59 | 59 | ||
60 | renderPoints :: | 60 | renderPoints :: |
61 | Mat 4 4 Float | 61 | Mat 4 4 Float |
62 | -> PrimitiveStream Point (Vec 4 Float, Vec 4 Float) | 62 | -> PrimitiveStream Line (Vec 4 Float, Vec 4 Float) |
63 | -> ( (FragmentOperation Depth, FragmentOperation (Color (VecScalar 4 Float))) | 63 | -> ( (FragmentOperation Depth, FragmentOperation (Color (VecScalar 4 Float))) |
64 | , FragmentStream 1 ((Vec 4 Float)) ) | 64 | , FragmentStream 1 ((Vec 4 Float)) ) |
65 | renderPoints cam points = | 65 | renderPoints cam points = |
66 | points | 66 | points |
67 | & rasterizePrimitives (PointCtx (PointSize 5.0) 1.0 LowerLeft) ((Flat)) | 67 | & rasterizePrimitives (LineCtx 1.0 LastVertex) ((Flat)) |
68 | & mapFragments (\((c)) -> ((c))) | 68 | & mapFragments (\((c)) -> ((c))) |
69 | & accumulateWith (DepthOp Less True, ColorOp NoBlending (V4 True True True True)) | 69 | & accumulateWith (DepthOp Less True, ColorOp NoBlending (V4 True True True True)) |
70 | 70 | ||