Skip to content

Commit 8d0258a

Browse files
committed
CPlot: add spec post
1 parent 5c02035 commit 8d0258a

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

Cassiopee/CPlot/CPlot/Plugins/screenDump.cpp

+11-4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
void accumulateSlit(E_Int ni, E_Int nj, char* imf, char* imt, char* imb,
2727
E_Int i, E_Int nil, E_Int njl, char* imOut);
2828

29+
void specPostProcess(char* in, E_Int ni, E_Int nj, float* depth, char* out);
30+
2931
//=============================================================================
3032
// Screen dump plugins
3133
//=============================================================================
@@ -332,8 +334,16 @@ char* Data::export2Image(E_Int exportWidth, E_Int exportHeight)
332334
}
333335
free(localBuf); free(localDepth);
334336
}
335-
free(depth);
336337

338+
// software postprocessing on final buffer (just before screen dump)
339+
if (rank == 0)
340+
{
341+
char* bfl = new char [_view.w * _view.h];
342+
for (E_Int i = 0; i < 3*_view.w*_view.h; i++) bfl[i] = buffer[i];
343+
specPostProcess(bfl, _view.w, _view.h, depth, buffer);
344+
delete [] bfl;
345+
}
346+
free(depth);
337347
MPI_Barrier(MPI_COMM_WORLD); // seems needed
338348

339349
#else
@@ -429,9 +439,6 @@ char* Data::export2Image(E_Int exportWidth, E_Int exportHeight)
429439
glDeleteFramebuffersEXT(1, &fb);
430440
#endif
431441

432-
// software postprocessing on final buffer (just before screen dump)
433-
434-
435442
return buffer;
436443
}
437444

Cassiopee/CPlot/CPlot/PyTree.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -1535,7 +1535,7 @@ def display360ODS2__(t, posCam, posEye, dirCam, offscreen, exportRez, stereoShif
15351535
# display360 (offscreen=1, 2 or 7)
15361536
# type360=0 (360 degres), =1 (180 degres)
15371537
#==============================================================================
1538-
def display360(t, type360=0, blurSigma=-1., **kwargs):
1538+
def display360(t, type360=0, **kwargs):
15391539
"""Display for 360 images."""
15401540
import KCore.Vector as Vector
15411541
import Converter.Mpi as Cmpi
@@ -1564,7 +1564,7 @@ def display360(t, type360=0, blurSigma=-1., **kwargs):
15641564
display360__(t, posCam, posEye, dirCam, offscreen, exportRez, kwargs)
15651565
# Create the 360 image from cube images
15661566
if Cmpi.rank == 0:
1567-
panorama(export, exportRez, type360=type360, blurSigma=blurSigma)
1567+
panorama(export, exportRez, type360=type360)
15681568
Cmpi.barrier() # wait for completion
15691569

15701570
elif stereo == 1: # stereo ODS internal (only offscreen=1 or 7)
@@ -1635,14 +1635,14 @@ def display360(t, type360=0, blurSigma=-1., **kwargs):
16351635
posCam0 = Vector.add(posCam, dv)
16361636
display360__(t, posCam0, posEye, dirCam, offscreen, exportRez, kwargs)
16371637
if Cmpi.rank == 0:
1638-
panorama(export1, exportRez, type360=type360, blueSigma=blurSigma)
1638+
panorama(export1, exportRez, type360=type360)
16391639
Cmpi.barrier() # wait for completion
16401640

16411641
# left eye
16421642
posCam0 = Vector.sub(posCam, dv)
16431643
display360__(t, posCam0, posEye, dirCam, offscreen, exportRez, kwargs)
16441644
if Cmpi.rank == 0:
1645-
panorama(export2, exportRez, type360=type360, blueSigma=blurSigma)
1645+
panorama(export2, exportRez, type360=type360)
16461646
Cmpi.barrier() # wait for completion
16471647

16481648
# stitch
@@ -1683,7 +1683,7 @@ def display360(t, type360=0, blurSigma=-1., **kwargs):
16831683

16841684
# assemble 6 cube images en une image panoramique
16851685
# type360=0 -> 360, type360=1 -> 180
1686-
def panorama(export, exportRez, type360=0, blurSigma=-1.):
1686+
def panorama(export, exportRez, type360=0):
16871687
res = exportRez.split('x')
16881688
if type360 == 0: resx = int(res[0]); resy = int(res[1])
16891689
else: resx = int(res[1]); resy = int(res[1])
@@ -1705,7 +1705,6 @@ def panorama(export, exportRez, type360=0, blurSigma=-1.):
17051705
C._addVars(a7, ['r','g','b','a'])
17061706
a7f = C.getFields('nodes', a7, api=3)[0]
17071707
CPlot.cplot.panorama(a1, a2, a3, a4, a5, a6, a7f, type360)
1708-
CPlot.cplot.blur(a7f, blurSigma)
17091708
C.convertPyTree2File(a7, export)
17101709
return a7
17111710

Cassiopee/CPlot/CPlot/blur.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ void gaussianBlur2(E_Float* in, E_Int ni, E_Int nj, E_Float* c, E_Int n, E_Float
9494
}
9595
}
9696

97-
// identical but applied to interlaced color buffer (3), return out
98-
void gaussianBlur3(char* in, E_Int ni, E_Int nj, E_Float* c, E_Int n, float* depth, char* out)
97+
// specific post-processing applied to interlaced color buffer (3), return out
98+
void specPostProcess(char* in, E_Int ni, E_Int nj, float* depth, char* out)
9999
{
100100
float dmin, dmax;
101101
// compute min/max of depth

0 commit comments

Comments
 (0)