diff --git a/checkin_notes b/checkin_notes index 438719482f..ecaf4dcbe9 100644 --- a/checkin_notes +++ b/checkin_notes @@ -49,6 +49,7 @@ David 21 Apr 2006 uc_graphics.C upper_case.C + Charlie 27 April 2006 - Mac: updated XCode project for upper_case, fixed jconfig.h to be cross-platform. upper_case now @@ -59,3 +60,11 @@ Charlie 27 April 2006 mac_build/ UpperCase.xcodeproj/ project.pbxproj + +David 29 Apr 2006 + - use project preferences () for graphics color + - remove -exit, -signal options from upper_case + + uppercase/ + uc_graphics.C + upper_case.C diff --git a/uppercase/uc_graphics.C b/uppercase/uc_graphics.C index d1095535ac..80e75967dc 100644 --- a/uppercase/uc_graphics.C +++ b/uppercase/uc_graphics.C @@ -26,6 +26,7 @@ #include "config.h" #endif +#include "parse.h" #include "gutil.h" #include "boinc_gl.h" #include "graphics_api.h" @@ -38,6 +39,27 @@ APP_INIT_DATA uc_aid; bool mouse_down = false; int mouse_x, mouse_y; double pitch_angle, roll_angle, viewpoint_distance=10; +float color[4] = {.7, .2, .5, 1}; + +static void parse_project_prefs(char* buf) { + char cs[256]; + COLOR c; + double hue; + if (parse_str(buf, "", cs, 256)) { + if (!strcmp(cs, "Tahiti Sunset")) { + hue = .9; + } else if (!strcmp(cs, "Desert Sands")) { + hue = .1; + } else { + hue = .5; + } + HLStoRGB(hue, .5, .5, c); + color[0] = c.r; + color[1] = c.g; + color[2] = c.b; + color[3] = 1; + } +} // set up lighting model // @@ -55,6 +77,7 @@ void app_graphics_init() { int viewport[4]; boinc_get_init_data(uc_aid); + parse_project_prefs(uc_aid.project_preferences); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); txf_load_fonts("."); boinc_resolve_filename("logo.jpg", path, sizeof(path)); @@ -113,9 +136,9 @@ void set_viewpoint(double dist) { glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt( - x, y, z, // eye position - 0,-.8,0, // where we're looking - 0.0, 1.0, 0. // up is in positive Y direction + x, y, z, // eye position + 0,-.8,0, // where we're looking + 0.0, 1.0, 0. // up is in positive Y direction ); glRotated(pitch_angle, 1., 0., 0); glRotated(roll_angle, 0., 1., 0); @@ -128,7 +151,7 @@ static void app_init_camera(double dist) { 45.0, // field of view in degree 1.0, // aspect ratio 1.0, // Z near clip - 1000.0 // Z far + 1000.0 // Z far ); set_viewpoint(dist); } @@ -144,7 +167,6 @@ void app_graphics_render(int xs, int ys, double time_of_day) { app_init_camera(viewpoint_distance); scale_screen(width, height); - GLfloat color[4] = {.7, .2, .5, 1}; mode_shaded(color); draw_3d_stuff(); diff --git a/uppercase/upper_case.C b/uppercase/upper_case.C index 6ee0283d4c..49b9429251 100755 --- a/uppercase/upper_case.C +++ b/uppercase/upper_case.C @@ -20,9 +20,7 @@ // read "in", convert to UC, write to "out" // command line options: // -run_slow: sleep 1 second after each character, useful for debugging -// -cpu_time N: use about N CPU seconds -// -signal: raise SIGHUP signal (for testing signal handler) -// -exit: exit with status -10 (for testing exit handler) +// -cpu_time N: use about N CPU seconds after copying files // #ifdef _WIN32 @@ -159,17 +157,6 @@ void worker() { boinc_sleep(1.); } -#ifdef HAVE_SIGNAL_H - if (raise_signal) { - raise(SIGHUP); - } -#endif - if (random_exit) { - if (drand() < 0.05) { - exit(-10); - } - } - int flag = boinc_time_to_checkpoint(); if (flag) { retval = do_checkpoint(out, nchars); @@ -196,10 +183,6 @@ void worker() { use_some_cpu(); } } - - if (random_exit) exit(-10); - fprintf(stderr, "APP: upper_case ending, wrote %d chars\n", nchars); - boinc_finish(0); } @@ -213,27 +196,18 @@ int main(int argc, char **argv) { BOINC_DIAG_TRACETOSTDERR ); - // NOTE: if you change output here, remember to change the output that - // test_uc.py pattern-matches against. - for (i=0; i