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

天行健 君子當自強而不息

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>
            亚洲精品国产精品国自产观看浪潮| 欧美视频在线视频| 国产免费亚洲高清| 午夜精品久久久久久久| 一区二区日韩欧美| 国产精品一区二区欧美| 久久亚洲私人国产精品va| 久久亚洲捆绑美女| 日韩午夜在线电影| 99精品欧美一区| 国产欧美日韩在线观看| 久久午夜精品| 欧美成人一区二区三区在线观看| 一本大道av伊人久久综合| 中文精品一区二区三区| 国产一区99| 亚洲国产日韩美| 欧美午夜精品理论片a级大开眼界 欧美午夜精品理论片a级按摩 | 亚洲人成网站色ww在线| 亚洲精品久久久久久久久久久久 | 国产精品黄色| 免费观看日韩av| 欧美日韩免费视频| 久久深夜福利免费观看| 欧美精品偷拍| 久久久久国产精品一区| 欧美精品福利| 久久久成人精品| 欧美日韩免费看| 老司机久久99久久精品播放免费| 欧美精品一区二区三区四区 | 91久久久久久久久| 亚洲欧美国产va在线影院| 亚洲国产精品999| 亚洲欧美日韩视频一区| 日韩一二在线观看| 久久免费黄色| 欧美一级午夜免费电影| 欧美精品一区二区久久婷婷| 久久精品亚洲精品| 国产精品久久久久久久久搜平片| 亚洲电影免费在线观看| 欧美日韩专区在线| 久久久久女教师免费一区| 欧美国产一区二区三区激情无套| 久久久999| 国产精品女同互慰在线看| 亚洲国产一区二区精品专区| 国产一区二区三区日韩欧美| 夜色激情一区二区| 99精品99| 欧美福利视频在线观看| 欧美jizzhd精品欧美喷水| 国产亚洲精品自拍| 亚洲一二三级电影| 亚洲一区二区三区免费观看| 欧美高清视频| 最新日韩在线视频| 亚洲靠逼com| 欧美高清视频一区二区| 亚洲国产电影| 亚洲六月丁香色婷婷综合久久| 葵司免费一区二区三区四区五区| 玖玖玖国产精品| 国产偷国产偷精品高清尤物| 午夜一区二区三区不卡视频| 午夜精品美女自拍福到在线| 国产精品videossex久久发布| 99在线|亚洲一区二区| 亚洲视频免费看| 欧美视频在线观看| 一区二区三区成人精品| 亚洲欧美日韩一区在线| 国产精品美女久久久浪潮软件| 亚洲午夜性刺激影院| 欧美尤物一区| 韩国三级电影久久久久久| 久久久久www| 欧美激情精品久久久久| 欧美日韩国产va另类| 亚洲美女av在线播放| 亚洲影院在线观看| 国产精品男人爽免费视频1| 亚洲综合视频网| 久久久久久久久伊人| 亚洲国产精品视频一区| 欧美精品99| 亚洲在线视频网站| 久久一区二区三区国产精品| 亚洲国产一区二区在线| 欧美日韩国产bt| 久久成人av少妇免费| 亚洲第一黄色| 亚洲免费在线播放| 狠狠做深爱婷婷久久综合一区| 欧美va天堂在线| 亚洲影院一区| 亚洲成色777777女色窝| 国产精品久久999| 久久精品国产亚洲aⅴ| 亚洲国产一区二区三区高清| 午夜伦理片一区| 最新亚洲电影| 国产精品无码专区在线观看| 久久中文字幕一区| aa亚洲婷婷| 欧美国产视频一区二区| 亚洲免费伊人电影在线观看av| 激情久久久久久| 国产精品久久91| 男男成人高潮片免费网站| 亚洲免费视频成人| 亚洲国产精品福利| 久久久久网站| 亚洲欧美日韩综合一区| 最新国产成人在线观看| 国产性猛交xxxx免费看久久| 欧美剧在线观看| 久久一区二区三区国产精品| 亚洲自拍偷拍视频| 亚洲日本一区二区三区| 免费在线一区二区| 久久精品91久久久久久再现| 亚洲一区二区三区乱码aⅴ| 亚洲国产三级网| 国产专区欧美精品| 国产精品卡一卡二卡三| 欧美日韩精品| 欧美大片在线看| 免费一级欧美在线大片| 久久精品亚洲精品国产欧美kt∨| 亚洲午夜精品久久久久久app| 亚洲人成网站色ww在线| 亚洲国产岛国毛片在线| 欧美丰满高潮xxxx喷水动漫| 卡通动漫国产精品| 久久久噜噜噜久噜久久| 欧美一区二区三区四区视频| 亚洲一区视频在线| 亚洲香蕉伊综合在人在线视看| 亚洲精品国产拍免费91在线| 亚洲国产综合在线| 亚洲黄色小视频| 日韩视频免费观看高清完整版| 亚洲国产视频直播| 亚洲精品国产视频| 亚洲人成毛片在线播放| 最新国产の精品合集bt伙计| 亚洲日韩第九十九页| 99国产精品99久久久久久粉嫩| 亚洲日本va午夜在线电影| 亚洲日本中文字幕| 在线综合亚洲欧美在线视频| 亚洲图片欧洲图片av| 小辣椒精品导航| 久久美女性网| 欧美激情精品久久久久久大尺度| 亚洲国产经典视频| 99精品视频免费在线观看| 亚洲天堂av高清| 久久9热精品视频| 免费看的黄色欧美网站| 欧美日韩99| 国产欧美一区视频| 一色屋精品亚洲香蕉网站| 日韩午夜三级在线| 亚洲欧美综合国产精品一区| 久久久久久电影| 亚洲电影有码| 亚洲男人av电影| 快播亚洲色图| 国产精品久久777777毛茸茸| 激情成人av| 亚洲天堂男人| 另类激情亚洲| 一本到高清视频免费精品| 欧美一区二区三区久久精品茉莉花| 久久久久网址| 国产精品高潮呻吟| 在线高清一区| 亚洲欧美在线高清| 欧美高清在线一区二区| 中文精品在线| 欧美成人午夜激情在线| 国产欧美 在线欧美| 亚洲全部视频| 久久久综合网| 亚洲一区二区视频| 欧美aⅴ99久久黑人专区| 国产乱码精品一区二区三区五月婷 | 欧美日韩亚洲不卡| 伊人久久婷婷| 欧美一区二区成人| 亚洲欧洲日韩综合二区| 欧美一区亚洲一区| 国产精品久久久久久久久婷婷 | 韩国精品久久久999| 亚洲欧美日韩一区二区三区在线| 亚洲国产成人在线播放| 久久精品久久综合|