From 70b1db3a51f70bebb834b3e67df610be705d9186 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Fri, 24 May 2019 13:45:37 +0300
Subject: [PATCH] Bounce and remove scene reset

---
 applications/reconstruct/src/main.cpp | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/applications/reconstruct/src/main.cpp b/applications/reconstruct/src/main.cpp
index 615cc1a72..d715e19fa 100644
--- a/applications/reconstruct/src/main.cpp
+++ b/applications/reconstruct/src/main.cpp
@@ -398,17 +398,22 @@ static void run() {
 	float3 *point_array = new float3[rayparams.m_width*rayparams.m_height];
 	uchar3 *colour_array = new uchar3[rayparams.m_width*rayparams.m_height];
 
+	float bounce = 0.0;
+	int bounce_dir = 1;
+
+	net.broadcast("grab");  // To sync cameras
+
 	int active = inputs.size();
 	while (active > 0 && display_merged.active()) {
 		active = 0;
 
-		net.broadcast("grab");  // To sync cameras
+		
 		
 		PointCloud<PointXYZRGB>::Ptr cloud(new PointCloud<PointXYZRGB>);
 
 		// TODO (Nick) Should be able to only partially clear...
 		LOG(INFO) << "RESET";
-		scene.reset();
+		//scene.reset();
 		
 		for (size_t i = 0; i < inputs.size(); i++) {
 			//if (i == 1) continue;
@@ -453,10 +458,14 @@ static void run() {
 		uniform_sampling.setRadiusSearch(0.1f);
 		uniform_sampling.filter(*cloud);*/
 
-		Eigen::Affine3f transform(Eigen::Translation3f(0.0f,0.0f,0.0f));
+		if (bounce_dir > 0) bounce += 0.02f;
+		else bounce -= 0.02f;
+		if (fabs(bounce) > 1.0f) bounce_dir = (bounce_dir > 0) ? -1 : 1;
+
+		Eigen::Affine3f transform(Eigen::Translation3f(bounce,0.0f,0.0f));
 		Eigen::Matrix4f viewPose = transform.matrix();
 
-		viewPose = inputs[0].source->getPose();
+		//viewPose = inputs[0].source->getPose();
 
 		LOG(INFO) << "Render vertex data";
 		rays.render(scene.getHashData(), scene.getHashParams(), inputs[0].gpu, viewPose);
-- 
GitLab