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

new displayBorderFactor option

parent 669802e6
No related branches found
No related tags found
No related merge requests found
...@@ -114,6 +114,8 @@ class CTX { ...@@ -114,6 +114,8 @@ class CTX {
int nonModalWindows; int nonModalWindows;
// clipping plane distance factor // clipping plane distance factor
double clipFactor; double clipFactor;
// display border factor (0 = model fits window size exactly)
double displayBorderFactor;
// do or do not use the trackball for rotations // do or do not use the trackball for rotations
int useTrackball, trackballHyperbolicSheet; int useTrackball, trackballHyperbolicSheet;
// point around which to rotate the scene // point around which to rotate the scene
... ...
......
...@@ -583,6 +583,8 @@ StringXNumber GeneralOptions_Number[] = { ...@@ -583,6 +583,8 @@ StringXNumber GeneralOptions_Number[] = {
"Vertical position (in pixels) of the upper left corner of the contextual " "Vertical position (in pixels) of the upper left corner of the contextual "
"windows" }, "windows" },
{ F|O, "DisplayBorderFactor" , opt_general_display_border_factor , 1./3. ,
"Border factor for model display (0: model fits window size exactly)" },
{ F|O, "DoubleBuffer" , opt_general_double_buffer , 1. , { F|O, "DoubleBuffer" , opt_general_double_buffer , 1. ,
"Use a double buffered graphic window (on Unix, should be set to 0 when " "Use a double buffered graphic window (on Unix, should be set to 0 when "
"working on a remote host without GLX)" }, "working on a remote host without GLX)" },
... ...
......
...@@ -3024,6 +3024,13 @@ double opt_general_clip_factor(OPT_ARGS_NUM) ...@@ -3024,6 +3024,13 @@ double opt_general_clip_factor(OPT_ARGS_NUM)
return CTX::instance()->clipFactor; return CTX::instance()->clipFactor;
} }
double opt_general_display_border_factor(OPT_ARGS_NUM)
{
if(action & GMSH_SET)
CTX::instance()->displayBorderFactor = val;
return CTX::instance()->displayBorderFactor;
}
double opt_general_point_size(OPT_ARGS_NUM) double opt_general_point_size(OPT_ARGS_NUM)
{ {
if(action & GMSH_SET) if(action & GMSH_SET)
... ...
......
...@@ -294,6 +294,7 @@ double opt_general_scale0(OPT_ARGS_NUM); ...@@ -294,6 +294,7 @@ double opt_general_scale0(OPT_ARGS_NUM);
double opt_general_scale1(OPT_ARGS_NUM); double opt_general_scale1(OPT_ARGS_NUM);
double opt_general_scale2(OPT_ARGS_NUM); double opt_general_scale2(OPT_ARGS_NUM);
double opt_general_clip_factor(OPT_ARGS_NUM); double opt_general_clip_factor(OPT_ARGS_NUM);
double opt_general_display_border_factor(OPT_ARGS_NUM);
double opt_general_point_size(OPT_ARGS_NUM); double opt_general_point_size(OPT_ARGS_NUM);
double opt_general_line_width(OPT_ARGS_NUM); double opt_general_line_width(OPT_ARGS_NUM);
double opt_general_shine(OPT_ARGS_NUM); double opt_general_shine(OPT_ARGS_NUM);
... ...
......
...@@ -262,7 +262,6 @@ void drawContext::draw3d() ...@@ -262,7 +262,6 @@ void drawContext::draw3d()
void drawContext::draw2d() void drawContext::draw2d()
{ {
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
for(int i = 0; i < 6; i++) for(int i = 0; i < 6; i++)
glDisable((GLenum)(GL_CLIP_PLANE0 + i)); glDisable((GLenum)(GL_CLIP_PLANE0 + i));
...@@ -292,14 +291,12 @@ void drawContext::draw2d() ...@@ -292,14 +291,12 @@ void drawContext::draw2d()
void drawContext::initProjection(int xpick, int ypick, int wpick, int hpick) void drawContext::initProjection(int xpick, int ypick, int wpick, int hpick)
{ {
double Va = double Va =
(double) (viewport[3] - viewport[1]) / (double) (viewport[3] - viewport[1]) /
(double) (viewport[2] - viewport[0]); (double) (viewport[2] - viewport[0]);
double Wa = (CTX::instance()->max[1] - CTX::instance()->min[1]) / double Wa = (CTX::instance()->max[1] - CTX::instance()->min[1]) /
(CTX::instance()->max[0] - CTX::instance()->min[0]); (CTX::instance()->max[0] - CTX::instance()->min[0]);
// compute the viewport in World coordinates (with margins) // compute the viewport in World coordinates (with margins)
if(Va > Wa) { if(Va > Wa) {
vxmin = CTX::instance()->min[0]; vxmin = CTX::instance()->min[0];
...@@ -317,10 +314,12 @@ void drawContext::initProjection(int xpick, int ypick, int wpick, int hpick) ...@@ -317,10 +314,12 @@ void drawContext::initProjection(int xpick, int ypick, int wpick, int hpick)
vymin = CTX::instance()->min[1]; vymin = CTX::instance()->min[1];
vymax = CTX::instance()->max[1]; vymax = CTX::instance()->max[1];
} }
vxmin -= (vxmax - vxmin) / 3.; double fact = CTX::instance()->displayBorderFactor;
vxmax += 0.25 * (vxmax - vxmin); double xborder = fact * (vxmax - vxmin), yborder = fact * (vymax - vymin);
vymin -= (vymax - vymin) / 3.; vxmin -= xborder;
vymax += 0.25 * (vymax - vymin); vxmax += xborder;
vymin -= yborder;
vymax += yborder;
// store what one pixel represents in world coordinates // store what one pixel represents in world coordinates
pixel_equiv_x = (vxmax - vxmin) / (viewport[2] - viewport[0]); pixel_equiv_x = (vxmax - vxmin) / (viewport[2] - viewport[0]);
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment