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

天行健 君子當自強而不息

Using the .X File Format(2)

Defining Templates

Since an .X file's open−ended design is so, well, open−ended, you must predefine each template that you intend to use for DirectX to understand how to access the template's data. Typically templates are defined inside an .X file, although you can define them from within your program (as I mentioned earlier).

You define a template (contained in an .X file) by assigning it a unique class name preceded by the word template, as I have done in the following line of text. (Notice the opening bracket, which signifies the start of the template's definition.)

template ContactEntry {

Cool−now you've started the declaration of a template that you will use to store a person's contact information. We're calling the template class ContactEntry, as you can see from the code. Even though you have assigned your template a unique class name, you need to go one step further and also assign it a unique identification number−a GUID.

When you get around to reading an .X file into your program, you'll only have access to the GUIDs of each template, not the class names. The class names are important only to your .X file data objects; you want your program to differentiate those data objects by their template GUIDs.

To define a GUID for your template, fire up the guidgen.exe program that comes with your Microsoft Visual C/C++ compiler installation (located in the \Common\Tools directory of your MSVC installation). After you've found and executed the guidgen.exe file, you'll be presented with a small dialog box, shown in Figure 3.1.

Figure 3.1: The guidgen.exe's Create GUID dialog box allows you to create a unique identification number in various formats.

As you can see in Figure 3.1, the Create GUID dialog box allows you to choose the format of the GUID you want to create. In this case you'll use format #2, DEFINE_GUID(). Select the option and click the Copy button.

Now a completely unique identification number is on the Clipboard, waiting for you to paste it into your code. Go back to the .X file you are creating and paste the contents of the Clipboard into your template declaration.

template ContactEntry {
// {4C9D055B−C64D−4bfe−A7D9−981F507E45FF}
DEFINE_GUID(<<name>>,
0x4c9d055b, 0xc64d, 0x4bfe, 0xa7, 0xd9, 0x98, 0x1f, 0x50, 0x7e, 0x45, 0xff);

Whoops! That's a little too much text for the template, so you need to cut out the DEFINE_GUID macro stuff and paste that into your project's source code. Yes, that's right−every template you define requires a matching GUID definition (via the DEFINE_GUID macro, for example) inside your code. This means you need to include the initguid.h file in your code and use DEFINE_GUID, as I have done here.

#include "initguid.h"

// At beginning of source code file − add DEFINE_GUIDs
DEFINE_GUID(ContactEntry, 0x4c9d055b, 0xc64d, 0x4bfe, 0xa7, 0xd9, 0x98,  0x1f, 0x50, 0x7e, 0x45, 0xff);

Notice that in the DEFINE_GUID macro, I've replaced the <<name>> text with the actual class name of the template I am defining. In this case, I am using ContactEntry as a macro name. From this point on, the ContactEntry macro will contain a pointer to my template's GUID (which must match the template's GUID in the .X file).

Getting back to the ContactEntry template, you also need to remove the comment tag from the pasted text and change the GUID's brackets to angle brackets, as I have done here:

template ContactEntry {
<4C9D055B−C64D−4bfe−A7D9−981F507E45FF>

Now you're ready to move on and define the template's data. Templates are much like C structures and classes; they contain variables and pointers to other templates, as well as access restrictions. The types of variables you can use are much like the ones you use in C. Table 3.1 shows you the data types at your disposal for defining templates, as well as matching C/C++ data types.

Much like C/C++ variable declarations, you follow the data type keyword with an instance name and finish with a semicolon (signifying the end of the variable declaration).

DWORD Value;

In Table 3.1, you'll notice the array keyword, which defines an array of data types. To define an array, you specify the array keyword followed by the data type, instance name, and array size (enclosed in square brackets). For example, to declare an array of 20 STRING data types, you could use:

array STRING Text[20];

Note The cool thing about arrays is that you can use another data type to define the array size, as I have done here:

DWORD ArraySize;

array STRING Names[ArraySize];

Now you need to go back to the ContactEntry template and define a person's name, phone number, and age. The three variables−two strings (name and phone number) and one numerical value (age)−can be defined in the ContactEntry template as follows.

template ContactEntry {
  <4C9D055B−C64D−4bfe−A7D9−981F507E45FF>
  STRING Name; // The contact's name
  STRING PhoneNumber; // The contact's phone number
  DWORD Age; // The contact's age
}

Cool! You finish your template definition with a closing bracket, and you're ready to go.

 

Creating Data Objects from Templates

After you have defined a template, you can begin creating data objects and defining their data. Data objects are defined by their respective template class types and an optional instance name. You can use this instance name to later reference the data object inside the .X file or from within your project (a feature you'll read about later in this chapter).

Moving on with the example, take the ContactEntry template and create a data object from it. This data object will contain a person's name, phone number, and age.

ContactEntry JimsEntry {
  "Jim Adams";
  "(800) 555−1212";
  30;
}

Notice that I've declared the data object's instance name as JimsEntry. From now on, I can reference this data object by using the name enclosed in brackets, like this:

{JimsEntry}

Referencing a data object in this manner is called data referencing, or referencing (as if you couldn't guess!), and it allows you to point one data object to another. For example, an animation sequence template (AnimationSet) requires you to reference a Frame data object for the sequence's embedded objects.

You can also use referencing to duplicate an object's data without having to retype it. This is useful when you are creating a few identical Mesh data objects in an .X file, with each Mesh object being oriented differently inside various Frame objects.


posted on 2008-04-16 19:16 lovedday 閱讀(408) 評論(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>
            国产精品热久久久久夜色精品三区 | 欧美高清在线一区| 海角社区69精品视频| 欧美一区二区三区在线看| 亚洲欧美成人一区二区在线电影| 国产精品国产三级国产专区53| 一本一本a久久| 亚洲美女诱惑| 国产精品一二| 免费精品视频| 欧美日韩国产综合网| 亚洲自拍啪啪| 久久精品91| 亚洲美女视频在线观看| 一本大道久久a久久精品综合| 国产精品看片你懂得| 久久久999精品视频| 女同性一区二区三区人了人一| 91久久亚洲| 亚洲无玛一区| 亚洲高清在线视频| 9久re热视频在线精品| 国产午夜精品理论片a级大结局 | 亚洲美女免费精品视频在线观看| 亚洲美女黄色| 国产综合久久久久影院| 亚洲国产小视频在线观看| 欧美性猛交xxxx乱大交退制版| 久久精品人人爽| 欧美日韩爆操| 你懂的视频欧美| 国产精品久久久久久久久久妞妞| 免费久久99精品国产| 国产精品区二区三区日本| 欧美国产精品一区| 国产视频一区在线观看一区免费 | 午夜精品区一区二区三| 久热综合在线亚洲精品| 亚洲一区二区三区色| 久久亚洲精品一区二区| 亚洲女与黑人做爰| 欧美电影打屁股sp| 久久影院亚洲| 国产午夜精品美女毛片视频| 亚洲精品在线观| 亚洲国产成人久久综合一区| 亚洲欧美激情一区二区| 99精品热6080yy久久| 久久夜色精品| 久久久久久久一区二区三区| 欧美午夜片在线免费观看| 亚洲国产精品久久久久婷婷884| 国内精品久久久久久| 亚洲无吗在线| 亚洲免费在线电影| 欧美日韩视频一区二区| 亚洲风情亚aⅴ在线发布| 国产主播一区| 久久国产精品久久精品国产| 亚洲女与黑人做爰| 国产精品美女久久久久久免费| 亚洲激情在线播放| 亚洲乱码国产乱码精品精可以看 | 久久国产精品久久国产精品| 午夜精品999| 国产精品女人毛片| 亚洲午夜精品| 欧美伊人精品成人久久综合97| 欧美日韩一区二区在线视频| 亚洲理论在线| 亚洲一区www| 欧美午夜片在线观看| 亚洲色图在线视频| 亚洲欧美综合国产精品一区| 国产精品久久久久91| 亚洲综合色婷婷| 久久久xxx| 亚洲电影免费观看高清| 久久综合久久久久88| 亚洲国产日本| 亚洲午夜黄色| 国产视频久久久久久久| 久久久精品免费视频| 欧美激情第二页| 亚洲图片欧美午夜| 国产视频欧美视频| 久久久久久69| 亚洲国产一区二区三区a毛片| 日韩一级在线| 国产日韩精品在线| 裸体歌舞表演一区二区| 亚洲人屁股眼子交8| 亚洲欧美成人精品| 国产专区欧美精品| 欧美国产在线视频| 亚洲一区二区三区国产| 久久在线免费观看| 中文一区二区在线观看| 国产偷国产偷亚洲高清97cao | 亚洲欧美日韩精品在线| 蜜臀va亚洲va欧美va天堂| 99re视频这里只有精品| 国产精品视频yy9099| 久久亚洲一区二区| 一区二区电影免费观看| 久久免费视频这里只有精品| 亚洲剧情一区二区| 国产欧美一区二区精品性 | 亚洲一区二区三区中文字幕在线| 久久免费视频在线观看| 99re热这里只有精品免费视频| 国产精品视频xxx| 欧美成人精品一区二区| 亚洲欧美日韩第一区| 亚洲欧洲一区二区三区在线观看| 午夜一级久久| 亚洲精品影视在线观看| 国产一区二区三区在线播放免费观看| 欧美成人一品| 久久精品国产69国产精品亚洲| 99re热精品| 欧美激情一区二区三区成人| 久久国产精品第一页| 亚洲一区免费| 亚洲免费高清| 尤物精品国产第一福利三区| 国产精品久久久久久久午夜片| 欧美成人精品在线观看| 久久精品国产999大香线蕉| 亚洲私人影院| 一个色综合av| 99www免费人成精品| 亚洲国产专区| 欧美大片在线看| 欧美77777| 欧美成人午夜视频| 巨乳诱惑日韩免费av| 久久精品一区二区| 欧美影视一区| 欧美亚洲三级| 午夜精品网站| 欧美一区二区三区在| 午夜久久影院| 欧美在线亚洲综合一区| 亚洲欧美另类综合偷拍| 亚洲手机成人高清视频| 亚洲一二三四久久| 亚洲图片欧洲图片av| 亚洲一区二区精品| 亚洲欧美日韩一区二区在线 | 99re6这里只有精品视频在线观看| 亚洲黄色有码视频| 日韩午夜av在线| 亚洲久久在线| 国产精品99久久不卡二区| 国产精品99久久久久久白浆小说| 一区二区三区高清视频在线观看| 99精品视频免费| 亚洲一区国产| 欧美一区二区精品久久911| 久久精品国产69国产精品亚洲 | 亚洲午夜黄色| 欧美专区第一页| 免费高清在线视频一区·| 欧美sm视频| 99精品99久久久久久宅男| av不卡在线| 欧美一区二区三区在线观看视频| 欧美中文在线观看| 女女同性女同一区二区三区91| 欧美精选在线| 国产女精品视频网站免费 | 国产欧美视频一区二区三区| 国产一区二区毛片| 99国产精品久久久久久久久久 | 久久九九国产精品| 欧美电影在线观看完整版| 亚洲美女免费精品视频在线观看| 在线综合视频| 美国成人直播| 国产精品成人久久久久| 激情小说另类小说亚洲欧美 | 欧美性猛交xxxx乱大交退制版| 国产日韩一区| 一区二区三区日韩欧美| 久久精品理论片| 亚洲国产精品一区二区www在线| 一区二区三区不卡视频在线观看| 久久国产精品久久久久久电车| 欧美精品粉嫩高潮一区二区| 国产精品一区二区在线观看网站| 尤物网精品视频| 亚洲欧美日韩精品| 欧美激情一区二区三区在线视频观看 | 久久人人爽爽爽人久久久| 欧美三级电影精品| 亚洲国产日韩在线| 久久精品国产一区二区电影| 亚洲激情网址| 久久久在线视频|