Skip to content
Snippets Groups Projects
Commit f2d1fbef authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

avoid overflow (vertex array stored as floats) - fixes #270

parent 96d0447e
No related branches found
No related tags found
No related merge requests found
...@@ -145,7 +145,8 @@ static void drawVectorArray(drawContext *ctx, PView *p, VertexArray *va) ...@@ -145,7 +145,8 @@ static void drawVectorArray(drawContext *ctx, PView *p, VertexArray *va)
float *s = va->getVertexArray(3 * i); float *s = va->getVertexArray(3 * i);
float *v = va->getVertexArray(3 * (i + 1)); float *v = va->getVertexArray(3 * (i + 1));
glColor4ubv((GLubyte *)va->getColorArray(4 * i)); glColor4ubv((GLubyte *)va->getColorArray(4 * i));
double l = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); double vv[3] = {v[0], v[1], v[2]};
double l = sqrt(vv[0] * vv[0] + vv[1] * vv[1] + vv[2] * vv[2]);
double lmax = opt->tmpMax; double lmax = opt->tmpMax;
if((l || opt->vectorType == 6) && lmax){ if((l || opt->vectorType == 6) && lmax){
double scale = (opt->arrowSizeMax - opt->arrowSizeMin) / lmax; double scale = (opt->arrowSizeMax - opt->arrowSizeMin) / lmax;
...@@ -408,7 +409,7 @@ class drawPView { ...@@ -408,7 +409,7 @@ class drawPView {
// use adaptive data if available // use adaptive data if available
PViewData *data = p->getData(true); PViewData *data = p->getData(true);
PViewOptions *opt = p->getOptions(); PViewOptions *opt = p->getOptions();
if(data->getDirty() || !data->getNumTimeSteps()) return; if(data->getDirty() || !data->getNumTimeSteps()) return;
if(!opt->visible || opt->type != PViewOptions::Plot3D) return; if(!opt->visible || opt->type != PViewOptions::Plot3D) return;
if(!_ctx->isVisible(p)) return; if(!_ctx->isVisible(p)) return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment