diff --git a/Common/Options.cpp b/Common/Options.cpp index 6801433afe9275c2aef836659d80e2ac21c85ec2..6657a383af9119a8db78ba557d57393094aef270 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.243 2005-05-21 04:55:59 geuzaine Exp $ +// $Id: Options.cpp,v 1.244 2005-05-21 17:27:03 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -5432,7 +5432,7 @@ double opt_view_max_recursion_level(OPT_ARGS_NUM) { GET_VIEW(0.); if(action & GMSH_SET) { - if (v->adaptive) + if(v->adaptive) v->adaptive->setGlobalResolutionLevel(v,(int)val); } #if defined(HAVE_FLTK) @@ -5442,7 +5442,7 @@ double opt_view_max_recursion_level(OPT_ARGS_NUM) } } #endif - if (v->adaptive) + if(v->adaptive) return v->adaptive->getGlobalResolutionLevel(); return 0; } @@ -5451,15 +5451,14 @@ double opt_view_target_error(OPT_ARGS_NUM) { GET_VIEW(0.); if(action & GMSH_SET) { - if (v->adaptive) - { - v->adaptive->setTolerance(val); - v->adaptive->setGlobalResolutionLevel(v,v->adaptive->getGlobalResolutionLevel()); - } + if(v->adaptive) { + v->adaptive->setTolerance(val); + v->adaptive->setGlobalResolutionLevel(v,v->adaptive->getGlobalResolutionLevel()); + } } #if defined(HAVE_FLTK) if(_gui_action_valid(action, num)) { - if (v->adaptive){ + if(v->adaptive){ WID->view_value[34]->value(v->adaptive->getTolerance()); } } @@ -6195,6 +6194,7 @@ double opt_view_line_type(OPT_ARGS_NUM) GET_VIEW(0.); if(action & GMSH_SET) { v->LineType = (int)val; + v->Changed = 1; } #if defined(HAVE_FLTK) if(_gui_action_valid(action, num)) { diff --git a/Common/Views.cpp b/Common/Views.cpp index 53425e18201a6f49acbd01f6939e0e84c55efb49..4c15390b216e881ca94632bf258a7c71316f4b2d 100644 --- a/Common/Views.cpp +++ b/Common/Views.cpp @@ -1,4 +1,4 @@ -// $Id: Views.cpp,v 1.174 2005-04-06 19:03:01 geuzaine Exp $ +// $Id: Views.cpp,v 1.175 2005-05-21 17:27:03 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -94,6 +94,7 @@ Post_View *BeginView(int allocate) v->Index = i; v->Dirty = 1; v->TriVertexArray = NULL; + v->LinVertexArray = NULL; v->NbTimeStep = 1; v->TimeStepMin = NULL; v->TimeStepMax = NULL; @@ -586,6 +587,7 @@ void FreeView(Post_View * v) // Note: all the second order elements have already been freed in xxxx if(v->normals) delete v->normals; if(v->TriVertexArray) delete v->TriVertexArray; + if(v->LinVertexArray) delete v->LinVertexArray; if(v->adaptive) delete v->adaptive; FreeGeneralizedRaise(v); Free(v); diff --git a/Common/Views.h b/Common/Views.h index cf608c46512787f0f23e32c8698104f66579d518..c3e3825e2ec05802b7e3b872aad5fd575592570d 100644 --- a/Common/Views.h +++ b/Common/Views.h @@ -69,8 +69,8 @@ class Post_View{ int NbT2, NbT3; List_T *T2D, *T2C, *T3D, *T3C; // 2D and 3D text strings - // a vertex array to draw triangles efficiently - VertexArray *TriVertexArray; + // vertex arrays to draw triangles and lines efficiently + VertexArray *TriVertexArray, *LinVertexArray; // options int Type; diff --git a/Graphics/Iso.cpp b/Graphics/Iso.cpp index 570b8923011b0b2b946394ec4eb541a96aee4e02..61d03af6fbef05bf991da6f0afc2fc565890ee39 100644 --- a/Graphics/Iso.cpp +++ b/Graphics/Iso.cpp @@ -1,4 +1,4 @@ -// $Id: Iso.cpp,v 1.33 2005-01-01 19:35:29 geuzaine Exp $ +// $Id: Iso.cpp,v 1.34 2005-05-21 17:27:03 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -33,7 +33,7 @@ extern Context_T CTX; // Draw an iso-line inside a triangle void IsoTriangle(Post_View * View, double *X, double *Y, double *Z, - double *Val, double V) + double *Val, double V, unsigned int color) { // don't draw anything if the value is constant if(Val[0] == Val[1] && Val[0] == Val[2]) @@ -54,8 +54,17 @@ void IsoTriangle(Post_View * View, double *X, double *Y, double *Z, nb++; } - if(nb == 2) - Draw_Line(View->LineType, View->LineWidth, Xp, Yp, Zp, View->Light); + if(nb == 2){ + if(View->LinVertexArray && View->LinVertexArray->fill && !View->LineType){ + View->LinVertexArray->add(Xp[0], Yp[0], Zp[0], color); + View->LinVertexArray->add(Xp[1], Yp[1], Zp[1], color); + View->LinVertexArray->num++; + } + else{ + glColor4ubv((GLubyte *) & color); + Draw_Line(View->LineType, View->LineWidth, Xp, Yp, Zp, View->Light); + } + } } // Compute the polygon between the two iso-lines V1 and V2 in a diff --git a/Graphics/Iso.h b/Graphics/Iso.h index eb6e4f5816cec5cb6ea0448d2682148cc11c7c9e..2a04457df3b29159d6f1d4ad01274b0c4a9b37f2 100644 --- a/Graphics/Iso.h +++ b/Graphics/Iso.h @@ -33,8 +33,9 @@ void CutLine(double *X, double *Y, double *Z, double *Val, void IsoLine(Post_View *View, double *X, double *Y, double *Z, double *Val, double V); -void IsoTriangle(Post_View *View, double *X, double *Y, double *Z, - double *Val, double V); +void IsoTriangle(Post_View *View, + double *X, double *Y, double *Z, double *Val, double V, + unsigned int color); void IsoSimplex(Post_View *View, int preproNormals, double *X, double *Y, double *Z, double *Val, double V, diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp index c0f6733df5eff8be31dfb2d04c4d131caacd1ebe..a40ae312bb3fcf9794d414f2838c0d19456450ee 100644 --- a/Graphics/Post.cpp +++ b/Graphics/Post.cpp @@ -1,4 +1,4 @@ -// $Id: Post.cpp,v 1.99 2005-03-14 18:55:22 geuzaine Exp $ +// $Id: Post.cpp,v 1.100 2005-05-21 17:27:03 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -648,6 +648,9 @@ void Draw_Post(void) if(v->TriVertexArray) delete v->TriVertexArray; v->TriVertexArray = new VertexArray(3, 10000); v->TriVertexArray->fill = 1; + if(v->LinVertexArray) delete v->LinVertexArray; + v->LinVertexArray = new VertexArray(2, 10000); + v->LinVertexArray->fill = 1; goto pass_0; } } @@ -655,14 +658,16 @@ void Draw_Post(void) } else{ // don't even enter the classic data path if we don't have to - if(v->TriVertexArray){ - if(v->Boundary < 1 && !v->ShowElement && !v->Normals && - v->IntervalsType != DRAW_POST_NUMERIC && v->IntervalsType != DRAW_POST_ISO){ + if(v->TriVertexArray || v->LinVertexArray){ + if(v->Boundary < 1 && !v->ShowElement && !v->Normals && + (!v->LineType || (v->LineType && v->IntervalsType != DRAW_POST_ISO)) && + v->IntervalsType != DRAW_POST_NUMERIC){ Msg(DEBUG, "View[%d]: skiping 2D scalar pass alltogether", v->Index); skip_2d = 1; } if(v->Boundary < 2 && !v->ShowElement && - v->IntervalsType != DRAW_POST_NUMERIC && v->IntervalsType != DRAW_POST_ISO){ + (!v->LineType || (v->LineType && v->IntervalsType != DRAW_POST_ISO)) && + v->IntervalsType != DRAW_POST_NUMERIC){ Msg(DEBUG, "View[%d]: skiping 3D scalar pass alltogether", v->Index); skip_3d = 1; } @@ -742,10 +747,13 @@ void Draw_Post(void) Msg(DEBUG, "View[%d]; %d tris in vertex array", v->Index, v->TriVertexArray->num); v->TriVertexArray->fill = 0; } + if(v->LinVertexArray && v->LinVertexArray->fill){ + Msg(DEBUG, "View[%d]; %d segs in vertex array", v->Index, v->LinVertexArray->num); + v->LinVertexArray->fill = 0; + } } if(v->TriVertexArray && v->TriVertexArray->num){ - if(CTX.alpha && ColorTable_IsAlpha(&v->CT) && !v->FakeTransparency && (changedEye() || v->Changed)){ Msg(DEBUG, "Sorting View[%d] for transparency (WITH vertex array)", v->Index); @@ -774,6 +782,16 @@ void Draw_Post(void) glDisableClientState(GL_NORMAL_ARRAY); } + if(v->LinVertexArray && v->LinVertexArray->num){ + glVertexPointer(3, GL_FLOAT, 0, v->LinVertexArray->vertices->array); + glColorPointer(4, GL_UNSIGNED_BYTE, 0, v->LinVertexArray->colors->array); + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_COLOR_ARRAY); + glDrawArrays(GL_LINES, 0, 2 * v->LinVertexArray->num); + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + } + if(v->DrawStrings) { glColor4ubv((GLubyte *) & v->color.text3d); Draw_Text2D3D(3, v->TimeStep, v->NbT3, v->T3D, v->T3C); diff --git a/Graphics/PostElement.cpp b/Graphics/PostElement.cpp index 32d9a656bd7c5d899857af0d3d0301c3a1d51979..7d1a8172bf41a209603e5908139fb9619091ef36 100644 --- a/Graphics/PostElement.cpp +++ b/Graphics/PostElement.cpp @@ -1,4 +1,4 @@ -// $Id: PostElement.cpp,v 1.64 2005-04-06 16:30:52 geuzaine Exp $ +// $Id: PostElement.cpp,v 1.65 2005-05-21 17:27:04 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -575,13 +575,15 @@ void Draw_ScalarTriangle(Post_View * View, int preproNormals, } } - if(!preproNormals && View->IntervalsType == DRAW_POST_ISO) { + if(!preproNormals && View->IntervalsType == DRAW_POST_ISO && + (!View->LinVertexArray || (View->LinVertexArray && View->LinVertexArray->fill) || + View->LineType)){ for(int k = 0; k < View->NbIso; k++) { if(ValMin == ValMax) k = View->NbIso / 2; - PaletteDiscrete(View, View->NbIso, k); + unsigned int col = PaletteDiscrete(View, View->NbIso, k); IsoTriangle(View, X, Y, Z, Val, - View->GVFI(ValMin, ValMax, View->NbIso, k)); + View->GVFI(ValMin, ValMax, View->NbIso, k), col); if(ValMin == ValMax) break; } diff --git a/TODO b/TODO index 932378f8966e79c985dbdcd53da21de87375cec2..e0f37285d4223b8d902392a4d800e33cbba045fa 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -$Id: TODO,v 1.91 2005-03-14 21:19:32 geuzaine Exp $ +$Id: TODO,v 1.92 2005-05-21 17:27:03 geuzaine Exp $ ******************************************************************** @@ -30,10 +30,6 @@ add GUI for ******************************************************************** -add vertex arrays for isolines in post-pro - -******************************************************************** - Labels: - add dynamic variables? E.g., if a string contains %string.string, replace it dynamically in Draw_Text2D/3D by calling diff --git a/doc/VERSIONS b/doc/VERSIONS index 2801646f1f59584ae1057e094bdec4c2f58a3a75..3a1b99a5afe95cb744c7c2a1a30e3630df1f8ad8 100644 --- a/doc/VERSIONS +++ b/doc/VERSIONS @@ -1,4 +1,4 @@ -$Id: VERSIONS,v 1.327 2005-05-21 01:10:48 geuzaine Exp $ +$Id: VERSIONS,v 1.328 2005-05-21 17:27:04 geuzaine Exp $ New since 1.60: added support for second order (curved) elements in post-processor; new version (1.4) of post-processing file formats; new @@ -6,7 +6,7 @@ stippling options for 2D plots; removed limit on allowed number of files on command line; all "Combine" operations are now available in the parser; changed View.ArrowLocation into View.GlyphLocation; optimized memory usage when loading many (>1000) views; optimzed -loading and drawing of line meshes; +loading and drawing of line meshes and 2D iso views; New in 1.60: added support for discrete curves; new Window menu on Mac OS X; generalized all octree-based plugins (CutGrid, StreamLines,