Skip to content

Add support for meshes of line and triangle-fan types #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/LambdaCube/GL/Mesh.hs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ uploadMeshToGPU mesh@(Mesh attrs mPrim) = do
vBuf <- compileBuffer [meshAttrToArray a | a <- Map.elems attrs]
(indices,prim) <- case mPrim of
P_Points -> return (Nothing,PointList)
P_Lines -> return (Nothing,LineList)
P_LineStrip -> return (Nothing,LineStrip)
P_LineLoop -> return (Nothing,LineLoop)
P_TriangleStrip -> return (Nothing,TriangleStrip)
P_TriangleFan -> return (Nothing,TriangleFan)
P_Triangles -> return (Nothing,TriangleList)
P_TriangleStripI v -> (,TriangleStrip) <$> mkIndexBuf v
P_TrianglesI v -> (,TriangleList) <$> mkIndexBuf v
Expand Down
1 change: 1 addition & 0 deletions src/LambdaCube/GL/Type.hs
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ data Primitive
| TriangleFan
| LineStrip
| LineList
| LineLoop
| PointList
| TriangleStripAdjacency
| TriangleListAdjacency
Expand Down
2 changes: 2 additions & 0 deletions src/LambdaCube/GL/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ primitiveToFetchPrimitive prim = case prim of
TriangleFan -> Triangles
LineStrip -> Lines
LineList -> Lines
LineLoop -> Lines
PointList -> Points
TriangleStripAdjacency -> TrianglesAdjacency
TriangleListAdjacency -> TrianglesAdjacency
Expand All @@ -708,6 +709,7 @@ primitiveToGLType p = case p of
TriangleFan -> GL_TRIANGLE_FAN
LineStrip -> GL_LINE_STRIP
LineList -> GL_LINES
LineLoop -> GL_LINE_LOOP
PointList -> GL_POINTS
TriangleStripAdjacency -> GL_TRIANGLE_STRIP_ADJACENCY
TriangleListAdjacency -> GL_TRIANGLES_ADJACENCY
Expand Down