Skip to content

Commit

Permalink
OCC: add lonelyEdges detection, CPlot: mapEdge copy/paste
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit128 committed Sep 13, 2024
1 parent f78e818 commit e77c425
Show file tree
Hide file tree
Showing 15 changed files with 150 additions and 147 deletions.
5 changes: 1 addition & 4 deletions Cassiopee/CPlot/CPlot/Display/displaySMeshZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,17 @@ void Data::displaySMeshZone(StructZone* zonep, E_Int zone)
double pt1[3]; double pt2[3]; double pt3[3]; double pt4[3];

E_Float nz = 1./_numberOfStructZones;
#include "meshStyles.h"

// Grid dimensions
E_Int ni = zonep->ni;
E_Int nj = zonep->nj;
E_Int nk = zonep->nk;
if (ptrState->dim == 2) nk = 1;
E_Int nij = ni*nj;

bool is1D = false;
if (ni*nj == 1 || ni*nk == 1 || nj*nk == 1) is1D = true;

if (is1D) { glLineWidth(3.); color2[0] = 0.1; color2[1] = 0.1; color2[2] = 1.; }

#include "meshStyles.h"
#include "selection.h"

d = dist2BB(_view.xcam, _view.ycam, _view.zcam,
Expand Down
10 changes: 3 additions & 7 deletions Cassiopee/CPlot/CPlot/Display/displaySSolidZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,12 @@ void Data::displaySSolidZone(StructZone* zonep, E_Int zone)
getrgb = _plugins.zoneColorMap->f;

E_Float nz = 1./_numberOfStructZones;
bool is1D = ((zonep->ni*zonep->nj == 1) | (zonep->ni*zonep->nk == 1) | (zonep->nj*zonep->nk == 1));

#include "solidStyles.h"

#include "selection.h"

bool is1D = ((zonep->ni*zonep->nj == 1) | (zonep->ni*zonep->nk == 1) | (zonep->nj*zonep->nk == 1));
if (is1D == true && ptrState->mode == RENDER) glLineWidth(1.+5*zonep->shaderParam1);
else if (is1D == true) glLineWidth(3.);
else glLineWidth(1.);

if (is1D == true && ptrState->mode == MESH) return; // already drawn in mesh
if (is1D && ptrState->mode == MESH) return; // already drawn in mesh

// scale
E_Float s = MAX(zonep->xmax-zonep->xmin, zonep->ymax-zonep->ymin);
Expand Down
14 changes: 9 additions & 5 deletions Cassiopee/CPlot/CPlot/Display/displayUMeshHOZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ void Data::displayUMeshZone_ho(UnstructZone* zonep, E_Int zone, E_Int zonet)
double pt1[3]; double pt2[3]; double pt3[3]; double pt4[3];

E_Float nz = 1./_numberOfUnstructZones;
#include "meshStyles.h"
#include "selection.h"

E_Int eltType0 = zonep->eltType[0];
bool is1D = false;
if (eltType0 == 1 || eltType0 == 0 || (eltType0 == 10 && zonep->nelts1D > 0)) is1D = true;
if (is1D) glLineWidth(3.);

#include "meshStyles.h"
#include "selection.h"

int ishader = 3;
this->_shaders.set_tesselation(ishader);
this->_shaders.activate((short unsigned int)this->_shaders.shader_id(shader::None));
Expand All @@ -115,7 +115,11 @@ void Data::displayUMeshZone_ho(UnstructZone* zonep, E_Int zone, E_Int zonet)

// For BARS or NODES or 1D NGONS: display nodes
if (is1D)
{
{
if (zonep->colorR > -0.5)
{color1[0] = zonep->colorR; color1[1] = zonep->colorG; color1[2] = zonep->colorB;}
#include "selection.h"

glBegin(GL_QUADS);
if (zonep->blank == 0)
{
Expand Down
7 changes: 2 additions & 5 deletions Cassiopee/CPlot/CPlot/Display/displayUMeshZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,18 @@ void Data::displayUMeshZone(UnstructZone* zonep, E_Int zone, E_Int zonet)
double pt1[3]; double pt2[3]; double pt3[3]; double pt4[3];

E_Float nz = 1./_numberOfUnstructZones;
#include "meshStyles.h"

E_Int eltType0 = zonep->eltType[0];
bool is1D = false;
if (eltType0 == 1 || eltType0 == 0 || (eltType0 == 10 && zonep->nelts1D > 0)) is1D = true;

if (is1D) { glLineWidth(3.); color2[0] = 0.1; color2[1] = 0.1; color2[2] = 1.; }

#include "meshStyles.h"
#include "selection.h"

#include "displayUMeshZone.h"

// For BARS or NODES or 1D NGONS: display node
if (is1D)
{
{
glBegin(GL_QUADS);
if (zonep->blank == 0)
{
Expand Down
10 changes: 3 additions & 7 deletions Cassiopee/CPlot/CPlot/Display/displayUSolidHOZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,11 @@ void Data::displayUSolidHOZone(UnstructZone *zonep, E_Int zone, E_Int zonet)
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.);

#include "solidStyles.h"
#include "selection.h"

// scale
E_Float s = MAX(zonep->xmax - zonep->xmin, zonep->ymax - zonep->ymin);
Expand Down
102 changes: 49 additions & 53 deletions Cassiopee/CPlot/CPlot/Display/displayUSolidZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,75 +25,71 @@
//=============================================================================
void Data::displayUSolidZone(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;
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];
// Style
float color1[3]; float color2[3];

// Colormap
float r, g, b;
void (*getrgb)(Data* data, double, float*, float*, float*);
getrgb = _plugins.zoneColorMap->f;
// 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"
E_Float nz = 1. / _numberOfUnstructZones;
E_Int eltType0 = zonep->eltType[0];
bool is1D = ( (eltType0 == 1) | (eltType0 == 10 && zonep->nelts1D > 0) );

#include "selection.h"
#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.);
if (is1D && ptrState->mode == MESH) return; // already drawn in mesh

if (is1D == true && ptrState->mode == MESH) return; // already drawn in mesh
// 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);

// 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
{
// Only for textured rendering, we use vect display =======================
if (ptrState->mode == RENDER && zonep->material == 14 && zonep->texu != NULL) // Textured rendering
{
#ifdef __SHADERS__
triggerShader(*zonep, zonep->material, s, color1);
triggerShader(*zonep, zonep->material, s, color1);
#endif

E_Int ff = 0;
double offb = 0.;
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;
}
glLineWidth(1.);
return;
}
// END Textured rendering ============================================
#ifdef __SHADERS__
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);
}
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);
}
#endif

#undef PLOT
Expand All @@ -102,5 +98,5 @@ void Data::displayUSolidZone(UnstructZone *zonep, E_Int zone, E_Int zonet)
#undef PLOTQUAD
#undef PLOTQUAD2
#include "displayUSolidZone.h"
glLineWidth( 1. );
glLineWidth( 1. );
}
10 changes: 10 additions & 0 deletions Cassiopee/CPlot/CPlot/Display/meshStyles.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,13 @@
glLineWidth(1.*resf);
break;
}

