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

天行健 君子當自強而不息

Using the .X File Format(5)

Accessing .X Files

Regardless of the version of DirectX you are using (either DirectX 8 or 9), the methods you use to access .X files are the same. In fact, the interfaces have not changed names between the two newest versions of DirectX (8 and 9), making it possible for you to quickly port your version 8 code to the newer version 9 (and vice versa if you want).

The first step to accessing any .X file is to create an IDirectXFile interface.

Applications use the methods of the IDirectXFile interface to create instances of the IDirectXFileEnumObject and IDirectXFileSaveObject interfaces, and to register templates. Deprecated.

IDirectXFile Members

Method Description
IDirectXFile::CreateEnumObject Creates an enumerator object. Deprecated.
IDirectXFile::CreateSaveObject Creates a save object. Deprecated.
IDirectXFile::RegisterTemplates Registers custom templates. Deprecated.

Remarks

The globally unique identifier (GUID) for the IDirectXFile interface is IID_IDirectXFile.

The IDirectXFile interface is obtained by calling the DirectXFileCreate function.

The LPDIRECTXFILE type is defined as a pointer to this interface.

typedef interface IDirectXFile *LPDIRECTXFILE;

You need to call the DirectXFileCreate function, as shown in the following bit of code:

IDirectXFile *pDXFile = NULL;
HRESULT Result = DirectXFileCreate(&pDXFile);

As you can see from the previous lines of code, the DirectXFileCreate function takes one parameter−the pointer to an IDirectXFile interface. You can quickly determine whether the function has succeeded in creating a valid, IDirectXFile interface by using the SUCCEEDED or FAILED macro on the return code from the DirectXFileCreate call.

Once you've successfully created the IDirectXFile interface, you can optionally register any templates you'll be using (such as the DirectX standard templates) and create an enumeration interface that weeds through the top−level data objects within your .X files.

 

Registering Custom and Standard Templates

To save storage space and improve your data security, the .X interfaces allow you to remove all template definitions from .X files and embed them into your executable. This means that instead of the .X files defining templates, your program has to do it. Don't worry−it's not as difficult as it sounds. As you'll see in a moment, Microsoft has taken the liberty of doing the hard work by defining the standard templates inside a couple include files, making everything as simple as possible.

To register the standard templates (or any template, for that matter) from within your program, you'll need to call upon the IDirectXFile::RegisterTemplates function.

HRESULT IDirectXFile::RegisterTemplates(
  LPVOID pvData, // buffer containing template definitions
  DWORD cbSize); // # of bytes of data

The pvData parameter is merely a data buffer that contains the template definitions in the exact format you'd see in an .X file. For example, you can define a template data buffer like this:

char *Templates = "
"xof 0303txt 0032 \
template CustomTemplate { \
<4c944580−9e9a−11cf−ab43−0120af71e433> \
DWORD Length; \
array DWORD Values[Length]; \
}";

Note Notice that the template definition in Templates uses the backslash character to represent a new line, and that the first line of text is a standard .X file header.

Going back to RegisterTemplates, the cbSize parameter represents the size of the template data buffer, which you can determine in this case by using the strlen of the Templates buffer. Put together, you can register the templates defined in Templates using the following code:

pFile−>RegisterTemplates(Templates, strlen(Templates));

Now let's get back to the topic at hand−registering the standard templates. You've seen RegisterTemplates at work. In order to register the standard templates, you need to include two additional files in your project−rmxftmpl.h and rmxfguid.h. These two files define the template definitions and GUIDs of the standard templates, respectively.

Tip To remember rmxftmpl.h and rmxfguid.h, just remember that rmxf stands for retained mode x−file, tmpl means template, and guid means globally unique identifier.

Inside the rmxftmpl.h file, you'll find the D3DRM_XTEMPLATES template data buffer and the D3DRM_XTEMPLATE_BYTES macro. These are used in the call to RegisterTemplates to register the standard templates, as you can see here:

pFile−>RegisterTemplates(D3DRM_XTEMPLATES,  D3DRM_XTEMPLATE_BYTES);

That's right; just by calling the above bit of code, you have successfully registered the standard templates, and you're ready to move on! A word of advice before you do: Once you begin using the .X format for your own custom templates and data, don't forget that using RegisterTemplates works perfectly for registering your own custom template definitions!

 

