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

天行健 君子當自強而不息

Working with skeletal animation(2)

Loading Hierarchies from .X

Not to beat a dead horse (why would I do a horrible thing like that?), but I want to quickly review how to load a frame hierarchy from an .X file.

For your frame hierarchy you should use the D3DXFRAME structure (or the D3DXFRAME_EX structure). As I mentioned earlier in this chapter, the D3DXFRAME structure (or the derived D3DXFRAME_EX structure) contains two pointers that you use to create the frame hierarchy−pFrameSibling and pFrameFirstChild. Your job is to link each frame you load from an .X file using those two pointers.

Starting with a root frame object, begin iterating every data object from an .X file you specify. When you encounter a Frame object, link it either as a sibling or a child of the previous frame. Continue through the .X file until you have loaded all frames. For this example, use the D3DXFRAME_EX structure to contain the frames in the hierarchy.

Basically, you'll open an .X file for access, and then iterate every data object in the file. For each Frame object you find, you need to create a matching D3DXFRAME (or D3DXFRAME_EX) object and link it to a hierarchy of frames.

To process an .X file, you can construct a class to handle the majority of the work for you. You simply instance the class's ParseObject function, which gives you access to each data object's data.

For now, take a look at the ParseObject function that is called for each data object that is enumerated.

BOOL cXFrameParser::ParseObject(
IDirectXFileData *pDataObj,
IDirectXFileData *pParentDataObj,
DWORD Depth,
void **Data, BOOL Reference)
{
const GUID *Type = GetObjectGUID(pDataObj);
	// If the object type is a Frame (non−referenced), then add that frame to the hierarchy.
if(*Type == TID_D3DRMFrame && Reference == FALSE)
{
// Allocate a frame container
D3DXFRAME_EX *pFrame = new D3DXFRAME_EX();
		// Get the frame's name (if any)
pFrame−>Name = GetObjectName(pDataObj);
		// Link frame into hierarchy
if(Data == NULL)
{
// Link as sibling of root
pFrame−>pFrameSibling = m_RootFrame;
m_RootFrame = pFrame; pFrame = NULL;
Data = (void**)&m_RootFrame;
}
else
{
// Link as child of supplied frame
D3DXFRAME_EX *pFramePtr = (D3DXFRAME_EX*)*Data;
pFrame−>pFrameSibling = pFramePtr−>pFrameFirstChild;
pFramePtr−>pFrameFirstChild = pFrame; pFrame = NULL;
Data = (void**)&pFramePtr−>pFrameFirstChild;
}
}
	// Load a frame transformation matrix
if(*Type==TID_D3DRMFrameTransformMatrix && Reference==FALSE)
{
D3DXFRAME_EX *Frame = (D3DXFRAME_EX*)*Data;
		if(Frame) 
{
Frame−>TransformationMatrix = *(D3DXMATRIX*) GetObjectData(pDataObj, NULL);
Frame−>matOriginal = Frame−>TransformationMatrix;
}
}
	// Parse child objects
return ParseChildObjects(pDataObj, Depth, Data, Reference);
}

Basically, the ParseObject function is called for each data object that is enumerated. Inside the ParseObject function, you check the currently enumerated object's type (using the object's template GUID). If that type is a Frame, then you allocate a frame structure and load the frame's name into it.

Next, you link the frame into the hierarchy of frames, which is where things look a little strange. The cXFrameParser class maintains two pointers−one for the root frame object that is being built up (m_RootFrame, a member of the class), and one for a data object (Data) that is passed to each call of ParseObject. The data pointer keeps track of the last frame data object that was loaded.

As you begin parsing the .X file, the data pointer Data is set to NULL, meaning that it doesn't point to any frame object being loaded. When you load a frame object into a frame structure, you are checking that data pointer to see whether it points to another frame structure. If it doesn't, it is assumed that the current frame is a sibling of the root. If the data pointer does point to another frame, it is assumed that the currently enumerated frame is a child of the frame to which the data pointer points.

