lcl_variation_A.slim

[index]

11th January 2009   3:58pm 39sec
/stuhome/vsfx419/slim/lcl_variation_A.slim


Variation A - with one command line and using if and else
statement



# Sample template that uses RSLFunction
slim 1 extensions cutter {
extensions fundza cutr {
    # 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 MixKolors1 {
        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 blend {
            description "How much of Color 2 to mix with Color 1"
            label "Blend"
            subtype slider
            range {0 1}
            detail varying
            default 0.5
            }
        parameter float st_switch {
            description "switching between s and t"
            label "Direction switch"
            subtype selector
            range {s 0 t 1}
            default 0
            }
        parameter float freq {
            description "how many cycles of wave"
            label "wave_cycles"
            subtype slider
            range {0 10}
            detail varying
            default 1
            }
        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
        cutrMixKolors1 (
                color c1;
                color c2;
                float blend;
                float st_switch;
                float freq;
                output color result;
                )
        {
        float wave = sin(((s*(-1*st_switch+1) + t*(st_switch))*2PI*freq) + 1) * 0.5;  
        //flaot wave;
        //if (st_switch == 0)
        //        wave = (sin(s*2PI*freq)+1)*0.5;
        //else 
        //        wave = (sin(t*2PI*freq)+1)*0.5;
        result = mix(c1, c2, blend * wave);
        }
} } } }