Opening an .X File

After you've created an IDirectXFile interface and registered the templates you'll be using, you need to open the .X file and begin enumerating the data objects within it. The process of opening the .X file and creating an enumeration object occurs in one call to the IDirectXFile::CreateEnumObject function.

HRESULT IDirectXfile::CreateEnumObject(
  LPVOID pvSource, // .X filename
  DXFILELOADOPTIONS dwLoadOptions, // Load options
  LPDIRECTXFILEENUMOBJECT* ppEnumObj); // Enum interface

When you call the CreateEnumObject function, specify the file name of the .X file to load as pvSource and the interface you'll be using as ppEnumObj. As for dwLoadOptions, you should specify the value DXFILELOAD_FROMFILE, which tells DirectX to load the file from disk. Other possible values for dwLoadOptions are DXFILELOAD_FROMRESOURCE, DXFILELOAD_FROMMEMORY, and DXFILELOAD_FROMURL. These values tell DirectX to load the .X file from a resource, memory buffer, or network URL, respectively. Yep, that's right−you can load .X files directly over the Internet!

Tip To load an .X file from the Internet using a URL, specify the complete network path in pvSource.To load from a resource or memory location, just specify the resource handle or memory pointer (both cast as LPVOID) in pvSource.

Continue the example and create an enumeration object for the .X file. The following code will create an enumeration object used to parse a file from a disk.

// Filename = filename to load ("test.x" for example)
IDirectXFileEnumObject *pEnum;
pFile−>CreateEnumObject((LPVOID)Filename, DXFILELOAD_FROMFILE, &pEnum);

From the code's comments, you can see that Filename points to a valid file name−in this case, test.x. Once successfully called, the CreateEnumObject gives you a valid enumeration object (only one is required per open .X file), ready to do all your enumeration dirty work.
 

posted on 2008-04-17 18:11 lovedday 閱讀(753) 評論(0)  編輯 收藏 引用

公告

導航

統計

常用鏈接

