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

@ -2,11 +2,13 @@
#include "AbstractMesh.h"
#include "Point.h"
#include "Node.h"
#include <vector>
#include <memory>
#include <string>
#include <unordered_map>
class Node;
class Edge;
class TriFace;
@ -27,13 +29,38 @@ public:
void populate(VecNodes& nodes, VecEdges& edges, VecFaces& faces);
std::vector<std::vector<Point> > getFaceVertices() const;
template<typename T>
std::vector<T> getVerticesFlat(T scaleX = 1.0, T scaleY = 1.0, T scaleZ = 1.0) const
{
std::vector<T> ret(3*mNodes.size());
for(std::size_t idx = 0; idx<mNodes.size(); idx++)
{
auto node = mNodes[idx].get();
ret[3*idx] = node->getPoint().getX()/scaleX;
ret[3*idx + 1] = node->getPoint().getY()/scaleY;
ret[3*idx + 2] = node->getPoint().getZ()/scaleZ;
}
return ret;
}
std::vector<unsigned> getFaceNodeIds() const;
void addConstantFaceVectorAttribute(const std::string& tag, const std::vector<double>& values);
void addConstantNodeVectorAttribute(const std::string& tag, const std::vector<double>& values);
std::vector<std::vector<double> > getFaceVectorAttributes(const std::string& tag);
std::vector<std::vector<double> > getNodeVectorAttributes(const std::string& tag);
void addVectorAttribute(const std::string& tag, const std::vector<double>& values);
bool hasVectorAttribute(const std::string& tag) const;
std::vector<double> getVectorAttribute(const std::string& tag) const;
private:
std::unordered_map<std::string, std::vector<double> > mVectorAttributes;
VecNodes mNodes;
VecEdges mEdges;
VecFaces mFaces;