青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

天行健 君子當自強而不息

D3D Animation Basis(7)

Updating Skinned Meshes

A skinned mesh works like this: Each vertex is attached to an imaginary bone (which is specified by a frame object). As these frames move, so do the vertices attached to them. To update the coordinates of the vertices as the bones move, you need to call a special function that takes the source vertex data, transforms it according to the bones' transformations, and stores the results in a second mesh object. This special function is called ID3DXSkinInfo::UpdateSkinnedMesh.

Whenever you load a mesh using the D3DXLoadSkinMeshFromXof function (which is what the second LoadMesh function does), you get a pointer to an ID3DXSkinInfo object. This object contains the information about which vertices are attached to which bones. This way, the object knows which transformations to apply to the vertices.

To update the vertices, you must first lock the mesh's vertex buffer (which contains the source vertex coordinates), as well as the destination mesh's vertex buffer. The destination mesh will receive the updated vertices as they are transformed. Once locked, you need to call UpdateSkinnedMesh, also specifying a series of transformation matrices (stored as D3DXMATRIX objects) that represent the various bone transformations.

For now, just check out the update_skin_mesh helper function code to see how it updates the skinned meshes for you.

HRESULT update_skin_mesh(D3DXMESHCONTAINER_EX* mesh_container)
{
    
if(mesh_container == NULL)
        
return E_FAIL;

    
if(mesh_container->MeshData.pMesh == NULL || mesh_container->skin_mesh == NULL || mesh_container->pSkinInfo == NULL)
        
return E_FAIL;

    
if(mesh_container->bone_matrices == NULL || mesh_container->frame_matrices == NULL)
        
return E_FAIL;

    
// copy the bone matrices over (must have been combined before call draw_mesh)
    for(DWORD i = 0; i < mesh_container->pSkinInfo->GetNumBones(); i++)
    {
        
// start with bone offset matrix
        mesh_container->bone_matrices[i] = *(mesh_container->pSkinInfo->GetBoneOffsetMatrix(i));

        
// apply frame transformation
        if(mesh_container->frame_matrices[i])
            mesh_container
->bone_matrices[i] *= (*mesh_container->frame_matrices[i]);
    }

    
void* src_vertices;
    
void* dest_vertices;

    mesh_container
->MeshData.pMesh->LockVertexBuffer(D3DLOCK_READONLY, (void**)&src_vertices);
    mesh_container
->skin_mesh->LockVertexBuffer(0, (void**)&dest_vertices);

    
// update the skinned mesh using provided transformations
    mesh_container->pSkinInfo->UpdateSkinnedMesh(mesh_container->bone_matrices, NULL, src_vertices, dest_vertices);

    mesh_container
->MeshData.pMesh->UnlockVertexBuffer();
    mesh_container
->skin_mesh->UnlockVertexBuffer();    

    
return S_OK;
}

 

