diff --git a/Cassiopee/CPlot/CPlot/Display/displaySSolidZone.cpp b/Cassiopee/CPlot/CPlot/Display/displaySSolidZone.cpp index 615d5ac45..a696924f1 100644 --- a/Cassiopee/CPlot/CPlot/Display/displaySSolidZone.cpp +++ b/Cassiopee/CPlot/CPlot/Display/displaySSolidZone.cpp @@ -40,10 +40,6 @@ void Data::displaySSolidZone(StructZone* zonep, E_Int zone) E_Float nz = 1./_numberOfStructZones; #include "solidStyles.h" - // Ecrasement si renderTag - if (zonep->colorR > -0.5) - {color1[0] = zonep->colorR; color1[1] = zonep->colorG; color1[2] = zonep->colorB;} - #include "selection.h" bool is1D = ((zonep->ni*zonep->nj == 1) | (zonep->ni*zonep->nk == 1) | (zonep->nj*zonep->nk == 1)); diff --git a/Cassiopee/CPlot/CPlot/Display/displayUSolidHOZone.cpp b/Cassiopee/CPlot/CPlot/Display/displayUSolidHOZone.cpp index 71268226a..33feda319 100644 --- a/Cassiopee/CPlot/CPlot/Display/displayUSolidHOZone.cpp +++ b/Cassiopee/CPlot/CPlot/Display/displayUSolidHOZone.cpp @@ -25,117 +25,108 @@ //============================================================================= void Data::displayUSolidHOZone(UnstructZone *zonep, E_Int zone, E_Int zonet) { - E_Int i, n1, n2, n3, n4, n5, n6, n7, n8; - E_Int ret1, ret2, ret3, ret4, f; - - // Style - float color1[ 3 ]; - float color2[ 3 ]; - - // Colormap - float r, g, b; - void ( *getrgb )( Data * data, double, float *, float *, float * ); - getrgb = _plugins.zoneColorMap->f; - - E_Float nz = 1. / _numberOfUnstructZones; -#include "solidStyles.h" - - // Ecrasement si renderTag - if (zonep->colorR > -0.5) - { - color1[ 0 ] = zonep->colorR; - color1[ 1 ] = zonep->colorG; - color1[ 2 ] = zonep->colorB; - } - -#include "selection.h" - - E_Int eltType0 = zonep->eltType[0]; - bool is1D = ( (eltType0 == 1) | (eltType0 == 10 && zonep->nelts1D > 0) ); - if (is1D == true && ptrState->mode == RENDER) - glLineWidth(1. + 5 * zonep->shaderParam1); - else if (is1D == true) glLineWidth(3.); - else glLineWidth(1.); - - // scale - E_Float s = MAX(zonep->xmax - zonep->xmin, zonep->ymax - zonep->ymin); - s = MAX(s, zonep->zmax - zonep->zmin); - s = 100. / (s + 1.e-12); - - // Only for textured rendering, we use vect display ======================= - if (ptrState->mode == RENDER && zonep->material == 14 && zonep->texu != NULL) // Textured rendering - { - // Sans doute également à modifier pour le high order ? - triggerShader(*zonep, zonep->material, s, color1); - - E_Int ff = 0; - double offb = 0.; + E_Int i, n1, n2, n3, n4, n5, n6, n7, n8; + E_Int ret1, ret2, ret3, ret4, f; + + // Style + float color1[ 3 ]; + float color2[ 3 ]; + + // Colormap + float r, g, b; + void ( *getrgb )( Data * data, double, float *, float *, float * ); + getrgb = _plugins.zoneColorMap->f; + + E_Float nz = 1. / _numberOfUnstructZones; + #include "solidStyles.h" + + #include "selection.h" + + E_Int eltType0 = zonep->eltType[0]; + bool is1D = ( (eltType0 == 1) | (eltType0 == 10 && zonep->nelts1D > 0) ); + if (is1D == true && ptrState->mode == RENDER) glLineWidth(1. + 5 * zonep->shaderParam1); + else if (is1D == true) glLineWidth(3.); + else glLineWidth(1.); + + // scale + E_Float s = MAX(zonep->xmax - zonep->xmin, zonep->ymax - zonep->ymin); + s = MAX(s, zonep->zmax - zonep->zmin); + s = 100. / (s + 1.e-12); + + // Only for textured rendering, we use vect display ======================= + if (ptrState->mode == RENDER && zonep->material == 14 && zonep->texu != NULL) // Textured rendering + { + // Sans doute également à modifier pour le high order ? + triggerShader(*zonep, zonep->material, s, color1); + + E_Int ff = 0; + double offb = 0.; #undef PLOT - double* f1 = zonep->texu; - double* f2 = zonep->texv; - double* f3 = zonep->texw; - double fmin1, fmax1, fmin2, fmax2, fmin3, fmax3; - fmax1 = 0.; fmin1 = 1.; - fmax2 = 0.; fmin2 = 1.; - fmax3 = 0.; fmin3 = 1.; + double* f1 = zonep->texu; + double* f2 = zonep->texv; + double* f3 = zonep->texw; + double fmin1, fmax1, fmin2, fmax2, fmin3, fmax3; + fmax1 = 0.; fmin1 = 1.; + fmax2 = 0.; fmin2 = 1.; + fmax3 = 0.; fmin3 = 1.; #define GL_QUADS_ARE GL_QUADS #define PLOTQUAD PLOTQUADQ #define PLOTQUAD2 PLOTQUADQ2 #include "displayUVectSolidZone.h" - glLineWidth( 1. ); - return; - } - // END Textured rendering =========================================== - // Activation du shader de tesselation : - int ishader = 0; - if (eltType0 == UnstructZone::TRI) - ishader = 1; // OK, element de type Tri_6, TRI_9, TRI_10, TRI_12 or TRI_15 - if (eltType0 == UnstructZone::QUAD) - ishader = 2; // OK, element de type Quad_8 ou Quad_9, QUAD_12, QUAD_16, QUAD_25 - this->_shaders.set_tesselation(ishader); - if (ptrState->mode == RENDER) - { - if (zonep->selected == 1 && zonep->active == 1) - triggerShader(*zonep, zonep->material, s, color2); - else - triggerShader(*zonep, zonep->material, s, color1); - } - else - { - if (zonep->selected == 1 && zonep->active == 1) - triggerShader(*zonep, 0, s, color2); - else - triggerShader(*zonep, 0, s, color1); - } - // Pour eviter de tracer le low order sans faire expres :-) - unsigned short idShader = this->_shaders.currentShader(); - int t_inner = this->ptrState->inner_tesselation; - int t_outer = this->ptrState->outer_tesselation; - this->_shaders[ idShader ]->setUniform( "uInner", (float)t_inner ); - this->_shaders[ idShader ]->setUniform( "uOuter", (float)t_outer ); - this->_shaders[ idShader ]->setUniform( "patch_size", (int)zonep->eltSize[0] ); - - glPatchParameteri(GL_PATCH_VERTICES, zonep->eltSize[0]); - glBegin(GL_PATCHES); - - E_Int ind_elt, ind; - E_Int ne = zonep->nec[0]; - E_Int stride = ne; - E_Int* connect = zonep->connect[0]; - double* x = zonep->x; - double* y = zonep->y; - double* z = zonep->z; + glLineWidth( 1. ); + return; + } + // END Textured rendering =========================================== + // Activation du shader de tesselation : + int ishader = 0; + if (eltType0 == UnstructZone::TRI) + ishader = 1; // OK, element de type Tri_6, TRI_9, TRI_10, TRI_12 or TRI_15 + if (eltType0 == UnstructZone::QUAD) + ishader = 2; // OK, element de type Quad_8 ou Quad_9, QUAD_12, QUAD_16, QUAD_25 + this->_shaders.set_tesselation(ishader); + if (ptrState->mode == RENDER) + { + if (zonep->selected == 1 && zonep->active == 1) + triggerShader(*zonep, zonep->material, s, color2); + else + triggerShader(*zonep, zonep->material, s, color1); + } + else + { + if (zonep->selected == 1 && zonep->active == 1) + triggerShader(*zonep, 0, s, color2); + else + triggerShader(*zonep, 0, s, color1); + } + // Pour eviter de tracer le low order sans faire expres :-) + unsigned short idShader = this->_shaders.currentShader(); + int t_inner = this->ptrState->inner_tesselation; + int t_outer = this->ptrState->outer_tesselation; + this->_shaders[ idShader ]->setUniform( "uInner", (float)t_inner ); + this->_shaders[ idShader ]->setUniform( "uOuter", (float)t_outer ); + this->_shaders[ idShader ]->setUniform( "patch_size", (int)zonep->eltSize[0] ); + + glPatchParameteri(GL_PATCH_VERTICES, zonep->eltSize[0]); + glBegin(GL_PATCHES); + + E_Int ind_elt, ind; + E_Int ne = zonep->nec[0]; + E_Int stride = ne; + E_Int* connect = zonep->connect[0]; + double* x = zonep->x; + double* y = zonep->y; + double* z = zonep->z; - for (E_Int ielts = 0; ielts < ne; ++ielts) + for (E_Int ielts = 0; ielts < ne; ++ielts) + { + ind_elt = ielts; + for (E_Int inode = 0; inode < zonep->eltSize[0]; inode++) { - ind_elt = ielts; - for (E_Int inode = 0; inode < zonep->eltSize[0]; inode++) - { - ind = connect[ind_elt + inode * stride]-1; - glVertex3f( (float)x[ind], (float)y[ind], (float)z[ind] ); - } + ind = connect[ind_elt + inode * stride]-1; + glVertex3f( (float)x[ind], (float)y[ind], (float)z[ind] ); } - glEnd(); - glLineWidth(1.); - return; + } + glEnd(); + glLineWidth(1.); + return; } diff --git a/Cassiopee/CPlot/CPlot/Display/displayUSolidZone.cpp b/Cassiopee/CPlot/CPlot/Display/displayUSolidZone.cpp index dd70a1c56..86d60118d 100644 --- a/Cassiopee/CPlot/CPlot/Display/displayUSolidZone.cpp +++ b/Cassiopee/CPlot/CPlot/Display/displayUSolidZone.cpp @@ -39,14 +39,6 @@ void Data::displayUSolidZone(UnstructZone *zonep, E_Int zone, E_Int zonet) E_Float nz = 1. / _numberOfUnstructZones; #include "solidStyles.h" - // Ecrasement si renderTag - if (zonep->colorR > -0.5) - { - color1[ 0 ] = zonep->colorR; - color1[ 1 ] = zonep->colorG; - color1[ 2 ] = zonep->colorB; - } - #include "selection.h" E_Int eltType0 = zonep->eltType[0]; diff --git a/Cassiopee/CPlot/CPlot/Display/renderDLSSolidZone.cpp b/Cassiopee/CPlot/CPlot/Display/renderDLSSolidZone.cpp index deb3d1b22..da95c2917 100644 --- a/Cassiopee/CPlot/CPlot/Display/renderDLSSolidZone.cpp +++ b/Cassiopee/CPlot/CPlot/Display/renderDLSSolidZone.cpp @@ -37,12 +37,6 @@ void DataDL::renderGPUSSolidZone(StructZone* zonep, E_Int zone) E_Float nz = 1./_numberOfStructZones; #include "solidStyles.h" - // Ecrasement si renderTag - if (zonep->colorR > -0.5) - {color1[0] = zonep->colorR; - color1[1] = zonep->colorG; - color1[2] = zonep->colorB;} - #include "selection.h" bool is1D = ((zonep->ni*zonep->nj == 1) | (zonep->ni*zonep->nk == 1) | (zonep->nj*zonep->nk == 1)); diff --git a/Cassiopee/CPlot/CPlot/Display/renderDLUSolidHOZone.cpp b/Cassiopee/CPlot/CPlot/Display/renderDLUSolidHOZone.cpp index fc76bb5ba..4ed096524 100644 --- a/Cassiopee/CPlot/CPlot/Display/renderDLUSolidHOZone.cpp +++ b/Cassiopee/CPlot/CPlot/Display/renderDLUSolidHOZone.cpp @@ -38,14 +38,6 @@ void DataDL::renderGPUUSolidHOZone(UnstructZone *zonep, E_Int zone, E_Int zonet) E_Float nz = 1. / _numberOfUnstructZones; #include "solidStyles.h" - // Ecrasement si renderTag - if (zonep->colorR > -0.5) - { - color1[ 0 ] = zonep->colorR; - color1[ 1 ] = zonep->colorG; - color1[ 2 ] = zonep->colorB; - } - #include "selection.h" E_Int eltType0 = zonep->eltType[0]; diff --git a/Cassiopee/CPlot/CPlot/Display/renderDLUSolidZone.cpp b/Cassiopee/CPlot/CPlot/Display/renderDLUSolidZone.cpp index 6661ca643..deddeb4f1 100644 --- a/Cassiopee/CPlot/CPlot/Display/renderDLUSolidZone.cpp +++ b/Cassiopee/CPlot/CPlot/Display/renderDLUSolidZone.cpp @@ -37,12 +37,6 @@ void DataDL::renderGPUUSolidZone(UnstructZone* zonep, E_Int zone, E_Int zonet) E_Float nz = 1./_numberOfUnstructZones; #include "solidStyles.h" - // Ecrasement si renderTag - if (zonep->colorR > -0.5) - {color1[0] = zonep->colorR; - color1[1] = zonep->colorG; - color1[2] = zonep->colorB;} - #include "selection.h" E_Int eltType0 = zonep->eltType[0]; diff --git a/Cassiopee/CPlot/CPlot/Display/solidStyles.h b/Cassiopee/CPlot/CPlot/Display/solidStyles.h index 0a4f87831..33a5f8cb7 100644 --- a/Cassiopee/CPlot/CPlot/Display/solidStyles.h +++ b/Cassiopee/CPlot/CPlot/Display/solidStyles.h @@ -42,3 +42,7 @@ color2[0] = 0.; color2[1] = 0.; color2[2] = 1; break; } + // Ecrasement si renderTag + if (zonep->colorR > -0.5) + {color1[0] = zonep->colorR; color1[1] = zonep->colorG; color1[2] = zonep->colorB;} + diff --git a/Cassiopee/CPlot/apps/tkMapEdge.py b/Cassiopee/CPlot/apps/tkMapEdge.py index 58d277122..41343ef5a 100644 --- a/Cassiopee/CPlot/apps/tkMapEdge.py +++ b/Cassiopee/CPlot/apps/tkMapEdge.py @@ -263,7 +263,10 @@ def uniformize1D(density, h, npts, factor): z = CTK.t[2][nob][2][noz] zones.append(z) try: - D._uniformize(zones, npts, h, factor, density) + if npts > 0: + for z in zones: D._uniformize(z, npts, h, factor, density) + else: + D._uniformize(zones, npts, h, factor, density) for c, nz in enumerate(nzs): nob = CTK.Nb[nz]+1 noz = CTK.Nz[nz] @@ -373,8 +376,7 @@ def apply2D(density, h, npts, factor, ntype=0): out.append(b) # Garde les autres out += u - #tp = C.newPyTree(['Base']) - #tp[2][1][2] += out + #tp = C.newPyTree(['Base', out]) #C.convertPyTree2File(tp, 'edges.cgns') # Rebuild @@ -734,7 +736,6 @@ def uniformize(event=None): density = -1; npts = 2; factor = -1; h = -1 if rtype == 'Density': density = CTK.varsFromWidget(VARS[0].get(), 1) - print('density', density) if len(density) != 1: CTK.TXT.insert('START', 'Invalid points density.\n') CTK.TXT.insert('START', 'Error: ', 'Error')