• <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>

            天行健 君子當(dāng)自強(qiáng)而不息

            網(wǎng)格模型高級技術(shù)(18)


            cSkinMesh類的設(shè)計與實現(xiàn)

            cSkinMesh類的實現(xiàn)與cAnimMesh的實現(xiàn)基本相同,區(qū)別在以下幾點。

             

            首先是在load_from_xfile()中增加了對網(wǎng)格模型骨骼矩陣的保存:

            HRESULT cSkinMesh::setup_bone_matrix_pointers(D3DXFRAME* frame)
            {    
                HRESULT hr;

                
            if(frame == NULL)
                    
            return S_OK;

                
            if(frame->pMeshContainer != NULL)
                {
                    hr 
            = setup_bone_matrix_pointers_on_mesh(frame->pMeshContainer);

                    
            if(FAILED(hr))
                        
            return hr;
                }

                
            if(frame->pFrameSibling != NULL)
                {
                    hr 
            = setup_bone_matrix_pointers(frame->pFrameSibling);

                    
            if(FAILED(hr))
                        
            return hr;
                }

                
            if(frame->pFrameFirstChild != NULL)
                {
                    hr 
            = setup_bone_matrix_pointers(frame->pFrameFirstChild);

                    
            if(FAILED(hr))
                        
            return hr;
                }
                
                
            return S_OK;    
            }


            HRESULT cSkinMesh::setup_bone_matrix_pointers_on_mesh(D3DXMESHCONTAINER
            * base_mesh_container)
            {
                
            if(base_mesh_container == NULL)
                    
            return S_OK;

                D3DXMESHCONTAINER_DERIVED
            * mesh_container = (D3DXMESHCONTAINER_DERIVED*) base_mesh_container;

                
            if(mesh_container->pSkinInfo != NULL)
                {
                    UINT num_bones 
            = mesh_container->pSkinInfo->GetNumBones();
                    mesh_container
            ->ppBoneMatrices = new D3DXMATRIX*[num_bones];

                    
            if(mesh_container->ppBoneMatrices == NULL)
                        
            return E_OUTOFMEMORY;

                    
            for(UINT i = 0; i < num_bones; i++)
                    {
                        LPCSTR bone_name 
            = mesh_container->pSkinInfo->GetBoneName(i);
                        D3DXFRAME_DERIVED
            * frame = (D3DXFRAME_DERIVED*) D3DXFrameFind(m_root_frame, bone_name);

                        
            if(frame == NULL)
                            
            return E_FAIL;

                        mesh_container
            ->ppBoneMatrices[i] = &frame->CombinedTransformMatrix;
                    }
                }

                
            return S_OK;
            }


            HRESULT cSkinMesh::load_from_xfile(CONST WCHAR
            * wfilename)
            {
                HRESULT hr;

                WCHAR wpath[MAX_PATH];
                DXUTFindDXSDKMediaFileCch(wpath, 
            sizeof(wpath) / sizeof(WCHAR), wfilename);

                V_RETURN(D3DXLoadMeshHierarchyFromXW(wpath, D3DXMESH_MANAGED, m_device, m_alloc_hierarchy, NULL, 
            &m_root_frame,
                                                     
            &m_anim_controller));

                V_RETURN(setup_bone_matrix_pointers(m_root_frame));

                V_RETURN(D3DXFrameCalculateBoundingSphere(m_root_frame, 
            &m_object_center, &m_object_radius));

                
            return S_OK;
            }

             

             

            接下來是DrawMeshContainer()的實現(xiàn),該函數(shù)負(fù)責(zé)當(dāng)前網(wǎng)格容器中具體網(wǎng)格模型的渲染,其實現(xiàn)大致可以分為以下幾個步驟:

            【1】如果當(dāng)前網(wǎng)格模型是蒙皮網(wǎng)格模型

            (1)根據(jù)當(dāng)前硬件設(shè)備的性能決定是否采用軟件頂點處理模式。

            (2)激活索引頂點混合。

            (3)設(shè)置頂點混合所需要的矩陣索引數(shù)量。

            (4)渲染索引蒙皮網(wǎng)格模型,在具體渲染時,需要逐個屬性組進(jìn)行渲染,在渲染每個子網(wǎng)格時,首先需要設(shè)置骨骼混合矩陣、材質(zhì)和數(shù)組。

            (5)恢復(fù)相關(guān)渲染狀態(tài)。

            【2】如果當(dāng)前網(wǎng)格模型不是蒙皮網(wǎng)格模型,則直接設(shè)置組合變換矩陣、材質(zhì)和紋理,然后進(jìn)行渲染。

             HRESULT cSkinMesh::draw_mesh_container(CONST D3DXMESHCONTAINER* base_mesh_container, CONST D3DXFRAME* base_frame)
            {
                HRESULT hr;

                D3DXMESHCONTAINER_DERIVED
            * mesh_container = (D3DXMESHCONTAINER_DERIVED*) base_mesh_container;
                D3DXFRAME_DERIVED
            * frame = (D3DXFRAME_DERIVED*) base_frame;

                
            if(mesh_container->pSkinInfo != NULL)
                {
                    
            if(mesh_container->UseSoftwareVP)
                    {
                        V_RETURN(m_device
            ->SetSoftwareVertexProcessing(TRUE));
                    }
                    
                    
            if(mesh_container->MaxBonesInflPerVertex)
                        m_device
            ->SetRenderState(D3DRS_INDEXEDVERTEXBLENDENABLE, TRUE);

                    
            if(mesh_container->MaxBonesInflPerVertex == 1)
                        m_device
            ->SetRenderState(D3DRS_VERTEXBLEND, D3DVBF_0WEIGHTS);
                    
            else if(mesh_container->MaxBonesInflPerVertex == 2)
                        m_device
            ->SetRenderState(D3DRS_VERTEXBLEND, D3DVBF_1WEIGHTS);
                    
            else if(mesh_container->MaxBonesInflPerVertex == 3)
                        m_device
            ->SetRenderState(D3DRS_VERTEXBLEND, D3DVBF_2WEIGHTS);
                    
            else
                        m_device
            ->SetRenderState(D3DRS_VERTEXBLEND, D3DVBF_3WEIGHTS);

                    D3DXBONECOMBINATION
            * bone_comb = (D3DXBONECOMBINATION*) mesh_container->pBoneCombBuffer->GetBufferPointer();

                    
            for(UINT attr_index = 0; attr_index < mesh_container->NumAttrGroups; attr_index++)
                    {
                        
            // setup vertex index blending world matrix for every mesh group
                        for(UINT palette_index = 0; palette_index < mesh_container->NumMatrixPalettes; palette_index++)
                        {
                            UINT matrix_index 
            = bone_comb[attr_index].BoneId[palette_index];

                            
            if(matrix_index != UINT_MAX)
                            {
                                D3DXMATRIX mat_palette;

                                D3DXMatrixMultiply(
            &mat_palette,
                                                   mesh_container
            ->ppBoneOffsetMatrices[matrix_index],
                                                   mesh_container
            ->ppBoneMatrices[matrix_index]);

                                m_device
            ->SetTransform(D3DTS_WORLDMATRIX(palette_index), &mat_palette);
                            }
                        }

                        DWORD attr_id 
            = bone_comb[attr_index].AttribId;

                        m_device
            ->SetMaterial(&mesh_container->pMaterials[attr_id].MatD3D);
                        m_device
            ->SetTexture(0, mesh_container->ppTextures[attr_id]);

                        mesh_container
            ->MeshData.pMesh->DrawSubset(attr_index);
                    }

                    
            // restore render state

                    m_device
            ->SetRenderState(D3DRS_INDEXEDVERTEXBLENDENABLE, FALSE);
                    m_device
            ->SetRenderState(D3DRS_VERTEXBLEND, D3DVBF_DISABLE);

                    
            if(mesh_container->UseSoftwareVP)
                    {
                        V_RETURN(m_device
            ->SetSoftwareVertexProcessing(FALSE));
                    }
                }
                
            else
                {
                    m_device
            ->SetTransform(D3DTS_WORLD, &frame->CombinedTransformMatrix);

                    
            for(UINT i = 0; i < mesh_container->NumMaterials; i++)
                    {
                        m_device
            ->SetMaterial(&mesh_container->pMaterials[i].MatD3D);
                        m_device
            ->SetTexture(0, mesh_container->ppTextures[i]);

                        mesh_container
            ->MeshData.pMesh->DrawSubset(i);
                    }
                }

                
            return S_OK;
            }

             

             

            蒙皮骨骼動畫網(wǎng)格模型類的使用

            首先需要修改頂點處理模式,如果當(dāng)前Direct3D設(shè)備使用純硬件頂點處理模式,則改為混合頂點處理模式:

            // If video card does not support hardware transform and light, then uses sofaware mode.
            if((pCaps->DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0)
            pDeviceSettings->BehaviorFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING;
            // !!important, change vertex processing to mixed mode.
            if(pDeviceSettings->BehaviorFlags & D3DCREATE_HARDWARE_VERTEXPROCESSING)
            pDeviceSettings->BehaviorFlags = D3DCREATE_MIXED_VERTEXPROCESSING;

            因為硬件可能不支持索引頂點混合,這時就需要使用軟件頂點處理,所以在使用cSkinMesh類渲染蒙皮骨骼動畫網(wǎng)格模型的程序中,如果Direct3D設(shè)備使用純硬件頂點處理模式,則需要改為混合頂點處理模式,否則在調(diào)用IDirect3DDevice9::SetSoftwareProcessing()函數(shù)將頂點處理模式改為軟件頂點處理模式時會出錯。

            接下來在回調(diào)函數(shù)OnCreateDevice()中創(chuàng)建cSkinMesh類的實例:

            g_skin_mesh = new cSkinMesh();
            V_RETURN(g_skin_mesh->create(pd3dDevice, L"tiny.x"));

            再接下來在回調(diào)函數(shù)OnFrameRender()中渲染網(wǎng)格模型:

            V(g_skin_mesh->render(&g_mat_world, fElapsedTime));

            最后在回調(diào)函數(shù)OnDestroyDevice()中釋放網(wǎng)格模型:

            g_skin_mesh->destroy();

             

            運行截圖:

             

            主程序:

            #include "dxstdafx.h"
            #include 
            "resource.h"
            #include 
            "SkinMesh.h"

            #pragma warning(disable : 
            4127 4995)

            #define IDC_TOGGLE_FULLSCREEN    1
            #define IDC_TOGGLE_REF            2
            #define IDC_CHANGE_DEVICE        3

            #define release_com(p)    do { if(p) { (p)->Release(); (p) = NULL; } } while(0)

            ID3DXFont
            *                    g_font;
            ID3DXSprite
            *                g_text_sprite;
            bool                        g_show_help;

            CDXUTDialogResourceManager    g_dlg_resource_manager;
            CD3DSettingsDlg                g_settings_dlg;
            CDXUTDialog                    g_button_dlg;

            cSkinMesh
            *                    g_skin_mesh;
            D3DXMATRIX                    g_mat_world;

            //--------------------------------------------------------------------------------------
            // Rejects any devices that aren't acceptable by returning false
            //--------------------------------------------------------------------------------------
            bool CALLBACK IsDeviceAcceptable( D3DCAPS9* pCaps, D3DFORMAT AdapterFormat, 
                                              D3DFORMAT BackBufferFormat, 
            bool bWindowed, void* pUserContext )
            {
                
            // Typically want to skip backbuffer formats that don't support alpha blending

                IDirect3D9
            * pD3D = DXUTGetD3DObject(); 

                
            if( FAILED( pD3D->CheckDeviceFormat( pCaps->AdapterOrdinal, pCaps->DeviceType, AdapterFormat, 
                                D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING, D3DRTYPE_TEXTURE, BackBufferFormat ) ) )
                    
            return false;

                
            return true;
            }


            //--------------------------------------------------------------------------------------
            // Before a device is created, modify the device settings as needed.
            //--------------------------------------------------------------------------------------
            bool CALLBACK ModifyDeviceSettings( DXUTDeviceSettings* pDeviceSettings, const D3DCAPS9* pCaps, void* pUserContext )
            {
                
            // If video card does not support hardware transform and light, then uses sofaware mode.
                if((pCaps->DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0)
                    pDeviceSettings
            ->BehaviorFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING;

                
            // !!important, change vertex processing to mixed mode.
                if(pDeviceSettings->BehaviorFlags & D3DCREATE_HARDWARE_VERTEXPROCESSING)
                    pDeviceSettings
            ->BehaviorFlags = D3DCREATE_MIXED_VERTEXPROCESSING;

                
            static bool is_first_time = true;

                
            if(is_first_time)
                {
                    is_first_time 
            = false;

                    
            // if using reference device, then pop a warning message box.
                    if(pDeviceSettings->DeviceType == D3DDEVTYPE_REF)
                        DXUTDisplaySwitchingToREFWarning();
                }

                
            return true;
            }


            //--------------------------------------------------------------------------------------
            // Create any D3DPOOL_MANAGED resources here 
            //--------------------------------------------------------------------------------------
            HRESULT CALLBACK OnCreateDevice( IDirect3DDevice9* pd3dDevice, 
                                             
            const D3DSURFACE_DESC* pBackBufferSurfaceDesc, 
                                             
            void* pUserContext )
            {
                HRESULT    hr;

                V_RETURN(g_dlg_resource_manager.OnCreateDevice(pd3dDevice));
                V_RETURN(g_settings_dlg.OnCreateDevice(pd3dDevice));

                D3DXCreateFont(pd3dDevice, 
            180, FW_BOLD, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY,
                               DEFAULT_PITCH 
            | FF_DONTCARE, L"Arial"&g_font);
                
                g_skin_mesh 
            = new cSkinMesh();
                V_RETURN(g_skin_mesh
            ->create(pd3dDevice, L"tiny.x"));

                
            return S_OK;
            }


            //--------------------------------------------------------------------------------------
            // Create any D3DPOOL_DEFAULT resources here 
            //--------------------------------------------------------------------------------------
            HRESULT CALLBACK OnResetDevice( IDirect3DDevice9* pd3dDevice, 
                                            
            const D3DSURFACE_DESC* pBackBufferSurfaceDesc, 
                                            
            void* pUserContext )
            {
                HRESULT hr;

                V_RETURN(g_dlg_resource_manager.OnResetDevice());
                V_RETURN(g_settings_dlg.OnResetDevice());
                V_RETURN(g_font
            ->OnResetDevice());
                V_RETURN(D3DXCreateSprite(pd3dDevice, 
            &g_text_sprite));

                
            // set dialog position and size

                g_button_dlg.SetLocation(pBackBufferSurfaceDesc
            ->Width - 1700);
                g_button_dlg.SetSize(
            170170);

                
            // setup view matrix

                D3DXMATRIX mat_view;
                D3DXVECTOR3 eye(
            0.0f0.0f-1000.0f);
                D3DXVECTOR3  at(
            0.0f0.0f,  0.0f);
                D3DXVECTOR3  up(
            0.0f1.0f,  0.0f);

                D3DXMatrixLookAtLH(
            &mat_view, &eye, &at, &up);
                pd3dDevice
            ->SetTransform(D3DTS_VIEW, &mat_view);

                
            // set projection matrix
                D3DXMATRIX mat_proj;    
                
            float aspect = (float)pBackBufferSurfaceDesc->Width / pBackBufferSurfaceDesc->Height;
                D3DXMatrixPerspectiveFovLH(
            &mat_proj, D3DX_PI/4, aspect, 1.0f2000.0f);
                pd3dDevice
            ->SetTransform(D3DTS_PROJECTION, &mat_proj);

                
            // setup light
                
                D3DLIGHT9 light;
                ZeroMemory(
            &light, sizeof(D3DLIGHT9));

                light.Type       
            = D3DLIGHT_DIRECTIONAL;
                light.Diffuse.r  
            = 1.0f;
                light.Diffuse.g  
            = 1.0f;
                light.Diffuse.b  
            = 1.0f;
                light.Range         
            = 1000.0f;

                D3DXVECTOR3 light_dir(
            0.0f-1.0f1.0f);    
                D3DXVec3Normalize((D3DXVECTOR3
            *&light.Direction, &light_dir);
                pd3dDevice
            ->SetLight(0&light);
                pd3dDevice
            ->LightEnable(0, TRUE);
                pd3dDevice
            ->SetRenderState(D3DRS_LIGHTING, TRUE);

                pd3dDevice
            ->SetRenderState(D3DRS_AMBIENT, 0x00505050);

                
            return S_OK;
            }

            //--------------------------------------------------------------------------------------
            // Release resources created in the OnResetDevice callback here 
            //--------------------------------------------------------------------------------------
            void CALLBACK OnLostDevice( void* pUserContext )
            {
                g_dlg_resource_manager.OnLostDevice();
                g_settings_dlg.OnLostDevice();
                g_font
            ->OnLostDevice();

                release_com(g_text_sprite);
            }


            //--------------------------------------------------------------------------------------
            // Release resources created in the OnCreateDevice callback here
            //--------------------------------------------------------------------------------------
            void CALLBACK OnDestroyDevice( void* pUserContext )
            {
                g_dlg_resource_manager.OnDestroyDevice();
                g_settings_dlg.OnDestroyDevice();    

                release_com(g_font);

                g_skin_mesh
            ->destroy();
            }

            //--------------------------------------------------------------------------------------
            // Handle updates to the scene
            //--------------------------------------------------------------------------------------
            void CALLBACK OnFrameMove( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext )
            {
                D3DXMATRIX mat_trans, mat_rot;    
                
                D3DXMatrixTranslation(
            &mat_trans, 0.0f30.0f-100.0f);
                D3DXMatrixRotationY(
            &mat_rot, timeGetTime() / 1000.0f);
                    
                g_mat_world 
            = mat_trans * mat_rot;
            }

            //--------------------------------------------------------------------------------------
            // Render the helper information
            //--------------------------------------------------------------------------------------
            void RenderText()
            {
                CDXUTTextHelper text_helper(g_font, g_text_sprite, 
            20);
                
                text_helper.Begin();

                
            // show frame and device states
                text_helper.SetInsertionPos(55);
                text_helper.SetForegroundColor( D3DXCOLOR(
            1.0f0.475f0.0f1.0f) );
                text_helper.DrawTextLine( DXUTGetFrameStats(
            true) );
                text_helper.DrawTextLine( DXUTGetDeviceStats() );

                
            // show helper information
                
                
            const D3DSURFACE_DESC* surface_desc = DXUTGetBackBufferSurfaceDesc();

                
            if(g_show_help)
                {
                    text_helper.SetInsertionPos(
            10, surface_desc->Height - 15 * 6);
                    text_helper.SetForegroundColor( D3DXCOLOR(
            1.0f0.475f0.0f1.0f) );
                    text_helper.DrawTextLine(L
            "Controls (F1 to hide):");
                    
                    text_helper.SetInsertionPos(
            40, surface_desc->Height - 15 * 4);
                    text_helper.DrawTextLine(L
            "Quit: ESC");
                }
                
            else
                {
                    text_helper.SetInsertionPos(
            10, surface_desc->Height - 15 * 4);
                    text_helper.SetForegroundColor( D3DXCOLOR(
            1.0f1.0f1.0f1.0f) );
                    text_helper.DrawTextLine(L
            "Press F1 for help");
                }

                text_helper.End();
            }

            //--------------------------------------------------------------------------------------
            // Render the scene 
            //--------------------------------------------------------------------------------------
            void CALLBACK OnFrameRender( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext )
            {
                HRESULT hr;

                
            if(g_settings_dlg.IsActive())
                {
                    g_settings_dlg.OnRender(fElapsedTime);
                    
            return;
                }

                
            // Clear the render target and the zbuffer 
                V( pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB(0000), 1.0f0) );

                
            // Render the scene
                if( SUCCEEDED( pd3dDevice->BeginScene() ) )
                {                                    
                    V(g_skin_mesh
            ->render(&g_mat_world, fElapsedTime));
                    RenderText();
                    V(g_button_dlg.OnRender(fElapsedTime));

                    V( pd3dDevice
            ->EndScene() );
                }
            }


            //--------------------------------------------------------------------------------------
            // Handle messages to the application 
            //--------------------------------------------------------------------------------------
            LRESULT CALLBACK MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, 
                                      
            bool* pbNoFurtherProcessing, void* pUserContext )
            {
                
            *pbNoFurtherProcessing = g_dlg_resource_manager.MsgProc(hWnd, uMsg, wParam, lParam);
                
            if(*pbNoFurtherProcessing)
                    
            return 0;

                
            if(g_settings_dlg.IsActive())
                {
                    g_settings_dlg.MsgProc(hWnd, uMsg, wParam, lParam);
                    
            return 0;
                }

                
            *pbNoFurtherProcessing = g_button_dlg.MsgProc(hWnd, uMsg, wParam, lParam);
                
            if(*pbNoFurtherProcessing)
                    
            return 0;

                
            return 0;
            }


            //--------------------------------------------------------------------------------------
            // Handle keybaord event
            //--------------------------------------------------------------------------------------
            void CALLBACK OnKeyboardProc(UINT charater, bool is_key_down, bool is_alt_down, void* user_context)
            {
                
            if(is_key_down)
                {
                    
            switch(charater)
                    {
                    
            case VK_F1:
                        g_show_help 
            = !g_show_help;
                        
            break;
                    }
                }
            }

            //--------------------------------------------------------------------------------------
            // Handle events for controls
            //--------------------------------------------------------------------------------------
            void CALLBACK OnGUIEvent(UINT eventint control_id, CDXUTControl* control, void* user_context)
            {
                
            switch(control_id)
                {
                
            case IDC_TOGGLE_FULLSCREEN:
                    DXUTToggleFullScreen();
                    
            break;

                
            case IDC_TOGGLE_REF:
                    DXUTToggleREF();
                    
            break;

                
            case IDC_CHANGE_DEVICE:
                    g_settings_dlg.SetActive(
            true);
                    
            break;
                }
            }

            //--------------------------------------------------------------------------------------
            // Initialize dialogs
            //--------------------------------------------------------------------------------------
            void InitDialogs()
            {
                g_settings_dlg.Init(
            &g_dlg_resource_manager);
                g_button_dlg.Init(
            &g_dlg_resource_manager);

                g_button_dlg.SetCallback(OnGUIEvent);

                
            int x = 35, y = 10, width = 125, height = 22;

                g_button_dlg.AddButton(IDC_TOGGLE_FULLSCREEN, L
            "Toggle full screen", x, y,         width, height);
                g_button_dlg.AddButton(IDC_TOGGLE_REF,          L
            "Toggle REF (F3)",     x, y += 24, width, height);
                g_button_dlg.AddButton(IDC_CHANGE_DEVICE,      L
            "Change device (F2)", x, y += 24, width, height, VK_F2);    
            }

            //--------------------------------------------------------------------------------------
            // Initialize everything and go into a render loop
            //--------------------------------------------------------------------------------------
            INT WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
            {
                
            // Enable run-time memory check for debug builds.
            #if defined(DEBUG) | defined(_DEBUG)
                _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF 
            | _CRTDBG_LEAK_CHECK_DF );
            #endif

                
            // Set the callback functions
                DXUTSetCallbackDeviceCreated( OnCreateDevice );
                DXUTSetCallbackDeviceReset( OnResetDevice );
                DXUTSetCallbackDeviceLost( OnLostDevice );
                DXUTSetCallbackDeviceDestroyed( OnDestroyDevice );
                DXUTSetCallbackMsgProc( MsgProc );
                DXUTSetCallbackFrameRender( OnFrameRender );
                DXUTSetCallbackFrameMove( OnFrameMove );
                DXUTSetCallbackKeyboard(OnKeyboardProc);
               
                
            // TODO: Perform any application-level initialization here
                InitDialogs();

                
            // Initialize DXUT and create the desired Win32 window and Direct3D device for the application
                DXUTInit( truetruetrue ); // Parse the command line, handle the default hotkeys, and show msgboxes
                DXUTSetCursorSettings( truetrue ); // Show the cursor and clip it when in full screen
                DXUTCreateWindow( L"Use Skin Mesh" );
                DXUTCreateDevice( D3DADAPTER_DEFAULT, 
            true640480, IsDeviceAcceptable, ModifyDeviceSettings );

                
            // Start the render loop
                DXUTMainLoop();

                
            // TODO: Perform any application-level cleanup here

                
            return DXUTGetExitCode();
            }

            下載示例工程


            posted on 2008-06-13 13:11 lovedday 閱讀(2923) 評論(0)  編輯 收藏 引用


            只有注冊用戶登錄后才能發(fā)表評論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            公告

            導(dǎo)航

            統(tǒng)計

            常用鏈接

            隨筆分類(178)

            3D游戲編程相關(guān)鏈接

            搜索

            最新評論

            亚洲国产精品热久久| 国产精品久久久久久久app | 久久91精品国产91久久小草| 少妇内射兰兰久久| 久久精品国产福利国产秒| 久久久黄片| 精品综合久久久久久888蜜芽| 精品久久香蕉国产线看观看亚洲 | 国产高潮久久免费观看| 尹人香蕉久久99天天拍| 久久久精品人妻一区二区三区蜜桃| 国内精品久久国产大陆| 久久人人爽人人爽人人片AV高清| 天天综合久久久网| 久久久久久亚洲AV无码专区| 久久久久久久国产免费看| 国产精品对白刺激久久久| 成人久久免费网站| 久久综合色区| 久久精品国产WWW456C0M| 久久精品免费观看| 久久久久亚洲精品天堂| 无码任你躁久久久久久| 久久被窝电影亚洲爽爽爽| 久久香蕉超碰97国产精品| 久久国内免费视频| 性做久久久久久久久浪潮| 日韩亚洲欧美久久久www综合网| 无码人妻久久一区二区三区蜜桃 | 久久黄视频| 国产午夜福利精品久久| 久久精品国产清高在天天线| 亚洲国产精品无码久久一线| 人妻少妇精品久久| 欧美激情精品久久久久久| 777久久精品一区二区三区无码| 精品久久久久久无码专区不卡| 蜜臀av性久久久久蜜臀aⅴ麻豆 | 免费精品99久久国产综合精品 | 99精品久久久久久久婷婷| 久久99国产精品一区二区|