Commit 7fc35974 authored by Jan Möbius's avatar Jan Möbius

Merge branch 'MeshNode_EdgesColored' into 'master'

fix edges_colored drawmode for for meshes

drawmode was rendered with empty vertex declaration

See merge request !51
parents 5a1bda81 f0de14c2
Pipeline #672 passed with stage
......@@ -2430,11 +2430,11 @@ void ACG::DrawMeshT<Mesh>::updateEdgeHalfedgeVertexDeclarations()
{
vertexDeclEdgeCol_->clear();
vertexDeclEdgeCol_->addElement(GL_FLOAT, 3, VERTEX_USAGE_POSITION, perEdgeVertexBuffer());
vertexDeclEdgeCol_->addElement(GL_UNSIGNED_BYTE, 4, VERTEX_USAGE_COLOR, perEdgeColorBuffer());
vertexDeclEdgeCol_->addElement(GL_FLOAT, 4, VERTEX_USAGE_COLOR, perEdgeColorBuffer());
vertexDeclHalfedgeCol_->clear();
vertexDeclHalfedgeCol_->addElement(GL_FLOAT, 3, VERTEX_USAGE_POSITION, perHalfedgeVertexBuffer());
vertexDeclHalfedgeCol_->addElement(GL_UNSIGNED_BYTE, 4, VERTEX_USAGE_COLOR, perHalfedgeColorBuffer());
vertexDeclHalfedgeCol_->addElement(GL_FLOAT, 4, VERTEX_USAGE_COLOR, perHalfedgeColorBuffer());
vertexDeclHalfedgePos_->clear();
vertexDeclHalfedgePos_->addElement(GL_FLOAT, 3, VERTEX_USAGE_POSITION, perHalfedgeVertexBuffer());
......
......@@ -834,6 +834,7 @@ void ACG::SceneGraph::MeshNodeT<Mesh>::getRenderObjects( IRenderer* _renderer, G
ro.shaderDesc.vertexColors = true;
// note: colored edges are in sysmem, so they are directly bound to the VertexDeclaration
drawMesh_->updateEdgeHalfedgeVertexDeclarations();
ro.vertexDecl = drawMesh_->getEdgeColoredVertexDeclaration();
ro.glDrawArrays(GL_LINES, 0, int(mesh_.n_edges() * 2));
......@@ -855,6 +856,7 @@ void ACG::SceneGraph::MeshNodeT<Mesh>::getRenderObjects( IRenderer* _renderer, G
ro.shaderDesc.shadeMode = SG_SHADE_UNLIT;
// buffers in system memory
drawMesh_->updateEdgeHalfedgeVertexDeclarations();
if (props->colored())
ro.vertexDecl = drawMesh_->getHalfedgeVertexDeclaration();
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment