clipping plane

This commit is contained in:
Joachim Schoeberl 2012-11-05 11:28:58 +00:00
parent eaf9ec57ac
commit ce505100a5
2 changed files with 33 additions and 22 deletions

View File

@ -833,7 +833,7 @@ proc viewingoptionsdialog { } {
tixControl $f.subdiv -label "Subdivision" -integer true \
-variable visoptions.subdivisions -min 0 -max 8 \
-options { entry.width 2 } \
-command { puts "mesh-subdivision"; Ng_SetVisParameters; Ng_Vis_Set parameters; Ng_SetNextTimeStamp; redraw }
-command { Ng_SetVisParameters; Ng_Vis_Set parameters; Ng_SetNextTimeStamp; redraw }
checkbutton $f.showbadels -text "Show bad elements" \
@ -1094,8 +1094,10 @@ proc viewingoptionsdialog { } {
proc clipplanecommand { { optionalvar 0 } } {
Ng_SetVisParameters
after idle redraw
}
set clippingdialog_pop1 0
@ -1123,18 +1125,20 @@ proc clippingdialog { } {
set w .clipping_dlg
if {[winfo exists .clipping_dlg] == 1} {
wm withdraw $w
wm deiconify $w
focus $w
} {
} {
toplevel $w
label $w.lab1 -text "Normal x"
scale $w.scale1 -orient horizontal -length 300 -from -1 -to 1 \
-resolution 0.01 -tickinterval 0.5 \
-variable viewoptions.clipping.nx \
-command { popupcheckredraw2 clippingdialog_pop1 ${viewoptions.clipping.enable} }
-command { clipplanecommand }
# -command { popupcheckredraw2 clippingdialog_pop1 ${viewoptions.clipping.enable} }
# Ng_SetVisParameters;
# if { ${viewoptions.clipping.enable} == 1 } { redraw };
@ -1144,28 +1148,33 @@ proc clippingdialog { } {
scale $w.scale2 -orient horizontal -length 300 -from -1 -to 1 \
-resolution 0.01 -tickinterval 0.5 \
-variable viewoptions.clipping.ny \
-command { popupcheckredraw2 clippingdialog_pop2 ${viewoptions.clipping.enable} }
-command { clipplanecommand }
# -command { popupcheckredraw2 clippingdialog_pop2 ${viewoptions.clipping.enable} }
label $w.lab3 -text "Normal z"
scale $w.scale3 -orient horizontal -length 300 -from -1 -to 1 \
-resolution 0.01 -tickinterval 0.5 \
-variable viewoptions.clipping.nz \
-command { popupcheckredraw2 clippingdialog_pop3 ${viewoptions.clipping.enable} }
-command { clipplanecommand }
# -command { popupcheckredraw2 clippingdialog_pop3 ${viewoptions.clipping.enable} }
label $w.lab4 -text "Distance"
scale $w.scale4 -orient horizontal -length 300 -from -1 -to 1.001 \
-resolution 0.0001 -tickinterval 0.5 \
-variable viewoptions.clipping.dist \
-command { popupcheckredraw2 clippingdialog_pop4 ${viewoptions.clipping.enable} }
-command { clipplanecommand }
# -command { popupcheckredraw2 clippingdialog_pop4 ${viewoptions.clipping.enable} }
tixControl $w.clipdomain -label "Clip only domain" -integer true \
-variable viewoptions.clipping.onlydomain -min 0 -max 50 \
-options { entry.width 2 } \
-command { Ng_SetVisParameters; redraw }
-command { clipplanecommand; }
# -command { Ng_SetVisParameters; redraw }
tixControl $w.donotclipdomain -label "Do not clip domain" -integer true \
-variable viewoptions.clipping.notdomain -min 0 -max 50 \
-options { entry.width 2 } \
-command { Ng_SetVisParameters; redraw }
-command { clipplanecommand; }
# -command { Ng_SetVisParameters; redraw }
pack $w.lab1 $w.scale1 $w.lab2 $w.scale2 $w.lab3 $w.scale3 $w.lab4 $w.scale4 $w.clipdomain $w.donotclipdomain
@ -1193,11 +1202,10 @@ proc clippingdialog { } {
# grab $w
focus $w
# $w.scale1 configure -command { puts "call1b"; Ng_SetVisParameters; redraw }
# puts "after"
clipplanecommand
}
}

View File

@ -31,7 +31,6 @@ The interface between the GUI and the netgen library
extern bool nodisplay;
#include <nginterface.h>
// extern "C" void RunParallel ( void * (*fun)(void *), void * in);
@ -686,14 +685,13 @@ namespace netgen
sprintf (buf, "%lf", multithread.percent);
Tcl_SetVar (interp, "::status_percent", buf, 0);
int i;
lstring[0] = 0;
for (i = 1; i <= tets_in_qualclass.Size(); i++)
for (int i = 1; i <= tets_in_qualclass.Size(); i++)
{
sprintf (buf, " %d", tets_in_qualclass.Get(i));
strcat (lstring, buf);
}
for (i = tets_in_qualclass.Size()+1; i <= 20; i++)
for (int i = tets_in_qualclass.Size()+1; i <= 20; i++)
strcat (lstring, " 0");
Tcl_SetVar (interp, "::status_tetqualclasses", lstring, 0);
@ -2862,17 +2860,22 @@ void PlayAnimFile(const char* name, int speed, int maxcnt)
vispar.locviewer = atoi (Tcl_GetVar (interp, "::viewoptions.light.locviewer", TCL_GLOBAL_ONLY));
vispar.transp = atof (Tcl_GetVar (interp, "::viewoptions.mat.transp", TCL_GLOBAL_ONLY));
vispar.clipnormal.X() = atof (Tcl_GetVar (interp, "::viewoptions.clipping.nx", TCL_GLOBAL_ONLY));
vispar.clipnormal.Y() = atof (Tcl_GetVar (interp, "::viewoptions.clipping.ny", TCL_GLOBAL_ONLY));
vispar.clipnormal.Z() = atof (Tcl_GetVar (interp, "::viewoptions.clipping.nz", TCL_GLOBAL_ONLY));
vispar.clipdist = atof (Tcl_GetVar (interp, "::viewoptions.clipping.dist", TCL_GLOBAL_ONLY));
vispar.clipenable = atoi (Tcl_GetVar (interp, "::viewoptions.clipping.enable", TCL_GLOBAL_ONLY));
VisualizationParameters::Clipping hclip;
hclip.normal.X() = atof (Tcl_GetVar (interp, "::viewoptions.clipping.nx", TCL_GLOBAL_ONLY));
hclip.normal.Y() = atof (Tcl_GetVar (interp, "::viewoptions.clipping.ny", TCL_GLOBAL_ONLY));
hclip.normal.Z() = atof (Tcl_GetVar (interp, "::viewoptions.clipping.nz", TCL_GLOBAL_ONLY));
hclip.dist = atof (Tcl_GetVar (interp, "::viewoptions.clipping.dist", TCL_GLOBAL_ONLY));
hclip.enable = atoi (Tcl_GetVar (interp, "::viewoptions.clipping.enable", TCL_GLOBAL_ONLY));
vispar.clipdomain =
atoi (Tcl_GetVar (interp, "::viewoptions.clipping.onlydomain", TCL_GLOBAL_ONLY));
vispar.donotclipdomain =
atoi (Tcl_GetVar (interp, "::viewoptions.clipping.notdomain", TCL_GLOBAL_ONLY));
vispar.clipplanetimestamp = NextTimeStamp();
if ( ! (hclip == vispar.clipping) )
{
hclip.timestamp = NextTimeStamp();
vispar.clipping = hclip;
}
vispar.whitebackground = atoi (Tcl_GetVar (interp, "::viewoptions.whitebackground", TCL_GLOBAL_ONLY));