diff --git a/Common/Context.h b/Common/Context.h index b9b71aa800ce19fed4d5170ac55a3d76be307914..bbc82317292b17fdc7e6821a5226e1e518c15ecc 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -107,7 +107,6 @@ class Context_T { double light_position[6][4]; // light sources positions double shine, shine_exponent; // material specular reflection parameters int render_mode; // GMSH_RENDER, GMSH_SELECT, GMSH_FEEDBACK - int clip[6]; // status of clip planes (bit arrays) double clip_plane[6][4]; // clipping planes int clip_whole_elements, clip_only_draw_intersecting_volume, clip_only_volume; // clip options int polygon_offset, polygon_offset_always; // polygon offset control @@ -146,6 +145,7 @@ class Context_T { double tolerance; double snap[3]; int occ_fix_small_edges, occ_fix_small_faces, occ_sew_faces; + int clip; // status of clip planes (bit array) } geom; // mesh options @@ -179,6 +179,7 @@ class Context_T { int zone_definition; PartitionOptions partition_options; CGNSOptions cgns_options; + int clip; // status of clip planes (bit array) } mesh; // post processing options diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index e86f9d439fb701198c33a9d8c2b0d42074a2ee97..ba972ab05302173aac732775f2093850b2a71813 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -459,8 +459,6 @@ StringXNumber GeneralOptions_Number[] = { { F|O, "BackgroundGradient" , opt_general_background_gradient , 1. , "Draw background gradient (0=none, 1=vertical, 2=horizontal, 3=radial)" }, - { F, "Clip0" , opt_general_clip0 , 0. , - "Enable clipping plane 0 (Geometry=2^0, Mesh=2^1, View[i]=2^(2+i))" }, { F, "Clip0A" , opt_general_clip0a , 1.0 , "First coefficient in equation for clipping plane 0 (`A' in `AX+BY+CZ+D=0')" }, { F, "Clip0B" , opt_general_clip0b , 0.0 , @@ -469,8 +467,6 @@ StringXNumber GeneralOptions_Number[] = { "Third coefficient in equation for clipping plane 0 (`C' in `AX+BY+CZ+D=0')" }, { F, "Clip0D" , opt_general_clip0d , 0.0 , "Fourth coefficient in equation for clipping plane 0 (`D' in `AX+BY+CZ+D=0')" }, - { F, "Clip1" , opt_general_clip1 , 0., - "Enable clipping plane 1 (Geometry=2^0, Mesh=2^1, View[i]=2^(2+i))" }, { F, "Clip1A" , opt_general_clip1a , 1.0 , "First coefficient in equation for clipping plane 1" }, { F, "Clip1B" , opt_general_clip1b , 0.0 , @@ -479,8 +475,6 @@ StringXNumber GeneralOptions_Number[] = { "Third coefficient in equation for clipping plane 1" }, { F, "Clip1D" , opt_general_clip1d , 0.0 , "Fourth coefficient in equation for clipping plane 1" }, - { F, "Clip2" , opt_general_clip2 , 0., - "Enable clipping plane 2 (Geometry=2^0, Mesh=2^1, View[i]=2^(2+i))" }, { F, "Clip2A" , opt_general_clip2a , 1.0 , "First coefficient in equation for clipping plane 2" }, { F, "Clip2B" , opt_general_clip2b , 0.0 , @@ -489,8 +483,6 @@ StringXNumber GeneralOptions_Number[] = { "Third coefficient in equation for clipping plane 2" }, { F, "Clip2D" , opt_general_clip2d , 0.0 , "Fourth coefficient in equation for clipping plane 2" }, - { F, "Clip3" , opt_general_clip3 , 0., - "Enable clipping plane 3 (Geometry=2^0, Mesh=2^1, View[i]=2^(2+i))" }, { F, "Clip3A" , opt_general_clip3a , 1.0 , "First coefficient in equation for clipping plane 3" }, { F, "Clip3B" , opt_general_clip3b , 0.0 , @@ -499,8 +491,6 @@ StringXNumber GeneralOptions_Number[] = { "Third coefficient in equation for clipping plane 3" }, { F, "Clip3D" , opt_general_clip3d , 0.0 , "Fourth coefficient in equation for clipping plane 3" }, - { F, "Clip4" , opt_general_clip4 , 0., - "Enable clipping plane 4 (Geometry=2^0, Mesh=2^1, View[i]=2^(2+i))" }, { F, "Clip4A" , opt_general_clip4a , 1.0 , "First coefficient in equation for clipping plane 4" }, { F, "Clip4B" , opt_general_clip4b , 0.0 , @@ -509,8 +499,6 @@ StringXNumber GeneralOptions_Number[] = { "Third coefficient in equation for clipping plane 4" }, { F, "Clip4D" , opt_general_clip4d , 0.0 , "Fourth coefficient in equation for clipping plane 4" }, - { F, "Clip5" , opt_general_clip5 , 0., - "Enable clipping plane 5 (Geometry=2^0, Mesh=2^1, View[i]=2^(2+i))" }, { F, "Clip5A" , opt_general_clip5a , 1.0 , "First coefficient in equation for clipping plane 5" }, { F, "Clip5B" , opt_general_clip5b , 0.0 , @@ -807,6 +795,8 @@ StringXNumber GeometryOptions_Number[] = { { F|O, "CirclePoints" , opt_geometry_circle_points, 20. , "Number of points used to draw a circle/ellipse" }, + { F, "Clip" , opt_geometry_clip , 0., + "Enable clipping planes? (Plane[i]=2^i, i=0,...,5)" }, { F|O, "ExtrudeReturnLateralEntities" , opt_geometry_extrude_return_lateral, 1. , "Add lateral entities in lists returned by extrusion commands?" }, @@ -950,6 +940,8 @@ StringXNumber MeshOptions_Number[] = { "Compute characteristic lengths from curvature" }, { F|O, "CharacteristicLengthFromPoints" , opt_mesh_lc_from_points , 1. , "Compute characteristic lengths from values given at geometry points" }, + { F, "Clip" , opt_mesh_clip , 0., + "Enable clipping planes? (Plane[i]=2^i, i=0,...,5)" }, { F|O, "ColorCarousel" , opt_mesh_color_carousel , 1. , "Mesh coloring (0=by element type, 1=by elementary entity, 2=by physical entity, 3=by partition)" }, { F, "CpuTime" , opt_mesh_cpu_time , 0. , @@ -1241,6 +1233,8 @@ StringXNumber ViewOptions_Number[] = { { F|O, "CenterGlyphs" , opt_view_center_glyphs , 0, "Center glyphs (arrows, numbers, etc.)" }, + { F, "Clip" , opt_view_clip , 0., + "Enable clipping planes? (Plane[i]=2^i, i=0,...,5)" }, { F|O, "ColormapAlpha" , opt_view_colormap_alpha , 1.0 , "Colormap alpha channel value (used only if != 1)" }, { F|O, "ColormapAlphaPower" , opt_view_colormap_alpha_power , 0.0 , diff --git a/Common/Options.cpp b/Common/Options.cpp index ccf8dbb8a1ce56482cf1b1a8a008004f628a299b..0ffc03d2253aabdae8980768f503fa2986c89942 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -3492,17 +3492,6 @@ double opt_general_expert_mode(OPT_ARGS_NUM) return CTX.expert_mode; } -double opt_general_clip0(OPT_ARGS_NUM) -{ - if(action & GMSH_SET) - CTX.clip[0] = (int)val; -#if defined(HAVE_FLTK) - if(WID && (action & GMSH_GUI)) - WID->reset_clip_browser(); -#endif - return CTX.clip[0]; -} - double opt_general_clip0a(OPT_ARGS_NUM) { if(action & GMSH_SET) @@ -3547,17 +3536,6 @@ double opt_general_clip0d(OPT_ARGS_NUM) return CTX.clip_plane[0][3]; } -double opt_general_clip1(OPT_ARGS_NUM) -{ - if(action & GMSH_SET) - CTX.clip[1] = (int)val; -#if defined(HAVE_FLTK) - if(WID && (action & GMSH_GUI)) - WID->reset_clip_browser(); -#endif - return CTX.clip[1]; -} - double opt_general_clip1a(OPT_ARGS_NUM) { if(action & GMSH_SET) @@ -3602,17 +3580,6 @@ double opt_general_clip1d(OPT_ARGS_NUM) return CTX.clip_plane[1][3]; } -double opt_general_clip2(OPT_ARGS_NUM) -{ - if(action & GMSH_SET) - CTX.clip[2] = (int)val; -#if defined(HAVE_FLTK) - if(WID && (action & GMSH_GUI)) - WID->reset_clip_browser(); -#endif - return CTX.clip[2]; -} - double opt_general_clip2a(OPT_ARGS_NUM) { if(action & GMSH_SET) @@ -3657,17 +3624,6 @@ double opt_general_clip2d(OPT_ARGS_NUM) return CTX.clip_plane[2][3]; } -double opt_general_clip3(OPT_ARGS_NUM) -{ - if(action & GMSH_SET) - CTX.clip[3] = (int)val; -#if defined(HAVE_FLTK) - if(WID && (action & GMSH_GUI)) - WID->reset_clip_browser(); -#endif - return CTX.clip[3]; -} - double opt_general_clip3a(OPT_ARGS_NUM) { if(action & GMSH_SET) @@ -3712,17 +3668,6 @@ double opt_general_clip3d(OPT_ARGS_NUM) return CTX.clip_plane[3][3]; } -double opt_general_clip4(OPT_ARGS_NUM) -{ - if(action & GMSH_SET) - CTX.clip[4] = (int)val; -#if defined(HAVE_FLTK) - if(WID && (action & GMSH_GUI)) - WID->reset_clip_browser(); -#endif - return CTX.clip[4]; -} - double opt_general_clip4a(OPT_ARGS_NUM) { if(action & GMSH_SET) @@ -3767,17 +3712,6 @@ double opt_general_clip4d(OPT_ARGS_NUM) return CTX.clip_plane[4][3]; } -double opt_general_clip5(OPT_ARGS_NUM) -{ - if(action & GMSH_SET) - CTX.clip[5] = (int)val; -#if defined(HAVE_FLTK) - if(WID && (action & GMSH_GUI)) - WID->reset_clip_browser(); -#endif - return CTX.clip[5]; -} - double opt_general_clip5a(OPT_ARGS_NUM) { if(action & GMSH_SET) @@ -4457,6 +4391,17 @@ double opt_geometry_snap2(OPT_ARGS_NUM) return CTX.geom.snap[2]; } +double opt_geometry_clip(OPT_ARGS_NUM) +{ + if(action & GMSH_SET) + CTX.geom.clip = (int)val; +#if defined(HAVE_FLTK) + if(WID && (action & GMSH_GUI)) + WID->reset_clip_browser(); +#endif + return CTX.geom.clip; +} + double opt_mesh_optimize(OPT_ARGS_NUM) { if(action & GMSH_SET) @@ -5616,6 +5561,17 @@ double opt_mesh_partition_metis_refine_algorithm(OPT_ARGS_NUM) return CTX.mesh.partition_options.refine_algorithm; } +double opt_mesh_clip(OPT_ARGS_NUM) +{ + if(action & GMSH_SET) + CTX.mesh.clip = (int)val; +#if defined(HAVE_FLTK) + if(WID && (action & GMSH_GUI)) + WID->reset_clip_browser(); +#endif + return CTX.mesh.clip; +} + double opt_solver_max_delay(OPT_ARGS_NUM) { if(action & GMSH_SET) @@ -7852,6 +7808,24 @@ double opt_view_use_stipple(OPT_ARGS_NUM) #endif } +double opt_view_clip(OPT_ARGS_NUM) +{ +#if !defined(HAVE_NO_POST) + GET_VIEW(0.); + if(action & GMSH_SET) { + opt->Clip = (int)val; + } +#if defined(HAVE_FLTK) + if(_gui_action_valid(action, num)){ + WID->reset_clip_browser(); + } +#endif + return opt->Clip; +#else + return 0.; +#endif +} + double opt_print_format(OPT_ARGS_NUM) { if(action & GMSH_SET) diff --git a/Common/Options.h b/Common/Options.h index bd70424558c769fe0c6b99628429522f57ce4a6f..d8f535d5812fe794692523ef5815f34fc8b334b6 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -324,32 +324,26 @@ double opt_general_trackball(OPT_ARGS_NUM); double opt_general_rotation_center_cg(OPT_ARGS_NUM); double opt_general_zoom_factor(OPT_ARGS_NUM); double opt_general_expert_mode(OPT_ARGS_NUM); -double opt_general_clip0(OPT_ARGS_NUM); double opt_general_clip0a(OPT_ARGS_NUM); double opt_general_clip0b(OPT_ARGS_NUM); double opt_general_clip0c(OPT_ARGS_NUM); double opt_general_clip0d(OPT_ARGS_NUM); -double opt_general_clip1(OPT_ARGS_NUM); double opt_general_clip1a(OPT_ARGS_NUM); double opt_general_clip1b(OPT_ARGS_NUM); double opt_general_clip1c(OPT_ARGS_NUM); double opt_general_clip1d(OPT_ARGS_NUM); -double opt_general_clip2(OPT_ARGS_NUM); double opt_general_clip2a(OPT_ARGS_NUM); double opt_general_clip2b(OPT_ARGS_NUM); double opt_general_clip2c(OPT_ARGS_NUM); double opt_general_clip2d(OPT_ARGS_NUM); -double opt_general_clip3(OPT_ARGS_NUM); double opt_general_clip3a(OPT_ARGS_NUM); double opt_general_clip3b(OPT_ARGS_NUM); double opt_general_clip3c(OPT_ARGS_NUM); double opt_general_clip3d(OPT_ARGS_NUM); -double opt_general_clip4(OPT_ARGS_NUM); double opt_general_clip4a(OPT_ARGS_NUM); double opt_general_clip4b(OPT_ARGS_NUM); double opt_general_clip4c(OPT_ARGS_NUM); double opt_general_clip4d(OPT_ARGS_NUM); -double opt_general_clip5(OPT_ARGS_NUM); double opt_general_clip5a(OPT_ARGS_NUM); double opt_general_clip5b(OPT_ARGS_NUM); double opt_general_clip5c(OPT_ARGS_NUM); @@ -421,6 +415,7 @@ double opt_geometry_scaling_factor(OPT_ARGS_NUM); double opt_geometry_snap0(OPT_ARGS_NUM); double opt_geometry_snap1(OPT_ARGS_NUM); double opt_geometry_snap2(OPT_ARGS_NUM); +double opt_geometry_clip(OPT_ARGS_NUM); double opt_mesh_label_frequency(OPT_ARGS_NUM); double opt_mesh_optimize(OPT_ARGS_NUM); double opt_mesh_optimize_netgen(OPT_ARGS_NUM); @@ -524,6 +519,7 @@ double opt_mesh_partition_chaco_terminal_propogation(OPT_ARGS_NUM); double opt_mesh_partition_metis_algorithm(OPT_ARGS_NUM); double opt_mesh_partition_metis_edge_matching(OPT_ARGS_NUM); double opt_mesh_partition_metis_refine_algorithm(OPT_ARGS_NUM); +double opt_mesh_clip(OPT_ARGS_NUM); double opt_solver_max_delay(OPT_ARGS_NUM); double opt_solver_listen(OPT_ARGS_NUM); double opt_solver_plugins(OPT_ARGS_NUM); @@ -662,6 +658,7 @@ double opt_view_point_size(OPT_ARGS_NUM); double opt_view_line_width(OPT_ARGS_NUM); double opt_view_point_type(OPT_ARGS_NUM); double opt_view_line_type(OPT_ARGS_NUM); +double opt_view_clip(OPT_ARGS_NUM); double opt_print_format(OPT_ARGS_NUM); double opt_print_eps_compress(OPT_ARGS_NUM); double opt_print_eps_ps3shading(OPT_ARGS_NUM); diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 6d50d8099412a53a0844782d0869bb15a8e60f4d..967ab7fe86c529ba6ce3b7b9f2acdd4c254553e6 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -2337,19 +2337,39 @@ void clip_update_cb(CALLBACK_ARGS) { if(WID->clip_group[0]->visible()){ // clipping planes int idx = WID->clip_choice->value(); - CTX.clip[idx] = 0; - for(int i = 0; i < WID->clip_browser->size(); i++) - if(WID->clip_browser->selected(i+1)) - CTX.clip[idx] += (1<<i); + CTX.geom.clip &= ~(1 << idx); + CTX.mesh.clip &= ~(1 << idx); + for(unsigned int i = 0; i < PView::list.size(); i++) + PView::list[i]->getOptions()->Clip &= ~(1 << idx); + for(int i = 0; i < WID->clip_browser->size(); i++){ + if(WID->clip_browser->selected(i + 1)){ + if(i == 0) + CTX.geom.clip |= (1 << idx); + else if(i == 1) + CTX.mesh.clip |= (1 << idx); + else if(i - 2 < PView::list.size()) + PView::list[i - 2]->getOptions()->Clip |= (1 << idx); + } + } for(int i = 0; i < 4; i++) CTX.clip_plane[idx][i] = WID->clip_value[i]->value(); } else{ // clipping box - for(int idx = 0; idx < 6; idx++){ - CTX.clip[idx] = 0; - for(int i = 0; i < WID->clip_browser->size(); i++) - if(WID->clip_browser->selected(i+1)) - CTX.clip[idx] += (1<<i); + CTX.geom.clip = 0; + CTX.mesh.clip = 0; + for(unsigned int i = 0; i < PView::list.size(); i++) + PView::list[i]->getOptions()->Clip = 0; + for(int i = 0; i < WID->clip_browser->size(); i++){ + if(WID->clip_browser->selected(i + 1)){ + for(int idx = 0; idx < 6; idx++){ + if(i == 0) + CTX.geom.clip |= (1 << idx); + else if(i == 1) + CTX.mesh.clip |= (1 << idx); + else if(i - 2 < PView::list.size()) + PView::list[i - 2]->getOptions()->Clip |= (1 << idx); + } + } } double c[3] = {WID->clip_value[4]->value(), WID->clip_value[5]->value(), @@ -2379,10 +2399,10 @@ void clip_update_cb(CALLBACK_ARGS) if(CTX.clip_whole_elements || CTX.clip_whole_elements != WID->clip_butt[0]->value()){ for(int clip = 0; clip < 6; clip++){ - if(CTX.clip[clip] & 2) + if(CTX.mesh.clip) CTX.mesh.changed |= (ENT_LINE | ENT_SURFACE | ENT_VOLUME); for(unsigned int index = 0; index < PView::list.size(); index++) - if(CTX.clip[clip] & (1 << (2 + index))) + if(PView::list[index]->getOptions()->Clip) PView::list[index]->setChanged(true); } } @@ -2409,8 +2429,12 @@ void clip_invert_cb(CALLBACK_ARGS) void clip_reset_cb(CALLBACK_ARGS) { + CTX.geom.clip = 0; + CTX.mesh.clip = 0; + for(unsigned int index = 0; index < PView::list.size(); index++) + PView::list[index]->getOptions()->Clip = 0; + for(int i = 0; i < 6; i++){ - CTX.clip[i] = 0; CTX.clip_plane[i][0] = 1.; for(int j = 1; j < 4; j++) CTX.clip_plane[i][j] = 0.; diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 1382f387f937be3a87341f42c42955ffca2e060e..115bb1ffecdaab8ef2aa9bf1596a0ca772b33e88 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -4547,9 +4547,13 @@ void GUI::reset_clip_browser() } int idx = clip_choice->value(); clip_browser->deselect(); - for(int i = 0; i < clip_browser->size(); i++) - if(CTX.clip[idx] & (1<<i)) - clip_browser->select(i+1); + for(int i = 0; i < clip_browser->size(); i++){ + if((i == 0 && CTX.geom.clip & (1 << idx)) || + (i == 1 && CTX.mesh.clip & (1 << idx)) || + (i - 2 < PView::list.size() && + PView::list[i - 2]->getOptions()->Clip & (1 << idx))) + clip_browser->select(i + 1); + } for(int i = 0; i < 4; i++) clip_value[i]->value(CTX.clip_plane[idx][i]); for(int i = 4; i < 7; i++) diff --git a/Graphics/Axes.cpp b/Graphics/Axes.cpp index 8add366b00fd08e871f1b60340c10119b82d61bf..ee93f164f768e47d15bcb1a6f27c47826bc99288 100644 --- a/Graphics/Axes.cpp +++ b/Graphics/Axes.cpp @@ -29,7 +29,7 @@ void Draw_Axes() CTX.max[0], CTX.max[1], CTX.max[2]); glColor3d(1.,0.,0.); for(int j = 0; j < 6; j++) - if(CTX.clip[j] & 1 || CTX.clip[j] & 2) + if(CTX.geom.clip & (1 << j) || CTX.mesh.clip & (1 << j)) Draw_PlaneInBoundingBox(CTX.min[0], CTX.min[1], CTX.min[2], CTX.max[0], CTX.max[1], CTX.max[2], CTX.clip_plane[j][0], CTX.clip_plane[j][1], diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp index 1c79082456c54c1e7b01901379cf45f31efc169b..4866ad7ef2492b2b344591bc7ecb235a1fdd606c 100644 --- a/Graphics/Geom.cpp +++ b/Graphics/Geom.cpp @@ -518,7 +518,7 @@ void Draw_Geom() glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE); for(int i = 0; i < 6; i++) - if(CTX.clip[i] & 1) + if(CTX.geom.clip & (1 << i)) glEnable((GLenum)(GL_CLIP_PLANE0 + i)); else glDisable((GLenum)(GL_CLIP_PLANE0 + i)); diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp index ada2c1aba892ae4145c15d55bea3eb9ef525db45..4d0a285519d7dc2260ab90bd105f3a4722da4a99 100644 --- a/Graphics/Mesh.cpp +++ b/Graphics/Mesh.cpp @@ -116,7 +116,7 @@ static bool isElementVisible(MElement *ele) if(CTX.clip_whole_elements){ bool hidden = false; for(int clip = 0; clip < 6; clip++){ - if(CTX.clip[clip] & 2){ + if(CTX.mesh.clip & (1 << clip)){ if(ele->getDim() < 3 && CTX.clip_only_volume){ } else{ @@ -772,7 +772,7 @@ class initMeshGRegion { { if(CTX.clip_whole_elements && CTX.clip_only_draw_intersecting_volume){ for(int clip = 0; clip < 6; clip++){ - if(CTX.clip[clip] & 2) + if(CTX.mesh.clip & (1 << clip)) return (int)sqrt((double)num); } } @@ -920,7 +920,7 @@ void Draw_Mesh() if(!CTX.clip_whole_elements){ for(int i = 0; i < 6; i++) - if(CTX.clip[i] & 2) + if(CTX.mesh.clip & (1 << i)) glEnable((GLenum)(GL_CLIP_PLANE0 + i)); else glDisable((GLenum)(GL_CLIP_PLANE0 + i)); diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp index 992ac188303e55826db57f0fc8db0b75bba4ba01..83d605c04299d8b5e8122a2bc63fc6d1f03e06a8 100644 --- a/Graphics/Post.cpp +++ b/Graphics/Post.cpp @@ -280,12 +280,13 @@ static double intersectClipPlane(int clip, int numNodes, double xyz[NMAX][3]) return val; } -static bool isElementVisible(int index, int dim, int numNodes, double xyz[NMAX][3]) +static bool isElementVisible(PViewOptions *opt, int dim, int numNodes, + double xyz[NMAX][3]) { if(!CTX.clip_whole_elements) return true; bool hidden = false; for(int clip = 0; clip < 6; clip++){ - if(CTX.clip[clip] & (1 << (2 + index))){ + if(opt->Clip & (1 << clip)){ if(dim < 3 && CTX.clip_only_volume){ } else{ @@ -953,7 +954,7 @@ static void addElementsInArrays(PView *p, bool preprocessNormalsOnly) } changeCoordinates(p, ent, i, numNodes, numEdges, numComp, xyz, val); int dim = data->getDimension(opt->TimeStep, ent, i); - if(!isElementVisible(p->getIndex(), dim, numNodes, xyz)) continue; + if(!isElementVisible(opt, dim, numNodes, xyz)) continue; for(int j = 0; j < numNodes; j++) opt->TmpBBox += SPoint3(xyz[j][0], xyz[j][1], xyz[j][2]); @@ -1243,8 +1244,9 @@ class initPView { int _estimateIfClipped(PView *p, int num) { if(CTX.clip_whole_elements && CTX.clip_only_draw_intersecting_volume){ + PViewOptions *opt = p->getOptions(); for(int clip = 0; clip < 6; clip++){ - if(CTX.clip[clip] & (1 << (2 + p->getIndex()))) + if(opt->Clip & (1 << clip)) return (int)sqrt((double)num); } } @@ -1381,7 +1383,7 @@ class drawPView { if(!CTX.clip_whole_elements){ for(int i = 0; i < 6; i++) - if(CTX.clip[i] & (1 << (2 + p->getIndex()))) + if(opt->Clip & (1 << i)) glEnable((GLenum)(GL_CLIP_PLANE0 + i)); else glDisable((GLenum)(GL_CLIP_PLANE0 + i)); @@ -1490,7 +1492,7 @@ class drawPViewBoundingBox { bb.max().x(), bb.max().y(), bb.max().z()); glColor3d(1., 0., 0.); for(int i = 0; i < 6; i++) - if(CTX.clip[i] & (1 << (2 + p->getIndex()))) + if(opt->Clip & (1 << i)) Draw_PlaneInBoundingBox(bb.min().x(), bb.min().y(), bb.min().z(), bb.max().x(), bb.max().y(), bb.max().z(), CTX.clip_plane[i][0], CTX.clip_plane[i][1], diff --git a/Post/PViewOptions.h b/Post/PViewOptions.h index e3c2cad1b749c8801e91e6041ca77d453be8aaf2..c15b18c90b596d47198444e74022a0d11bebb0af 100644 --- a/Post/PViewOptions.h +++ b/Post/PViewOptions.h @@ -85,6 +85,7 @@ class PViewOptions { void *GenRaise_f[3]; double TargetError; int MaxRecursionLevel; + int Clip; // status of clip planes (bit array) struct{ unsigned int point, line, triangle, quadrangle; unsigned int tetrahedron, hexahedron, prism, pyramid; diff --git a/doc/VERSIONS.txt b/doc/VERSIONS.txt index 91a01f091802c539f9f65cd465dfcaf22e145ffa..7eeaa93d48cb5fa9a2ef1889f89e53812be6ba0f 100644 --- a/doc/VERSIONS.txt +++ b/doc/VERSIONS.txt @@ -1,4 +1,7 @@ -$Id: VERSIONS.txt,v 1.18 2008-11-20 19:12:54 geuzaine Exp $ +$Id: VERSIONS.txt,v 1.19 2008-11-25 17:18:33 geuzaine Exp $ + +2.2.7 (?): fixed clipping planes when more than 32 views are present +(replaced General.Clip with {Geometry,Mesh,View}.Clip). 2.2.6 (Nov 21, 2008): better transfinite smoothing and automatic corner selection; fixed high order meshing crashes on Windows and diff --git a/doc/texinfo/opt_general.texi b/doc/texinfo/opt_general.texi index ecef8fdef0ddd33442b67f171d1b2a46e7ef7449..1a529223f088eb010697edc31741009d3ec59c91 100644 --- a/doc/texinfo/opt_general.texi +++ b/doc/texinfo/opt_general.texi @@ -179,11 +179,6 @@ Draw background gradient (0=none, 1=vertical, 2=horizontal, 3=radial)@* Default value: @code{1}@* Saved in: @code{General.OptionsFileName} -@item General.Clip0 -Enable clipping plane 0 (Geometry=2^0, Mesh=2^1, View[i]=2^(2+i))@* -Default value: @code{0}@* -Saved in: @code{-} - @item General.Clip0A First coefficient in equation for clipping plane 0 (`A' in `AX+BY+CZ+D=0')@* Default value: @code{1}@* @@ -204,11 +199,6 @@ Fourth coefficient in equation for clipping plane 0 (`D' in `AX+BY+CZ+D=0')@* Default value: @code{0}@* Saved in: @code{-} -@item General.Clip1 -Enable clipping plane 1 (Geometry=2^0, Mesh=2^1, View[i]=2^(2+i))@* -Default value: @code{0}@* -Saved in: @code{-} - @item General.Clip1A First coefficient in equation for clipping plane 1@* Default value: @code{1}@* @@ -229,11 +219,6 @@ Fourth coefficient in equation for clipping plane 1@* Default value: @code{0}@* Saved in: @code{-} -@item General.Clip2 -Enable clipping plane 2 (Geometry=2^0, Mesh=2^1, View[i]=2^(2+i))@* -Default value: @code{0}@* -Saved in: @code{-} - @item General.Clip2A First coefficient in equation for clipping plane 2@* Default value: @code{1}@* @@ -254,11 +239,6 @@ Fourth coefficient in equation for clipping plane 2@* Default value: @code{0}@* Saved in: @code{-} -@item General.Clip3 -Enable clipping plane 3 (Geometry=2^0, Mesh=2^1, View[i]=2^(2+i))@* -Default value: @code{0}@* -Saved in: @code{-} - @item General.Clip3A First coefficient in equation for clipping plane 3@* Default value: @code{1}@* @@ -279,11 +259,6 @@ Fourth coefficient in equation for clipping plane 3@* Default value: @code{0}@* Saved in: @code{-} -@item General.Clip4 -Enable clipping plane 4 (Geometry=2^0, Mesh=2^1, View[i]=2^(2+i))@* -Default value: @code{0}@* -Saved in: @code{-} - @item General.Clip4A First coefficient in equation for clipping plane 4@* Default value: @code{1}@* @@ -304,11 +279,6 @@ Fourth coefficient in equation for clipping plane 4@* Default value: @code{0}@* Saved in: @code{-} -@item General.Clip5 -Enable clipping plane 5 (Geometry=2^0, Mesh=2^1, View[i]=2^(2+i))@* -Default value: @code{0}@* -Saved in: @code{-} - @item General.Clip5A First coefficient in equation for clipping plane 5@* Default value: @code{1}@* diff --git a/doc/texinfo/opt_geometry.texi b/doc/texinfo/opt_geometry.texi index 6112b2f026f679bbe671c732e301b7f5294f455d..fe8f5d91999a2f82156a947e589c10453e4d6d44 100644 --- a/doc/texinfo/opt_geometry.texi +++ b/doc/texinfo/opt_geometry.texi @@ -14,6 +14,11 @@ Number of points used to draw a circle/ellipse@* Default value: @code{20}@* Saved in: @code{General.OptionsFileName} +@item Geometry.Clip +Enable clipping planes? (Plane[i]=2^i, i=0,...,5)@* +Default value: @code{0}@* +Saved in: @code{-} + @item Geometry.ExtrudeReturnLateralEntities Add lateral entities in lists returned by extrusion commands?@* Default value: @code{1}@* diff --git a/doc/texinfo/opt_mesh.texi b/doc/texinfo/opt_mesh.texi index adbdf9a728e48b5cb0770dd2b1bab982babc12e7..e5d96aa3462897f7b7cb3c44ba08a9a768fe3c23 100644 --- a/doc/texinfo/opt_mesh.texi +++ b/doc/texinfo/opt_mesh.texi @@ -149,6 +149,11 @@ Compute characteristic lengths from values given at geometry points@* Default value: @code{1}@* Saved in: @code{General.OptionsFileName} +@item Mesh.Clip +Enable clipping planes? (Plane[i]=2^i, i=0,...,5)@* +Default value: @code{0}@* +Saved in: @code{-} + @item Mesh.ColorCarousel Mesh coloring (0=by element type, 1=by elementary entity, 2=by physical entity, 3=by partition)@* Default value: @code{1}@* diff --git a/doc/texinfo/opt_view.texi b/doc/texinfo/opt_view.texi index 83892c423d2e13d4dcbbeacdf02d5fb4ab8bffe8..baf88027a83fec9c581154d5bef4296046b23b31 100644 --- a/doc/texinfo/opt_view.texi +++ b/doc/texinfo/opt_view.texi @@ -219,6 +219,11 @@ Center glyphs (arrows, numbers, etc.)@* Default value: @code{0}@* Saved in: @code{General.OptionsFileName} +@item View.Clip +Enable clipping planes? (Plane[i]=2^i, i=0,...,5)@* +Default value: @code{0}@* +Saved in: @code{-} + @item View.ColormapAlpha Colormap alpha channel value (used only if != 1)@* Default value: @code{1}@*