use of maspack.render.GL.GLGridPlane in project artisynth_core by artisynth.
the class ViewerToolBar method updateWidgets.
/**
* Called after the viewer state has been changed by some other agent, to
* update the appearance of the widgets and icons.
*/
public void updateWidgets() {
updateIcons();
if (myGridDisplayEnabled) {
boolean gridOn = myViewer.getGridVisible();
GLGridPlane grid = myViewer.getGrid();
if ((myGridDisplay != null) != gridOn) {
if (gridOn) {
myGridDisplay = GridDisplay.createAndAdd(grid, this, myGridDisplayIndex);
} else {
GridDisplay.removeAndDispose(myGridDisplay, this, myGridDisplayIndex);
myGridDisplay = null;
}
}
}
if (myGridDisplay != null) {
myGridDisplay.updateWidgets();
}
for (ClipPlaneControl cpc : myClipPlaneControls) {
cpc.updateWidgets();
}
}
use of maspack.render.GL.GLGridPlane in project artisynth_core by artisynth.
the class MenuBarHandler method updateWidgets.
public void updateWidgets() {
// frame is being set visible can cause some problems
if (!myFrame.isVisible()) {
return;
}
GLViewer v = getMainViewer();
boolean gridOn = v.getGridVisible();
GLGridPlane grid = v.getGrid();
if ((myGridDisplay != null) != gridOn) {
if (gridOn) {
myGridDisplay = GridDisplay.createAndAdd(grid, myToolBar, myGridDisplayIndex);
} else {
GridDisplay.removeAndDispose(myGridDisplay, myToolBar, myGridDisplayIndex);
myGridDisplay = null;
}
}
if (myGridDisplay != null) {
myGridDisplay.updateWidgets();
}
}
use of maspack.render.GL.GLGridPlane in project artisynth_core by artisynth.
the class ViewerFrame method updateWidgets.
protected void updateWidgets() {
// frame is being set visible can cause some problems
if (!isVisible()) {
return;
}
if (myTopPanel != null) {
// if we have a top panel, then we have a grid display there
boolean gridOn = viewer.getGridVisible();
GLGridPlane grid = viewer.getGrid();
if ((myGridDisplay != null) != gridOn) {
if (gridOn) {
myGridDisplay = GridDisplay.createAndAdd(grid, myTopPanel, myGridDisplayIndex);
} else {
GridDisplay.removeAndDispose(myGridDisplay, myTopPanel, myGridDisplayIndex);
myGridDisplay = null;
}
}
if (myGridDisplay != null) {
myGridDisplay.updateWidgets();
}
}
}
use of maspack.render.GL.GLGridPlane in project artisynth_core by artisynth.
the class Translator3d method updatePosition.
private void updatePosition(Point3d p0, Point3d p1, MouseRayEvent e) {
Vector3d del = new Vector3d();
del.sub(p1, p0);
// if (dragIsConstrained(e)) {
if (dragIsConstrained()) {
Renderer renderer = e.getViewer();
boolean constrainedToGrid = false;
if (renderer instanceof GLViewer) {
GLViewer viewer = (GLViewer) renderer;
if (viewer.getGridVisible()) {
GLGridPlane grid = viewer.getGrid();
RigidTransform3d XDraggerToGrid = new RigidTransform3d();
XDraggerToGrid.mulInverseLeft(grid.getGridToWorld(), myXDraggerToWorld);
if (XDraggerToGrid.R.isAxisAligned(EPS)) {
// if the dragger orientation is axis-aligned with grid
// coordinates, then adjust constrained motions so that the
// dragger center always lies on a grid point. (Otherwise, this
// can't necessarily be done without causing the dragger to move
// off the specified line or plane of translation).
Point3d pa = new Point3d(del);
pa.transform(XDraggerToGrid);
grid.alignPoint(pa, pa);
pa.inverseTransform(XDraggerToGrid);
del.set(pa);
constrainToFixture(del);
constrainedToGrid = true;
}
}
}
if (!constrainedToGrid) {
// if not possible to constrain to grid, just constrain the step
// size
double s = getConstrainedStepSize();
del.x = s * Math.round(del.x / s);
del.y = s * Math.round(del.y / s);
del.z = s * Math.round(del.z / s);
}
}
myXDraggerToWorld.mulXyz(del.x, del.y, del.z);
myIncrementalTransform.p.set(del.x, del.y, del.z);
myTransform.mul(myIncrementalTransform);
}
use of maspack.render.GL.GLGridPlane in project artisynth_core by artisynth.
the class MeshViewer method updateWidgets.
public void updateWidgets() {
// frame is being set visible can cause some problems
if (!isVisible()) {
return;
}
boolean gridOn = viewer.getGridVisible();
GLGridPlane grid = viewer.getGrid();
if ((myGridDisplay != null) != gridOn) {
if (gridOn) {
myGridDisplay = GridDisplay.createAndAdd(grid, myToolBar, myGridDisplayIndex);
} else {
GridDisplay.removeAndDispose(myGridDisplay, myToolBar, myGridDisplayIndex);
myGridDisplay = null;
}
}
if (myGridDisplay != null) {
myGridDisplay.updateWidgets();
}
}
Aggregations