src/inputvertices.h

Sat, 08 Apr 2023 12:55:11 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Sat, 08 Apr 2023 12:55:11 +0300
changeset 343
4a82990affd5
parent 322
a39f454a3d7f
permissions
-rw-r--r--

Fix BFC formatting not working due to being evaluated after comment format

#pragma once
#include "src/basics.h"

class InputVertices
{
	std::vector<glm::vec3> polygon = {origin};
	std::size_t numpoints = 1;
public:
	bool currentPointOnExistingPoint() const;
	std::size_t calcNumPoints() const;
	void updateCurrentPoint(const glm::vec3& p);
	void removeLastPoint();
	void finishCurrentPoint();
	void clear();
	const glm::vec3& operator[](std::size_t i) const
	{
		return this->polygon[i];
	}
	std::size_t bufferSize() const
	{
		return this->polygon.size();
	}
	std::size_t polygonSize() const
	{
		return this->numpoints;
	}
	auto begin() const
	{
		return std::begin(this->polygon);
	}
	auto end() const
	{
		return std::end(this->polygon);
	}
	auto polygonEnd() const
	{
		return std::begin(this->polygon) + static_cast<long int>(this->numpoints);
	}
};

mercurial