Search in sources :

Example 1 with SimpleViewerApp

use of maspack.test.GL.MultiViewer.SimpleViewerApp in project artisynth_core by artisynth.

the class MultiViewerTesterBase method addTransRotator.

protected static void addTransRotator(MultiViewer tester) {
    for (SimpleViewerApp app : tester.getWindows()) {
        Transrotator3d dragger = new Transrotator3d();
        dragger.setPosition(new Vector3d(1, 0, 0.2));
        app.viewer.addDragger(dragger);
    }
}
Also used : Vector3d(maspack.matrix.Vector3d) SimpleViewerApp(maspack.test.GL.MultiViewer.SimpleViewerApp) Transrotator3d(maspack.render.Transrotator3d)

Example 2 with SimpleViewerApp

use of maspack.test.GL.MultiViewer.SimpleViewerApp in project artisynth_core by artisynth.

the class InstanceTest method addContent.

@Override
protected void addContent(MultiViewer mv) {
    SimpleSelectable renderable = new SimpleSelectable() {

        RenderObject robj = null;

        @Override
        public void updateBounds(Vector3d pmin, Vector3d pmax) {
            Point3d.X_UNIT.updateBounds(pmin, pmax);
            Point3d.Y_UNIT.updateBounds(pmin, pmax);
            Point3d.Z_UNIT.updateBounds(pmin, pmax);
            Point3d.NEG_X_UNIT.updateBounds(pmin, pmax);
            Point3d.NEG_Y_UNIT.updateBounds(pmin, pmax);
            Point3d.NEG_Z_UNIT.updateBounds(pmin, pmax);
        }

        @Override
        public void render(Renderer renderer, int flags) {
            if (robj == null) {
                robj = new RenderObject();
                float x = 0.5f;
                robj.addPoint(new float[] { -x, -x, -x });
                robj.addPoint(new float[] { x, -x, -x });
                robj.addPoint(new float[] { -x, x, -x });
                robj.addPoint(new float[] { x, x, -x });
                robj.addPoint(new float[] { -x, -x, x });
                robj.addPoint(new float[] { x, -x, x });
                robj.addPoint(new float[] { -x, x, x });
                robj.addPoint(new float[] { x, x, x });
                robj.addLine(0, 1);
                robj.addLine(1, 3);
                robj.addLine(3, 2);
                robj.addLine(2, 0);
                robj.addLine(4, 5);
                robj.addLine(5, 7);
                robj.addLine(7, 6);
                robj.addLine(6, 4);
                robj.createLineGroup();
                robj.addLine(0, 4);
                robj.addLine(4, 5);
                robj.addLine(5, 1);
                robj.addLine(1, 0);
            }
            // renderer.drawPoints (robj, PointStyle.POINT, 10);
            renderer.setFrontColor(new float[] { 0.8f, 0.8f, 0.8f, 1.0f });
            renderer.drawPoints(robj, PointStyle.SPHERE, 0.1);
            renderer.drawLines(robj, 0, LineStyle.CYLINDER, 0.025);
            renderer.drawLines(robj, 1, LineStyle.SOLID_ARROW, 0.05);
        }

        @Override
        public void prerender(RenderList list) {
        }

        @Override
        public int getRenderHints() {
            return 0;
        }

        @Override
        public int numSelectionQueriesNeeded() {
            return 0;
        }

        @Override
        public boolean isSelectable() {
            return false;
        }

        @Override
        public void getSelection(LinkedList<Object> list, int qid) {
        }

        @Override
        public void setSelected(boolean set) {
        }

        @Override
        public boolean isSelected() {
            // TODO Auto-generated method stub
            return false;
        }
    };
    mv.addRenderable(renderable);
    for (SimpleViewerApp app : mv.getWindows()) {
        app.viewer.setAxialView(AxisAlignedRotation.X_Y);
    }
}
Also used : SimpleSelectable(maspack.test.GL.MultiViewer.SimpleSelectable) Vector3d(maspack.matrix.Vector3d) Renderer(maspack.render.Renderer) SimpleViewerApp(maspack.test.GL.MultiViewer.SimpleViewerApp) RenderObject(maspack.render.RenderObject) RenderList(maspack.render.RenderList) LinkedList(java.util.LinkedList)

Aggregations

Vector3d (maspack.matrix.Vector3d)2 SimpleViewerApp (maspack.test.GL.MultiViewer.SimpleViewerApp)2 LinkedList (java.util.LinkedList)1 RenderList (maspack.render.RenderList)1 RenderObject (maspack.render.RenderObject)1 Renderer (maspack.render.Renderer)1 Transrotator3d (maspack.render.Transrotator3d)1 SimpleSelectable (maspack.test.GL.MultiViewer.SimpleSelectable)1