Search in sources :

Example 1 with FractionRenderType

use of artisynth.core.femmodels.AuxMaterialBundle.FractionRenderType in project artisynth_core by artisynth.

the class AuxMaterialElementDesc method render.

public void render(Renderer renderer, RenderProps props, int flags) {
    double widgetSize = 0;
    double rad = 0;
    FractionRenderType renderType = AuxMaterialBundle.DEFAULT_FRACTION_RENDER_TYPE;
    ModelComponent gparent = getGrandParent();
    if (gparent instanceof AuxMaterialBundle) {
        AuxMaterialBundle bundle = (AuxMaterialBundle) gparent;
        widgetSize = bundle.getElementWidgetSize();
        rad = bundle.getFractionRenderRadius();
        renderType = bundle.getFractionRenderType();
    }
    if (widgetSize != 0 || rad > 0) {
        Shading savedShading = renderer.setPropsShading(props);
        renderer.setFaceColoring(props, myWidgetColor, isSelected());
        if (widgetSize != 0) {
            myElement.renderWidget(renderer, widgetSize, props);
        }
        if (rad > 0) {
            renderFraction(renderer, props, rad, renderType);
        }
        renderer.setShading(savedShading);
    }
}
Also used : ModelComponent(artisynth.core.modelbase.ModelComponent) Shading(maspack.render.Renderer.Shading) FractionRenderType(artisynth.core.femmodels.AuxMaterialBundle.FractionRenderType)

Example 2 with FractionRenderType

use of artisynth.core.femmodels.AuxMaterialBundle.FractionRenderType in project artisynth_core by artisynth.

the class AuxMaterialElementDescList method dorender.

private void dorender(Renderer renderer, int flags, boolean selected) {
    // This code is taken mostly verbatim from FemElement3dList.
    // Should find a way to avoid duplicate code ...
    double fractionRenderRadius = 0;
    FractionRenderType fractionRenderType = AuxMaterialBundle.DEFAULT_FRACTION_RENDER_TYPE;
    ModelComponent parent = getParent();
    if (parent instanceof AuxMaterialBundle) {
        fractionRenderRadius = ((AuxMaterialBundle) parent).getFractionRenderRadius();
        fractionRenderType = ((AuxMaterialBundle) parent).getFractionRenderType();
    }
    if (fractionRenderRadius > 0) {
        Shading savedShading = renderer.getShading();
        renderer.setShading(myRenderProps.getShading());
        renderer.setPointColoring(myRenderProps, /*highlight=*/
        false);
        renderFractions(renderer, fractionRenderRadius, fractionRenderType, false);
        renderer.setShading(savedShading);
    }
}
Also used : ModelComponent(artisynth.core.modelbase.ModelComponent) Shading(maspack.render.Renderer.Shading) FractionRenderType(artisynth.core.femmodels.AuxMaterialBundle.FractionRenderType)

Aggregations

FractionRenderType (artisynth.core.femmodels.AuxMaterialBundle.FractionRenderType)2 ModelComponent (artisynth.core.modelbase.ModelComponent)2 Shading (maspack.render.Renderer.Shading)2