• <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年6月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            293012345


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

            常用鏈接

            留言簿(94)

            隨筆分類(649)

            隨筆檔案(505)

            相冊

            BCB

            Crytek

            • crymod
            • Crytek's Offical Modding Portal

            Game Industry

            OGRE

            other

            Programmers

            Qt

            WOW Stuff

            搜索

            •  

            積分與排名

            • 積分 - 911346
            • 排名 - 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 七星重劍 閱讀(947) 評論(0)  編輯 收藏 引用 所屬分類: Game Graphics 、HLSL&ShaderMonkey
            日本亚洲色大成网站WWW久久| 97久久国产亚洲精品超碰热| 久久无码国产| 日日狠狠久久偷偷色综合免费| 久久伊人精品一区二区三区| 久久久久亚洲精品无码蜜桃| 狠狠干狠狠久久| 亚洲国产成人久久一区WWW| 色欲综合久久中文字幕网| 久久久久久综合一区中文字幕 | 亚洲国产另类久久久精品| www性久久久com| 久久综合色老色| 国产精品久久久久影院嫩草| 四虎影视久久久免费| 91视频国产91久久久| 久久天天婷婷五月俺也去| 色综合久久久久| 人妻久久久一区二区三区| 亚洲国产成人久久笫一页| 午夜不卡888久久| 久久人人妻人人爽人人爽| 精品久久久久久无码不卡| 国产精品亚洲综合专区片高清久久久| 久久久久av无码免费网| 午夜精品久久久久成人| AA级片免费看视频久久| 色综合久久最新中文字幕| 国产婷婷成人久久Av免费高清 | 久久亚洲精品无码AV红樱桃| 一本色道久久88综合日韩精品 | 成人综合久久精品色婷婷| 久久亚洲欧洲国产综合| 国产成人久久久精品二区三区| 久久精品无码一区二区三区| 久久91精品国产91久久小草| 久久精品国产亚洲av高清漫画| 久久久久久国产精品免费无码 | 国产成人久久精品麻豆一区 | 18岁日韩内射颜射午夜久久成人| 久久777国产线看观看精品|