Initial plotting support.
This commit is contained in:
parent
df450a7be0
commit
c2027801be
34 changed files with 756 additions and 20 deletions
53
src/rendering/visual_elements/basic_shapes/PolygonNode.cpp
Normal file
53
src/rendering/visual_elements/basic_shapes/PolygonNode.cpp
Normal 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));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue