Пример #1
0
extern "C" void Smoke3d_CB(int var) {
    int i;
    char *tour_label;
    char *vol_prefixptr;

    updatemenu=1;
    switch(var) {
        float temp_min, temp_max;

    case VOL_UNLOAD_ALL:
        UnLoadVolSmoke3DMenu(-1);
        break;
    case VOL_PREFIX:
        break;
    case VOL_TOUR_LIST:
        TOUR_CB(TOUR_LIST);
        break;
    case START_FRAME:
        if(vol_startframe0<0) {
            vol_startframe0=0;
            SPINNER_startframe->set_int_val(vol_startframe0);
        }
        break;
    case SKIP_FRAME:
        if(vol_skipframe0<1) {
            vol_skipframe0=1;
            SPINNER_skipframe->set_int_val(vol_skipframe0);
        }
        break;
    case CANCEL_GENERATE_IMAGES:
        Script_CB(SCRIPT_CANCEL_NOW);
        break;
    case GENERATE_IMAGES:
        if(selected_tour==NULL) {
            tour_label=NULL;
        }
        else {
            tour_label=selected_tour->label;
        }
        trim(vol_prefix);
        vol_prefixptr=trim_front(vol_prefix);
        if(strlen(vol_prefixptr)==0)vol_prefixptr=fdsprefix;
        init_volrender_script(vol_prefixptr, tour_label, vol_startframe0, vol_skipframe0);
        break;
    case NONGPU_VOL_FACTOR:
        init_volrender_surface(NOT_FIRSTCALL);
        break;
    case GPU_VOL_FACTOR:
        break;
    case COMBINE_MESHES:
        define_volsmoke_textures();
        break;
    case SHOW_FIRECOLORMAP:
        Update_Smokecolormap(smoke_render_option);
        if(show_firecolormap==1) {
            show_glui_colorbar();
        }
        else {
            hide_glui_colorbar();
        }
        break;
    case TEMP_MIN:
        temp_min = 20.0;
        temp_max = (float)(10.0*(int)(temperature_cutoff/10.0)-10.0);
        SPINNER_temperature_min->set_float_limits(temp_min,temp_max);
        Update_Smokecolormap(smoke_render_option);
        break;
    case TEMP_CUTOFF:
        temp_min = (float)(10*(int)(temperature_min/10.0) + 10.0);
        temp_max = (float)(10*(int)(temperature_max/10.0) - 10.0);
        SPINNER_temperature_cutoff->set_float_limits(temp_min,temp_max);
        Update_Smokecolormap(smoke_render_option);
        break;
    case TEMP_MAX:
        temp_min = (float)(10*(int)(temperature_cutoff/10.0)+10.0);
        temp_max = 1800.0;
        SPINNER_temperature_max->set_float_limits(temp_min,temp_max);
        Update_Smokecolormap(smoke_render_option);
        break;
    case LOAD_COMPRESSED_DATA:
        if(load_volcompressed==1) {
            CHECKBOX_compress_volsmoke->disable();
        }
        else {
            CHECKBOX_compress_volsmoke->enable();
        }
        break;
    case SMOKE_OPTIONS:
        if(firecolormap_type!=FIRECOLORMAP_NOCONSTRAINT&&smoke_render_option==RENDER_SLICE) {
            PANEL_colormap2b->enable();
            SPINNER_hrrpuv_cutoff->enable();
            PANEL_colormap2b->open();
        }
        else {
            PANEL_colormap2b->disable();
            PANEL_colormap2b->close();
        }
        if(smoke_render_option==RENDER_SLICE) {
            if(PANEL_colormap2a!=NULL) {
                PANEL_colormap2a->disable();
                PANEL_colormap2a->close();
            }
            if(PANEL_absorption!=NULL)PANEL_absorption->enable();
            firecolormap_type=firecolormap_type_save;
            RADIO_use_colormap->set_int_val(firecolormap_type);
            RADIOBUTTON_direct->enable();
            SPINNER_smoke3d_fire_halfdepth->enable();
        }
        else {
            if(PANEL_colormap2a!=NULL) {
                PANEL_colormap2a->enable();
                PANEL_colormap2a->open();
            }
            if(PANEL_absorption!=NULL)PANEL_absorption->disable();
            firecolormap_type_save=firecolormap_type;
            firecolormap_type=FIRECOLORMAP_CONSTRAINT;
            RADIO_use_colormap->set_int_val(firecolormap_type);
            RADIOBUTTON_direct->disable();
            SPINNER_smoke3d_fire_halfdepth->disable();
        }
        Smoke3d_CB(FIRECOLORMAP_TYPE);
        Update_Smoke_Type();
        break;
    case FIRECOLORMAP_TYPE:
        if(firecolormap_type==FIRECOLORMAP_CONSTRAINT&&smoke_render_option==RENDER_VOLUME) {
            PANEL_colormap2a->open();
            PANEL_colormap2a->enable();
        }
        else {
            PANEL_colormap2a->close();
            PANEL_colormap2a->disable();
        }
        if(firecolormap_type!=FIRECOLORMAP_NOCONSTRAINT&&smoke_render_option==RENDER_SLICE) {
            PANEL_colormap2b->enable();
            SPINNER_hrrpuv_cutoff->enable();
            PANEL_colormap2b->open();
        }
        else {
            PANEL_colormap2b->disable();
            PANEL_colormap2b->close();
        }
        if(firecolormap_type!=FIRECOLORMAP_DIRECT) {
            LISTBOX_smoke_colorbar->enable();
            ROLLOUT_colormap3->disable();
            ROLLOUT_colormap3->close();
            if(fire_colorbar_index_save!=-1) {
                SmokeColorBarMenu(fire_colorbar_index_save);
            }
            else {
                SmokeColorBarMenu(fire_colorbar_index);
            }
        }
        else {
            LISTBOX_smoke_colorbar->disable();
            ROLLOUT_colormap3->enable();
            ROLLOUT_colormap3->open();
            SPINNER_smoke3d_smoke_albedo->enable();
            SPINNER_smoke3d_fire_red->enable();
            SPINNER_smoke3d_fire_green->enable();
            SPINNER_smoke3d_fire_blue->enable();
            SPINNER_smoke3d_fire_halfdepth->enable();

            fire_colorbar_index_save=fire_colorbar_index;
        }
        if(LISTBOX_smoke_colorbar->get_int_val()!=fire_colorbar_index) {
            LISTBOX_smoke_colorbar->set_int_val(fire_colorbar_index);
        }
        Update_Smokecolormap(smoke_render_option);
        break;
    case SMOKE_COLORBAR_LIST:
        SmokeColorBarMenu(fire_colorbar_index);
        Update_Smokecolormap(smoke_render_option);
        updatemenu=1;
        break;
    case SMOKETEST:
        update_alpha();
        break;
    case FRAMELOADING:
        smoke3dframestep = smoke3dframeskip+1;
        updatemenu=1;
        break;
    case SAVE_SETTINGS:
        writeini(LOCAL_INI,NULL);
        break;
    case GLOBAL_FIRE_CUTOFF:
        glutPostRedisplay();
        force_redisplay=1;
        Idle_CB();
        Update_Smokecolormap(smoke_render_option);
        break;
    case FIRE_RED:
    case FIRE_GREEN:
    case FIRE_BLUE:
    case SMOKE_SHADE:
        glutPostRedisplay();
        force_redisplay=1;
        Update_Smokecolormap(smoke_render_option);
        Idle_CB();
        break;
    case FIRE_HALFDEPTH:
        for(i=0; i<nmeshes; i++) {
            mesh *meshi;

            meshi = meshinfo + i;
            meshi->update_firehalfdepth=1;
        }
        glutPostRedisplay();
        force_redisplay=1;
        Update_Smokecolormap(smoke_render_option);
        Idle_CB();
        break;
#ifdef pp_GPU
    case SMOKE_RTHICK:

        smoke3d_thick = log_base2(smoke3d_rthick);
        glutPostRedisplay();
        force_redisplay=1;
        Idle_CB();
        break;
#else
    case SMOKE_THICK:
        glutPostRedisplay();
        force_redisplay=1;
        Idle_CB();
        break;
#endif
#ifdef pp_CULL
    case CULL_PORTSIZE:
        initcull(cullsmoke);
        break;
    case CULL_SMOKE:
        initcull(cullsmoke);
        break;
#endif
    case VOL_NGRID:
        glutPostRedisplay();
        break;
    case VOL_SMOKE:
    {
        volrenderdata *vr;

        vr = &meshinfo->volrenderinfo;
        if(vr!=NULL&&vr->smokeslice!=NULL&&vr->smokeslice->slicetype==SLICE_CENTER) {
            if(usegpu==1&&combine_meshes==1) {
                combine_meshes=0;
                update_combine_meshes();
                Smoke3d_CB(COMBINE_MESHES);
            }
            if(usegpu==0&&combine_meshes==0) {
                combine_meshes=1;
                update_combine_meshes();
                Smoke3d_CB(COMBINE_MESHES);
            }
        }
    }
    if(smoke_render_option==RENDER_SLICE) {
#ifdef pp_GPU
        if(usegpu==1) {
            RADIO_skipframes->set_int_val(0);
            RADIO_skipframes->disable();
#ifdef pp_CULL
            if(cullactive==1) {
                CHECKBOX_smokecullflag->enable();
            }
            SPINNER_cull_portsize->enable();
            CHECKBOX_show_cullports->enable();
#endif
        }
        else {
            RADIO_skipframes->enable();
#ifdef pp_CULL
            CHECKBOX_smokecullflag->disable();
            SPINNER_cull_portsize->disable();
            CHECKBOX_show_cullports->disable();
#endif
        }
#else
        RADIO_skipframes->enable();
#endif
    }
    break;
    default:
#ifdef _DEBUG
        abort();
#endif
        break;
    }
}
Пример #2
0
void update_Display(void){

  if(update_have_gvec == 1){
    update_have_gvec = 0;
    update_gvec_down(1);
  }
  if(update_smokecolorbar == 1){
    update_smokecolorbar = 0;
    SmokeColorBarMenu(fire_colorbar_index);
  }
  if(update_colorbartype == 1){
    colorbardata *cb;

    cb = getcolorbar(colorbarname);
    if(cb != NULL){
      colorbartype = cb - colorbarinfo;
      current_colorbar = cb;
      if(colorbartype != colorbartype_default){
        colorbartype_ini = colorbartype;
      }
    }
    update_colorbartype = 0;
  }
  if(update_fire_line == 1){
    WUI_CB(TERRAIN_FIRE_LINE_UPDATE);
    update_fire_line = 0;
  }
  if(updatezoommenu == 1 || first_display > 0){
    if(first_display > 0)first_display--;
    updatezoommenu = 0;
    ZoomMenu(zoomindex);
  }
  if(update_makeiblank_smoke3d == 1){
    makeiblank_smoke3d();
  }
#ifdef pp_CULL
  if(update_initcull == 1)initcull(cullsmoke);
#endif
  if(update_streaks == 1 && ReadPartFile == 1){
    ParticleStreakShowMenu(streak_index);
    update_streaks = 0;
  }
  if(update_screensize == 1){
    update_screensize = 0;
    update_windowsizelist();
    ResizeWindow(screenWidthINI, screenHeightINI);
  }
  if(updatemenu == 1 && usemenu == 1 && menustatus == GLUT_MENU_NOT_IN_USE){
    glutDetachMenu(GLUT_RIGHT_BUTTON);
    InitMenus(LOAD);
    glutAttachMenu(GLUT_RIGHT_BUTTON);
    updatemenu = 0;
  }
  if(update_fire_colorbar_index == 1){
    SmokeColorBarMenu(fire_colorbar_index_ini);
    update_fire_colorbar_index = 0;
  }
  if(showtime == 0 && ntotal_smooth_blockages > 0){
    update_smoothblockage_info();
  }
  if(update_colorbar_select_index == 1 && colorbar_select_index >= 0 && colorbar_select_index <= 255){
    update_colorbar_select_index = 0;
    UpdateRGBColors(colorbar_select_index);
  }
}