新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> 本版讨论高级C/C++编程、代码重构(Refactoring)、极限编程(XP)、泛型编程等话题
    [返回] 中文XML论坛 - 专业的XML技术讨论区计算机技术与应用『 C/C++编程思想 』 → 网格模型高级技术(4) 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 16510 个阅读者浏览上一篇主题  刷新本主题   平板显示贴子 浏览下一篇主题
     * 贴子主题: 网格模型高级技术(4) 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     卷积内核 帅哥哟,离线,有人找我吗?
      
      
      威望:8
      头衔:总统
      等级:博士二年级(版主)
      文章:3942
      积分:27590
      门派:XML.ORG.CN
      注册:2004/7/21

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给卷积内核发送一个短消息 把卷积内核加入好友 查看卷积内核的个人资料 搜索卷积内核在『 C/C++编程思想 』的所有贴子 访问卷积内核的主页 引用回复这个贴子 回复这个贴子 查看卷积内核的博客楼主
    发贴心情 

    一个网格模型中可以包含多个动画集,在渲染网格时通过动画控制器可以在各个动画集之间进行切换,从而可以在渲染网格模型时根据具体情况播放不同的动画。这里将具有多个骨骼动画的网格模型称为"多骨骼动画网格模型",当然骨骼动画网格模型也完全可以具有蒙皮信息,下面的示例程序演示了渲染多骨骼动画网格模型时骨骼动画之间的切换,骨骼动画间的切换是通过动画控制器来完成的。

    在示例程序MultiAnimMesh中渲染的网格模型具有4个动画集,即具有4个动作,通过按下数字键"1" ~ "4"在4个动作之间进行切换:

    case 49: // press key "1" g_skin_mesh->m_anim_controller->GetAnimationSetByName("Walk", &g_anim_set); g_skin_mesh->m_anim_controller->SetTrackAnimationSet(0, g_anim_set);  break;
    case 50: // press key "2" g_skin_mesh->m_anim_controller->GetAnimationSetByName("Jog", &g_anim_set); g_skin_mesh->m_anim_controller->SetTrackAnimationSet(0, g_anim_set);  break; 
    case 51: // press key "3" g_skin_mesh->m_anim_controller->GetAnimationSetByName("Loiter", &g_anim_set); g_skin_mesh->m_anim_controller->SetTrackAnimationSet(0, g_anim_set);  break;
    case 52: // press key "4" g_skin_mesh->m_anim_controller->GetAnimationSetByName("Wave", &g_anim_set); g_skin_mesh->m_anim_controller->SetTrackAnimationSet(0, g_anim_set);  break;
    GetAnimationSetByName()根据名称取得动画播放集:

    Gets an animation set, given its name.

    HRESULT GetAnimationSetByName(  LPCSTR pName,  LPD3DXANIMATIONSET * ppAnimSet);
    Parameters
    pName
    [in] String containing the name of the animation set.
    ppAnimSet
    [out] Pointer to the ID3DXAnimationSet animation set.
    Return Values
    If the method succeeds, the return value is S_OK. If the method fails, the following value will be returned: D3DERR_INVALIDCALL.

    Remarks
    The animation controller contains an array of animation sets. This method returns an animation set that has the given name.

    SetTrackAnimationSet()设置要播放的动画集:

    Applies the animation set to the specified track.

    HRESULT SetTrackAnimationSet(  UINT Track,  LPD3DXANIMATIONSET pAnimSet);
    Parameters
    Track
    [in] Identifier of the track to which the animation set is applied.
    pAnimSet
    [in] Pointer to the ID3DXAnimationSet animation set to be added to the track.
    Return Values
    If the method succeeds, the return value is S_OK. If the method fails, the return value can be one of the following values: D3DERR_INVALIDCALL, E_OUTOFMEMORY.

    Remarks
    This method sets the animation set to the specified track for mixing. The animation set for each track is blended according to the track weight and speed when ID3DXAnimationController::AdvanceTime is called.

    运行效果图:

    按此在新窗口浏览图片

    步行

    按此在新窗口浏览图片

    跑步

    按此在新窗口浏览图片

    观望


    按此在新窗口浏览图片

    挥手

    ----------------------------------------------
    事业是国家的,荣誉是单位的,成绩是领导的,工资是老婆的,财产是孩子的,错误是自己的。

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2009/1/5 13:45:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 C/C++编程思想 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/5/19 10:38:17

    本主题贴数7,分页: [1]

     *树形目录 (最近20个回帖) 顶端 
    主题:  网格模型高级技术(4)(7681字) - 卷积内核,2009年1月5日
        回复:  主程序:#include "dxstdafx.h"#include "resource.h..(14856字) - 卷积内核,2009年1月5日
        回复:  一个网格模型中可以包含多个动画集,在渲染网格时通过动画控制器可以在各个动画集之间进行切换,从而可以..(3060字) - 卷积内核,2009年1月5日
        回复:  主程序:#include "dxstdafx.h"#include "resource.h..(13564字) - 卷积内核,2009年1月5日
        回复:  [B]cSkinMesh类的设计与实现[/B]cSkinMesh类的实现与cAnimMesh的..(7373字) - 卷积内核,2009年1月5日
        回复:  蒙皮骨骼动画网格模型接口是对上一节骨骼动画网格模型接口的扩展,添加了处理蒙皮信息的功能。 ..(8066字) - 卷积内核,2009年1月5日
        回复:  主程序:#include "dxstdafx.h"#include "resource.h..(16265字) - 卷积内核,2009年1月5日

    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    58.594ms