[Bf-blender-cvs] [8a1f323] master: Cycles Standalone: Add more controls and options

Thomas Dinges noreply at git.blender.org
Fri Feb 14 21:41:47 CET 2014


Commit: 8a1f3238be98b99216dd7b57d814f3c7c2c1a696
Author: Thomas Dinges
Date:   Fri Feb 14 21:40:51 2014 +0100
https://developer.blender.org/rB8a1f3238be98b99216dd7b57d814f3c7c2c1a696

Cycles Standalone: Add more controls and options

* P key, pauses the render
* W/A/S/D for camera movement

===================================================================

M	intern/cycles/app/cycles_standalone.cpp
M	intern/cycles/util/util_view.cpp

===================================================================

diff --git a/intern/cycles/app/cycles_standalone.cpp b/intern/cycles/app/cycles_standalone.cpp
index 3ec92a2..fdee92a 100644
--- a/intern/cycles/app/cycles_standalone.cpp
+++ b/intern/cycles/app/cycles_standalone.cpp
@@ -46,7 +46,8 @@ struct Options {
 	int width, height;
 	SceneParams scene_params;
 	SessionParams session_params;
-	bool quiet, show_help, interactive;
+	bool quiet;
+	bool show_help, interactive, pause;
 } options;
 
 static void session_print(const string& str)
@@ -240,14 +241,50 @@ static void resize(int width, int height)
 
 static void keyboard(unsigned char key)
 {
-	if(key == 'r')
-		options.session->reset(session_buffer_params(), options.session_params.samples);
-	else if(key == 'h')
+	/* Toggle help */
+	if(key == 'h')
 		options.show_help = !(options.show_help);
-	else if(key == 'i')
-		options.interactive = !(options.interactive);
+
+	/* Reset */
+	else if(key == 'r')
+		options.session->reset(session_buffer_params(), options.session_params.samples);
+
+	/* Cancel */
 	else if(key == 27) // escape
 		options.session->progress.set_cancel("Canceled");
+
+	/* Pause */
+	else if(key == 'p') {
+		options.pause = !options.pause;
+		options.session->set_pause(options.pause);
+	}
+
+	/* Interactive Mode */
+	else if(key == 'i')
+		options.interactive = !(options.interactive);
+
+	else if(options.interactive && (key == 'w' || key == 'a' || key == 's' || key == 'd')) {
+		Transform matrix = options.session->scene->camera->matrix;
+		float3 translate;
+
+		if(key == 'w')
+			translate = make_float3(0.0f, 0.0f, 0.1f);
+		else if(key == 's')
+			translate = make_float3(0.0f, 0.0f, -0.1f);
+		else if(key == 'a')
+			translate = make_float3(-0.1f, 0.0f, 0.0f);
+		else if(key == 'd')
+			translate = make_float3(0.1f, 0.0f, 0.0f);
+
+		matrix = matrix * transform_translate(translate);
+
+		/* Update and Reset */
+		options.session->scene->camera->matrix = matrix;
+		options.session->scene->camera->need_update = true;
+		options.session->scene->camera->need_device_update = true;
+
+		options.session->reset(session_buffer_params(), options.session_params.samples);
+	}
 }
 #endif
 
diff --git a/intern/cycles/util/util_view.cpp b/intern/cycles/util/util_view.cpp
index 361a7bc..3af75b6 100644
--- a/intern/cycles/util/util_view.cpp
+++ b/intern/cycles/util/util_view.cpp
@@ -100,14 +100,16 @@ void view_display_help()
 	view_display_text(x1+20, y2-20, "Cycles Renderer");
 	view_display_text(x1+20, y2-40, "(C) 2011-2014 Blender Foundation");
 	view_display_text(x1+20, y2-80, "Controls:");
-	view_display_text(x1+20, y2-100, "h:  Show/Hide this help message");
-	view_display_text(x1+20, y2-120, "r:  Restart the render");
-	view_display_text(x1+20, y2-140, "q:  Quit the program");
-	view_display_text(x1+20, y2-160, "esc:  Cancel the render");
-
-	view_display_text(x1+20, y2-190, "Interactive Mode (i-key):");
-	view_display_text(x1+20, y2-210, "LMB:  Move camera");
-	view_display_text(x1+20, y2-230, "RMB:  Rotate camera");
+	view_display_text(x1+20, y2-100, "h:  Info/Help");
+	view_display_text(x1+20, y2-120, "r:  Reset");
+	view_display_text(x1+20, y2-140, "p:  Pause");
+	view_display_text(x1+20, y2-160, "esc:  Cancel");
+	view_display_text(x1+20, y2-180, "q:  Quit program");
+
+	view_display_text(x1+20, y2-210, "i:  Interactive mode");
+	view_display_text(x1+20, y2-230, "Left mouse:  Move camera");
+	view_display_text(x1+20, y2-250, "Right mouse:  Rotate camera");
+	view_display_text(x1+20, y2-270, "W/A/S/D:  Move camera");
 
 	glColor3f(1.0f, 1.0f, 1.0f);
 }




More information about the Bf-blender-cvs mailing list