Knowing whether the currently enumerated frame is a sibling or a child is a factor when you are creating the hierarchy. Sibling frames are linked to each other using the pFrameSibling pointer of the D3DXFRAME structure, whereas child frames are linked using pFrameFirstChild. Once a frame has been loaded, the data pointer is adjusted to point at the new frame or back to the sibling frame. In the end, all frames become linked either as siblings or children.

One more thing that you'll notice in the ParseObject function is the code to load a frame's transformation matrix (represented by the FrameTransformMatrix template). A FrameTransformMatrix object is typically embedded in a Frame data object. This FrameTransformMatrix object defines the initial orientation of the Frame being loaded.

For skeletal animation, this frame transformation matrix defines the initial pose of your skeletal structure. For example, a standard skeletal structure might be posed with the body standing erect and the arms extended. However, suppose all of your animations are based on the character standing in a different pose, perhaps with his arms dropped down to his sides and with his legs slightly bent. Instead of reorienting all the vertices or bones to match that pose before saving the .X file in your 3D modeling program, you can change the frame transformations. From that point forward, all motions of the bones will be relative to that pose. This becomes more apparent as you try to manipulate the bone orientations and during animation, so I'll leave the topic alone for the moment. Just know that inside each frame structure you are loading, there is space to store an initial transformation matrix (in the D3DXFRAME::TransformationMatrix object).

After all is said and done, your frame hierarchy will be loaded. Of course, the root frame is stored in the m_RootFrame linked list of D3DXFRAME_EX objects inside the frame−loading class. It's your job to grab that pointer and assign it to one you'll use in your program. After you've done that, you can start messing around with the orientation of the bones.


