Search in sources :

Example 6 with PointStyle

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

the class VertexList method drawPoints.

private void drawPoints(Renderer renderer, int gidx, RenderProps props, boolean selected) {
    Shading savedShading = renderer.setPointShading(props);
    renderer.setPointColoring(props, selected);
    PointStyle style = props.getPointStyle();
    switch(style) {
        case POINT:
            {
                int size = props.getPointSize();
                if (size > 0) {
                    // renderer.setLightingEnabled (false);
                    // renderer.setColor (props.getPointColorArray(), selected);
                    renderer.drawPoints(myRob, gidx, PointStyle.POINT, size);
                // renderer.setLightingEnabled (true);
                }
                break;
            }
        case CUBE:
        case SPHERE:
            {
                double rad = props.getPointRadius();
                if (rad > 0) {
                    // Shading savedShading = renderer.getShadeModel();
                    // renderer.setPointLighting (props, selected);
                    renderer.drawPoints(myRob, gidx, style, rad);
                // renderer.setShadeModel(savedShading);
                }
                break;
            }
    }
    renderer.setShading(savedShading);
}
Also used : PointStyle(maspack.render.Renderer.PointStyle) Shading(maspack.render.Renderer.Shading)

Example 7 with PointStyle

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

the class VertexList method render.

public void render(Renderer renderer, int flags) {
    RenderProps props = myRenderProps;
    if (renderer.isSelecting()) {
        PointStyle style = props.getPointStyle();
        if (style == PointStyle.POINT) {
            int size = props.getPointSize();
            if (size > 0) {
                renderer.setPointSize(size);
            } else {
                return;
            }
        }
        for (int i = 0; i < size(); i++) {
            VertexComponent pnt = get(i);
            if (pnt.getRenderProps() == null && renderer.isSelectable(pnt)) {
                float[] v0 = pnt.myRenderCoords;
                renderer.beginSelectionQuery(i);
                switch(style) {
                    case POINT:
                        {
                            renderer.drawPoint(v0);
                            break;
                        }
                    case CUBE:
                        {
                            renderer.drawCube(v0, 2 * props.getPointRadius());
                        }
                    case SPHERE:
                        {
                            renderer.drawSphere(v0, props.getPointRadius());
                            break;
                        }
                }
                renderer.endSelectionQuery();
            }
        }
        if (style == PointStyle.POINT) {
            renderer.setPointSize(1);
        }
    } else if (myRob != null) {
        int numReg = myRob.numPoints(REG_GRP);
        int numSel = myRob.numPoints(SEL_GRP);
        // draw selected first
        if (numSel > 0) {
            drawPoints(renderer, SEL_GRP, props, /*selected=*/
            true);
        }
        if (numReg > 0) {
            drawPoints(renderer, REG_GRP, props, /*selected=*/
            false);
        }
    }
}
Also used : PointStyle(maspack.render.Renderer.PointStyle) PointRenderProps(maspack.render.PointRenderProps) RenderProps(maspack.render.RenderProps)

Aggregations

PointStyle (maspack.render.Renderer.PointStyle)7 Shading (maspack.render.Renderer.Shading)4 RenderObject (maspack.render.RenderObject)3 IntersectionPoint (maspack.collision.IntersectionPoint)1 PenetratingPoint (maspack.collision.PenetratingPoint)1 LineSegment (maspack.geometry.LineSegment)1 PointRenderProps (maspack.render.PointRenderProps)1 RenderProps (maspack.render.RenderProps)1 ColorInterpolation (maspack.render.Renderer.ColorInterpolation)1 FaceStyle (maspack.render.Renderer.FaceStyle)1 LineStyle (maspack.render.Renderer.LineStyle)1