• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            天行健 君子當自強而不息

            高級著色語言HLSL入門(7)

            max (Direct3D 9 HLSL)

            Selects the greater of x and y.

            Syntax

            ret max(x, y)

            Where:

            Name In/Out Template Type Component Type Size
            x in scalar, vector, or matrix float, int any
            y in same as input x float, int same dimension(s) as input x
            ret return type same as input x float, int same dimension(s) as input x

            Minimum Shader Version

            This intrinsic function is supported in the following (or above) shader versions:

            Vertex Shader Pixel Shader
            vs_1_1 ps_1_4

             

            min (Direct3D 9 HLSL)

            Selects the lesser of x and y.

            Syntax

            ret min(x, y)

            Where:

            Name In/Out Template Type Component Type Size
            x in scalar, vector, or matrix float, int any
            y in same as input x float, int same dimension(s) as input x
            ret return type same as input x float, int same dimension(s) as input x

            Minimum Shader Version

            This intrinsic function is supported in the following (or above) shader versions:

            Vertex Shader Pixel Shader
            vs_1_1 ps_1_4

             

            mul (Direct3D 9 HLSL)

            Performs matrix multiplication between x and y. If x is a vector, it treated as a row vector. If y is a vector, it is treated as a column vector. The inner dimension x-columns and y-rows must be equal. The result has the dimension x-rows x y-columns.

            Syntax

            ret mul(x, y)

            There are 9 overloaded versions of this function, to handle the different cases for the types and sizes of the x and y input arguments. The following table lists these versions.

            Version Name Purpose Template Type Component Type Size
            1          
              x in scalar float, int 1
              y in scalar same as input x 1
              ret out scalar same as input x 1
            2          
              x in scalar float, int 1
              y in vector float, int any
              ret out vector float, int same dimension(s) as input y
            3          
              x in scalar float, int 1
              y in matrix float, int any
              ret out matrix same as input y same dimension(s) as input y
            4          
              x in vector float, int any
              y in scalar float, int 1
              ret out vector float, int same dimension(s) as input x
            5          
              x in vector float, int any
              y in vector float, int same dimension(s) as input x
              ret out scalar float, int 1
            6          
              x in vector float, int any
              y in matrix float, int rows = same dimension(s) as input x, columns = any
              ret out vector float, int same dimension(s) as input y columns
            7          
              x in matrix float, int any
              y in scalar float, int 1
              ret out matrix float, int same dimension(s) as input x
            8          
              x in matrix float, int any
              y in vector float, int number of columns in input x
              ret out vector float, int number of rows in input x
            9          
              x in matrix float, int any
              y in matrix float, int rows = number of columns in input x
              ret out matrix float, int rows = number of rows in input x, columns = number of columns in input y

            Minimum Shader Version

            This intrinsic function is supported in the following (or above) shader versions:

            Vertex Shader Pixel Shader
            vs_1_1 ps_1_1

             

            normalize (Direct3D 9 HLSL)

            Returns the normalized vector x / length(x). If the length of x is 0, the result is indefinite.

            Syntax

            ret normalize(x)

            Where:

            Name In/Out Template Type Component Type Size
            x in vector float any
            ret out same as input x float same dimension(s) as input x

            Minimum Shader Version

            This intrinsic function is supported in the following (or above) shader versions:

            Vertex Shader Pixel Shader
            vs_1_1 ps_2_0

             

            pow (Direct3D 9 HLSL)

            Returns xy.

            Syntax

            ret pow(x, y)

            Where:

            Name In/Out Template Type Component Type Size
            x in scalar, vector, or matrix float any
            y in same as input x float same dimension(s) as input x
            ret out same as input x float same dimension(s) as input x

            Remarks

            Special cases:

            • If x = 0, then the result will always be 0.
            • If x < 0, there will be a compile error.

            This intrinsic function is supported in the following (or above) shader versions:

            Vertex Shader Pixel Shader
            vs_1_1 ps_2_0

             

            radians (Direct3D 9 HLSL)

            Converts x from degrees to radians.

            Syntax

            ret radians(x)

            Where:

            Name In/Out Template Type Component Type Size
            x in scalar, vector, or matrix float any
            ret out same as input x float same dimension(s) as input x

            Minimum Shader Version

            This intrinsic function is supported in the following (or above) shader versions:

            Vertex Shader Pixel Shader
            vs_1_1 ps_1_1

             

            reflect (Direct3D 9 HLSL)

            Returns the reflection vector v, given the entering ray direction i, and the surface normal n, as in:

            v = i - 2 * dot(i, n) * n

            Syntax

            ret reflect(i, n)

            Where:

            Name In/Out Template Type Component Type Size
            i in vector float any
            n in vector float same dimension(s) as input i
            ret out vector float same dimension(s) as input i

            Minimum Shader Version

            This intrinsic function is supported in the following (or above) shader versions:

            Vertex Shader Pixel Shader
            vs_1_1 ps_1_1

             

            refract (Direct3D 9 HLSL)

            Returns the refraction vector given the entering ray direction i, the surface normal n, and the refraction index ri. If the angle between i and n is too great for a given eta, refract returns (0,0,0).

            Syntax

            ret refract(i, n, ri)

            Where:

            Name In/Out Template Type Component Type Size
            i in vector float any
            n in vector float same dimension(s) as input i
            ri in scalar float 1
            refraction vector out vector float same dimension(s) as input i

            Minimum Shader Version

            This intrinsic function is supported in the following (or above) shader versions:

            Vertex Shader Pixel Shader
            vs_1_1 ps_2_0

             

            rsqrt (Direct3D 9 HLSL)

            Returns 1 / sqrt(x).

            Syntax

            ret rsqrt(x)

            Where:

            Name In/Out Template Type Component Type Size
            x in scalar, vector, or matrix float any
            ret out same as input x float same dimension(s) as input x

            Minimum Shader Version

            This intrinsic function is supported in the following (or above) shader versions:

            Vertex Shader Pixel Shader
            vs_1_1 ps_2_0

             

            saturate (Direct3D 9 HLSL)

            Clamps x to the range [0, 1].

            Syntax

            ret saturate(x)

            Where:

            Name In/Out Template Type Component Type Size
            x in scalar, vector, or matrix float any
            ret out same as input x float same dimension(s) as input x

            Minimum Shader Version

            This intrinsic function is supported in the following (or above) shader versions:

            Vertex Shader Pixel Shader
            vs_1_1 ps_1_1

             

            sin (Direct3D 9 HLSL)

            Returns the sine of x.

            Syntax

            ret sin(x)

            Where:

            Name In/Out Template Type Component Type Size
            x in scalar, vector, or matrix float any
            ret out same as input x float same dimension(s) as input x

            Minimum Shader Version

            This intrinsic function is supported in the following (or above) shader versions:

            Vertex Shader Pixel Shader
            vs_1_1 ps_2_0

             

            sincos (Direct3D 9 HLSL)

            Returns the sine and cosine of x. sin(x) is stored in the output parameter s. cos(x) is stored in the output parameter c.

            Syntax

            sincos(x, out s, out c)

            Where:

            Name In/Out Template Type Component Type Size
            x in scalar, vector, or matrix float any
            s out same as input x float same dimension(s) as input x
            c out same as input x float same dimension(s) as input x

            Minimum Shader Version

            This intrinsic function is supported in the following (or above) shader versions:

            Vertex Shader Pixel Shader
            vs_1_1 ps_2_0

             

            sqrt (Direct3D 9 HLSL)

            Square root (per component).

            Syntax

            ret sqrt(x)

            Where:

            Name In/Out Template Type Component Type Size
            x in scalar, vector, or matrix float any
            ret out same as input x float same dimension(s) as input x

            Minimum Shader Version

            This intrinsic function is supported in the following (or above) shader versions:

            Vertex Shader Pixel Shader
            vs_1_1 ps_2_0

             

            tan (Direct3D 9 HLSL)

            Returns the tangent of x.

            Syntax

            ret tan(x)

            Where:

            Name In/Out Template Type Component Type Size
            x in scalar, vector, or matrix float any
            ret out same as input x float same dimension(s) as input x

            Minimum Shader Version

            This intrinsic function is supported in the following (or above) shader versions:

            Vertex Shader Pixel Shader
            vs_1_1 ps_2_0

             

            transpose (Direct3D 9 HLSL)

            Returns the transpose of the input matrix x. If the dimensions of the source matrix is p-rows x q-columns, the resulting matrix is q-columns x p-rows.

            Syntax

            ret transpose(x)

            Where:

            Name In/Out Template Type Component Type Size
            x in matrix float, int, bool any
            ret out matrix float, int, bool rows = same number of columns as input x, columns = same number of rows as input x

            Minimum Shader Version

            This intrinsic function is supported in the following (or above) shader versions:

            Vertex Shader Pixel Shader
            vs_1_1 ps_1_1

             

            大多數函數已經重載以使其可以對所有內建類型有意義。例如,abs對所有數值類型有意義,所以它為所有這些數值類型進行了重載。又例如,叉積的叉乘僅對3D向量有意義,所以它對所有類型的3D向量(比如:int,float,double的3D向量)進行了重載。另一方面,線性插值——lerp,對于數值、2D、3D和4D向量有意義,因此重載了這些類型。

            注意:如果你傳遞進去一個非數值類型到一個(要求)數值類型的函數,也就是一個僅能對數值類型進行操作的函數(比如:cos(x)),那么這個函數會對傳進去的每個分量進行操作。例如,你寫:

            floats v = float3 (0.0f, 0.0f, 0.0f);

            v = cos(v);

            那么函數將會對每個分量進行操作:v=(cos(x),cos(y),cos(z))。

            下例展示了這些固有的函數可能被調用的方式:

            float x = sin(1.0f);       // sine of 1.0f radian.

            float y = sqrt(4.0f);      // square root of 4.

             

            vector u = {1.0f, 2.0f, -3.0f, 0.0f};

            vector v = {3.0f, -1.0f, 0.0f, 2.0f};

            float  s = dot(u, v);      // compute dot product of u and v.

             

            float3 i = {1.0f, 0.0f, 0.0f};

            float3 j = {0.0f, 1.0f, 0.0f};

            float3 k = cross(i, j);    // compute cross product of i and j.

             

            matrix<float, 2, 2> M = {1.0f, 2.0f, 3.0f, 4.0f};

            matrix<float, 2, 2> T = transpose(M); // compute transpose


            posted on 2008-04-05 18:28 lovedday 閱讀(2560) 評論(0)  編輯 收藏 引用

            公告

            導航

            統計

            常用鏈接

            隨筆分類(178)

            3D游戲編程相關鏈接

            搜索

            最新評論

            日产精品久久久久久久| 久久99精品久久久大学生| 91超碰碰碰碰久久久久久综合| 狠色狠色狠狠色综合久久| 99久久免费国产精品| 少妇熟女久久综合网色欲| 成人综合伊人五月婷久久| 久久青青草原精品国产软件 | 亚洲国产天堂久久久久久| 久久夜色精品国产噜噜麻豆| a级毛片无码兔费真人久久| 久久久久久国产精品无码下载 | 日韩人妻无码精品久久久不卡| 久久中文娱乐网| 亚洲国产精品高清久久久| 久久国产视频网| 青青国产成人久久91网| 婷婷综合久久中文字幕蜜桃三电影| 精品免费久久久久国产一区| 亚洲va久久久噜噜噜久久天堂| 久久成人18免费网站| 久久精品国产半推半就| 国产精品久久久亚洲| 人妻无码αv中文字幕久久琪琪布 人妻无码久久一区二区三区免费 人妻无码中文久久久久专区 | 久久精品国产99久久久古代| 国产精品99久久精品爆乳| 国产欧美久久久精品| aaa级精品久久久国产片| 久久综合久久美利坚合众国| 日韩va亚洲va欧美va久久| 中文字幕亚洲综合久久2| 久久电影网一区| 91麻精品国产91久久久久 | 久久国产精品-久久精品| AAA级久久久精品无码片| 久久精品无码午夜福利理论片| 浪潮AV色综合久久天堂| 99久久精品国内| 精品乱码久久久久久夜夜嗨| 亚洲国产天堂久久久久久| 国产精品久久久久久久久久影院 |