Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <languageVersion : 1.0;>
- kernel rotozoomandsinemodulate <
- namespace : "effects";
- vendor : "Henke37";
- version : 3;
- >
- {
- input image4 src;
- output pixel4 dst;
- parameter float2 zoom <
- minValue: float2(0.01,0.01);
- defaultValue: float2(1.0,1.0);
- maxValue: float2(5.0,5.0);
- previewValue: float2(0.6,0.6);
- componentName: "x|y";
- >;
- parameter float spin <
- minValue: 0.0;
- maxValue: 3.146*2.0;
- parameterType: "angleRadians";
- previewValue: 2.45;
- >;
- parameter float2 spinCenter <
- parameterType: "position";
- componentName: "x|y";
- >;
- parameter float2 offset <
- componentName: "x|y";
- minValue: float2(-1.0,-1.0);
- maxValue: float2(1.0,1.0);
- defaultValue: float2(0.0,0.0);
- parameterType: "percentage";
- >;
- parameter float2 imgSize <
- parameterType: "inputSize";
- inputSizeName: "src";
- >;
- parameter float2 sineAmplitude <
- minValue: float2(0.0,0.0);
- maxValue: float2(1.0,1.0);
- componentName: "x|y";
- parameterType: "percentage";
- >;
- parameter float2 sineOffset <
- minValue: float2(0.0,0.0);
- maxValue: float2(3.146*2.0,3.146*2.0);
- parameterType: "angleRadians";
- componentName: "x|y";
- >;
- parameter float4 sinePeriod <
- minValue: float4(0.0,0.0,0.0,0.0);
- maxValue: float4(30.0,30.0,30.0,30.0);
- componentName: "x*x|y*x|y*x|y*y";
- parameterType: "percentage";
- >;
- void evaluatePixel() {
- float2 pos=outCoord();
- pos/=imgSize;
- pos-=spinCenter/imgSize;
- float angle=atan(pos.y,pos.x);
- float dist=sqrt(pos.x*pos.x+pos.y*pos.y);
- angle+=spin;
- pos.x=cos(angle)*dist;
- pos.y=sin(angle)*dist;
- pos+=spinCenter/imgSize;
- pos/=zoom;
- pos+=offset;
- pos.x+=sin(sinePeriod.s*pos.x+sinePeriod.t*pos.y+sineOffset.x)*sineAmplitude.x;
- pos.y+=sin(sinePeriod.p*pos.x+sinePeriod.q*pos.y+sineOffset.y)*sineAmplitude.y;
- pos*=imgSize;
- pos=mod(pos,imgSize);
- dst = sample(src,pos);
- }
- #if !AIF_FLASH_TARGET
- region generated() {
- return everywhere();
- }
- #endif
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement