Initial plotting support.

This commit is contained in:
jmsgrogan 2023-01-24 17:15:25 +00:00
parent df450a7be0
commit c2027801be
34 changed files with 756 additions and 20 deletions

View file

@ -0,0 +1,53 @@
#include "PolygonNode.h"
#include "Polygon.h"
#include "SceneInfo.h"
#include "SceneModel.h"
PolygonNode::PolygonNode(const Transform& t)
: GeometryNode(t)
{
}
PolygonNode::~PolygonNode()
{
}
PolygonNode::Type PolygonNode::getType()
{
return Type::Polygon;
}
void PolygonNode::setPoints(const std::vector<Point>& points)
{
mPoints = points;
mGeometryIsDirty = true;
}
void PolygonNode::createOrUpdateGeometry(SceneInfo* sceneInfo)
{
if (!mBackgroundItem)
{
if (sceneInfo->mSupportsGeometryPrimitives)
{
auto polygon = std::make_unique<ntk::Polygon>(mPoints);
mBackgroundItem = std::make_unique<SceneModel>(std::move(polygon));
}
else
{
//auto mesh = MeshPrimitives::buildRectangleAsTriMesh();
//mBackgroundItem = std::make_unique<SceneModel>(std::move(mesh));
}
mBackgroundItem->setName(mName + "_Model");
}
else
{
if (sceneInfo->mSupportsGeometryPrimitives)
{
auto polygon = std::make_unique<ntk::Polygon>(mPoints);
mBackgroundItem->updateGeometry(std::move(polygon));
}
}
}