• <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>
            隨筆 - 505  文章 - 1034  trackbacks - 0
            <2008年9月>
            31123456
            78910111213
            14151617181920
            21222324252627
            2829301234
            567891011


            子曾經曰過:編程無他,唯手熟爾!

            常用鏈接

            留言簿(94)

            隨筆分類(649)

            隨筆檔案(505)

            相冊

            BCB

            Crytek

            • crymod
            • Crytek's Offical Modding Portal

            Game Industry

            OGRE

            other

            Programmers

            Qt

            WOW Stuff

            搜索

            •  

            積分與排名

            • 積分 - 915233
            • 排名 - 14

            最新隨筆

            最新評論

            閱讀排行榜

            評論排行榜


            截圖:





            LPDIRECT3DVERTEXSHADER9         g_pVertexShader = NULL;
            LPD3DXCONSTANTTABLE             g_pConstantTable 
            = NULL;
            LPDIRECT3DVERTEXDECLARATION9    g_pVertexDeclaration 
            = NULL;


            OnCreateDevice


                D3DVERTEXELEMENT9 decl[] =
                {
                    { 
            00, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
                    D3DDECL_END()
                };

                V_RETURN( pd3dDevice
            ->CreateVertexDeclaration( decl, &g_pVertexDeclaration ) );

            創建vertex shader

                // Assemble the vertex shader from the file
                V_RETURN( D3DXCompileShaderFromFile( strPath, NULL, NULL, "Ripple",
                                                     
            "vs_2_0", dwShaderFlags, &pCode,
                                                     NULL, 
            &g_pConstantTable ) );

                
            // Create the vertex shader
                hr = pd3dDevice->CreateVertexShader( ( DWORD* )pCode->GetBufferPointer(),
                                                     
            &g_pVertexShader );



            每幀設置shader里面的常量
            void CALLBACK OnFrameMove( double fTime, float fElapsedTime, void* pUserContext )
            {
                
            // Update the camera's position based on user input 
                g_Camera.FrameMove( fElapsedTime );

                
            // Set up the vertex shader constants
                D3DXMATRIXA16 mWorldViewProj;
                D3DXMATRIXA16 mWorld;
                D3DXMATRIXA16 mView;
                D3DXMATRIXA16 mProj;

                mWorld 
            = *g_Camera.GetWorldMatrix();
                mView 
            = *g_Camera.GetViewMatrix();
                mProj 
            = *g_Camera.GetProjMatrix();

                mWorldViewProj 
            = mWorld * mView * mProj;

                g_pConstantTable
            ->SetMatrix( DXUTGetD3D9Device(), "mWorldViewProj"&mWorldViewProj );
                g_pConstantTable
            ->SetFloat( DXUTGetD3D9Device(), "fTime", ( float
             )fTime );
            }


            Vertex Shader代碼

            HLSLwithoutEffects.vsh
            float4x4 mWorldViewProj;  // World * View * Projection transformation
            float fTime;              // Time parameter. This keeps increasing


            //-----------------------------------------------------------------------------
            // Vertex shader output structure
            //-----------------------------------------------------------------------------
            struct VS_OUTPUT
            {
                float4 Position   : POSITION;   
            // vertex position 
                float4 Diffuse    : COLOR0;     // vertex diffuse color
            };


            //-----------------------------------------------------------------------------
            // Name: Ripple
            // Type: Vertex shader                                      
            // Desc: This shader ripples the vertices
            //-----------------------------------------------------------------------------
            VS_OUTPUT Ripple( in float2 vPosition : POSITION )
            {
                VS_OUTPUT Output;
                
                
            float fSin, fCos;   
                
            float x = length( vPosition ) * sin( fTime ) * 15.0f;
                
                
            // This HLSL intrinsic computes returns both the sine and cosine of x
                sincos( x, fSin, fCos );

                
            // Change the y of the vertex position based on a function of time 
                
            // and transform the vertex into projection space. 
                Output.Position = mul( float4( vPosition.x, fSin * 0.1f, vPosition.y, 1.0f ), mWorldViewProj );
                
                
            // Output the diffuse color as function of time and 
                
            // the vertex's object space position
                Output.Diffuse = 0.5f - 0.5f * fCos;
                
                
            return Output;
            }



            posted on 2008-11-18 14:33 七星重劍 閱讀(950) 評論(0)  編輯 收藏 引用 所屬分類: Game GraphicsHLSL&ShaderMonkey
            久久精品久久久久观看99水蜜桃 | 97香蕉久久夜色精品国产| 日本免费久久久久久久网站| 精品国产婷婷久久久| 国产精品美女久久福利网站| 欧美牲交A欧牲交aⅴ久久| 国产ww久久久久久久久久| 精品久久亚洲中文无码| 777米奇久久最新地址| 精产国品久久一二三产区区别| 日韩人妻无码一区二区三区久久99 | 热久久国产精品| 久久亚洲精品国产精品婷婷| 狠色狠色狠狠色综合久久| 久久精品国产亚洲AV蜜臀色欲| 99久久精品日本一区二区免费| 99精品国产99久久久久久97| 免费精品99久久国产综合精品| 一本色道久久综合狠狠躁篇 | 青青草原综合久久大伊人导航| 久久久国产精品福利免费| 久久久www免费人成精品| 久久精品无码一区二区三区日韩| 91久久成人免费| 久久国产福利免费| av午夜福利一片免费看久久| 久久综合噜噜激激的五月天| 中文字幕无码久久久| 久久国产福利免费| 久久激情亚洲精品无码?V| 国产成人精品久久亚洲| 国产91色综合久久免费分享| 久久人爽人人爽人人片AV| 亚洲人成精品久久久久| 久久精品国产网红主播| 精品久久久久久国产91| 国产精品久久久久AV福利动漫| 久久精品中文騷妇女内射| 伊人久久无码中文字幕| 久久综合给合久久狠狠狠97色69| 亚洲精品国产美女久久久 |