• <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
            人妻精品久久无码专区精东影业| 伊人久久大香线焦综合四虎| 亚洲AV日韩AV永久无码久久| 婷婷伊人久久大香线蕉AV| 久久国产精品无码一区二区三区| 久久电影网2021| 伊人色综合久久天天人守人婷 | 久久96国产精品久久久| 九九热久久免费视频| 人妻久久久一区二区三区| 久久av免费天堂小草播放| 亚洲国产精品久久久天堂| 久久强奷乱码老熟女网站| 国产欧美久久一区二区| 亚洲午夜精品久久久久久浪潮| 色噜噜狠狠先锋影音久久| 77777亚洲午夜久久多人| 精品久久久久久无码中文字幕| 无码人妻久久一区二区三区| 香蕉久久夜色精品国产尤物| 久久国产视屏| 久久最近最新中文字幕大全| 亚洲国产精品无码久久久蜜芽| 久久这里只有精品视频99| AAA级久久久精品无码片| 一本色道久久综合狠狠躁| 久久亚洲欧洲国产综合| 97久久精品人人澡人人爽| 久久亚洲中文字幕精品有坂深雪 | 99久久国产亚洲高清观看2024| 久久精品aⅴ无码中文字字幕不卡| 一本综合久久国产二区| 久久播电影网| 国产精品熟女福利久久AV| 久久最近最新中文字幕大全 | 91久久成人免费| 草草久久久无码国产专区| 久久国产精品-国产精品| 精品久久久久久无码专区不卡| 精品免费久久久久久久| 久久棈精品久久久久久噜噜|