隨筆分類(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综合电影在线视频| 久久国产乱子精品免费女| 亚洲在线不卡| 精品999在线观看| 欧美二区视频| 欧美日韩精品不卡| 欧美一区2区视频在线观看| 亚洲欧美日韩精品| 影音先锋国产精品| 亚洲精品一区中文| 国产日本精品| 亚洲国产精品免费| 国产精品日韩欧美一区| 美女日韩在线中文字幕| 欧美日韩天堂| 欧美一区二区三区啪啪| 米奇777超碰欧美日韩亚洲| 亚洲伦伦在线| 亚洲欧美日韩一区二区三区在线| 精品福利免费观看| 99国产精品久久久久久久久久| 国产精品久久久久久久久婷婷| 久久久久久久久久久久久久一区| 欧美69视频| 久久不见久久见免费视频1| 美日韩精品免费| 欧美在线观看一区二区三区| 欧美成人福利视频| 欧美一区二区视频在线观看| 欧美极品aⅴ影院| 久久人人97超碰国产公开结果| 欧美日韩国产区一| 欧美国产日韩一区二区三区| 老司机凹凸av亚洲导航| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ入口 | 欧美1级日本1级| 欧美一区激情视频在线观看| 免费毛片一区二区三区久久久| 欧美日韩国产bt| 欧美成人日韩| 精品成人一区二区三区| 亚洲欧美成人在线| 亚洲一级电影| 欧美日韩美女| 亚洲精品国产精品国产自| 激情综合久久| 欧美亚洲三区| 欧美一区二区视频在线观看2020| 欧美日韩一区二区视频在线| 亚洲国产成人一区| …久久精品99久久香蕉国产| 欧美一区网站| 久久久久国内| 国产一区导航| 久久精品成人| 久久琪琪电影院| 激情综合久久| 美女精品国产| 亚洲国产精品www| 亚洲精品一区二区三区在线观看| 卡一卡二国产精品| 嫩草影视亚洲| 亚洲第一精品夜夜躁人人躁 | 99精品国产一区二区青青牛奶| 亚洲国产精品久久久久| 久久综合导航| 亚洲国产va精品久久久不卡综合| 最近看过的日韩成人| 麻豆精品视频在线观看视频| 欧美国产另类| 99热精品在线| 国产精品大全| 欧美中日韩免费视频| 麻豆精品一区二区av白丝在线| 一区二区三区在线高清| 欧美成人激情在线| 亚洲美女精品久久| 欧美一级淫片aaaaaaa视频| 国产亚洲精品自拍| 久久一区国产| 亚洲伦理在线免费看| 欧美一区二区三区免费大片| 国内精品一区二区| 欧美国产日本韩| 中日韩美女免费视频网址在线观看| 香蕉久久夜色精品国产使用方法| 国产日韩亚洲欧美| 欧美风情在线观看| 亚洲影视九九影院在线观看| 久久色在线观看| 日韩午夜精品| 国产视频亚洲精品| 欧美精品一区二区在线播放| 亚洲综合欧美日韩| 欧美激情欧美激情在线五月| 亚洲女性喷水在线观看一区| 韩日精品视频| 欧美偷拍一区二区| 久久综合给合| 亚洲综合色噜噜狠狠| 亚洲成色www久久网站| 性亚洲最疯狂xxxx高清| 亚洲人www| 国产一区二区三区丝袜| 欧美乱大交xxxxx| 欧美一区免费| 制服丝袜亚洲播放| 欧美国产日本在线| 久久精品一区二区| 亚洲一区免费在线观看| 在线免费观看日韩欧美| 国产精品一区二区你懂的| 欧美成人免费大片| 久久黄色级2电影| 亚洲男人的天堂在线aⅴ视频| 亚洲激情视频在线| 久久综合影音| 久久国内精品视频| 午夜精品久久久久久久99热浪潮| 99pao成人国产永久免费视频| 国产一区深夜福利| 国产人成一区二区三区影院 | 久久成人在线| 亚洲欧美国产日韩中文字幕| 日韩视频免费| 亚洲成在人线av| 欧美二区在线| 欧美xx视频| 欧美成人午夜激情在线| 久热精品在线视频| 美女网站在线免费欧美精品| 久久精品夜色噜噜亚洲aⅴ | 亚洲国产高清在线| 在线精品一区二区| 亚洲电影下载| 亚洲国产精品久久久久秋霞影院| 伊人影院久久| 亚洲国产专区校园欧美| 亚洲第一级黄色片| 91久久综合亚洲鲁鲁五月天| 亚洲日本aⅴ片在线观看香蕉| 又紧又大又爽精品一区二区| 一区二区三区在线免费播放| 亚洲第一福利在线观看| 最新日韩精品| aa级大片欧美| 亚洲一区二区动漫| 欧美一级黄色网| 久久精品国产亚洲精品| 久久人人爽人人| 欧美ed2k| 亚洲人成高清| 亚洲图片在线观看| 欧美一区二区私人影院日本| 久久精品一区四区| 欧美大片一区二区| 欧美午夜精品久久久久久久| 国产精品一页| 亚洲国产一二三| 一区二区三区欧美在线| 欧美亚洲系列| 欧美成人自拍| 一区二区三区日韩欧美| 欧美一区二区三区在线播放| 另类专区欧美制服同性| 欧美日韩精品欧美日韩精品| 国产女精品视频网站免费| 伊人久久大香线蕉综合热线| 99精品国产99久久久久久福利| 欧美诱惑福利视频| 亚洲国产精品一区二区第一页| 99精品免费网| 久久午夜视频| 国产精品免费观看在线| 亚洲国内在线| 午夜欧美大尺度福利影院在线看| 免费久久99精品国产自在现线| 亚洲毛片av在线| 久久久久一区二区| 国产精品伦一区| 亚洲精品激情| 久久午夜电影| 一区二区三区视频观看| 免费欧美日韩| 黄色成人在线观看| 午夜精品三级视频福利| 亚洲国产日本| 久久在线免费观看| 国产午夜精品久久久久久免费视| 99国产一区| 欧美高清视频一区| 欧美一区二区在线免费播放| 欧美午夜视频在线观看| 亚洲日本激情| 久久综合久久美利坚合众国| 亚洲欧美精品| 国产精品一区2区| 亚洲制服av| 一本色道**综合亚洲精品蜜桃冫|