Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Dinges <blender@dingto.org>2014-01-24 15:57:19 +0400
committerThomas Dinges <blender@dingto.org>2014-01-24 15:59:15 +0400
commit544b7e6be42cda0f07fb83590a089a516bd6cfec (patch)
tree8a3fe1ca417c9ed04231cc67ea034d326789c38e
parent456dc16e4a191c4cf101e62a22bf91046ed07e06 (diff)
Cycles Standalone: Add a help message, which appears when pressing the "h" key.
This is very basic for now, but can be extended with more info (available devices for example) later. Thanks to Bastien and Sergey for some help with the glRect coordinates stuff.
-rw-r--r--intern/cycles/app/cycles_standalone.cpp7
-rw-r--r--intern/cycles/util/util_view.cpp29
-rw-r--r--intern/cycles/util/util_view.h1
3 files changed, 36 insertions, 1 deletions
diff --git a/intern/cycles/app/cycles_standalone.cpp b/intern/cycles/app/cycles_standalone.cpp
index 6b201017c46..0993b0d4f55 100644
--- a/intern/cycles/app/cycles_standalone.cpp
+++ b/intern/cycles/app/cycles_standalone.cpp
@@ -45,7 +45,7 @@ struct Options {
int width, height;
SceneParams scene_params;
SessionParams session_params;
- bool quiet;
+ bool quiet, show_help;
} options;
static void session_print(const string& str)
@@ -167,6 +167,9 @@ static void display_info(Progress& progress)
latency, sample, total_time, sample_time, status.c_str());
view_display_info(str.c_str());
+
+ if(options.show_help)
+ view_display_help();
}
static void display()
@@ -189,6 +192,8 @@ static void keyboard(unsigned char key)
{
if(key == 'r')
options.session->reset(session_buffer_params(), options.session_params.samples);
+ else if(key == 'h')
+ options.show_help = !(options.show_help);
else if(key == 27) // escape
options.session->progress.set_cancel("Canceled");
}
diff --git a/intern/cycles/util/util_view.cpp b/intern/cycles/util/util_view.cpp
index 27c8d51149a..1e8db0086f5 100644
--- a/intern/cycles/util/util_view.cpp
+++ b/intern/cycles/util/util_view.cpp
@@ -74,6 +74,35 @@ void view_display_info(const char *info)
glColor3f(1.0f, 1.0f, 1.0f);
}
+void view_display_help()
+{
+ const int w = V.width / 1.15;
+ const int h = V.height / 1.15;
+
+ const int x1 = (V.width - w) / 2;
+ const int x2 = x1 + w;
+
+ const int y1 = (V.height - h) / 2;
+ const int y2 = y1 + h;
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glColor4f(0.4f, 0.4f, 0.4f, 0.8f);
+ glRectf(x1, y1, x2, y2);
+ glDisable(GL_BLEND);
+
+ glColor3f(0.8f, 0.8f, 0.8f);
+
+ 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, "Help:");
+ view_display_text(x1+20, y2-100, "h: Toggle 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");
+
+ glColor3f(1.0f, 1.0f, 1.0f);
+}
+
static void view_display()
{
if(V.first_display) {
diff --git a/intern/cycles/util/util_view.h b/intern/cycles/util/util_view.h
index 2339e452b94..a0d0d492790 100644
--- a/intern/cycles/util/util_view.h
+++ b/intern/cycles/util/util_view.h
@@ -34,6 +34,7 @@ void view_main_loop(const char *title, int width, int height,
ViewKeyboardFunc keyboard);
void view_display_info(const char *info);
+void view_display_help();
void view_redraw();
CCL_NAMESPACE_END