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

天行健 君子當自強而不息

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 閱讀(200) 評論(0)  編輯 收藏 引用


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


公告

導(dǎo)航

統(tǒng)計

常用鏈接

隨筆分類(178)

3D游戲編程相關(guān)鏈接

搜索

最新評論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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国产精品久久久久久久成人热| 日韩一级在线| 久久久精品国产免费观看同学| 亚洲欧美日韩在线播放| 欧美一区永久视频免费观看| 久久精品国产精品亚洲精品| 亚洲欧美日韩系列| 亚洲制服av| 久久综合亚洲社区| 欧美日韩一区二区在线| 国产无一区二区| 91久久综合| 欧美一级一区| 日韩视频一区二区三区在线播放| 欧美日韩国产不卡| 在线观看中文字幕不卡| 亚洲欧美欧美一区二区三区| 亚洲欧美一区二区三区久久 | 久久精品视频在线观看| 欧美一区二区在线免费观看| 欧美视频免费看| 亚洲第一在线视频| 亚洲美女黄网| 欧美国产日韩一区二区| 国产一区二区黄| 欧美在线高清视频| 欧美成人在线影院| 狠狠色综合网站久久久久久久| 亚洲免费视频一区二区| 久久国产欧美| 国产日产亚洲精品| 午夜伦理片一区| 亚洲图片在区色| 欧美日韩久久精品| 久久深夜福利免费观看| 亚洲片区在线| 久久精品一区二区| 欧美高清视频一区二区| 久久精品国产精品亚洲综合| 美国十次成人| 亚洲欧洲一区二区三区| 欧美一区二区视频免费观看| 99pao成人国产永久免费视频| 久久成人一区| 亚洲制服av| 亚洲欧美变态国产另类| 亚洲美女毛片| 亚洲少妇中出一区| 国产精品大片免费观看| 一本在线高清不卡dvd | 久久久久成人网| 欧美视频久久| 亚洲精品日韩欧美| 亚洲七七久久综合桃花剧情介绍| 欧美亚洲一区二区在线| 欧美一区二区三区视频| 国产精品theporn88| 性欧美长视频| 国产精品高潮呻吟视频| 日韩亚洲欧美一区| 日韩午夜在线电影| 欧美freesex交免费视频| 夜夜嗨av一区二区三区| 免费高清在线视频一区·| 麻豆国产精品va在线观看不卡| 欧美成人激情在线| 欧美激情一区二区三区在线视频| 欧美激情一区二区三区高清视频| 亚洲综合国产| 国产精品福利在线| 亚洲午夜一区二区| 欧美在线观看www| 国产一区二区在线观看免费播放| 久久久久久网址| 国产亚洲精品久久久久动| 欧美一区二区三区在| 久久久国产精彩视频美女艺术照福利 | 欧美成人精品福利| 国产精品成人aaaaa网站| 亚洲精品影院在线观看| 亚洲一区二区久久| 久久综合影视| 亚洲电影欧美电影有声小说| 欧美日本一道本| 猛男gaygay欧美视频| 欧美日韩免费观看一区 | 亚洲影院一区| 国产日韩欧美电影在线观看| 欧美中文字幕| 性刺激综合网| 激情av一区二区| 亚洲欧美日韩在线播放| 久久久久免费| 最新亚洲一区| 国产精品久久久久久久久久久久久| 亚洲一区免费视频| 一本色道久久88综合亚洲精品ⅰ| 欧美三日本三级少妇三99 | 久久婷婷国产综合精品青草| 亚洲二区三区四区| 久久成人羞羞网站| 亚洲另类视频| 久久久久久国产精品mv| 亚洲人永久免费| 国产精品亚洲综合天堂夜夜 | 亚洲自拍电影| 在线不卡a资源高清| 欧美永久精品| 亚洲美女av电影| 久久夜色精品| 午夜精品久久| 亚洲日本欧美在线| 久久婷婷人人澡人人喊人人爽| 亚洲欧美制服另类日韩| 亚洲激情视频在线播放| 欧美69视频| 午夜精品短视频| 亚洲欧洲在线播放| 影音国产精品| 国产精品a久久久久| 欧美成人精品不卡视频在线观看| 亚洲一区亚洲| 日韩午夜高潮| 亚洲国产日韩欧美在线99| 国产精品电影网站| 欧美片网站免费| 久久视频一区二区| 性做久久久久久久免费看| 欧美a级片网| 久久久一本精品99久久精品66| 在线亚洲一区观看| 国产精品久久7| 欧美激情精品久久久久久久变态| 欧美一区二区三区免费大片| 一区二区久久久久久| 久久国产黑丝| 亚洲国产一成人久久精品| 国产日韩欧美中文在线播放| 欧美日韩在线亚洲一区蜜芽| 农夫在线精品视频免费观看| 久久婷婷麻豆| 麻豆9191精品国产| 美国十次成人| 男人的天堂亚洲| 欧美大片专区| 欧美精品三级| 欧美日韩中文字幕| 国产精品国产福利国产秒拍| 欧美日韩在线直播| 国产精品99免视看9| 欧美日韩精品一区| 国产精品国产三级国产专区53| 欧美日韩午夜剧场| 国产精品久久一级| 蜜桃久久av一区| 女人色偷偷aa久久天堂| 欧美激情一区二区三区在线视频 | 亚洲视频一区二区| 亚洲欧美激情精品一区二区| 欧美亚洲在线播放| 久久天天躁狠狠躁夜夜av| 免费亚洲电影| 欧美国产91| 国产精品一卡二卡| 欧美久久一级| 国产精品美女主播| 狠狠色综合色区| 亚洲精品乱码久久久久久日本蜜臀| 亚洲日本中文字幕免费在线不卡| 亚洲伦伦在线| 欧美伊久线香蕉线新在线| 久久久亚洲成人| 91久久久亚洲精品| 亚洲免费一在线| 久久影视精品| 国产精品s色| 亚洲成人直播| 亚洲一区二区三区久久| 久久女同精品一区二区| 亚洲二区精品| 午夜日韩激情| 欧美黄色aa电影| 国产日本欧美视频| 亚洲精品网址在线观看| 久久精品国产99| 99国产精品久久久久老师| 欧美电影免费网站| 麻豆精品91| 亚洲一品av免费观看| 久久视频这里只有精品| 国产精品外国| 亚洲欧洲日韩女同| 久久国产精品久久精品国产| 亚洲国产精品成人一区二区 | 久久精品国产91精品亚洲| 欧美日韩第一页| 亚洲第一精品福利| 久久久久久穴| 午夜精品久久久久久久男人的天堂 | 久久字幕精品一区|