Aside from the typical error−checking code, the update_skin_mesh function starts by looping through each bone contained within the ID3DXSkinInfo object (stored in the D3DXMESHCONTAINER_EX object you've already loaded). For each bone, the original transformation matrix from the .X file is grabbed and stored in an array of matrices used in the call to UpdateSkinnedMesh.

From here the bone's transformation, as stored in the bone's respective frame object, is applied to the transformation matrix. This process continues until all transformation matrices are set up

At this point, you are ready to lock the vertex buffers and call the UpdateSkinnedMesh function.

The function is finished by unlocking the buffers and returning a success code.

And once again speaking of rendering, it is finally time to see the helper functions I created to get those
meshes on screen!


posted on 2008-04-15 10:22 lovedday 閱讀(320) 評論(0)  編輯 收藏 引用


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


公告

導航

統計

常用鏈接

隨筆分類(178)

3D游戲編程相關鏈接

搜索

最新評論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            亚洲一区二区精品视频| 久久国产精品99精品国产| 欧美黄污视频| 亚洲精品四区| 亚洲激情另类| 欧美精品一区二区精品网| 99re66热这里只有精品4| 亚洲久色影视| 国产精品一区在线观看| 久久久国产成人精品| 久久久久久久综合| 亚洲国产福利在线| 日韩午夜三级在线| 国产欧美日韩| 欧美高清视频在线观看| 欧美精品在线播放| 欧美一级欧美一级在线播放| 午夜日韩在线观看| 在线观看亚洲精品| 亚洲精品视频在线观看免费| 国产精品日韩精品欧美精品| 久久久久在线观看| 欧美极品aⅴ影院| 亚洲欧美日韩在线不卡| 欧美在线影院| 亚洲视频网在线直播| 欧美在线免费一级片| 亚洲精品在线免费| 午夜综合激情| 一区二区福利| 久久蜜桃资源一区二区老牛| 亚洲最新中文字幕| 久久久久成人精品| 亚洲免费网站| 欧美精品18| 久久亚洲一区二区三区四区| 欧美日韩另类综合| 免费成人毛片| 国产精品视频一区二区三区| 亚洲国产精品999| 国色天香一区二区| 亚洲在线中文字幕| 一区二区日韩精品| 狼狼综合久久久久综合网| 亚洲一区国产一区| 欧美激情精品久久久久久大尺度| 欧美一区二区日韩| 欧美午夜精彩| 亚洲精选一区二区| 亚洲国产一区二区三区高清| 亚洲欧美自拍偷拍| 午夜精品久久久久影视| 欧美肥婆在线| 欧美成人一区在线| 一区二区自拍| 久久精品久久99精品久久| 欧美伊人影院| 国产精品理论片| 99pao成人国产永久免费视频| 亚洲人成啪啪网站| 欧美.com| 亚洲电影激情视频网站| 在线观看亚洲专区| 久久九九精品99国产精品| 久久精品国亚洲| 国产日本欧洲亚洲| 亚洲一区影院| 欧美中在线观看| 国产日韩欧美在线看| 亚洲欧美一区二区三区极速播放| 亚洲一区二区在线免费观看| 欧美片网站免费| av成人国产| 性欧美大战久久久久久久久| 国产精品任我爽爆在线播放| 亚洲在线黄色| 久久久久久亚洲精品不卡4k岛国| 国产亚洲一区在线| 久久久亚洲精品一区二区三区| 老色鬼久久亚洲一区二区| 黄色亚洲网站| 免费一级欧美片在线观看| 亚洲国产欧美一区二区三区丁香婷| 亚洲国产精品成人综合| 欧美极品在线观看| 亚洲一区二区三区高清| 久久国内精品视频| 亚洲国产精品成人| 欧美激情一区二区三区成人| 99热在这里有精品免费| 欧美尤物一区| 亚洲国产另类精品专区| 欧美激情精品久久久久久蜜臀 | 亚洲第一精品福利| 欧美成人蜜桃| 亚洲午夜羞羞片| 美女网站在线免费欧美精品| 亚洲免费精品| 国产日韩欧美综合精品| 久久日韩粉嫩一区二区三区| 亚洲精品在线观| 欧美一级成年大片在线观看| 影院欧美亚洲| 欧美午夜无遮挡| 久久久久久久一区二区| 日韩亚洲精品视频| 久久久国产亚洲精品| 亚洲精品乱码久久久久久按摩观| 国产精品地址| 美日韩精品视频免费看| 亚洲无吗在线| 亚洲激情六月丁香| 久久久久久久久久码影片| 日韩亚洲成人av在线| 国产一区二区中文| 欧美日韩第一区| 久久精品123| 亚洲一区区二区| 亚洲啪啪91| 麻豆freexxxx性91精品| 亚洲欧美视频一区| 亚洲精选一区| 激情亚洲成人| 国产日韩欧美二区| 欧美午夜剧场| 欧美粗暴jizz性欧美20| 欧美一区二区福利在线| 亚洲午夜一区二区三区| 亚洲精品一区在线观看| 老司机精品导航| 欧美自拍丝袜亚洲| 亚洲女与黑人做爰| 亚洲一区二区黄色| 亚洲毛片视频| 亚洲精品小视频| 亚洲国产精品嫩草影院| 国内外成人免费激情在线视频| 国产精品久久777777毛茸茸| 欧美日韩国产一中文字不卡| 蜜桃久久精品乱码一区二区| 久久久国产视频91| 久久精品国产综合精品| 久久精品久久99精品久久| 香蕉av福利精品导航| 欧美亚洲一区二区在线| 亚洲欧美另类综合偷拍| 午夜在线不卡| 欧美诱惑福利视频| 欧美专区在线播放| 久久久夜夜夜| 久久躁日日躁aaaaxxxx| 蜜臀av一级做a爰片久久| 久久在线观看视频| 免费在线亚洲欧美| 欧美人妖在线观看| 欧美日韩午夜激情| 国产精品久久久久一区二区三区| 国产精品高潮呻吟久久av黑人| 国产精品久久二区二区| 国产精品麻豆va在线播放| 国产女主播在线一区二区| 国产欧美精品在线播放| 好吊日精品视频| 亚洲国产成人av在线| 亚洲日本黄色| 亚洲欧美精品中文字幕在线| 欧美一区二区三区免费视| 久久久久久久欧美精品| 免费久久精品视频| 亚洲另类一区二区| 亚洲一区综合| 久久这里只有精品视频首页| 欧美成人精品在线播放| 国产精品久久久久高潮| 国产综合视频在线观看| 亚洲日本精品国产第一区| 亚洲欧美成人一区二区在线电影| 欧美一区二区三区喷汁尤物| 蜜桃av噜噜一区| 99精品视频一区| 欧美一区二区在线免费观看 | 亚洲精品久久| 亚洲欧美制服另类日韩| 另类专区欧美制服同性| 欧美视频三区在线播放| 伊人久久综合97精品| 中文在线资源观看网站视频免费不卡 | 亚洲国产精彩中文乱码av在线播放| 亚洲精品色图| 久久国产主播精品| 91久久夜色精品国产九色| 欧美一级理论片| 欧美人与性动交α欧美精品济南到| 国产精品一区免费观看| 亚洲精品一线二线三线无人区| 午夜精品久久久久久久99黑人 | 一区二区精品国产| 久久综合中文| 亚洲专区国产精品| 欧美日韩和欧美的一区二区|