static void set_psf_linecolor_handler(int sel){ if (sel == BLACK_PSF_LINE) {kemoview_set_PSF_isoline_color_mode(BLACK_LINE);} else if (sel == WHITE_PSF_LINE) {kemoview_set_PSF_isoline_color_mode(WHITE_LINE);} else if (sel == RAINBOW_PSF_LINE) {kemoview_set_PSF_isoline_color_mode(RAINBOW_LINE);}; draw_mesh_w_menu(); return; };
static void set_psf_linecolor_handler(int sel){ if (sel == BLACK_PSF_LINE) {set_current_isoline_color(BLACK_LINE);} else if (sel == RAINBOW_PSF_LINE) {set_current_isoline_color(RAINBOW_LINE);} else if (sel == WHITE_PSF_LINE) {set_current_isoline_color(WHITE_LINE);}; draw_mesh_w_menu(); return; };
static void fline_handler(int sel){ int toggle; if (sel == FLINE_OFF) {close_fline_view();} else if (sel == ISET_FLINE_TYPE) {toggle = toggle_fline_type_flag();} else {kemoview_fline_draw_setting(sel);}; draw_mesh_w_menu(); return; };
static void set_psf_patchcolor_handler(int sel){ if (sel == WHITE_PSF_SURF) {kemoview_set_PSF_patch_color_mode(WHITE_SURFACE);} else if (sel == SGL_COLOR_PSF_SURF){set_psf_single_color_glui(winid);} else if (sel == RAINBOW_PSF_SURF) {kemoview_set_PSF_patch_color_mode(RAINBOW_SURFACE);} else if (sel == TEXTURE_PSF_SURF) {set_psf_texture_by_glui(winid);}; draw_mesh_w_menu(); return; };
static void set_psf_patchcolor_handler(int sel){ if (sel == WHITE_PSF_SURF) {set_current_psf_patch_color_mode(WHITE_SURFACE);} else if (sel == SGL_COLOR_PSF_SURF) {set_current_psf_patch_color_mode(SINGLE_COLOR);} else if (sel == RAINBOW_PSF_SURF) {set_current_psf_patch_color_mode(RAINBOW_SURFACE);} else if (sel == TEXTURE_PSF_SURF) {load_texture_handler();}; draw_mesh_w_menu(); return; };
static void domain_handler(int sel){ if(sel == MESH_OFF){ close_mesh_view(); } else{ kemoview_mesh_draw_toggle(sel); }; draw_mesh_w_menu(); return; }
static void psf_colormap_handler(int sel){ if(sel == WRITE_CMAP){write_PSF_colormap_file_glui(winid);} else if(sel == READ_CMAP){read_PSF_colormap_file_glui(winid);} else if (sel == ADD_PSF_COLOR) {edit_psf_colormap_by_glui(winid);} else if (sel == ADD_PSF_OPACITY) { edit_psf_opacitymap_by_glui(winid); draw_mesh_w_menu(); }; return; };
static void color_mode_handler(int sel){ if (sel == GRAYSCALE) { set_to_mesh_color_mode(GRAYSCALE); } else if( sel == RAINBOW_COLOR) { set_to_mesh_color_mode(RAINBOW_COLOR); } else if( sel == SET_NUM_COLORS) { set_num_color_loop_by_glui(winid); }; draw_mesh_w_menu(); return; }
static void load_texture_handler(){ char image_head[LENGTHBUF]; input_file_header(image_head); int id_image = input_image_format(); if(id_image == SAVE_PNG || id_image == SAVE_BMP){ set_texture_current_psf(id_image, image_head); set_current_psf_patch_color_mode(TEXTURED_SURFACE); }; glutSetWindow(winid); draw_mesh_w_menu(); return; };
static void object_property_handler(int sel){ int toggle; toggle = object_properties_toggle(sel); if ( sel == SET_NODE_SIZE) { set_node_size_console(); } else if( sel == SET_DISTANCE_DOMAIN) { set_domain_distance_console(); draw_modified_object_distance(); } else if( sel == SET_COAST_RADIUS) { set_coastline_radius_console(); } else if( sel == OUTPUT_V_MATRIX) { save_viewmatrix_file(); } else if( sel == INPUT_V_MATRIX) { load_viewmatrix_file(); }; draw_mesh_w_menu(); return; }
static void load_viewmatrix_glui(int sel){ char current[LENGTHBUF]; char file_name[LENGTHBUF]; char file_head[LENGTHBUF]; char img_ext[LENGTHBUF]; int ext_fmt; getcwd(current, sizeof(current)); strcpy(file_name, current); strcat(file_name, "/"); strcat(file_name, text_fname.c_str()); kemoview_load_modelview_file(file_name); draw_mesh_w_menu(); GLUI_Master.close_all(); return; };
static void init_kemoview_data_glui(int val){ char current[LENGTHBUF]; char file_name[LENGTHBUF]; char file_head[LENGTHBUF]; char file_ext[LENGTHBUF]; int iflag_datatype; getcwd(current, sizeof(current)); strcpy(file_name, current); strcat(file_name, "/"); strcat(file_name, text_fname.c_str()); get_ext_from_file_name(file_name, file_head, file_ext); printf("file name: %s\n", file_name); printf("file_head %s\n", file_head); printf("file_ext %s\n", file_ext); iflag_datatype = kemoview_open_data_glut(file_name); GLUI_Master.close_all(); draw_mesh_w_menu(); return; };
static void set_fline_col_type_handler(int sel){ set_to_fieldline_color(sel); draw_mesh_w_menu(); return; };
static void set_fline_c_comp_handler(int sel){ set_fline_color_comp_flag(sel); draw_mesh_w_menu(); return; };
static void set_psf_field_handler(int sel){ kemoview_set_PSF_field(sel); draw_mesh_w_menu(); return; };
static void set_psf_comp_handler(int sel){ kemoview_set_PSF_component(sel); draw_mesh_w_menu(); return; };
static void set_psf_comp_handler(int sel){ set_current_psf_component_flag(sel); draw_mesh_w_menu(); return; };
static void set_psf_field_handler(int sel){ set_current_psf_field_flag(sel); draw_mesh_w_menu(); return; };
static void set_fline_c_comp_handler(int sel){ kemoview_set_fline_color_component(sel); draw_mesh_w_menu(); return; };
static void nod_grp_handler(int sel){ kemoview_nod_grp_toggle(sel); draw_mesh_w_menu(); };
static void grid_4_surf_grp_handler(int sel){ kemoview_surf_grp_grid_toggle(sel); draw_mesh_w_menu(); };
static void set_psf_colormode_handler(int sel){ kemoview_set_PSF_color_mode(sel); draw_mesh_w_menu(); return; };
void draw_mesh_kemo(int iflag_streo_shutter, int iflag_dmesh) { int narg_glut = 0; char **arg_glut; /* Initialize arrays for viewer */ allocate_single_kemoviwewer_struct(iflag_dmesh); set_to_stereo_shutter(iflag_streo_shutter); if(iflag_streo_shutter == SHUTTER_ON){ set_to_iflag_anaglyph(ANAGLYPH_OFF); } else { set_to_iflag_anaglyph(ANAGLYPH_ON); }; link_glut_menu_address(); /*! Initializations with GLUT*/ glutInit(&narg_glut, arg_glut); if(iflag_streo_shutter == SHUTTER_ON){ glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE|GLUT_DEPTH |GLUT_MULTISAMPLE|GLUT_STEREO); } else { glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE|GLUT_DEPTH|GLUT_MULTISAMPLE); }; /*! Create viewer window*/ set_kemoview_retinamode(IZERO); set_kemoview_windowsize(NPIX_X, NPIX_Y); glutInitWindowSize(NPIX_X, NPIX_Y); winid = glutCreateWindow("Kemoviewer"); set_main_window_id_glut(winid); /*glutEntryFunc(enter_leave);*/ /*! Set the display callback */ glutDisplayFunc(display); glutReshapeFunc(modifywindow); if (!glutExtensionSupported("GL_ARB_texture_non_power_of_two")) {printf("GL_ARB_texture_non_power_of_two is not Supported\n");}; /* initialize view_modifier, receiving the id for it's submenu */ reset_kemoviewer_to_init_angle(); view_modifier_init(); /* ! set the perspective and lighting */ init_kemoview_background_color(); kemoviewer_initial_lighting(); /*! Create menu window*/ menu_win = glutCreateSubWindow(winid,IZERO,IZERO,MENU_WIDTH,MENU_HEIGHT); /*glutEntryFunc(enter_leave);*/ glutDisplayFunc(display_menu); draw_mesh_w_menu(); /*! set callback for GLUT*/ glutMainLoop(); return; };
static void viewtype_handler(int sel){ set_viewtype_mode_glut(sel, viewtype_title); draw_mesh_w_menu(); return; }
static void set_current_psf_handler(int sel){ set_to_current_PSF(sel); draw_mesh_w_menu(); return; };
static void set_fline_col_type_handler(int sel){ kemoview_set_fline_color_type(sel); draw_mesh_w_menu(); return; };
static void read_draw_kemoview_data_glut(){ read_kemoview_data_glut(); draw_mesh_w_menu(); return; };
static void surf_4_ele_grp_handler(int sel){ kemoview_ele_grp_toggle(sel); draw_mesh_w_menu(); };