mixpillcolor.slim

[index]

2nd March 2009   11:18am 57sec
/stuhome/vsfx419/slim/mixpillcolor.slim


mixpillcolor



# Sample template that uses RSLFunction
slim 1 extensions Vint {
extensions power Vint {
    # A template is an appearance that is used to generate functions and
    # is fundamental to Slim's shader creation features. Templates are
    # containers of properties.
    template color mixpillcolor {
        previewinfo {
            shadingrate 1
            objectsize 1
            objectshape Plane
            frame 1
            }
        # Parameters are used to collect all information associated
        # with a single parameter of an appearance.
        parameter color c1 {
            description "One of the colors to mix"
            label "Color 1"
            detail varying
            default {1 1 1}
            }
        parameter color c2 {
            description "One of the colors to mix"
            label "Color 2"
            detail varying
            default {1 1 1}
            }
        parameter float t1 {
            description "t1"
            label "t1"
            subtype slider
            range {0 1}
            detail varying
            default 0.5
            }
    parameter float t2 {
            description "t2"
            label "t2"
            subtype slider
            range {0 1}
            detail varying
            default 0.5
            }
        parameter color result {
                access output
                display hidden
                }
        # The RSLFunction is where the calculations are done.
        # The order in which the parameters are declared must
        # match the order in which they are described above.
        RSLFunction {
        void
        Vintmixpillcolor (
                color c1;
                color c2;
                float t1;
                float t2;
                output color result;
                )
        {
        float blend = smoothstep(t1,t2,t);
        result = mix(c1, c2, blend);
        }
} } } }