src/linetypes/cylinder.h

Fri, 08 Jun 2018 23:06:56 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Fri, 08 Jun 2018 23:06:56 +0300
changeset 1394
8d9d0532b3df
parent 1391
5fa4bf1fc781
permissions
-rw-r--r--

fixed cylinder rendering

#pragma once
#include "modelobject.h"

class LDCylinder : public LDMatrixObject
{
public:
	static const LDObjectType SubclassType = LDObjectType::Cylinder;

	LDCylinder() = default;
	LDCylinder(int segments, int divisions, const Matrix& transformationMatrix, const Vertex& position);

	virtual LDObjectType type() const override
	{
		return SubclassType;
	}

	virtual QString asText() const override;
	virtual void getVertices(DocumentManager *context, QSet<Vertex>& verts) const override;
	bool isRasterizable() const override { return true; }
	void rasterize(
		DocumentManager* context,
		Winding parentWinding,
		Model& model,
		bool deep,
		bool render
	) override;
	QVector<LDPolygon> rasterizePolygons(DocumentManager* context, Winding parentWinding) override;
	QString objectListText() const override;
	int triangleCount(DocumentManager*) const override { return 2 * m_segments; }
	QString typeName() const override { return "cylinder"; }
	void serialize(class Serializer& serializer) override;

private:
	QString buildFilename() const;
	void buildPrimitiveBody(Model& model) const;

	int m_segments;
	int m_divisions;
};

mercurial