Skip to content

Commit d6486bc

Browse files
authored
Merge pull request #2605 from gforney/master
corrections to 3d smoke/fire opacity computations that show up for small scale cases
2 parents 4e5eb91 + a4c440d commit d6486bc

4 files changed

Lines changed: 16 additions & 24 deletions

File tree

Source/smokeview/IOsmoke.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -711,12 +711,6 @@ void InitAlphas(unsigned char *smokealphanew, unsigned char *firealphanew, float
711711
if(smoke3d_frame_inc != 1)new_dx *= (float)smoke3d_frame_inc;
712712
have_fire = HaveFireLoaded();
713713
have_smoke = HaveSootLoaded();
714-
if(have_smoke != NO_SMOKE && have_fire != NO_FIRE && use_soot_multiplier == 1){
715-
use_soot_multiplier = 1;
716-
}
717-
else{
718-
use_soot_multiplier = 0;
719-
}
720714
for(i = 1; i < 255; i++){
721715
float soot_density, soot_opacity;
722716
int soot_alpha;
@@ -1921,7 +1915,6 @@ void SmokeWrapup(void){
19211915
smoke_render_option = RENDER_SLICE;
19221916
have_fire = HaveFireLoaded();
19231917
have_smoke = HaveSootLoaded();
1924-
update_smoke_opacity = 1;
19251918
ForceIdle();
19261919
}
19271920

Source/smokeview/glui_smoke.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ extern "C" void GLUI3dSmokeSetup(int main_window){
531531
"use opacity multiplier when smoke also loaded", &use_soot_multiplier, USE_SOOT_MULTIPLIER, GLUISmoke3dCB);
532532
SPINNER_soot_multiplier = glui_3dsmoke->add_spinner_to_panel(PANEL_fire_opacity,
533533
"opacity multiplier:", GLUI_SPINNER_FLOAT, &soot_multiplier, SOOT_MULTIPLIER, GLUISmoke3dCB);
534+
SPINNER_soot_multiplier->set_float_limits(MIN_SOOT_MULTIPLIER, MAX_SOOT_MULTIPLIER);
534535
if(active_smokesensors == 1){
535536
PANEL_smokesensor = glui_3dsmoke->add_panel_to_panel(ROLLOUT_opacity, "Visibility");
536537
RADIO_smokesensors = glui_3dsmoke->add_radiogroup_to_panel(PANEL_smokesensor, &show_smokesensors);

Source/smokeview/readsmv.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,8 +1354,8 @@ void UpdateMeshCoords(void){
13541354
float dz_scene = global_scase.zbar - global_scase.zbar0;
13551355
xyzmaxdiff = MAX(MAX(dx_scene,dy_scene),dz_scene);
13561356
// set fire_half depth to max of 1/40 domain size (rounded to 0.1 m) and 0.3
1357-
fire_halfdepth = (float)((int)(10.0*xyzmaxdiff/40.0+0.5))/10.0;
1358-
fire_halfdepth = MAX(fire_halfdepth, 0.3);
1357+
fire_halfdepth = (float)((int)(100.0*xyzmaxdiff/40.0+0.5))/100.0;
1358+
fire_halfdepth = MAX(fire_halfdepth, 0.05);
13591359
vector_scalelength = MIN(dx_scene, dz_scene);
13601360
if(global_scase.meshescoll.meshinfo[0].jbar > 1) {
13611361
vector_scalelength = MIN(vector_scalelength, dy_scene);
@@ -6122,12 +6122,11 @@ int ReadIni2(const char *inifile, int localfile){
61226122
global_scase.smoke_albedo = CLAMP(global_scase.smoke_albedo, 0.0, 1.0);
61236123
continue;
61246124
}
6125-
if(MatchINI(buffer, "SMOKEFIREPROP") == 1){
6126-
int dummy;
6127-
6125+
if(MatchINI(buffer, "FIREPROP") == 1){
61286126
if(fgets(buffer, 255, stream) == NULL)break;
6129-
sscanf(buffer, "%i %i", &dummy, &use_soot_multiplier);
6127+
sscanf(buffer, "%i %f", &use_soot_multiplier, &soot_multiplier);
61306128
use_soot_multiplier = CLAMP(use_soot_multiplier, 0, 1);
6129+
soot_multiplier = CLAMP(soot_multiplier, MIN_SOOT_MULTIPLIER, MAX_SOOT_MULTIPLIER);
61316130
update_use_soot_multiplier = 1;
61326131
continue;
61336132
}
@@ -8342,14 +8341,16 @@ void WriteIni(int flag,char *filename){
83428341
mmin[0], mmin[1], mmin[2],
83438342
mmax[0], mmax[1], mmax[2]);
83448343
}
8344+
fprintf(fileout, "FDEPTH2\n");
8345+
fprintf(fileout, " %f %f %f %i %i\n", fire_halfdepth, co2_halfdepth, soot_multiplier, use_fire_alpha, force_alpha_opaque);
83458346
fprintf(fileout, "FIRECOLOR\n");
83468347
fprintf(fileout, " %i %i %i\n", fire_color_int255[0], fire_color_int255[1], fire_color_int255[2]);
83478348
if(colorbars.fire_colorbar_index >= 0 && colorbars.fire_colorbar_index < colorbars.ncolorbars){
83488349
fprintf(fileout, "FIRECOLORMAP\n");
83498350
fprintf(fileout, " FIRE %i %s\n", fire_colormap_type, colorbars.colorbarinfo[colorbars.fire_colorbar_index].menu_label);
83508351
}
8351-
fprintf(fileout, "FDEPTH2\n");
8352-
fprintf(fileout, " %f %f %f %i %i\n", fire_halfdepth, co2_halfdepth, soot_multiplier, use_fire_alpha, force_alpha_opaque);
8352+
fprintf(fileout, "FIREPROP\n");
8353+
fprintf(fileout, " %i %f\n", use_soot_multiplier, soot_multiplier);
83538354
if(colorbars.ncolorbars > colorbars.ndefaultcolorbars){
83548355
colorbardata *cbi;
83558356
unsigned char *rrgb;
@@ -8385,11 +8386,6 @@ void WriteIni(int flag,char *filename){
83858386
fprintf(fileout, "SMOKEALBEDO\n");
83868387
fprintf(fileout, " %f\n", global_scase.smoke_albedo);
83878388
}
8388-
8389-
if((have_fire == NO_FIRE && have_smoke == NO_SMOKE)||(have_fire != NO_FIRE && have_smoke != NO_SMOKE)){
8390-
fprintf(fileout, "SMOKEFIREPROP\n");
8391-
fprintf(fileout, " %i %i\n", 1 - use_soot_multiplier, use_soot_multiplier);
8392-
}
83938389
fprintf(fileout, "SMOKEPROP\n");
83948390
fprintf(fileout, " %f\n", glui_mass_extinct);
83958391
glui_mass_extinct_default = glui_mass_extinct;

Source/smokeview/smokeviewvars.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,11 @@ SVEXTERN int SVDECL(glui_mesh_intersection_option, 0);
434434
SVEXTERN int SVDECL(partfast, 1);
435435
SVEXTERN int SVDECL(use_fire_alpha, 0);
436436
SVEXTERN float SVDECL(soot_multiplier, 3.0);
437+
SVEXTERN int SVDECL(update_use_soot_multiplier,0);
438+
SVEXTERN int SVDECL(use_soot_multiplier, 1);
439+
#define MIN_SOOT_MULTIPLIER 0.0
440+
#define MAX_SOOT_MULTIPLIER 100.0
441+
437442
#ifdef pp_OSX
438443
SVEXTERN int SVDECL(monitor_screen_height, -1);
439444
#endif
@@ -2095,11 +2100,8 @@ SVEXTERN int smoke_color_int255[4];
20952100
SVEXTERN int co2_color_int255[3];
20962101
#endif
20972102

2098-
SVEXTERN int SVDECL(update_use_soot_multiplier,0);
2099-
SVEXTERN int SVDECL(use_soot_multiplier, 0);
2100-
21012103
SVEXTERN int SVDECL(update_smokefire_colors, 0);
2102-
SVEXTERN float SVDECL(fire_halfdepth,0.3);
2104+
SVEXTERN float SVDECL(fire_halfdepth,0.1);
21032105
SVEXTERN float SVDECL(co2_halfdepth, 10.0);
21042106

21052107
SVEXTERN int SVDECL(co2_colormap_type, CO2_COLORBAR);

0 commit comments

Comments
 (0)