Search in sources :

Example 6 with SimpleSelectable

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

the class VolumePrimitivesTest method addContent.

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

        RenderProps props = new RenderProps();

        @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) {
            props.setFaceColor(Color.CYAN);
            props.setBackColor(Color.MAGENTA);
            renderer.setFaceColoring(props, /*highlight=*/
            false);
            renderer.setColor(props.getFaceColorF());
            renderer.setBackColor(props.getBackColorF());
            renderer.setFaceStyle(FaceStyle.FRONT_AND_BACK);
            // renderer.drawSphere (new float[] {0.1f,0.2f,0.3f}, 0.05);
            // renderer.drawSpindle (new float[]{-0.1f,-0.2f,-0.3f}, new float[]{-0.3f,-0.2f,-0.1f}, 0.05);
            // renderer.drawSpindle (new float[]{0.1f,-0.2f,0.3f}, new float[]{0.3f,-0.2f,0.1f}, 0.25);
            // renderer.drawCylinder (new float[]{-0.1f,0.2f,-0.3f}, new float[]{-0.3f,0.2f,-0.1f}, 0.3, true);
            // renderer.drawCylinder (new float[]{0.1f,0.2f,-0.3f}, new float[]{-0.3f,-0.2f,-0.3f}, 0.2, true);
            // renderer.drawCone (new float[]{-0.1f,0.2f,0.3f}, new float[]{0.3f,0.2f,-0.1f}, 0.1, 0, false);
            // renderer.drawCone (new float[]{-0.3f,0.2f,0.3f}, new float[]{0.5f,0.2f,-0.1f}, 0, 0.2, true);
            // renderer.drawSphere (new float[]{-0.1f,-0.2f,-0.3f}, 0.2);
            // renderer.drawSphere (new float[] {0.1f,0.2f,0.3f}, 0.02);
            // renderer.drawSphere (new float[] {0.1f,0.2f,0.6f}, 0.03);
            // renderer.drawSphere (new float[] {0.1f,0.2f,0.8f}, 0.04);
            // renderer.drawSphere (new float[] {0.1f,0.2f,1f}, 0.05);
            // renderer.drawCone (new float[]{0.1f,0.1f,-0.1f}, new float[]{0.3f,0.1f,-0.1f}, 0.05, 0.02, true);
            renderer.drawCube(new float[] { -0.2f, -0.2f, -0.2f }, 0.5);
        }

        @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);
}
Also used : SimpleSelectable(maspack.test.GL.MultiViewer.SimpleSelectable) Vector3d(maspack.matrix.Vector3d) RenderProps(maspack.render.RenderProps) Renderer(maspack.render.Renderer) RenderList(maspack.render.RenderList) LinkedList(java.util.LinkedList)

Aggregations

Renderer (maspack.render.Renderer)6 SimpleSelectable (maspack.test.GL.MultiViewer.SimpleSelectable)6 Vector3d (maspack.matrix.Vector3d)5 RenderList (maspack.render.RenderList)5 LinkedList (java.util.LinkedList)4 RenderProps (maspack.render.RenderProps)3 GL3 (com.jogamp.opengl.GL3)1 Font (java.awt.Font)1 Rectangle2D (java.awt.geom.Rectangle2D)1 File (java.io.File)1 HashMap (java.util.HashMap)1 JFrame (javax.swing.JFrame)1 AxisAngle (maspack.matrix.AxisAngle)1 Point3d (maspack.matrix.Point3d)1 RigidTransform3d (maspack.matrix.RigidTransform3d)1 GL3Viewer (maspack.render.GL.GL3.GL3Viewer)1 GLViewer (maspack.render.GL.GLViewer)1 RenderObject (maspack.render.RenderObject)1 Shading (maspack.render.Renderer.Shading)1 TextImageStore (maspack.render.TextImageStore)1