From 4caea0f8c5729e2e73a248f150a521ac77b7708e Mon Sep 17 00:00:00 2001
From: "Garcia-Hernandez, Ruben Jesus (rgarcia)" <garcia@lrz.de>
Date: Thu, 21 Sep 2017 12:02:13 +0200
Subject: [PATCH] Add showcontrollers option (default: do not show controllers)
 Fix atomcolour option

---
 NOMADVRLib/ConfigFile.cpp                   | 6 +++++-
 NOMADVRLib/ConfigFile.h                     | 1 +
 OpenVR/TimestepData/hellovr_opengl.vcxproj  | 7 ++++---
 OpenVR/TimestepData/hellovr_opengl_main.cpp | 9 ++++++---
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/NOMADVRLib/ConfigFile.cpp b/NOMADVRLib/ConfigFile.cpp
index aa7d86c..6397616 100644
--- a/NOMADVRLib/ConfigFile.cpp
+++ b/NOMADVRLib/ConfigFile.cpp
@@ -47,6 +47,7 @@ Solid *solid;
 bool saveStereo;
 int screenshotdownscaling;
 bool hapticFeedback;
+bool showcontrollers;
 
 //markers such as hole positions and electron positions
 float ** markers;
@@ -178,6 +179,7 @@ int loadConfigFile(const char * f)
 	saveStereo=false;
 	screenshotdownscaling=1;
 	hapticFeedback=false;
+	showcontrollers=false;
 	//
 	FILE *F = fopen(f, "r");
 	if (F == 0)
@@ -452,7 +454,7 @@ int loadConfigFile(const char * f)
 		} else if (!strcmp (s, "atomcolour")) {
 			char atom [100];
 			float rgb[3];
-			r = fscanf(F, "%s %f", atom, rgb, rgb + 1, rgb + 2);
+			r = fscanf(F, "%s %f %f %f", atom, rgb, rgb + 1, rgb + 2);
 			if (r!=4) {
 				eprintf ("Error loading atom colour");
 				return -19;
@@ -478,6 +480,8 @@ int loadConfigFile(const char * f)
 			hapticFeedback=true;
 		} else if (!strcmp (s, "supercell")) {
 			r=fscanf (F, "%f %f %f", supercell, supercell+1, supercell+2);
+		} else if (!strcmp (s, "showcontrollers")) { 
+			showcontrollers=true;
 		} else if (!strcmp (s, "\x0d")) { //discard windows newline (problem in Sebastian Kokott's phone (?!)
 			continue;
 		} else {
diff --git a/NOMADVRLib/ConfigFile.h b/NOMADVRLib/ConfigFile.h
index cf3dae0..42b45cd 100644
--- a/NOMADVRLib/ConfigFile.h
+++ b/NOMADVRLib/ConfigFile.h
@@ -43,6 +43,7 @@ extern bool saveStereo;
 extern int screenshotdownscaling;
 
 extern bool hapticFeedback;
+extern bool showcontrollers;
 
 //markers such as hole positions and electron positions
 extern float ** markers;
diff --git a/OpenVR/TimestepData/hellovr_opengl.vcxproj b/OpenVR/TimestepData/hellovr_opengl.vcxproj
index 378024c..0eaf776 100644
--- a/OpenVR/TimestepData/hellovr_opengl.vcxproj
+++ b/OpenVR/TimestepData/hellovr_opengl.vcxproj
@@ -23,6 +23,7 @@
     <Keyword>Win32Proj</Keyword>
     <RootNamespace>hellovr_opengl</RootNamespace>
     <ProjectName>NOMADViveT</ProjectName>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -49,7 +50,7 @@
     <UseDebugLibraries>false</UseDebugLibraries>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
-    <PlatformToolset>v120</PlatformToolset>
+    <PlatformToolset>v110</PlatformToolset>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
@@ -110,7 +111,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG;_WINDOWS;INDICESGL32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>..;../../headers;../thirdparty/glew/glew-1.11.0/include;../thirdparty/sdl2-2.0.3/include;Y:\v2t\software\rapidjson\include;Y:\v2t\software\curl\include;Y:\v2t\software\openvr\openvr-0.9.19\samples\TimestepData</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..;../../headers;../thirdparty/glew/glew-1.11.0/include;../thirdparty/sdl2-2.0.3/include;Y:\software\rapidjson\include;Y:\software\curl\include;Y:\software\openvr\openvr-0.9.19\samples\TimestepData</AdditionalIncludeDirectories>
       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
       <EnablePREfast>false</EnablePREfast>
     </ClCompile>
@@ -154,7 +155,7 @@
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;INDICESGL32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <AdditionalIncludeDirectories>..;../../headers;../thirdparty/glew/glew-1.11.0/include;..\thirdparty\sdl2-2.0.3\include;Y:\v2t\software\rapidjson\include;Y:\v2t\software\openvr\openvr-0.9.19\samples\TimestepData</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..;../../headers;../thirdparty/glew/glew-1.11.0/include;..\thirdparty\sdl2-2.0.3\include;Y:\software\rapidjson\include;Y:\software\openvr\openvr-0.9.19\samples\TimestepData;Y:\v2t\software\rapidjson\include;Y:\v2t\software\openvr\openvr-0.9.19\samples\TimestepData</AdditionalIncludeDirectories>
       <EnablePREfast>false</EnablePREfast>
     </ClCompile>
     <Link>
diff --git a/OpenVR/TimestepData/hellovr_opengl_main.cpp b/OpenVR/TimestepData/hellovr_opengl_main.cpp
index 87bc051..38cba01 100644
--- a/OpenVR/TimestepData/hellovr_opengl_main.cpp
+++ b/OpenVR/TimestepData/hellovr_opengl_main.cpp
@@ -2350,7 +2350,8 @@ void CMainApplication::RenderScene(vr::Hmd_Eye nEye)
 	if (ISOS==0) {
 		RenderAtoms(nEye);
 		RenderUnitCell(nEye);
-		RenderAllTrackedRenderModels(nEye);
+		if (showcontrollers)
+			RenderAllTrackedRenderModels(nEye);
 		return;
 	}
 
@@ -2386,7 +2387,8 @@ void CMainApplication::RenderScene(vr::Hmd_Eye nEye)
 					RenderAtoms(nEye);
 					RenderUnitCell(nEye);
 				}
-				RenderAllTrackedRenderModels(nEye);
+				if (showcontrollers)
+					RenderAllTrackedRenderModels(nEye);
 			} // for zl
 
 			glBindFramebuffer(GL_FRAMEBUFFER, dfb);
@@ -2481,7 +2483,8 @@ void CMainApplication::RenderScene(vr::Hmd_Eye nEye)
 			glBindTexture(GL_TEXTURE_2D, 0);
 			glUseProgram(m_unSceneProgramID);
 			PaintGrid(nEye, currentiso);
-			RenderAllTrackedRenderModels(nEye);
+			if (showcontrollers)
+				RenderAllTrackedRenderModels(nEye);
 		} //else currentiso =isos
 
 
-- 
GitLab