From c685e4b9bd0bee07f9e7812f495a66f970d3daba Mon Sep 17 00:00:00 2001 From: parker Date: Mon, 4 Aug 2025 12:16:19 +0100 Subject: [PATCH] feat: render split lines --- src/Gui/Viewport/GLMesh.cpp | 38 +++++++++++++++++++++++--------- src/Gui/Viewport/GLMesh.h | 6 +++-- src/OpDefs/GopGeometryImport.cpp | 2 +- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/Gui/Viewport/GLMesh.cpp b/src/Gui/Viewport/GLMesh.cpp index 46a9d61..b4d147f 100644 --- a/src/Gui/Viewport/GLMesh.cpp +++ b/src/Gui/Viewport/GLMesh.cpp @@ -50,8 +50,9 @@ void GLMesh::initBuffers() glEnableVertexAttribArray(0); glEnableVertexAttribArray(1); - glGenBuffers(1, &indexBuffer); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer); + glGenBuffers(1, &faceIndexBuffer); + glGenBuffers(1, &lineIndexBuffer); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, faceIndexBuffer); } @@ -119,8 +120,8 @@ void GLMesh::setPosBuffer(enzo::geo::Geometry& geometry) void GLMesh::setIndexBuffer(std::vector pointIndices, std::vector primVertexCounts) { bind(); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer); - indexData.clear(); + faceIndexData.clear(); + lineIndexData.clear(); unsigned int startVert = 0; @@ -130,18 +131,31 @@ void GLMesh::setIndexBuffer(std::vector pointIndices, std::vector prim int primVertexCount = primVertexCounts[primNum]; - for(size_t i=1; i=3) { - indexData.push_back(startVert); - indexData.push_back(startVert+i); - indexData.push_back(startVert+i+1); + for(size_t i=1; i vertexPosData; std::vector vertices; - std::vector indexData; + std::vector faceIndexData; + std::vector lineIndexData; void init(); void initBuffers(); diff --git a/src/OpDefs/GopGeometryImport.cpp b/src/OpDefs/GopGeometryImport.cpp index 9e539d2..fadf756 100644 --- a/src/OpDefs/GopGeometryImport.cpp +++ b/src/OpDefs/GopGeometryImport.cpp @@ -78,7 +78,7 @@ void GopGeometryImport::cookOp(enzo::op::Context context) const bt::Vector3 pointPos = {std::stod(result[1]), std::stod(result[2]), std::stod(result[3])}; PAttrHandle.addValue(pointPos); } - else if(firstChar=='f') + else if(firstChar=='f' || firstChar=='l') { std::vector result; boost::split(result, line, isspace);