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

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

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) 評(píng)論(0)  編輯 收藏 引用


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


公告

導(dǎo)航

統(tǒng)計(jì)

常用鏈接

隨筆分類(lèi)(178)

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

搜索

最新評(píng)論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            亚洲大片免费看| 91久久国产自产拍夜夜嗨| 国产精品视频不卡| 欧美视频不卡中文| 免费观看成人网| 巨乳诱惑日韩免费av| 欧美成人精品福利| 亚洲三级免费| 亚洲午夜精品一区二区三区他趣| 亚洲视频二区| 欧美在线二区| 巨乳诱惑日韩免费av| 欧美jizz19hd性欧美| 欧美日韩一区二| 欧美午夜片欧美片在线观看| 国产精品推荐精品| 亚洲国产日韩欧美| 亚洲一区三区视频在线观看| 久久这里只有| 亚洲高清在线| 亚洲影院一区| 玖玖综合伊人| 亚洲一区二区三区免费视频| 久久婷婷激情| 国产精品一区二区三区久久| 久久久精品一品道一区| 久久综合伊人77777麻豆| 国产亚洲一级高清| 国产精品久久影院| 激情综合久久| 亚洲视频精选在线| 久久久精品一区二区三区| 欧美激情乱人伦| 香蕉久久精品日日躁夜夜躁| 欧美国产一区在线| 影音先锋久久久| 欧美一区成人| 日韩一级黄色大片| 久久亚洲私人国产精品va| 国产伦理精品不卡| 中国日韩欧美久久久久久久久| 久久久噜噜噜久久中文字幕色伊伊| 亚洲人成网站777色婷婷| 久久av在线看| 国产亚洲电影| 午夜精品久久久久| 亚洲精品视频一区二区三区| 快she精品国产999| 黄色日韩在线| 黄网动漫久久久| 香蕉亚洲视频| 久久久久久一区二区三区| 欧美一级欧美一级在线播放| 好看的日韩视频| 欧美视频一区二区三区…| 亚洲午夜视频在线| 欧美精品日韩精品| 一区精品久久| 久久影院午夜论| 久久精品视频网| 伊人蜜桃色噜噜激情综合| 久久免费视频一区| 欧美在线视频免费| 尤物yw午夜国产精品视频| 久久综合网络一区二区| 久久精品国产一区二区三区免费看| 国产欧美日韩综合| 久久麻豆一区二区| 久久亚洲不卡| 亚洲第一网站| 亚洲黄色毛片| 欧美午夜视频一区二区| 性欧美video另类hd性玩具| 亚洲性色视频| 韩国亚洲精品| 欧美激情一区二区| 欧美精品一区二区三区很污很色的| 亚洲美女在线一区| av成人免费观看| 国产精品夜夜嗨| 美女在线一区二区| 欧美日韩成人激情| 久久精品国产第一区二区三区最新章节 | 国语自产精品视频在线看8查询8 | 亚洲欧美中文日韩在线| 香港成人在线视频| 亚洲国产精品www| 亚洲免费精彩视频| 国产日韩欧美一二三区| 欧美国产日产韩国视频| 日韩视频在线播放| 免费不卡在线视频| 午夜一区不卡| 欧美日韩一二三四五区| 欧美一级片久久久久久久| 久久激五月天综合精品| 激情婷婷久久| 久久福利一区| 欧美一区二区视频免费观看 | 欧美亚洲一级| 亚洲精品一区中文| 欧美亚洲自偷自偷| 亚洲精品美女久久久久| 一区在线免费观看| 久久久高清一区二区三区| 久久久午夜精品| 亚洲啪啪91| 亚洲第一区中文99精品| 欧美成人免费全部| 久久精品视频在线| 亚洲国产经典视频| 一区二区免费看| 国产午夜精品一区二区三区欧美 | 亚洲第一区色| 久久久久久久性| 亚洲在线一区| 亚洲欧美日韩一区在线观看| 艳妇臀荡乳欲伦亚洲一区| 能在线观看的日韩av| 欧美亚一区二区| 欧美福利一区二区三区| 国产精品一区一区| 亚洲最新在线| 亚洲欧洲日韩女同| 久久久免费精品| 久久久久久久一区| 国产伦精品一区二区三区视频黑人 | 免费视频一区二区三区在线观看| 国产精品综合av一区二区国产馆| 最新国产成人av网站网址麻豆| 国产午夜精品麻豆| 亚洲欧美影院| 欧美中文日韩| 国产欧美精品一区二区三区介绍| 夜夜嗨av色综合久久久综合网 | 日韩视频在线一区二区三区| 久久综合国产精品| 欧美国产国产综合| 亚洲人成在线播放| 免费在线观看精品| 亚洲国产精品久久久久秋霞蜜臀 | 亚洲午夜激情| 亚洲天堂av综合网| 老司机精品视频网站| 韩日成人在线| 久久久夜色精品亚洲| 老司机精品福利视频| 亚洲精品久久久久久久久久久久久 | 国产欧美一区在线| 性欧美大战久久久久久久久| 久久国产日韩欧美| 亚洲电影免费观看高清完整版在线观看 | 亚洲综合首页| 国产乱码精品1区2区3区| 欧美一区二区三区四区视频| 久久久最新网址| 亚洲人午夜精品免费| 欧美日韩免费在线观看| 亚洲综合视频一区| 欧美v日韩v国产v| 亚洲特级毛片| 激情综合激情| 国产精品qvod| 久久久www免费人成黑人精品| 亚洲国产一区二区a毛片| 亚洲免费影视| 亚洲国产精品精华液2区45| 欧美日韩国产不卡| 欧美主播一区二区三区| 亚洲激情视频网| 性色一区二区| 亚洲欧洲一区| 国产日韩精品视频一区二区三区| 久久免费偷拍视频| 亚洲深夜影院| 亚洲大片av| 欧美综合国产| 日韩视频在线一区二区三区| 国产欧美韩日| 欧美精品国产精品日韩精品| 午夜视频久久久| 99re66热这里只有精品4| 久久国产精品高清| 亚洲美女啪啪| 韩日在线一区| 国产精品日韩欧美一区二区三区| 久热re这里精品视频在线6| 中国成人亚色综合网站| 欧美岛国激情| 久久久久久久一区二区| 亚洲欧美精品suv| 99精品99| 亚洲精品黄色| 亚洲高清精品中出| 国产亚洲人成a一在线v站| 欧美手机在线视频| 欧美乱大交xxxxx| 欧美顶级艳妇交换群宴| 久久野战av| 久久亚洲风情|