42 lines
No EOL
752 B
C++
42 lines
No EOL
752 B
C++
#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<Point2>& points)
|
|
{
|
|
mPoints = points;
|
|
mGeometryIsDirty = true;
|
|
}
|
|
|
|
void PolygonNode::createOrUpdateGeometry(SceneInfo* sceneInfo)
|
|
{
|
|
auto polygon = std::make_unique<Polygon2>(mPoints);
|
|
|
|
if (!mBackgroundItem)
|
|
{
|
|
mBackgroundItem = std::make_unique<SceneModel>(std::move(polygon));
|
|
mBackgroundItem->setName(mName + "_Model");
|
|
}
|
|
else
|
|
{
|
|
mBackgroundItem->updateGeometry(std::move(polygon));
|
|
}
|
|
} |