src/gl/partrenderer.cpp

changeset 333
07e65a4c6611
parent 329
6d75fa09cc0c
child 338
719b909a7d2b
--- a/src/gl/partrenderer.cpp	Mon Jul 04 15:37:22 2022 +0300
+++ b/src/gl/partrenderer.cpp	Mon Jul 04 19:53:13 2022 +0300
@@ -50,10 +50,7 @@
 	surfaceFormat.setSamples(8);
 	this->setFormat(surfaceFormat);
 	const auto setNeedBuild = [&]{this->needBuild = true;};
-	connect(model, &Model::rowsInserted, setNeedBuild);
-	connect(model, &Model::rowsRemoved, setNeedBuild);
-	connect(model, &Model::dataChanged, setNeedBuild);
-	connect(model, &Model::modelReset, setNeedBuild);
+	connect(model, &QTextDocument::contentsChange, setNeedBuild);
 	const auto updateLayerMvpMatrix = [this]{
 		const glm::mat4 newMvpMatrix = this->projectionMatrix * this->viewMatrix * this->modelMatrix;
 		for (RenderLayer* layer : this->activeRenderLayers) {
@@ -82,7 +79,7 @@
 	for (RenderLayer* layer : this->inactiveRenderLayers) {
 		layer->initializeGL();
 	}
-	connect(this->model, &Model::dataChanged, this, &PartRenderer::build);
+	connect(this->model, &QTextDocument::contentsChanged, this, &PartRenderer::build);
 	this->initialized = true;
 	this->modelQuaternion = glm::angleAxis(glm::radians(30.0f), glm::vec3{-1, 0, 0});
 	this->modelQuaternion *= glm::angleAxis(glm::radians(225.0f), glm::vec3{-0, 1, 0});
@@ -437,7 +434,7 @@
 		viewportVector);
 }
 
-ElementId PartRenderer::pick(QPoint where)
+int32_t PartRenderer::pick(QPoint where)
 {
 	// y is flipped, take that into account
 	where.setY(this->height() - where.y());
@@ -494,11 +491,13 @@
 	return this->highlighted;
 }
 
-void PartRenderer::setSelection(const QSet<ElementId>& selection)
+void PartRenderer::setSelection(const QSet<int32_t>& selection)
 {
+#if 0
 	Q_ASSERT(not selection.contains({0}));
 	gl::setModelShaderSelectedObjects(&this->shaders, selection);
 	this->update();
+#endif
 }
 
 glm::vec3 PartRenderer::cameraVector(const QPointF& point) const

mercurial