From c202bb167e6d59503f54644c35ea4be2038998db Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Sun, 1 Nov 2020 14:54:06 +0200
Subject: [PATCH] Disable MLS smooth of render by default

---
 components/renderers/cpp/src/CUDARender.cpp | 39 +++++++++++++--------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/components/renderers/cpp/src/CUDARender.cpp b/components/renderers/cpp/src/CUDARender.cpp
index d4f7cb451..c573d23b1 100644
--- a/components/renderers/cpp/src/CUDARender.cpp
+++ b/components/renderers/cpp/src/CUDARender.cpp
@@ -407,22 +407,31 @@ void CUDARender::_mesh(ftl::rgbd::Frame &out, const Eigen::Matrix4d &t, cudaStre
 		value("normal_radius", 1), value("normal_smoothing", 0.02f),
 		params_.camera, pose_.getFloat3x3(), poseInverse_.getFloat3x3(), stream_);*/
 
-	ftl::cuda::normals(
-		//temp_.createTexture<half4>(Channel::Normals),
-		out.createTexture<half4>(_getNormalsChannel()),
-		out.getTexture<float>(_getDepthChannel()),
-		params_.camera, stream_);
+	float mls_smoothing = value("mls_smooth", 0.01f);
+	int mls_radius = value("mls_radius", 0);
 
-	/*ftl::cuda::mls_smooth(
-		temp_.createTexture<half4>(Channel::Normals),
-		out.createTexture<half4>(_getNormalsChannel()),
-		out.getTexture<float>(_getDepthChannel()),
-		//out.getTexture<float>(_getDepthChannel()),
-		value("mls_smooth", 0.01f),
-		value("mls_radius", 2),
-		params_.camera,
-		stream_
-	);*/
+	if (mls_radius == 0) {
+		ftl::cuda::normals(
+			out.createTexture<half4>(_getNormalsChannel()),
+			out.getTexture<float>(_getDepthChannel()),
+			params_.camera, stream_);
+	} else {
+		ftl::cuda::normals(
+			temp_.createTexture<half4>(Channel::Normals),
+			out.getTexture<float>(_getDepthChannel()),
+			params_.camera, stream_);
+
+		ftl::cuda::mls_smooth(
+			temp_.createTexture<half4>(Channel::Normals),
+			out.createTexture<half4>(_getNormalsChannel()),
+			out.getTexture<float>(_getDepthChannel()),
+			//out.getTexture<float>(_getDepthChannel()),
+			value("mls_smooth", 0.01f),
+			value("mls_radius", 2),
+			params_.camera,
+			stream_
+		);
+	}
 
 	ftl::cuda::transform_normals(
 		out.createTexture<half4>(_getNormalsChannel()),
-- 
GitLab