Search in sources :

Example 21 with RenderObject

use of maspack.render.RenderObject in project artisynth_core by artisynth.

the class VertexList method buildRenderObject.

protected void buildRenderObject() {
    myRob = new RenderObject();
    myRob.createPointGroup();
    myRob.createPointGroup();
    for (int i = 0; i < size(); i++) {
        VertexComponent pnt = get(i);
        myRob.addPosition(pnt.myRenderCoords);
        myRob.addVertex(i);
        if (pnt.getRenderProps() == null) {
            myRob.pointGroup(pnt.isSelected() ? SEL_GRP : REG_GRP);
            myRob.addPoint(i);
        }
    }
    myRobValidP = true;
}
Also used : RenderObject(maspack.render.RenderObject)

Example 22 with RenderObject

use of maspack.render.RenderObject in project artisynth_core by artisynth.

the class MultiViewerTesterBase method addAxes.

protected static void addAxes(MultiViewer tester) {
    // axes
    RenderObject axes = new RenderObject();
    axes.beginBuild(DrawMode.LINES);
    axes.addColor(255, 0, 0, 255);
    axes.vertex(0, 0, 0);
    axes.vertex(1, 0, 0);
    axes.addColor(0, 255, 0, 255);
    axes.vertex(0, 0, 0);
    axes.vertex(0, 1, 0);
    axes.addColor(0, 0, 255, 255);
    axes.vertex(0, 0, 0);
    axes.vertex(0, 0, 1);
    axes.endBuild();
    tester.addRenderable(new RenderObjectWrapper(axes));
}
Also used : RenderObject(maspack.render.RenderObject)

Example 23 with RenderObject

use of maspack.render.RenderObject in project artisynth_core by artisynth.

the class MultiViewerTesterBase method addStanfordBunnies.

protected static void addStanfordBunnies(MultiViewer tester, PolygonalMesh bunny) {
    RenderProps rprops = new RenderProps();
    rprops.setFaceStyle(FaceStyle.FRONT_AND_BACK);
    rprops.setShading(Shading.SMOOTH);
    rprops.setFaceColor(Color.WHITE.darker());
    rprops.setBackColor(Color.BLUE);
    rprops.setLineColor(Color.ORANGE);
    rprops.setSpecular(Color.WHITE);
    rprops.setShininess(1000);
    // rprops.setPointSlices(24);
    // rprops.setLineSlices(24);
    rprops.setShading(Shading.SMOOTH);
    if (bunny != null) {
        // one bunny
        RenderObject bunnyRO;
        RenderObjectWrapper rbunny;
        bunnyRO = RenderObjectFactory.createFromMesh(bunny, rprops.getShading() == Shading.FLAT, rprops.getDrawEdges());
        rbunny = new RenderObjectWrapper(bunnyRO);
        rbunny.setTransform(new RigidTransform3d(new Vector3d(-0.707, 0.707, 0), AxisAngle.IDENTITY));
        rbunny.setRenderProps(rprops);
        tester.addRenderable(rbunny);
        // two bunny
        bunnyRO = RenderObjectFactory.createFromMesh(bunny, rprops.getShading() == Shading.FLAT, true);
        rbunny = new RenderObjectWrapper(bunnyRO);
        rbunny.setTransform(new RigidTransform3d(new Vector3d(0.707, -0.707, 0), AxisAngle.IDENTITY));
        rbunny.setRenderProps(new RenderProps(rprops));
        rbunny.getRenderProps().setDrawEdges(true);
        rbunny.getRenderProps().setFaceColor(new Color(175, 153, 128));
        rbunny.getRenderProps().setEdgeColor(new Color(175, 153, 128).darker());
        tester.addRenderable(rbunny);
    }
}
Also used : RigidTransform3d(maspack.matrix.RigidTransform3d) Vector3d(maspack.matrix.Vector3d) Color(java.awt.Color) RenderProps(maspack.render.RenderProps) RenderObject(maspack.render.RenderObject)

Example 24 with RenderObject

use of maspack.render.RenderObject in project artisynth_core by artisynth.

the class MultiViewerTesterBase method addSolidBunny.

