Skip to content

Commit

Permalink
OCC: blindage param, CPlot: simplify 1d
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit128 committed Sep 12, 2024
1 parent 0f56cf8 commit 003d842
Show file tree
Hide file tree
Showing 9 changed files with 193 additions and 209 deletions.
6 changes: 3 additions & 3 deletions Cassiopee/CPlot/CPlot/Display/displaySMeshZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ 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"
#include "meshStyles.h"

// Grid dimensions
E_Int ni = zonep->ni;
Expand All @@ -102,7 +102,7 @@ void Data::displaySMeshZone(StructZone* zonep, E_Int zone)

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

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

d = dist2BB(_view.xcam, _view.ycam, _view.zcam,
zonep->xmin, zonep->ymin, zonep->zmin,
Expand All @@ -111,7 +111,7 @@ void Data::displaySMeshZone(StructZone* zonep, E_Int zone)
// steps
computeSteps(zonep, stepi, stepj, stepk);

#include "displaySMeshZone.h"
#include "displaySMeshZone.h"

// Zones 1D: on ajoute les noeuds
if (is1D)
Expand Down
8 changes: 3 additions & 5 deletions Cassiopee/CPlot/CPlot/Display/displaySSolidZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,13 @@ void Data::displaySSolidZone(StructZone* zonep, E_Int zone)
getrgb = _plugins.zoneColorMap->f;

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

// Ecrasement si renderTag
if (zonep->colorR > -0.5)
{color1[0] = zonep->colorR;
color1[1] = zonep->colorG;
color1[2] = zonep->colorB;}
{color1[0] = zonep->colorR; color1[1] = zonep->colorG; color1[2] = zonep->colorB;}

#include "selection.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);
Expand Down
13 changes: 5 additions & 8 deletions Cassiopee/CPlot/CPlot/Display/displayUMeshHOZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,8 @@ 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"
#include "meshStyles.h"
#include "selection.h"

E_Int eltType0 = zonep->eltType[0];
bool is1D = false;
Expand All @@ -116,20 +115,18 @@ void Data::displayUMeshZone_ho(UnstructZone* zonep, E_Int zone, E_Int zonet)

// For BARS or NODES or 1D NGONS: display nodes
if (is1D)
{
{
glBegin(GL_QUADS);
if (zonep->blank == 0)
{
for (i = 0; i < zonep->np; i++)
{ PLOTNODE; }
for (i = 0; i < zonep->np; i++) { PLOTNODE; }
}
else
{
for (i = 0; i < zonep->np; i++)
{
ret = _pref.blanking->f(this, i, zonep->blank, zone);
if (ret != 0)
{ PLOTNODE; }
if (ret != 0) { PLOTNODE; }
}
}
glEnd();
Expand Down
28 changes: 4 additions & 24 deletions Cassiopee/CPlot/CPlot/Display/displayUMeshZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,41 +89,21 @@ 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"
#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 "selection.h"
#include "selection.h"

/*if ( zonep->_is_high_order == true )
{
int ishader = 0;
if ( eltType0 == UnstructZone::TRI )
ishader = 1; // OK, element de type Tri_6
if ( eltType0 == UnstructZone::QUAD )
ishader = 2; // OK, element de type Quad_8
if ( not this->_shaders.has_tesselation() ) {
this->_shaders.set_tesselation( ishader );
}
this->_shaders.activate( (short unsigned int)this->_shaders.shader_id(0) );
std::cerr << "Shader id ::: " << this->_shaders.currentShader() << std::flush << std::endl;
int t_inner = this->ptrState->inner_tesselation;
int t_outer = this->ptrState->outer_tesselation;
this->_shaders[ this->_shaders.currentShader() ]->setUniform( "uInner", (float)t_inner );
this->_shaders[ this->_shaders.currentShader() ]->setUniform( "uOuter", (float)t_outer );
glPatchParameteri( GL_PATCH_VERTICES, zonep->eltSize );
}*/

#include "displayUMeshZone.h"
#include "displayUMeshZone.h"

// For BARS or NODES or 1D NGONS: display node
if (is1D)
{
{
glBegin(GL_QUADS);
if (zonep->blank == 0)
{
Expand Down
4 changes: 2 additions & 2 deletions Cassiopee/CPlot/CPlot/Display/renderDLSMeshZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ 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"
#include "meshStyles.h"

double* x = zonep->x;
double* y = zonep->y;
Expand All @@ -102,7 +102,7 @@ void DataDL::renderGPUSMeshZone(StructZone* zonep, E_Int zone)
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 "selection.h"
#include "selection.h"

d = dist2BB(_view.xcam, _view.ycam, _view.zcam,
zonep->xmin, zonep->ymin, zonep->zmin,
Expand Down
149 changes: 74 additions & 75 deletions Cassiopee/CPlot/CPlot/Display/renderDLUMeshZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,89 +63,88 @@
//=============================================================================
void DataDL::renderGPUUMeshZone(UnstructZone* zonep, E_Int zone, E_Int zonet)
{
ZoneImplDL* zImpl = static_cast<ZoneImplDL*>(zonep->ptr_impl);
if (zImpl->_DLmesh == 0)
{
displayUMeshZone(zonep, zone, zonet);
return;
}
E_Int i, ret;
ZoneImplDL* zImpl = static_cast<ZoneImplDL*>(zonep->ptr_impl);
if (zImpl->_DLmesh == 0)
{
displayUMeshZone(zonep, zone, zonet);
return;
}
E_Int i, ret;

// Style colors
float color1[3]; float color2[3];
// Style colors
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;

// For node rendering (1D zones)
double dref = 0.004;
double xi, yi, zi;
double viewMatrix[16];
glGetDoublev(GL_MODELVIEW_MATRIX, viewMatrix);
double right[3];
right[0] = viewMatrix[0];
right[1] = viewMatrix[4];
right[2] = viewMatrix[8];
double up[3];
up[0] = viewMatrix[1];
up[1] = viewMatrix[5];
up[2] = viewMatrix[9];
double xcam = _view.xcam;
double ycam = _view.ycam;
double zcam = _view.zcam;
double dx, dy, dz, dist, d;
double pru0, pru1, pru2, mru0, mru1, mru2;
double pt1[3];
double pt2[3];
double pt3[3];
double pt4[3];
// For node rendering (1D zones)
double dref = 0.004;
double xi, yi, zi;
double viewMatrix[16];
glGetDoublev(GL_MODELVIEW_MATRIX, viewMatrix);
double right[3];
right[0] = viewMatrix[0];
right[1] = viewMatrix[4];
right[2] = viewMatrix[8];
double up[3];
up[0] = viewMatrix[1];
up[1] = viewMatrix[5];
up[2] = viewMatrix[9];
double xcam = _view.xcam;
double ycam = _view.ycam;
double zcam = _view.zcam;
double dx, dy, dz, dist, d;
double pru0, pru1, pru2, mru0, mru1, mru2;
double pt1[3];
double pt2[3];
double pt3[3];
double pt4[3];

E_Float nz = 1. / _numberOfUnstructZones;
#include "meshStyles.h"
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 "selection.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 "selection.h"

// glCallList(zonep->_DLmesh);
if (zonep->_is_high_order == true)
{
int ishader = 3;
this->_shaders.set_tesselation(ishader);
this->_shaders.activate((short unsigned int)this->_shaders.shader_id(shader::None));
int t_outer = this->ptrState->outer_tesselation;
this->_shaders[this->_shaders.currentShader()]->setUniform("uOuter", (float)t_outer);
this->_shaders[this->_shaders.currentShader()]->setUniform( "patch_size", 3 );
if (zonep->_is_high_order == true)
{
int ishader = 3;
this->_shaders.set_tesselation(ishader);
this->_shaders.activate((short unsigned int)this->_shaders.shader_id(shader::None));
int t_outer = this->ptrState->outer_tesselation;
this->_shaders[this->_shaders.currentShader()]->setUniform("uOuter", (float)t_outer);
this->_shaders[this->_shaders.currentShader()]->setUniform( "patch_size", 3 );

glPatchParameteri( GL_PATCH_VERTICES, GLint(3) );
}
glCallList(zImpl->_DLmesh);
glPatchParameteri( GL_PATCH_VERTICES, GLint(3) );
}
glCallList(zImpl->_DLmesh);

// For BARS, NODE, 1D NGONS: display node
if (is1D)
// For BARS, NODE, 1D NGONS: display node
if (is1D)
{
glBegin(GL_QUADS);
if (zonep->blank == 0)
{
for (i = 0; i < zonep->np; i++) { PLOTNODE; }
}
else
{
glBegin(GL_QUADS);
if (zonep->blank == 0)
{
for (i = 0; i < zonep->np; i++) { PLOTNODE; }
}
else
{
for (i = 0; i < zonep->np; i++)
{
ret = _pref.blanking->f(this, i, zonep->blank, zonet);
if (ret != 0) { PLOTNODE; }
}
}
glEnd();
for (i = 0; i < zonep->np; i++)
{
ret = _pref.blanking->f(this, i, zonep->blank, zonet);
if (ret != 0) { PLOTNODE; }
}
}
this->_shaders.activate((short unsigned int)0);
glLineWidth(1.);
glEnd();
}
this->_shaders.activate((short unsigned int)0);
glLineWidth(1.);
}
Loading

0 comments on commit 003d842

Please sign in to comment.