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

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

Working with Maps and Levels(11)

Adding Barriers with cBarrier

Even though the barrier class marks areas on the map using geometric shapes in
exactly the same way as the trigger class does, the barrier class also positions meshes.
Looking again at the cBarrier class declaration, notice that each of the add barrier
functions — add_sphere, add_box, add_cylinder, and add_triangle—have a set of coordinates
that position and rotate the barrier’s mesh before being rendered.

To determine where the mesh is positioned, set the x_pos, y_pos, and z_pos arguments
of the add barrier functions to where you want the mesh rendered. You also need
to set the x_rot, y_rot, and z_rot arguments to the rotational values to draw the mesh.

For example, say that you want to add a spherical barrier that already has a mesh
assigned. The barrier is positioned at coordinates 10,20,30 (with a radius of 40),
while the mesh is positioned at 10,0,30 using no rotational values. To add the barrier,
you call the add_sphere function as follows:

cBarrier::add_sphere(1, TRUE,
                     10.0f, 0.0f, 30.0f, 0.0f, 0.0f, 0.0f,
                     10.0f, 20.0f, 30.0f, 40.0f);

You get a better understanding of adding and using barriers in the next section.

 

Using the Barrier Class

Using the barrier class is not difficult; it’s much like using the trigger class. The
biggest difference is that you have to add object placement data to the barrier data
files and assign the appropriate meshes and animations.

 

Creating the Barrier Data File

The barrier data files are arranged just like trigger data files, except that you start
each barrier definition with the identification number, type, enabled flag, placement
coordinates (X, Y, Z), and rotations (X-rotation, Y-rotation, and Z-rotation) to
place the barrier graphics object. Finish each definition with the respective barrier
type’s data.

The following defines two barriers to use (contained in a file called test.bar). Note
that the coordinates and rotational values of the barrier are shown in bold:

1 1 1 -900 0 0 0 0 0 -1154 0 10 -645 100 -10
2 1 0 0 0 -900 0 1.57 0 -10 0 -1154 10 100 -645

Here are two barriers, both using a box shape. The first barrier’s graphics object is
placed at -900,0,0 and has rotational values of 0,0,0. The first box covers the area
from -1154,0,10 to -645,100, -10.

The second barrier has a graphics object placed at 0,0, -900 and has rotational values
of 0,1.57,0. The second barrier covers the area from -10,0,-1154 to 10,100,-645.

 

Loading the Barrier Data

In order to load and use a barrier data file, instance the cBarrier class, load the data
file and appropriate meshes, and assign the meshes:

cBarrier Barrier;

// Load a barrier data file
Barrier.Load(“test.bar”);

// Load a mesh and animation to use
cMesh Mesh;
cAnimation Anim;
Mesh.Load(“barrier.x”);
Anim.Load(“barrier.x”, &Mesh);

// Assign mesh and animation to both barriers loaded
Barrier.SetMesh(1, &Mesh);
Barrier.SetMesh(2, &Mesh);
Barrier.SetAnim(1, &Anim, “AnimationName”, 0);
Barrier.SetAnim(2, &Anim, “AnimationName”, 0);

 

Checking Barrier Collisions

To see whether an area on the map is blocked, call get_barrier with the character
coordinates. If a value of TRUE is returned, passage is blocked, and you should take
appropriate actions. Take the following example that checks a character’s coordinates
against all barriers loaded from the barrier list.

You use a trio of values that represents the direction the character is moving in
each axis to determine beforehand whether the movement is blocked by a barrier.
Say that a character is moving 10 units in the position Z-axis, meaning that the
upcoming ZMove variable will be set to 10. That ZMove variable is added to the character’s
current position, and if intersecting with a barrier, that ZMove variable is cleared
out, thus not allowing such a movement along the axis, as shown here:

// XPos, YPos, ZPos = character coordinates
// XMove, YMove, ZMove = character movement values
if(Barrier.get_barrier(XPos+XMove,YPos+YMove,ZPos+ZMove)) {
  // Passage not allowed, clear movement variables
  XMove = YMove = ZMove = 0.0f;
}

 

Rendering Barriers

Last, you only need to call cBarrier::Render to draw all barrier objects within view:

// Frustum = pre-initialize cFrustum object
Barrier.render(timeGetTime(), &Frustum);

posted on 2007-12-10 14:50 lovedday 閱讀(198) 評(píng)論(0)  編輯 收藏 引用


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


公告

導(dǎo)航

統(tǒng)計(jì)

常用鏈接

