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

天行健 君子當自強而不息

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 閱讀(329) 評論(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>
            女女同性精品视频| 欧美日韩亚洲天堂| 男人的天堂亚洲在线| 一区二区三区无毛| 久久综合狠狠| 亚洲免费成人av| 欧美一区二区三区久久精品茉莉花 | 亚洲一区二区网站| 久久国产精品久久w女人spa| 极品少妇一区二区三区| 美女精品在线| 在线视频你懂得一区| 久久狠狠一本精品综合网| 在线播放豆国产99亚洲| 欧美激情综合| 午夜精品99久久免费| 免费精品视频| 亚洲自拍高清| 亚洲第一成人在线| 欧美日韩一区在线观看视频| 欧美一二三区在线观看| 91久久午夜| 午夜宅男久久久| 悠悠资源网亚洲青| 欧美视频一区在线观看| 久久久女女女女999久久| 日韩亚洲不卡在线| 免费h精品视频在线播放| 亚洲午夜激情在线| 亚洲观看高清完整版在线观看| 欧美精品久久久久久久久久| 欧美亚洲一区三区| 亚洲欧美在线高清| 免费观看亚洲视频大全| 宅男精品视频| 黄网动漫久久久| 欧美午夜视频在线| 久久欧美中文字幕| 亚洲自拍高清| 亚洲日本欧美天堂| 久热爱精品视频线路一| 亚洲在线一区| 亚洲日本乱码在线观看| 国产午夜精品理论片a级大结局| 欧美xx视频| 久久久久久久成人| 午夜精品在线观看| 洋洋av久久久久久久一区| 欧美成人中文字幕| 久久久久天天天天| 午夜精品国产精品大乳美女| 亚洲精品久久久久中文字幕欢迎你| 国产无一区二区| 国产精品久久久久久久第一福利| 欧美高清不卡在线| 免费不卡中文字幕视频| 久久se精品一区精品二区| 中文精品视频一区二区在线观看| 亚洲国产91精品在线观看| 久久亚洲春色中文字幕| 久久国产日韩| 欧美一区二区三区视频在线观看| 亚洲一区二区精品| 宅男在线国产精品| 99综合精品| 99这里有精品| av成人手机在线| 日韩视频一区| 日韩视频免费在线观看| 亚洲美女黄色片| 日韩视频免费观看高清在线视频| 亚洲高清一二三区| 亚洲国产高清自拍| 亚洲国产日韩欧美在线99 | 久久久91精品| 久久精品国产成人| 久久精品日韩| 裸体一区二区三区| 免费一级欧美在线大片| 欧美激情自拍| 欧美日韩在线播| 国产精品久久久久一区二区| 国产精品日韩精品| 国产日韩欧美夫妻视频在线观看| 国产农村妇女毛片精品久久莱园子| 国产精品永久免费视频| 国产亚洲欧美一区在线观看| 国内精品视频在线播放| 在线日韩av永久免费观看| 亚洲国产精品毛片| 日韩亚洲欧美一区二区三区| 亚洲视频福利| 欧美一区二区三区免费观看| 久久久噜噜噜久久中文字幕色伊伊| 久久久人成影片一区二区三区观看| 久久中文欧美| 亚洲国产精品一区在线观看不卡| 亚洲精品综合久久中文字幕| 亚洲性感激情| 久久九九精品| 欧美日韩免费区域视频在线观看| 国产精品xxxav免费视频| 国产日韩精品一区二区三区在线 | 亚洲一区二区三区在线视频| 亚洲欧美日韩国产中文在线| 欧美在线观看你懂的| 久久亚洲综合色一区二区三区| 欧美高清视频在线| 国产精品夜夜夜一区二区三区尤| 国产亚洲成精品久久| 亚洲精品1区| 羞羞漫画18久久大片| 欧美国产欧美亚洲国产日韩mv天天看完整| 亚洲国产精品毛片| 午夜精品成人在线视频| 麻豆国产精品777777在线| 欧美午夜电影网| 黄色国产精品| 亚洲视频综合| 麻豆国产精品777777在线| 日韩视频免费在线观看| 久久黄色级2电影| 欧美日韩国产不卡在线看| 国产一区二区黄色| 一区二区三区三区在线| 麻豆免费精品视频| 在线视频一区二区| 蜜臀av在线播放一区二区三区| 国产精品久久久久天堂| 亚洲区免费影片| 久久久欧美精品sm网站| 日韩一级黄色大片| 欧美成人四级电影| 一区二区三区在线视频播放| 亚洲男人的天堂在线| 亚洲第一成人在线| 久久精品国产99国产精品| 国产精品久久99| 99精品久久久| 亚洲电影毛片| 久久精品成人一区二区三区| 国产精品乱子乱xxxx| 9久re热视频在线精品| 欧美成人中文| 久久大逼视频| 国产日本欧美视频| 亚洲欧美激情一区| 一区二区三区www| 欧美伦理91| 亚洲精选中文字幕| 亚洲第一成人在线| 老司机一区二区| 伊人影院久久| 久久夜色精品国产噜噜av| 欧美一区二区三区视频免费| 国产精品亚洲不卡a| 午夜伦理片一区| 亚洲一区二区三区精品视频| 欧美视频在线不卡| 亚洲新中文字幕| 99热在这里有精品免费| 欧美日韩一区二区三区在线观看免| 亚洲精品视频免费观看| 亚洲国产精品一区二区www在线| 久久亚洲春色中文字幕| 亚洲第一天堂av| 欧美国产精品劲爆| 欧美国产精品劲爆| 日韩视频亚洲视频| 亚洲免费观看在线观看| 欧美三级在线视频| 午夜欧美不卡精品aaaaa| 亚洲亚洲精品三区日韩精品在线视频| 国产精品成人免费视频| 亚洲欧美日韩国产成人精品影院| 亚洲视频在线一区观看| 国产欧美丝祙| 久色成人在线| 欧美国产日韩精品| 一区二区三区四区在线| 亚洲少妇一区| 国产有码在线一区二区视频| 免费不卡在线视频| 欧美久久电影| 午夜国产精品视频免费体验区| 性欧美大战久久久久久久久| 黄色一区二区三区| 亚洲黄色三级| 国产精品高清在线| 久久久久久网站| 免费一级欧美在线大片| 亚洲午夜一区| 久久精品一本| 日韩视频在线你懂得| 亚洲午夜免费视频| 在线日本成人| 一区二区日韩伦理片| 狠狠综合久久| 亚洲美女av网站| 国产一区二区三区久久|