Search in sources :

Example 11 with Shading

use of maspack.render.Renderer.Shading in project artisynth_core by artisynth.

the class AxialSpringList method drawLines.

private void drawLines(Renderer renderer, RenderProps props, boolean selected) {
    LineStyle style = props.getLineStyle();
    Shading savedShading = renderer.setLineShading(props);
    renderer.setLineColoring(props, selected);
    switch(style) {
        case LINE:
            {
                int width = props.getLineWidth();
                if (width > 0) {
                    // renderer.setLightingEnabled (false);
                    // renderer.setColor (props.getLineColorArray(), selected);
                    renderer.drawLines(myRob, LineStyle.LINE, width);
                // renderer.setLightingEnabled (true);
                }
                break;
            }
        case SPINDLE:
        case SOLID_ARROW:
        case CYLINDER:
            {
                double rad = props.getLineRadius();
                if (rad > 0) {
                    // Shading savedShading = renderer.getShadeModel();
                    // renderer.setLineLighting (props, selected);
                    renderer.drawLines(myRob, style, rad);
                // renderer.setShadeModel(savedShading);
                }
                break;
            }
    }
    renderer.setShading(savedShading);
}
Also used : LineStyle(maspack.render.Renderer.LineStyle) Shading(maspack.render.Renderer.Shading)

Example 12 with Shading

use of maspack.render.Renderer.Shading in project artisynth_core by artisynth.

the class MFreeElement3d method render.

public void render(Renderer renderer, RenderProps rprops, int flags) {
    Shading savedShading = renderer.setLineShading(rprops);
    renderer.setLineColoring(rprops, isSelected());
    if (rprops.getLineWidth() > 0) {
        switch(rprops.getLineStyle()) {
            case LINE:
                {
                    renderer.setLineWidth(rprops.getLineWidth());
                    renderEdges(renderer, rprops);
                    renderer.setLineWidth(1);
                    break;
                }
            case CYLINDER:
                {
                    renderEdges(renderer, rprops);
                    break;
                }
            default:
                break;
        }
    }
    renderer.setShading(savedShading);
}
Also used : Shading(maspack.render.Renderer.Shading)

Example 13 with Shading

use of maspack.render.Renderer.Shading in project artisynth_core by artisynth.

the class MFreeElement3dList method render.

public void render(Renderer renderer, int flags) {
    dorender(renderer, /*selected=*/
    true);
    dorender(renderer, /*selected=*/
    false);
    Shading savedShading = renderer.setPropsShading(myRenderProps);
    renderer.setFaceColoring(myRenderProps, /*highlight=*/
    false);
    for (int i = 0; i < size(); i++) {
        double widgetSize;
        MFreeElement3d elem = get(i);
        if (elem.getRenderProps() == null && elem.isSelected() == isSelected() && elem.getElementWidgetSize() > 0) {
            if (renderer.isSelecting()) {
                if (renderer.isSelectable(elem)) {
                    renderer.beginSelectionQuery(i);
                    elem.renderWidget(renderer, myRenderProps, 0);
                    renderer.endSelectionQuery();
                }
            } else {
                renderer.setFaceColoring(myRenderProps, elem.isSelected());
                elem.renderWidget(renderer, myRenderProps, 0);
            }
        }
    }
    renderer.setShading(savedShading);
}
Also used : Shading(maspack.render.Renderer.Shading)

Example 14 with Shading

use of maspack.render.Renderer.Shading in project artisynth_core by artisynth.

the class SegmentedPlanarConnector method render.

public void render(Renderer renderer, int flags) {
    Vector3d nrm = new Vector3d(0, 0, 1);
    RigidTransform3d TDW = getCurrentTDW();
    RenderProps props = myRenderProps;
    Shading savedShading = renderer.setPropsShading(props);
    renderer.setFaceColoring(props, isSelected());
    renderer.setFaceStyle(props.getFaceStyle());
    ArrayList<Plane> planes = mySegPlaneCoupling.getPlanes();
    for (int i = 0; i < planes.size(); i++) {
        Plane plane = planes.get(i);
        nrm.set(plane.getNormal());
        computeRenderVtxs(i, TDW);
        renderer.beginDraw(DrawMode.TRIANGLE_STRIP);
        if (myRenderNormalReversedP) {
            renderer.setNormal(-nrm.x, -nrm.y, -nrm.z);
        } else {
            renderer.setNormal(nrm.x, nrm.y, nrm.z);
        }
        renderer.addVertex(myRenderVtxs[3]);
        renderer.addVertex(myRenderVtxs[0]);
        renderer.addVertex(myRenderVtxs[2]);
        renderer.addVertex(myRenderVtxs[1]);
        renderer.endDraw();
    }
    renderer.setShading(savedShading);
    renderer.setFaceStyle(FaceStyle.FRONT);
    renderer.drawPoint(myRenderProps, myRenderCoords, isSelected());
}
Also used : RigidTransform3d(maspack.matrix.RigidTransform3d) Vector3d(maspack.matrix.Vector3d) Plane(maspack.matrix.Plane) RenderProps(maspack.render.RenderProps) Shading(maspack.render.Renderer.Shading)

Example 15 with Shading

use of maspack.render.Renderer.Shading in project artisynth_core by artisynth.

the class ParticlePlaneConstraint method render.

public void render(Renderer renderer, int flags) {
    if (myPlaneSize > 0) {
        computeRenderVtxs();
        RenderProps props = myRenderProps;
        Shading savedShading = renderer.setPropsShading(props);
        renderer.setFaceColoring(props, isSelected());
        renderer.setFaceStyle(props.getFaceStyle());
        renderer.beginDraw(DrawMode.TRIANGLE_STRIP);
        renderer.setNormal(myNrm.x, myNrm.y, myNrm.z);
        renderer.addVertex(myRenderVtxs[3]);
        renderer.addVertex(myRenderVtxs[0]);
        renderer.addVertex(myRenderVtxs[2]);
        renderer.addVertex(myRenderVtxs[1]);
        renderer.endDraw();
        renderer.setShading(savedShading);
        // set default
        renderer.setFaceStyle(FaceStyle.FRONT);
    }
}
Also used : RenderProps(maspack.render.RenderProps) Shading(maspack.render.Renderer.Shading)

Aggregations

Shading (maspack.render.Renderer.Shading)38 RenderProps (maspack.render.RenderProps)10 RigidTransform3d (maspack.matrix.RigidTransform3d)7 Vector3d (maspack.matrix.Vector3d)7 FaceStyle (maspack.render.Renderer.FaceStyle)5 RenderObject (maspack.render.RenderObject)4 ColorInterpolation (maspack.render.Renderer.ColorInterpolation)4 PointStyle (maspack.render.Renderer.PointStyle)4 ModelComponent (artisynth.core.modelbase.ModelComponent)3 Point3d (maspack.matrix.Point3d)3 ColorMapProps (maspack.render.ColorMapProps)3 LineRenderProps (maspack.render.LineRenderProps)3 LineStyle (maspack.render.Renderer.LineStyle)3 FractionRenderType (artisynth.core.femmodels.AuxMaterialBundle.FractionRenderType)2 Rectangle2D (java.awt.geom.Rectangle2D)2 FaceRenderProps (maspack.render.FaceRenderProps)2 Renderer (maspack.render.Renderer)2 ColorMixing (maspack.render.Renderer.ColorMixing)2 DirectionRenderType (artisynth.core.femmodels.MuscleBundle.DirectionRenderType)1 LinkedList (java.util.LinkedList)1