Clean project structure.
This commit is contained in:
parent
78a4fa99ff
commit
947bf937fd
496 changed files with 206 additions and 137 deletions
75
src/rendering/mesh/AbstractMesh.cpp
Normal file
75
src/rendering/mesh/AbstractMesh.cpp
Normal file
|
@ -0,0 +1,75 @@
|
|||
#include "AbstractMesh.h"
|
||||
|
||||
void AbstractMesh::addConstantNodeVectorAttribute(const std::string& tag, const std::vector<double>& values)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::vector<std::vector<double> > AbstractMesh::getNodeVectorAttributes(const std::string& tag)
|
||||
{
|
||||
std::vector<std::vector<double> > attribs(mNodes.size());
|
||||
return attribs;
|
||||
}
|
||||
|
||||
void AbstractMesh::addVectorAttribute(const std::string& tag, const std::vector<double>& values)
|
||||
{
|
||||
mVectorAttributes[tag] = values;
|
||||
}
|
||||
|
||||
bool AbstractMesh::hasVectorAttribute(const std::string& tag) const
|
||||
{
|
||||
return mVectorAttributes.find(tag) != mVectorAttributes.end();
|
||||
}
|
||||
|
||||
unsigned AbstractMesh::getNumNodes() const
|
||||
{
|
||||
return unsigned(mNodes.size());
|
||||
}
|
||||
|
||||
const VecNodes& AbstractMesh::getNodes() const
|
||||
{
|
||||
return mNodes;
|
||||
}
|
||||
|
||||
std::vector<double> AbstractMesh::getVectorAttribute(const std::string& tag) const
|
||||
{
|
||||
auto iter = mVectorAttributes.find(tag);
|
||||
if (iter != mVectorAttributes.end())
|
||||
{
|
||||
return iter->second;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
void AbstractMesh::scale(double scaleX, double scaleY)
|
||||
{
|
||||
Transform transform({ 0.0, 0.0 }, scaleX, scaleY);
|
||||
|
||||
for (auto& node : mNodes)
|
||||
{
|
||||
node->apply(transform);
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractMesh::transform(const Transform& transform)
|
||||
{
|
||||
for (auto& node : mNodes)
|
||||
{
|
||||
node->apply(transform);
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractMesh::translate(double offsetX, double offsetY, double offsetZ)
|
||||
{
|
||||
const Point loc {-offsetX, -offsetY, -offsetZ};
|
||||
Transform transform(loc);
|
||||
for (auto& node : mNodes)
|
||||
{
|
||||
node->apply(transform);
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractMesh::translate(const Point& offset)
|
||||
{
|
||||
translate(offset.getX(), offset.getY(), offset.getZ());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue