首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

旋转浪头shader

2012-11-01 
旋转波浪shaderlanguageVersion : 1.0kernel NewFilternamespace : gamecubevendor : gamecubev

旋转波浪shader
<languageVersion : 1.0;>

kernel NewFilter
<   namespace : "gamecube";
    vendor : "gamecube";
    version : 1;
    description : "your description";
>
{
    input image4 src;
    output pixel4 dst;
   
    parameter float2 center
    <
        minValue : float2(1.0);
        maxValue : float2(200.0);
        defaultValue : float2(0.0);
    >;
   
    parameter float radius
    <
        minValue : 0.1;
        maxValue : 50.0;
        defaultValue : 4.0;
    >;

    void    evaluatePixel()    {        float radians = 3.0;        float2 relativePos = outCoord() - center;        float distFromCenter = length(relativePos);        distFromCenter /= radius;        float sincWeight = sin(distFromCenter)*radians/distFromCenter;                float cosAngle = cos(sincWeight);        float sinAngle = sin(sincWeight);        float2x2 rotMat = float2x2(            cosAngle,sinAngle,            -sinAngle,cosAngle        );                relativePos *= rotMat;        dst = sampleNearest(src,relativePos);    }

}

热点排行