Search in sources :

Example 1 with DirectionRenderType

use of artisynth.core.femmodels.MuscleBundle.DirectionRenderType 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)

Aggregations

DirectionRenderType (artisynth.core.femmodels.MuscleBundle.DirectionRenderType)1 ModelComponent (artisynth.core.modelbase.ModelComponent)1 Matrix3d (maspack.matrix.Matrix3d)1 SymmetricMatrix3d (maspack.matrix.SymmetricMatrix3d)1 Vector3d (maspack.matrix.Vector3d)1 Shading (maspack.render.Renderer.Shading)1