protected static void addSolidBunny(MultiViewer tester, PolygonalMesh bunny) {
    RenderProps rprops = new RenderProps();
    rprops.setFaceStyle(FaceStyle.FRONT_AND_BACK);
    rprops.setShading(Shading.SMOOTH);
    rprops.setFaceColor(new Color(20, 20, 20));
    rprops.setBackColor(Color.MAGENTA.darker());
    rprops.setLineColor(Color.ORANGE);
    rprops.setPointColor(Color.PINK);
    rprops.setSpecular(Color.WHITE);
    rprops.setShininess(1000);
    // rprops.setPointSlices(24);
    // rprops.setLineSlices(24);
    rprops.setShading(Shading.SMOOTH);
    rprops.setPointStyle(PointStyle.SPHERE);
    rprops.setLineStyle(LineStyle.SOLID_ARROW);
    rprops.setLineRadius(0.001);
    rprops.setPointRadius(0.005);
    if (bunny != null) {
        // one bunny
        RenderObject bunnyRO;
        RenderObjectWrapper rbunny;
        bunnyRO = RenderObjectFactory.createFromMesh(bunny, rprops.getShading() == Shading.FLAT, true);
        // vertices
        for (int i = 0; i < bunnyRO.numVertices(); ++i) {
            bunnyRO.addPoint(i);
        }
        rbunny = new RenderObjectWrapper(bunnyRO);
        rbunny.setTransform(new RigidTransform3d(new Vector3d(0, 0, 0), AxisAngle.IDENTITY));
        rbunny.setRenderProps(rprops);
        tester.addRenderable(rbunny);
    }
}
Also used : RigidTransform3d(maspack.matrix.RigidTransform3d) Vector3d(maspack.matrix.Vector3d) Color(java.awt.Color) RenderProps(maspack.render.RenderProps) RenderObject(maspack.render.RenderObject)

Example 25 with RenderObject

use of maspack.render.RenderObject in project artisynth_core by artisynth.

the class MultiViewerTesterBase method addCylinder.

protected static void addCylinder(MultiViewer tester) {
    // cylinder
    RenderObject cylinderRO = RenderObjectFactory.createCylinder(32, true);
    RenderObjectWrapper rcylinder = new RenderObjectWrapper(cylinderRO);
    AffineTransform3d cscale = new AffineTransform3d();
    cscale.setTranslation(0.3, 0.3, 0);
    cscale.setRotation(new AxisAngle(1d / Math.sqrt(2), -1d / Math.sqrt(2), 0, Math.PI / 8));
    cscale.applyScaling(0.05, 0.05, 1.0);
    rcylinder.setTransform(cscale);
    RenderProps rprops2 = rcylinder.getRenderProps();
    rprops2.setFaceColor(Color.CYAN);
    rprops2.setShading(Shading.SMOOTH);
    tester.addRenderable(rcylinder);
}
Also used : AxisAngle(maspack.matrix.AxisAngle) RenderProps(maspack.render.RenderProps) RenderObject(maspack.render.RenderObject) AffineTransform3d(maspack.matrix.AffineTransform3d)

Aggregations

RenderObject (maspack.render.RenderObject)45 Vector3d (maspack.matrix.Vector3d)8 RenderProps (maspack.render.RenderProps)7 Point3d (maspack.matrix.Point3d)4 Shading (maspack.render.Renderer.Shading)4 Color (java.awt.Color)3 IntersectionPoint (maspack.collision.IntersectionPoint)3 PenetratingPoint (maspack.collision.PenetratingPoint)3 LineSegment (maspack.geometry.LineSegment)3 AffineTransform3d (maspack.matrix.AffineTransform3d)3 RigidTransform3d (maspack.matrix.RigidTransform3d)3 PointStyle (maspack.render.Renderer.PointStyle)3 PenetrationRegion (maspack.collision.PenetrationRegion)2 Face (maspack.geometry.Face)2 Vertex3d (maspack.geometry.Vertex3d)2 Point2d (maspack.matrix.Point2d)2 Renderer (maspack.render.Renderer)2 ColorInterpolation (maspack.render.Renderer.ColorInterpolation)2 LineStyle (maspack.render.Renderer.LineStyle)2 Group (artisynth.core.mechmodels.Collidable.Group)1