src/gl/partrenderer.cpp

changeset 46
98645c8e7704
parent 45
272c84c7c87e
child 47
cd6704009eb9
--- a/src/gl/partrenderer.cpp	Sun Feb 02 00:58:59 2020 +0200
+++ b/src/gl/partrenderer.cpp	Thu Feb 06 20:33:05 2020 +0200
@@ -92,7 +92,7 @@
 	glEnable (GL_DEPTH_TEST);
 	glShadeModel (GL_SMOOTH);
 	glEnable (GL_MULTISAMPLE);
-	if (this->renderPreferences.lineAntiAliasing)
+	if (this->renderPreferences.lineAntiAliasing && this->renderPreferences.style != gl::RenderStyle::PickScene)
 	{
 		glEnable(GL_LINE_SMOOTH);
 		glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
@@ -106,11 +106,20 @@
 void PartRenderer::renderScene()
 {
 	const QColor& backgroundColor = this->renderPreferences.backgroundColor;
-	glClearColor(
-		static_cast<float>(backgroundColor.redF()),
-		static_cast<float>(backgroundColor.greenF()),
-		static_cast<float>(backgroundColor.blueF()),
-		1.0f);
+	if (this->renderPreferences.style != gl::RenderStyle::PickScene)
+	{
+		glClearColor(
+			static_cast<float>(backgroundColor.redF()),
+			static_cast<float>(backgroundColor.greenF()),
+			static_cast<float>(backgroundColor.blueF()),
+			1.0f);
+		this->compiler->setUniform("useLighting", true);
+	}
+	else
+	{
+		glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
+		this->compiler->setUniform("useLighting", false);
+	}
 	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 	glEnable(GL_DEPTH_TEST);
 	glEnable(GL_POLYGON_OFFSET_FILL);
@@ -139,6 +148,11 @@
 		this->setFragmentStyle(gl::FragmentStyle::RandomColors);
 		this->renderAllArrays();
 		break;
+	case gl::RenderStyle::PickScene:
+		glLineWidth(3.0f);
+		this->setFragmentStyle(gl::FragmentStyle::Id);
+		this->renderAllArrays();
+		break;
 	case gl::RenderStyle::Wireframe:
 		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
 		this->setFragmentStyle(gl::FragmentStyle::Normal);

mercurial