fixed cylinder rendering

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 1393
f0fe7ea82b81
child 1395
23551de3da36

fixed cylinder rendering

src/lddocument.cpp file | annotate | diff | comparison | revisions
src/linetypes/cylinder.cpp file | annotate | diff | comparison | revisions
src/linetypes/cylinder.h file | annotate | diff | comparison | revisions
--- a/src/lddocument.cpp	Thu Jun 07 23:24:02 2018 +0300
+++ b/src/lddocument.cpp	Fri Jun 08 23:06:56 2018 +0300
@@ -531,7 +531,7 @@
 				{
 					// Got another sub-file reference, recurse and inline it too if we're deep-inlining.
 					// If not, just add it into the objects normally.
-					if (deep and object->type() == LDObjectType::SubfileReference)
+					if (deep and object->isRasterizable())
 					{
 						LDSubfileReference* reference = static_cast<LDSubfileReference*>(object);
 						reference->rasterize(
--- a/src/linetypes/cylinder.cpp	Thu Jun 07 23:24:02 2018 +0300
+++ b/src/linetypes/cylinder.cpp	Fri Jun 08 23:06:56 2018 +0300
@@ -77,8 +77,9 @@
 QVector<LDPolygon> LDCylinder::rasterizePolygons(DocumentManager* context, Winding winding)
 {
 	Model cylinderBody {context};
-	buildPrimitiveBody(cylinderBody, winding);
+	buildPrimitiveBody(cylinderBody);
 	QVector<LDPolygon> result;
+	bool cachedShouldInvert = shouldInvert(winding, context);
 
 	for (LDObject* object : cylinderBody.objects())
 	{
@@ -93,7 +94,7 @@
 
 		if (polygon)
 		{
-			if (shouldInvert(winding, context))
+			if (cachedShouldInvert)
 				invertPolygon(*polygon);
 
 			result.append(*polygon);
@@ -105,14 +106,14 @@
 	return result;
 }
 
-void LDCylinder::buildPrimitiveBody(Model& model, Winding winding) const
+void LDCylinder::buildPrimitiveBody(Model& model) const
 {
 	PrimitiveModel primitive;
 	primitive.type = PrimitiveModel::Cylinder;
 	primitive.segments = m_segments;
 	primitive.divisions = m_divisions;
 	primitive.ringNumber = 0;
-	primitive.generateCylinder(model, winding);
+	primitive.generateCylinder(model);
 }
 
 QString LDCylinder::objectListText() const
--- a/src/linetypes/cylinder.h	Thu Jun 07 23:24:02 2018 +0300
+++ b/src/linetypes/cylinder.h	Fri Jun 08 23:06:56 2018 +0300
@@ -32,7 +32,7 @@
 
 private:
 	QString buildFilename() const;
-	void buildPrimitiveBody(Model& model, Winding winding = CounterClockwise) const;
+	void buildPrimitiveBody(Model& model) const;
 
 	int m_segments;
 	int m_divisions;

mercurial