Skip to content

Commit

Permalink
Merge pull request #1632 from gforney/master
Browse files Browse the repository at this point in the history
add -large command line option for large geometry cases - skips some steps
  • Loading branch information
gforney authored Jul 7, 2023
2 parents 88dd107 + b9d737d commit 1a05e42
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 42 deletions.
78 changes: 40 additions & 38 deletions Source/smokeview/IOgeometry.c
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,7 @@ void UpdateTriangles(int flag,int update){
verti = trianglei->verts[2];
verti->triangles[verti->itriangle++]=trianglei;
}
SmoothGeomNormals(geomlisti,geomi->geomtype);
if(large_case==0)SmoothGeomNormals(geomlisti,geomi->geomtype);
}
}

Expand Down Expand Up @@ -1609,47 +1609,49 @@ void UpdateTriangles(int flag,int update){

// average normals

for(iii = 0; iii<nsurface_verts; iii++){
int jjj;
vertdata *verti;
float *xyzi, *normi;
float avgnorm[3];

if(match_verts[iii]>=0)continue;
verti = surface_verts[iii];
xyzi = verti->xyz;
normi = verti->vert_norm;
avgnorm[0] = normi[0];
avgnorm[1] = normi[1];
avgnorm[2] = normi[2];
match_verts[iii] = iii;
for(jjj = iii+1; jjj<nsurface_verts; jjj++){
vertdata *vertj;
float *xyzj, *normj;

if(match_verts[jjj]>=0)continue;
vertj = surface_verts[jjj];
xyzj = vertj->xyz;
normj = vertj->vert_norm;
#define POINTEPS 0.001
if(ABS(xyzi[0]-xyzj[0])<POINTEPS&&ABS(xyzi[1]-xyzj[1])<POINTEPS&&ABS(xyzi[2]-xyzj[2])<POINTEPS){
match_verts[jjj] = iii;
avgnorm[0] += normj[0];
avgnorm[1] += normj[1];
avgnorm[2] += normj[2];
}
}
ReduceToUnit(avgnorm);
for(jjj = iii; jjj<nsurface_verts; jjj++){
if(match_verts[jjj] == match_verts[iii]){
if(large_case==0){
for(iii = 0; iii < nsurface_verts; iii++){
int jjj;
vertdata *verti;
float *xyzi, *normi;
float avgnorm[3];

if(match_verts[iii] >= 0)continue;
verti = surface_verts[iii];
xyzi = verti->xyz;
normi = verti->vert_norm;
avgnorm[0] = normi[0];
avgnorm[1] = normi[1];
avgnorm[2] = normi[2];
match_verts[iii] = iii;
for(jjj = iii + 1; jjj < nsurface_verts; jjj++){
vertdata *vertj;
float *normj;
float *xyzj, *normj;

if(match_verts[jjj] >= 0)continue;
vertj = surface_verts[jjj];
xyzj = vertj->xyz;
normj = vertj->vert_norm;
normj[0] = avgnorm[0];
normj[1] = avgnorm[1];
normj[2] = avgnorm[2];
#define POINTEPS 0.001
if(ABS(xyzi[0] - xyzj[0]) < POINTEPS && ABS(xyzi[1] - xyzj[1]) < POINTEPS && ABS(xyzi[2] - xyzj[2]) < POINTEPS){
match_verts[jjj] = iii;
avgnorm[0] += normj[0];
avgnorm[1] += normj[1];
avgnorm[2] += normj[2];
}
}
ReduceToUnit(avgnorm);
for(jjj = iii; jjj < nsurface_verts; jjj++){
if(match_verts[jjj] == match_verts[iii]){
vertdata *vertj;
float *normj;

vertj = surface_verts[jjj];
normj = vertj->vert_norm;
normj[0] = avgnorm[0];
normj[1] = avgnorm[1];
normj[2] = avgnorm[2];
}
}
}
}
Expand Down
35 changes: 34 additions & 1 deletion Source/smokeview/IOwui.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,39 @@ int HaveTerrainTexture(int *draw_surfaceptr){
return draw_texture;
}

/* ------------------ GetNTerrainTexturesLoaded ------------------------ */

int GetNTerrainTexturesLoaded(void){
int count, i, opaque_texture_index = -1;

for(i = 0; i < nterrain_textures; i++){
texturedata *texti;

texti = terrain_textures + i;
if(texti->loaded == 1 && texti->display == 1 && texti->is_transparent == 0){
opaque_texture_index = i;
break;
}
}

count = 0;
for(i = -1; i<nterrain_textures; i++){
texturedata *texti;

if(i==-1){
if(opaque_texture_index==-1)continue;
texti = terrain_textures+opaque_texture_index;
}
else{
if(i==opaque_texture_index)continue;
texti = terrain_textures+i;
}
if(texti->loaded==0||texti->display==0)continue;
count++;
}
return count;
}

/* ------------------ DrawTerrainGeom ------------------------ */

void DrawTerrainGeom(int option){
Expand Down Expand Up @@ -550,7 +583,7 @@ void DrawTerrainGeom(int option){
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glEnable(GL_TEXTURE_2D);

int count = 1;
int count = 0;
int is_transparent=0;
TransparentOff();
for(ii = -1; ii<nterrain_textures; ii++){
Expand Down
2 changes: 2 additions & 0 deletions Source/smokeview/command_args.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ CommandlineArgs ParseCommandlineNew(int argc, char **argv,
args.noexit = true;
} else if (strcmp(argv[i], "-setup") == 0) {
args.setup = true;
} else if(strcmp(argv[i], "-large") == 0) {
args.large_case = true;
} else if (strcmp(argv[i], "-bindir") == 0) {
++i;
if (i < argc) {
Expand Down
1 change: 1 addition & 0 deletions Source/smokeview/command_args.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ typedef struct CommandlineArgs {
/// and exit.
bool print_version;
bool update_bounds;
bool large_case;
bool no_graphics;
/// @brief calculate slice file parameters
bool update_slice;
Expand Down
4 changes: 4 additions & 0 deletions Source/smokeview/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void Usage(char *prog,int option){
PRINTF("%s\n", _(" -geominfo - output information about geometry triangles"));
PRINTF("%s\n", _(" -info generate casename.slcf and casename.viewpoint files containing slice file and viewpiont info"));
PRINTF("%s\n", _(" -lang xx - where xx is de, es, fr, it for German, Spanish, French or Italian"));
PRINTF("%s\n", _(" -large - take some shortcuts when reading in large geometry cases"));
PRINTF("%s\n", _(" -make_movie - open the movie generating dialog box"));
PRINTF("%s\n", _(" -outline - show geometry bound boxes instead of geometry"));
PRINTF("%s\n", _(" -ng_ini - non-graphics version of -ini."));
Expand Down Expand Up @@ -377,6 +378,9 @@ char *ProcessCommandLine(CommandlineArgs *args) {
if(args->no_graphics){
use_graphics = 0;
}
if(args->large_case){
large_case = 1;
}
if(args->update_slice){
use_graphics = 0;
update_slice = 1;
Expand Down
2 changes: 1 addition & 1 deletion Source/smokeview/readsmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -11596,7 +11596,7 @@ typedef struct {
radius_windrose = 0.2*xyzmaxdiff;
PRINT_TIMER(timer_readsmv, "InitVolRender");

ClassifyAllGeomMT();
if(large_case==0)ClassifyAllGeomMT();

PRINT_TIMER(timer_readsmv, "null");
UpdateTriangles(GEOM_STATIC,GEOM_UPDATE_ALL);
Expand Down
4 changes: 2 additions & 2 deletions Source/smokeview/showscene.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ void ShowScene2(int mode){

/* ++++++++++++++++++++++++ draw terrain +++++++++++++++++++++++++ */

CLIP_GEOMETRY;
DrawTerrainGeom(DRAW_OPAQUE);
CLIP_GEOMETRY;
DrawTerrainGeom(DRAW_OPAQUE);

if(visTerrainType != TERRAIN_HIDDEN&&nterraininfo>0&&ngeominfo==0 && geom_bounding_box_mousedown==0){
int i;
Expand Down
1 change: 1 addition & 0 deletions Source/smokeview/smokeviewvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -1350,6 +1350,7 @@ SVEXTERN int SVDECL(showhvac_dialog, 0);
SVEXTERN int SVDECL(showcolorbar_dialog,0);
SVEXTERN int SVDECL(showtour_dialog,0),SVDECL(showtrainer_dialog,0);
SVEXTERN int SVDECL(showtours,0);
SVEXTERN int SVDECL(large_case, 0);

SVEXTERN float shooter_xyz[3], shooter_dxyz[3], shooter_uvw[3], SVDECL(shooterpointsize,4.0);
SVEXTERN float shooter_velx, shooter_vely, shooter_velz, shooter_time, shooter_time_max;
Expand Down
4 changes: 4 additions & 0 deletions Source/smokeview/threader.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@
#define JOIN_SAMPLE
#endif

#define JOIN_CSVFILES
#define LOCK_CSV_LOAD_CPP
#define UNLOCK_CSV_LOAD_CPP

#define JOIN_PART_HIST
#endif

Expand Down

0 comments on commit 1a05e42

Please sign in to comment.