Contour Output Shaders

Output shaders are called after the image has been computed. An output shader can use the function mi_get_contour_line to get endpoints of a contour. When mi_get_contour_line returns miFALSE, there are no more contour lines.

Here is a very simple output shader that prints the screen-space coordinates of the contour endpoints.

    miBoolean my_contour_output_shader(
        miColor  *result,   /* unused */
        miState  *state)
        /* no parameters */
    {
        miContour_endpoint p1;
        miContour_endpoint p2;

        mi_info("Contour endpoints:");

        /* Get and write the contour endpoints */
        while (mi_get_contour_line(&p1, &p2))
                mi_info("%f %f --- %f %f", p1.point.x, p1.point.y,
                                           p2.point.x, p2.point.y);
        return(miTRUE);
    }

Copyright © 1986-2008 by mental images GmbH