update to wiggle hydra example

I decided to add frequency into my wiggle hydra example. Frequency adjusts the distance between a wave making wider or shorter waves. The old one only let you change the amplitude of the wave on the x and/or y.

kernel morph
{

parameter float xangle< minValue: 0.0;
    maxValue:10.0;
    defaultValue:5.0;
>;
parameter float frequency< minValue: 0.0;
    maxValue:2.0;
    defaultValue:1.0;
>;
parameter float yangle< minValue: 0.0;
    maxValue:10.0;
    defaultValue:0.0;
>;

    void evaluatePixel(in image4 src, out pixel4 dst)
    {
        float2 coord = outCoord();
        float xcoord = coord.x - sin(coord.y*frequency)*xangle;
        float ycoord = coord.y - sin(coord.x*frequency)*yangle;
        dst = sampleNearest(src,float2(xcoord,ycoord));
        if(dst.r==0.0&&dst.g==0.0&&dst.b==0.0){
           dst = sampleNearest(src,outCoord());
        }
    }
}

About Carly (Admin)

I'm a multimedia developer based in Brisbane. I work for an elearning firm and code my own projects in the wee small hours between eating, sleeping and working.
This entry was posted in My projects. Bookmark the permalink.

Leave a Reply