// 1D specific
if (is1D)
{
if (zonep->colorR != -1.)
{ color1[0] = zonep->colorR; color1[1] = zonep->colorG; color1[2] = zonep->colorB; }
color2[0] = 0.1; color2[1] = 0.1; color2[2] = 1.;
glLineWidth(3.);
}

5 changes: 2 additions & 3 deletions Cassiopee/CPlot/CPlot/Display/renderDLSMeshZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ void DataDL::renderGPUSMeshZone(StructZone* zonep, E_Int zone)
double pt1[3]; double pt2[3]; double pt3[3]; double pt4[3];

E_Float nz = 1./_numberOfStructZones;
#include "meshStyles.h"

double* x = zonep->x;
double* y = zonep->y;
double* z = zonep->z;
Expand All @@ -101,7 +99,8 @@ void DataDL::renderGPUSMeshZone(StructZone* zonep, E_Int zone)
if (ptrState->dim == 2) nk = 1;
bool is1D = false;
if (ni*nj == 1 || ni*nk == 1 || nj*nk == 1) is1D = true;
if (is1D) { glLineWidth(3.); color2[0] = 0.1; color2[1] = 0.1; color2[2] = 1.; }

#include "meshStyles.h"
#include "selection.h"

d = dist2BB(_view.xcam, _view.ycam, _view.zcam,
Expand Down
9 changes: 3 additions & 6 deletions Cassiopee/CPlot/CPlot/Display/renderDLSSolidZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,11 @@ void DataDL::renderGPUSSolidZone(StructZone* zonep, E_Int zone)
getrgb = _plugins.zoneColorMap->f;

E_Float nz = 1./_numberOfStructZones;
#include "solidStyles.h"

#include "selection.h"

bool is1D = ((zonep->ni*zonep->nj == 1) | (zonep->ni*zonep->nk == 1) | (zonep->nj*zonep->nk == 1));
if (is1D == true && ptrState->mode == RENDER) glLineWidth(1.+5*zonep->shaderParam1);
else if (is1D == true) glLineWidth(3.);
else glLineWidth(1.);

#include "solidStyles.h"
#include "selection.h"

if (is1D == true && ptrState->mode == MESH) return; // already drawn in mesh

Expand Down
7 changes: 3 additions & 4 deletions Cassiopee/CPlot/CPlot/Display/renderDLUMeshZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,14 @@ void DataDL::renderGPUUMeshZone(UnstructZone* zonep, E_Int zone, E_Int zonet)
double pt4[3];

E_Float nz = 1. / _numberOfUnstructZones;
#include "meshStyles.h"

double* x = zonep->x;
double* y = zonep->y;
double* z = zonep->z;
E_Int eltType0 = zonep->eltType[0];
bool is1D = false;
if (eltType0 == 1 || eltType0 == 0 || (eltType0 == 10 && zonep->nelts1D > 0)) is1D = true;
if (is1D) { glLineWidth(3.); color2[0] = 0.1; color2[1] = 0.1; color2[2] = 1.; }

#include "meshStyles.h"
#include "selection.h"

if (zonep->_is_high_order == true)
Expand All @@ -129,7 +128,7 @@ void DataDL::renderGPUUMeshZone(UnstructZone* zonep, E_Int zone, E_Int zonet)

// For BARS, NODE, 1D NGONS: display node
if (is1D)
{
{
glBegin(GL_QUADS);
if (zonep->blank == 0)
{
Expand Down
9 changes: 3 additions & 6 deletions Cassiopee/CPlot/CPlot/Display/renderDLUSolidHOZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,12 @@ void DataDL::renderGPUUSolidHOZone(UnstructZone *zonep, E_Int zone, E_Int zonet)
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.);

#include "solidStyles.h"
#include "selection.h"

// scale
E_Float s = MAX(zonep->xmax - zonep->xmin, zonep->ymax - zonep->ymin);
Expand Down
9 changes: 3 additions & 6 deletions Cassiopee/CPlot/CPlot/Display/renderDLUSolidZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,12 @@ void DataDL::renderGPUUSolidZone(UnstructZone* zonep, E_Int zone, E_Int zonet)
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.);

#include "solidStyles.h"
#include "selection.h"

if (is1D == true && ptrState->mode == MESH) return; // already drawn in mesh

Expand Down
4 changes: 4 additions & 0 deletions Cassiopee/CPlot/CPlot/Display/solidStyles.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@
if (zonep->colorR > -0.5)
{color1[0] = zonep->colorR; color1[1] = zonep->colorG; color1[2] = zonep->colorB;}

// specifique aux zones 1D
if (is1D && ptrState->mode == RENDER) glLineWidth(1.+5*zonep->shaderParam1);
else if (is1D) glLineWidth(3.);
else glLineWidth(1.);
Loading

0 comments on commit e77c425

Please sign in to comment.