Clean opengl rendering.

This commit is contained in:
James Grogan 2022-11-16 09:39:05 +00:00
parent 4849d83fcf
commit 798cb365d7
19 changed files with 483 additions and 274 deletions

View file

@ -16,16 +16,20 @@ void TriMesh::populate(VecNodes& nodes, VecEdges& edges, VecFaces& faces)
mFaces = std::move(faces);
}
std::vector<std::vector<Point> > TriMesh::getFaceVertices() const
std::vector<unsigned> TriMesh::getFaceNodeIds() const
{
std::vector<std::vector<Point> > verts(mFaces.size());
unsigned nodes_per_face = 3;
std::vector<unsigned> ids(nodes_per_face*mFaces.size());
for(std::size_t idx=0; idx<mFaces.size(); idx++)
{
const auto nodeIds = mFaces[idx]->getNodeIds();
verts[idx] = {mNodes[nodeIds[0]]->getPoint(), mNodes[nodeIds[1]]->getPoint(), mNodes[nodeIds[2]]->getPoint()};
for(std::size_t jdx=0; jdx<nodes_per_face; jdx++)
{
ids[nodes_per_face*idx + jdx] = nodeIds[jdx];
}
}
return verts;
return ids;
}
std::vector<std::vector<double> > TriMesh::getFaceVectorAttributes(const std::string& tag)
@ -45,3 +49,34 @@ void TriMesh::addConstantFaceVectorAttribute(const std::string& tag, const std::
face->addVectorAttribute(tag, values);
}
}
void TriMesh::addConstantNodeVectorAttribute(const std::string& tag, const std::vector<double>& values)
{
}
std::vector<std::vector<double> > TriMesh::getNodeVectorAttributes(const std::string& tag)
{
std::vector<std::vector<double> > attribs(mNodes.size());
return attribs;
}
void TriMesh::addVectorAttribute(const std::string& tag, const std::vector<double>& values)
{
mVectorAttributes[tag] = values;
}
bool TriMesh::hasVectorAttribute(const std::string& tag) const
{
return mVectorAttributes.find(tag) != mVectorAttributes.end();
}
std::vector<double> TriMesh::getVectorAttribute(const std::string& tag) const
{
auto iter = mVectorAttributes.find(tag);
if (iter != mVectorAttributes.end())
{
return iter->second;
}
return {};
}