diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/app/cycles_standalone.cpp | 49 | ||||
-rw-r--r-- | intern/cycles/util/util_view.cpp | 18 |
2 files changed, 53 insertions, 14 deletions
diff --git a/intern/cycles/app/cycles_standalone.cpp b/intern/cycles/app/cycles_standalone.cpp index 3ec92a2aa00..fdee92a5eb0 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 361a7bc95f2..3af75b6e76a 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); } |