posted on 2008-04-23 17:36 lovedday 閱讀(328) 評論(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>
            亚洲免费成人| 老巨人导航500精品| 久久精品人人做人人综合| 国产精品萝li| 亚洲一区二区黄| 久久久精品国产99久久精品芒果| 国产午夜精品视频免费不卡69堂| 欧美一区二区三区喷汁尤物| 美女主播一区| 亚洲一级二级| 精品1区2区| 欧美日韩国产三级| 先锋影音网一区二区| 欧美阿v一级看视频| 亚洲视频免费| 亚洲第一主播视频| 国产精品网站在线观看| 麻豆精品视频在线观看| 亚洲素人一区二区| 亚洲第一区在线| 午夜精品久久久久久久99黑人| 激情五月综合色婷婷一区二区| 欧美国产激情| 久久精品国产一区二区三区| 亚洲三级电影在线观看| 久久人人精品| 欧美在线综合| 亚洲一区二区高清视频| 亚洲欧洲综合另类在线| 国产一区二区电影在线观看| 欧美欧美午夜aⅴ在线观看| 久久久亚洲影院你懂的| 亚洲一区二区视频| 一区二区三区日韩| 日韩小视频在线观看专区| 亚洲高清精品中出| 欧美成人精品在线播放| 久久亚洲一区二区| 欧美伊人久久| 欧美亚洲综合久久| 亚洲一区二区三区在线看| 一本色道久久综合狠狠躁篇的优点 | 国产一区二区三区在线免费观看 | 欧美成年网站| 久久免费视频网站| 欧美亚洲三区| 午夜精品福利在线观看| 亚洲视频狠狠| 亚洲网站在线看| 一本色道久久综合亚洲91| 欧美激情视频给我| 老色鬼精品视频在线观看播放| 亚洲香蕉在线观看| 亚洲视频电影图片偷拍一区| 一本色道久久综合亚洲精品不 | 欧美另类久久久品| 欧美精品成人| 欧美日韩在线三区| 国产精品久久久久久久久久直播| 欧美日精品一区视频| 欧美色综合天天久久综合精品| 欧美久久久久久| 欧美午夜一区| 国产伦精品免费视频| 国产一区二区三区高清 | 国产欧美在线观看| 国产亚洲一区二区在线观看| 狠狠色综合网| 亚洲区一区二区三区| 99re6这里只有精品视频在线观看| 日韩视频一区二区三区| 亚洲午夜在线视频| 久久精品一二三| 欧美jizz19性欧美| 亚洲破处大片| 午夜精品婷婷| 欧美高清不卡| 国产伦精品一区二区三区视频孕妇| 国产一区日韩二区欧美三区| 亚洲电影在线播放| 一区二区欧美在线| 久久久国产视频91| 亚洲人成艺术| 欧美在线影院在线视频| 欧美精品福利在线| 国产字幕视频一区二区| 一区二区久久| 免费精品视频| 亚洲免费影视第一页| 欧美成人69| 国产中文一区二区| 亚洲综合社区| 亚洲黄色免费| 久久精品日韩| 国产精品第一区| 日韩视频免费观看高清在线视频| 久久激情视频久久| 99re66热这里只有精品4| 久久大逼视频| 国产精品狼人久久影院观看方式| 亚洲黑丝在线| 免费看黄裸体一级大秀欧美| 久久精品中文字幕一区| 亚洲午夜精品一区二区| 国产香蕉久久精品综合网| 亚洲精品一区二区三区婷婷月| 午夜日韩在线| 亚洲精品日韩久久| 蜜臀久久99精品久久久画质超高清| 国产精品亚洲综合一区在线观看 | 国产精品久久久久久模特| 亚洲日本精品国产第一区| 久久久久久婷| 欧美一区中文字幕| 国产一区二区三区不卡在线观看| 午夜精品婷婷| 亚洲欧美日韩精品综合在线观看| 欧美日韩国产大片| 亚洲伦理在线免费看| 欧美激情一区二区三区全黄 | 欧美精品福利| 亚洲乱码一区二区| 亚洲国产一区视频| 欧美高清视频一区二区| 亚洲精品国产精品国自产观看浪潮| 久久综合网hezyo| 久久久精品日韩| 在线观看成人av电影| 另类春色校园亚洲| 久久亚洲图片| 亚洲激情视频在线| 亚洲精品1234| 欧美日韩hd| 午夜精品久久久久久久99热浪潮| 99在线热播精品免费99热| 国产精品mm| 久久精品在线视频| 久久在线91| 一区二区欧美在线| 亚洲免费视频成人| 精品福利免费观看| 亚洲欧洲在线观看| 国产精品xnxxcom| 久久久亚洲人| 欧美大尺度在线| 午夜视频在线观看一区二区| 亚洲欧美三级伦理| 在线观看亚洲视频啊啊啊啊| 欧美黄色aaaa| 国产精品嫩草影院av蜜臀| 久热精品视频在线观看| 免费在线观看一区二区| 亚洲视屏在线播放| 欧美一级二区| 亚洲精品社区| 亚洲淫性视频| 亚洲激情在线| 午夜免费日韩视频| 国产精品久久久久久福利一牛影视| 亚洲国产精品成人| 欧美精品在线一区| 久久精品国产亚洲精品| 欧美电影免费网站| 午夜精品久久久久久久久久久| 久久久久国产精品www| 99视频精品在线| 久久99在线观看| 亚洲视频免费看| 久久久久亚洲综合| 午夜精品福利一区二区蜜股av| 久久久精品国产免费观看同学| 亚洲影院色在线观看免费| 久久精品一区二区三区中文字幕 | 欧美性猛交一区二区三区精品| 久久亚洲美女| 欧美性大战久久久久| 欧美韩国日本一区| 国产无一区二区| 日韩亚洲精品电影| 欧美日韩一区二区欧美激情| 免费视频亚洲| 国一区二区在线观看| 亚洲性感美女99在线| 亚洲每日在线| 蜜桃精品久久久久久久免费影院| 久久国产乱子精品免费女| 欧美色图天堂网| 亚洲精品久久久久久久久久久久久 | 欧美刺激性大交免费视频| 国产乱肥老妇国产一区二 | 久久久久五月天| 国产嫩草影院久久久久| 亚洲日本一区二区| 日韩写真在线| 欧美精品乱人伦久久久久久 | 性久久久久久久久| 欧美三日本三级少妇三99| 亚洲激情影视| 亚洲激情网站| 欧美日韩国产美|