Search in sources :

Example 31 with Shading

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

the class DicomPlaneViewer method render.

@Override
public synchronized void render(Renderer renderer, int flags) {
    RenderProps rprops = getRenderProps();
    renderer.pushModelMatrix();
    // adjust for widths and location
    renderer.mulModelMatrix(location);
    AffineTransform3d scaling = new AffineTransform3d();
    scaling.applyScaling(widths.x, widths.y, 1);
    renderer.mulModelMatrix(scaling);
    ColorMapProps oldColorMap = renderer.setColorMap(rprops.getColorMap());
    FaceStyle oldFaceStyle = renderer.setFaceStyle(FaceStyle.FRONT_AND_BACK);
    Shading oldShading = renderer.setShading(rprops.getShading());
    if (!renderer.isSelecting()) {
        renderer.setFaceColoring(rprops, isSelected());
    }
    renderer.drawTriangles(robj, 0);
    renderer.setShading(oldShading);
    renderer.setFaceStyle(oldFaceStyle);
    renderer.setColorMap(oldColorMap);
    renderer.popModelMatrix();
}
Also used : FaceStyle(maspack.render.Renderer.FaceStyle) ColorMapProps(maspack.render.ColorMapProps) LineRenderProps(maspack.render.LineRenderProps) RenderProps(maspack.render.RenderProps) Shading(maspack.render.Renderer.Shading) AffineTransform3d(maspack.matrix.AffineTransform3d)

Example 32 with Shading

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

the class DicomViewer method render.

@Override
public synchronized void render(Renderer renderer, int flags) {
    RenderProps rprops = getRenderProps();
    renderer.pushModelMatrix();
    renderer.setModelMatrix(myRenderTransform);
    if (drawBox) {
        // draw box
        Shading savedShading = renderer.setShading(Shading.NONE);
        renderer.setLineColoring(rprops, isSelected());
        renderer.drawLines(robj, 0);
        renderer.setShading(savedShading);
    }
    ColorMapProps oldColorMap = renderer.setColorMap(rprops.getColorMap());
    FaceStyle oldFaceStyle = renderer.setFaceStyle(FaceStyle.FRONT_AND_BACK);
    Shading oldShading = renderer.setShading(rprops.getShading());
    if (!renderer.isSelecting()) {
        renderer.setFaceColoring(rprops, isSelected());
    }
    for (int i = 0; i < 3; i++) {
        if (drawSlice[i]) {
            renderer.drawTriangles(robj, i);
        }
    }
    renderer.setShading(oldShading);
    renderer.setFaceStyle(oldFaceStyle);
    renderer.setColorMap(oldColorMap);
    renderer.popModelMatrix();
}
Also used : FaceStyle(maspack.render.Renderer.FaceStyle) ColorMapProps(maspack.render.ColorMapProps) LineRenderProps(maspack.render.LineRenderProps) RenderProps(maspack.render.RenderProps) Shading(maspack.render.Renderer.Shading)

Example 33 with Shading

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

the class MuscleElementDesc method render.

public void render(Renderer renderer, RenderProps props, int flags) {
    double widgetSize = 0;
    double directionLength = 0;
    ModelComponent gparent = getGrandParent();
    DirectionRenderType renderType = DirectionRenderType.ELEMENT;
    if (gparent instanceof MuscleBundle) {
        MuscleBundle bundle = (MuscleBundle) gparent;
        widgetSize = bundle.getElementWidgetSize();
        directionLength = bundle.getDirectionRenderLen();
        renderType = bundle.getDirectionRenderType();
    }
    if (widgetSize != 0) {
        Shading savedShading = renderer.setPropsShading(props);
        if (myWidgetColor != null) {
            renderer.setFaceColoring(props, myWidgetColor, isSelected());
        } else {
            renderer.setFaceColoring(props, isSelected());
        }
        myElement.renderWidget(renderer, widgetSize, props);
        renderer.setShading(savedShading);
    }
    if (directionLength > 0) {
        Matrix3d F = new Matrix3d();
        Vector3d dir = new Vector3d();
        float[] coords0 = new float[3];
        float[] coords1 = new float[3];
        renderDirection(renderer, props, coords0, coords1, F, dir, directionLength, renderType);
    }
}
Also used : SymmetricMatrix3d(maspack.matrix.SymmetricMatrix3d) Matrix3d(maspack.matrix.Matrix3d) ModelComponent(artisynth.core.modelbase.ModelComponent) DirectionRenderType(artisynth.core.femmodels.MuscleBundle.DirectionRenderType) Vector3d(maspack.matrix.Vector3d) Shading(maspack.render.Renderer.Shading)

Example 34 with Shading

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

the class FemElementRenderer method render.

public void render(Renderer renderer, FemElement3d elem, RenderProps props) {
    RenderObject r = myRob;
    updateEdgePositions(r, elem);
    Shading savedShading = renderer.setShading(Shading.NONE);
    renderer.setLineWidth(props.getLineWidth());
    renderer.setLineColoring(props, elem.isSelected());
    renderer.drawLines(r);
    renderer.setLineWidth(1);
    renderer.setShading(savedShading);
    double wsize = elem.getElementWidgetSize();
    if (wsize > 0) {
        renderWidget(renderer, elem, wsize, props);
    }
}
Also used : Shading(maspack.render.Renderer.Shading) RenderObject(maspack.render.RenderObject)

Example 35 with Shading

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

the class ParticleLineConstraint method render.

public void render(Renderer renderer, int flags) {
    if (myLineSize > 0) {
        computeRenderVtxs();
        RenderProps props = myRenderProps;
        Shading savedShading = renderer.setPropsShading(props);
        renderer.setLineColoring(props, isSelected());
        renderer.drawLine(myRenderVtxs[0], myRenderVtxs[1]);
        renderer.setShading(savedShading);
    }
}
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