• <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久久久国产精免费| 香蕉99久久国产综合精品宅男自| 亚洲女久久久噜噜噜熟女| 成人国内精品久久久久一区| 国产激情久久久久影院| 亚洲精品无码久久久久| 久久99精品久久久久久不卡| 久久人做人爽一区二区三区| 欧美久久精品一级c片片| 国内精品综合久久久40p| 97久久精品人人澡人人爽| 久久综合给久久狠狠97色| 久久久久久一区国产精品| 国产91色综合久久免费分享| 久久综合亚洲色HEZYO社区| 久久99精品国产麻豆宅宅| 亚洲AV无码久久| 久久狠狠爱亚洲综合影院| 久久黄视频| 久久亚洲视频| 久久精品无码一区二区三区日韩 | 亚洲人AV永久一区二区三区久久 | 一本色综合网久久| 色播久久人人爽人人爽人人片AV| 久久久久国产一区二区三区| 国产精品久久久久天天影视| 亚洲乱码精品久久久久..| 久久99热这里只频精品6| 日韩中文久久| 亚洲欧洲中文日韩久久AV乱码| 久久久久久国产精品无码下载| 国产精品青草久久久久福利99| 99久久综合国产精品二区| 国产午夜精品久久久久九九电影| 久久香蕉一级毛片| 久久久久99精品成人片三人毛片 |