隨筆分類(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| 亚洲精品美女91| 亚洲精品欧洲精品| 亚洲国产欧美日韩精品| 亚洲福利在线视频| 9久草视频在线视频精品| 正在播放亚洲一区| 亚洲欧美中文另类| 久久久久久久综合| 亚洲缚视频在线观看| 亚洲国产99| 亚洲视频第一页| 欧美一区二区成人| 欧美激情a∨在线视频播放| 欧美精选午夜久久久乱码6080| 欧美激情在线播放| 国产精品一区久久久| 在线观看三级视频欧美| 亚洲视频电影在线| 久久亚洲不卡| 亚洲精品老司机| 国产精品视频yy9299一区| 欧美激情一区二区在线 | 久久成人免费日本黄色| 久久久久网址| 欧美片网站免费| 国产一区二区av| 亚洲网友自拍| 欧美xxx在线观看| 一本色道精品久久一区二区三区| 香蕉久久国产| 欧美日韩一区二区三区在线看 | 欧美精品www| 国产精品视频成人| 亚洲美女电影在线| 久久综合色综合88| 先锋影音久久久| 欧美午夜精品久久久久久超碰| 亚洲成在人线av| 久久国产天堂福利天堂| 美女黄毛**国产精品啪啪 | 99一区二区| 久久久999成人| 国产精品一区一区| 亚洲一区二区在线| 欧美视频在线免费| 国产精品99久久久久久人| 性刺激综合网| 日韩天堂在线观看| 欧美精品一区二区三区蜜臀| 尤物九九久久国产精品的分类| 亚洲网站在线| 国产精品99久久99久久久二8 | 国产精品久久久久久久久借妻| 亚洲激情视频在线观看| 开心色5月久久精品| 欧美与黑人午夜性猛交久久久| 国产精品日韩欧美一区| 香蕉亚洲视频| 亚洲一区视频| 国产伦精品一区二区三区四区免费| 99re成人精品视频| 亚洲免费电影在线| 欧美三级在线播放| 午夜精品电影| 欧美一区二区三区精品| 国产日韩欧美不卡| 久久久久久久激情视频| 亚洲免费av片| 亚洲精品免费在线播放| 午夜精品久久久久久久男人的天堂| 国产精品亚洲欧美| 久久国产精品久久久久久久久久| 欧美在线播放高清精品| 亚洲国产毛片完整版| 亚洲另类自拍| 国产日韩精品一区二区三区在线| 看欧美日韩国产| 欧美激情在线观看| 午夜精品福利一区二区三区av| 欧美一区二区三区在线看| 国内一区二区三区在线视频| 欧美第一黄色网| 欧美日韩理论| 久久久91精品| 欧美精品国产精品| 久久精品亚洲精品| 美女久久网站| 亚洲欧美日韩一区在线观看| 久久色在线播放| 亚洲自拍偷拍色片视频| 久久精品亚洲一区二区| 中国女人久久久| 久久久av毛片精品| 亚洲一区二区网站| 免费成人av资源网| 欧美影院视频| 欧美日韩成人一区二区| 鲁大师成人一区二区三区| 欧美日韩亚洲一区二区三区在线观看 | 国产无一区二区| 亚洲精品国产精品久久清纯直播| 国产欧美精品久久| 亚洲激情成人网| 国产一区亚洲一区| 亚洲少妇在线| 亚洲美女尤物影院| 久久色在线观看| 久久成人这里只有精品| 欧美日韩在线不卡| 欧美成人tv| 国产一区二区三区久久久久久久久| 亚洲乱码国产乱码精品精| 韩国成人福利片在线播放| 亚洲影院色无极综合| 亚洲视频免费| 欧美日韩三级视频| 亚洲国产日韩欧美在线动漫 | 一本久久综合亚洲鲁鲁| 久久岛国电影| 久久久久久久尹人综合网亚洲 | 国产日韩欧美在线播放不卡| 亚洲精品综合久久中文字幕| 亚洲高清网站| 久久久av毛片精品| 久久在线免费观看| 国产综合色产在线精品| 91久久久久久久久久久久久| 欧美1区2区| 欧美极品在线观看| 亚洲成色精品| 亚洲黄一区二区三区| 久久综合影视| 欧美高清在线观看| 在线国产日韩| 欧美a级理论片| 亚洲黄色av一区| 亚洲一区二区三区高清不卡| 欧美日韩不卡视频| 在线亚洲+欧美+日本专区| 中文在线不卡视频| 国产精品美女一区二区在线观看| 日韩一级黄色大片| 香蕉av福利精品导航| 国产欧美精品日韩| 久久精品免费电影| 亚洲国产91精品在线观看| 日韩视频在线观看国产| 欧美日韩国产一区精品一区| 亚洲理论在线观看| 亚洲免费视频中文字幕| 国产一区日韩二区欧美三区| 欧美一区成人| 欧美激情一区二区三区蜜桃视频| 亚洲蜜桃精久久久久久久| 国产精品红桃| 久久久夜夜夜| 日韩午夜av| 欧美一区二区三区成人| 精品99视频| 欧美日韩国产一区二区三区| 亚洲综合社区| 美女视频网站黄色亚洲| 99视频精品全国免费| 国产日韩一区二区三区在线播放| 久久久精彩视频| 一区二区三区 在线观看视| 久久精品国产亚洲一区二区三区| 亚洲国产成人精品久久| 欧美视频精品在线| 久久亚洲色图| 一本色道久久综合精品竹菊| 久久久99免费视频| 日韩视频免费在线观看| 欧美区国产区| 久久久久91| 9色精品在线| 欧美日韩亚洲综合在线| 久久国内精品自在自线400部| 亚洲第一主播视频| 亚洲欧美国产三级| 国产精品草草| 亚洲综合电影| 亚洲视频在线观看免费| 欧美伦理一区二区| 亚洲欧美国产精品va在线观看| 母乳一区在线观看| 欧美在线免费观看视频| 免费久久精品视频| 99视频精品全部免费在线| 国产一区二区三区高清在线观看| 女主播福利一区| 另类酷文…触手系列精品集v1小说| 亚洲欧美区自拍先锋| 国产日韩欧美制服另类| 9国产精品视频| 亚洲精品综合在线| 亚洲激情精品| 国产麻豆9l精品三级站|