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

天行健 君子當自強而不息

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>
            久久精品国产一区二区三区免费看| 久久精品三级| 精品91在线| 欧美日韩国产综合视频在线| 欧美在线观看一区二区三区| 一区二区三区日韩在线观看| 亚洲人成欧美中文字幕| 老司机午夜精品| 亚洲三级影片| 亚洲国产成人精品视频| 1024亚洲| 亚洲高清视频的网址| 在线观看一区| 伊人影院久久| 在线精品视频一区二区三四| 狠狠色伊人亚洲综合网站色| 国产亚洲一区二区三区在线观看| 国产精品一区二区欧美| 国产欧美日韩亚洲精品| 国产午夜精品美女视频明星a级| 欧美午夜无遮挡| 国产精品igao视频网网址不卡日韩| 欧美激情综合五月色丁香| 欧美精品免费看| 欧美午夜电影在线观看| 国产精品一区二区久久精品| 国产日韩欧美综合| 黄色在线成人| 亚洲精选在线| 一区二区三区高清不卡| 亚洲一区二区三区在线播放| 午夜精品久久久久| 久久―日本道色综合久久| 欧美**人妖| 亚洲美女黄网| 欧美亚洲在线播放| 猛干欧美女孩| 国产精品美女一区二区| 国产日韩欧美在线视频观看| 亚洲国产精品久久精品怡红院| 国产亚洲电影| 91久久精品国产| 亚洲无亚洲人成网站77777| 欧美主播一区二区三区| 欧美专区日韩专区| 久久一区二区三区国产精品 | 亚洲精品视频免费| 亚洲性感美女99在线| 中日韩美女免费视频网站在线观看| 久久综合福利| 欧美日韩一区三区| 国产精品福利在线| 在线看日韩av| 香蕉久久一区二区不卡无毒影院| 久久婷婷色综合| 日韩亚洲视频在线| 可以看av的网站久久看| 欧美国产一区视频在线观看| 女生裸体视频一区二区三区| 欧美激情亚洲另类| 中国成人亚色综合网站| 久久久国际精品| 国产欧美一区二区色老头 | 国产精品久久国产精品99gif| 亚洲最新在线视频| 久久亚裔精品欧美| 欧美精品一级| 性做久久久久久久久| 亚洲精品免费看| 美女视频一区免费观看| 国产一区999| 午夜欧美视频| 亚洲激情在线播放| 另类国产ts人妖高潮视频| 国外精品视频| 久久久久久久久久久一区| 午夜精彩国产免费不卡不顿大片| 欧美系列一区| 久久成人人人人精品欧| 欧美一区二区三区在线| 狠狠v欧美v日韩v亚洲ⅴ| 免费成人在线视频网站| 久久久久青草大香线综合精品| 一区二区三区在线免费播放| 欧美成人精品激情在线观看| 欧美电影免费网站| 欧美一区二区三区在线观看| 国产美女扒开尿口久久久| 久久久久久久久久久成人| 久久只精品国产| 日韩视频在线观看| 亚洲视频在线一区| 狠狠色丁香久久婷婷综合丁香| 欧美成人精品福利| 国产精品护士白丝一区av| 久久精品一区二区三区不卡| 欧美福利在线| 欧美制服丝袜| 欧美精品日韩三级| 久久久久九九九九| 欧美精品在欧美一区二区少妇| 欧美一激情一区二区三区| 久久久亚洲高清| 亚洲午夜伦理| 久久男人资源视频| 亚洲欧美精品在线| 欧美国产日产韩国视频| 久久精品国产亚洲精品| 欧美日韩国产成人| 免费不卡视频| 国产欧美一区二区三区在线老狼 | 欧美电影在线| 久久精品一级爱片| 欧美四级伦理在线| 欧美激情成人在线视频| 国产欧美日本一区二区三区| 亚洲电影网站| 国产欧美日韩综合精品二区| 日韩午夜中文字幕| 亚洲精品欧美日韩| 久久久久久久久久久成人| 亚洲一区二区免费| 欧美激情精品久久久久久蜜臀 | 亚洲高清在线视频| 韩国av一区二区| 亚洲欧美激情诱惑| 亚洲天堂av图片| 欧美日韩18| 亚洲国产女人aaa毛片在线| 国产亚洲欧美中文| 性欧美大战久久久久久久免费观看| 亚洲一区二区三区视频| 欧美日韩中文另类| 99国产精品久久久久久久| av成人激情| 欧美精品福利在线| 亚洲国产精品久久| 亚洲日本一区二区| 欧美岛国在线观看| 亚洲精品视频免费在线观看| 亚洲毛片一区| 欧美涩涩视频| 在线一区二区三区做爰视频网站| 一区二区三区久久精品| 欧美精品999| 亚洲精品一区在线观看香蕉| 一区二区三区国产| 欧美手机在线视频| 亚洲一区在线看| 欧美在线|欧美| 国内精品免费在线观看| 久久这里只精品最新地址| 国产真实乱子伦精品视频| 欧美在线观看视频一区二区| 久久综合狠狠综合久久综合88| 国内一区二区在线视频观看| 欧美自拍偷拍| 亚洲国产精品成人一区二区| 在线亚洲免费| 亚洲成人在线视频网站| 99re国产精品| 国产精品卡一卡二卡三| 午夜日韩av| 欧美阿v一级看视频| 亚洲乱码国产乱码精品精98午夜 | 国产日韩精品一区二区浪潮av| 午夜精品99久久免费| 美乳少妇欧美精品| 亚洲精品久久久久中文字幕欢迎你 | 亚洲嫩草精品久久| 国产日本欧美视频| 久久午夜羞羞影院免费观看| 亚洲激情中文1区| 在线视频一区观看| 国内外成人免费激情在线视频| 欧美不卡视频| 亚洲专区在线| 欧美激情黄色片| 午夜精品福利一区二区蜜股av| 好男人免费精品视频| 欧美日韩成人一区二区| 久久高清一区| 中文日韩电影网站| 欧美激情综合色| 久久久久久久久伊人| 一区二区动漫| 亚洲国内自拍| 国产一区二区毛片| 国产精品福利在线观看网址| 久久综合伊人77777麻豆| 一区二区三区国产盗摄| 亚洲国产黄色| 蜜桃av一区二区在线观看| 亚洲免费在线精品一区| 亚洲激情偷拍| 国产日韩欧美在线一区| 欧美日韩精品在线| 欧美国产一区二区在线观看| 久久国产主播| 欧美在线视频在线播放完整版免费观看 |