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

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

Putting Together a Full Game(13)

 

Dealing with Maps

The sample game is divided into five maps (scenes). Each scene uses six bitmaps,
each of which is loaded as textures that are drawn to the display for each frame.
The game also uses an underlying simplified mesh for each scene. These simplified
meshes aid in properly drawing the 3D characters that inhabit each scene.

A total of four functions are contained within the application class that is used
to work with scenes. These functions are load_level, free_level, get_height_below, and
check_intersect. You use the get_height_below and check_intersect functions, which are
presented in Chapter 12, to check for mesh-to-mesh intersections. In the case of
the game, those mesh intersections are used to determine when characters intersect
with the simplified scene mesh.

float cApp::get_height_below(float x_pos, float y_pos, float z_pos)
{
    
// only one mesh in mesh level
    return closest_height_below(m_scene_mesh.get_root_mesh()->m_d3d_mesh, x_pos, y_pos, z_pos);
}

bool  cApp::check_intersect(float x_start, float y_start, float z_start,
                            
float x_end, float y_end, float z_end,
                            
float* dist)
{
    
// only one mesh in mesh level
    return is_ray_intersect_mesh(m_scene_mesh.get_root_mesh()->m_d3d_mesh,
                                 x_start, y_start, z_start,
                                 x_end, y_end, z_end,
                                 dist);
}

The load_level function loads the six scene textures and the simplified mesh and
executes the script associated with loading the scene. An external file, which you
see in just a moment, stores the position of the camera within each scene. Here is
the code for load_level:

bool cApp::load_level(int scene_index)
{
    m_scene_index = scene_index;

    free_level();

    
// load the backdrop textures

    
char filename[MAX_PATH];

    
for(int i = 0; i < 6; i++)
    {
        sprintf(filename, "..\\Data\\Scene%u%u.bmp", scene_index, i+1);
                
        
if(! load_texture_from_file(&m_scene_backdrops[i], filename, 0, D3DFMT_UNKNOWN))
            
return false;
    }

    
// load the scene mesh and configure object

    sprintf(filename, "..\\Data\\Scene%u.x", scene_index);

    
if(! m_scene_mesh.load(filename, "..\\Data"))
        
return FALSE;

    m_scene_object.create(&m_scene_mesh);

    
// load the camera data

    sprintf(filename, "..\\Data\\Cam%u.txt", scene_index);

    FILE* fp = fopen(filename, "rb");

    
if(fp == NULL)
        
return false;

    
float x_pos = get_next_float_2(fp);
    
float y_pos = get_next_float_2(fp);
    
float z_pos = get_next_float_2(fp);
    
float x_at  = get_next_float_2(fp);
    
float y_at  = get_next_float_2(fp);
    
float z_at  = get_next_float_2(fp);

    fclose(fp);

    m_camera.point(x_pos, y_pos, z_pos, x_at, y_at, z_at);
    set_display_camera(&m_camera);

    m_is_monster_last_frame = 
false;

    
// load script and execute it
    sprintf(filename, "..\\Data\\Scene%lu.mls", scene_index);
    m_game_script.execute(filename);

    
return true;
}

After you load the scene’s mesh and create the scene’s object, you are ready to
determine the placement of the camera used to render the 3-D graphics. You place
the camera in each scene by first creating a text file for each scene. Name these
files cam1.txt, cam2.txt, cam3.txt, cam4.txt, and cam5.txt—each named according
to its respective scene number (scenes being numbered 1 through 5).

Place a scene’s camera by opening the appropriate text file and reading in six numbers,
each of which is used to determine the camera’s orientation in the scene. The
first three numbers represent the position of the camera in the world, and the last
three numbers are the coordinates to which the camera is pointed.

After you load the six numbers and orient the camera, call the set_display_camera
function to inform Direct3D of the new view transformation being used by the camera.

After you position the camera in the file, the class clears a flag that determines
whether monsters are currently in the scene (for combat processing) and then
executes the script associated with the scene.

There's not much to do in load_level as you can see. The free_level function is rather
trouble-free as well. It frees the scene’s textures and simplified mesh, removes every
character from the character controller (except for the player, that is), and clears
all spells currently being processed. Here is the complete free_level function code:

void cApp::free_level()
{
    
for(int i = 0; i < 6; i++)
        release_com(m_scene_backdrops[i]);

    m_scene_mesh.free();
    m_barrier.free();
    m_trigger.free();
    m_game_spells.free();

    
// free all non-pc characters

    sCharacter* next_char;

    
for(sCharacter* char_ptr = m_game_chars.get_root_char(); char_ptr != NULL; char_ptr = next_char)
    {
        next_char = char_ptr->next;

        
if(char_ptr->type != CHAR_PC)
            m_game_chars.remove_char(char_ptr);
    }
}


posted on 2007-12-29 23:22 lovedday 閱讀(264) 評論(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精品亚洲| 久久在线免费观看| 欧美日韩高清在线播放| 国产精品亚发布| 一区二区三区在线免费视频| 91久久久久久国产精品| 亚洲性感美女99在线| 久久精品国产第一区二区三区| 噜噜噜躁狠狠躁狠狠精品视频| 欧美韩日亚洲| 亚洲免费一在线| 久热精品视频在线观看| 欧美日韩一本到| 亚洲高清视频中文字幕| 午夜日韩激情| 欧美成人国产一区二区| 亚洲一区二区三区四区五区黄| 久久久久九九视频| 国产精品毛片a∨一区二区三区|国 | 亚洲天堂免费观看| 久久综合久久综合九色| 国产精品a久久久久久| 伊人夜夜躁av伊人久久| 亚洲免费在线视频一区 二区| 麻豆国产精品va在线观看不卡| 99精品久久免费看蜜臀剧情介绍| 久久国产福利国产秒拍| 午夜欧美理论片| 狠狠操狠狠色综合网| 亚洲人成毛片在线播放| 久久久久久久久久久久久久一区| 亚洲精品老司机| 久久精品国产99国产精品澳门| 欧美日韩精品一区二区| 136国产福利精品导航网址| 欧美一级在线播放| 99re6热只有精品免费观看| 麻豆免费精品视频| 一区二区三区在线免费播放| 欧美日韩国产一区精品一区| 影音先锋在线一区| 久久麻豆一区二区| 亚洲欧美日韩第一区| 欧美日韩四区| 一区二区欧美在线| 亚洲毛片播放| 国产伦精品一区二区三区视频黑人 | 亚洲国产日日夜夜| 老司机午夜精品视频| 性色av一区二区三区| 国产精品中文在线| 性色一区二区| 亚洲男人第一网站| 国产九九视频一区二区三区| 性欧美激情精品| 午夜精品国产| 国产亚洲在线观看| 美国十次了思思久久精品导航| 久久久噜噜噜久噜久久| 欧美亚洲日本一区| 国产一区激情| 免费一级欧美片在线播放| 久久久人成影片一区二区三区| 一区在线免费| 亚洲国产精品尤物yw在线观看| 欧美成人四级电影| 欧美国产日韩xxxxx| 一区二区三区国产精华| 一区二区三区产品免费精品久久75 | 欧美亚洲专区| 亚洲国产精品欧美一二99| 欧美国产高清| 欧美日韩在线播放| 久久成人精品一区二区三区| 久久久91精品| 亚洲精品之草原avav久久| 噜噜噜噜噜久久久久久91| 亚洲破处大片| 夜夜嗨av一区二区三区网站四季av | 欧美日韩免费高清| 欧美一级视频一区二区| 久久久www成人免费毛片麻豆| 最新日韩在线视频| 一区二区三区精品国产| 国产伦精品一区二区三区照片91| 久久久久免费视频| 欧美精品aa| 久久久99国产精品免费| 欧美久久一区| 久久久久九九九| 欧美激情四色| 久久久久久久久久久久久女国产乱 | 久久国产主播精品| 99在线|亚洲一区二区| 先锋影音网一区二区| 日韩一级黄色大片| 久久精品99| 亚洲欧美日韩一区二区三区在线观看 | 久久综合图片| 欧美亚洲尤物久久| 欧美成人午夜激情| 久久久久久久波多野高潮日日| 欧美极品色图| 久久影院午夜论| 国产精品久久国产精品99gif| 免费亚洲电影在线观看| 国产精品一区二区男女羞羞无遮挡 | 日韩亚洲视频| 亚洲国产精品va在线观看黑人| 亚洲专区一区| 夜夜精品视频| 欧美成人亚洲成人| 久久夜色精品国产亚洲aⅴ| 欧美视频在线观看免费| 欧美激情精品久久久久久变态| 国产日韩欧美一区二区| 制服丝袜亚洲播放| 在线一区免费观看| 欧美日韩国产色视频| 欧美国产精品久久| 狠狠色狠狠色综合日日五| 中文有码久久| 在线视频日韩| 欧美日韩国产在线观看| 亚洲激情视频在线| 亚洲精品国产欧美| 久久一区二区视频| 国产精品久久久久9999高清| 欧美一区二区国产| 国产欧美日本| 亚洲一级黄色片| 欧美一区三区三区高中清蜜桃| 国产精品久久久久久一区二区三区| 亚洲美女黄网| 亚洲特色特黄| 国产精品久久国产精品99gif | 久久久精品午夜少妇| 免费观看一级特黄欧美大片| 精品福利免费观看| 美女精品在线| 亚洲高清视频在线观看| 亚洲人成毛片在线播放| 欧美精品在线免费观看| 日韩一级大片| 欧美一区二区三区电影在线观看| 国产伦精品一区| 久久视频在线免费观看| 亚洲黄页一区| 亚洲午夜极品| 国产人成精品一区二区三| 久久九九久精品国产免费直播| 欧美aⅴ99久久黑人专区| 亚洲乱码视频| 国产精品看片资源| 久久青草福利网站| 日韩亚洲欧美成人| 久久精品视频在线播放| 91久久精品国产91性色| 国产精品久久久久久久久免费樱桃 | 中日韩美女免费视频网址在线观看 | 欧美一区二区三区的| 韩国精品在线观看| 欧美大片在线看免费观看| 一本到12不卡视频在线dvd | 亚洲美女中文字幕| 久久精品在线免费观看| 亚洲日本欧美日韩高观看| 国产精品爱啪在线线免费观看| 欧美亚洲一级片| 亚洲人人精品| 久久久久久久高潮| 亚洲综合色视频| 亚洲国产精品成人一区二区| 欧美新色视频| 男人的天堂亚洲在线| 亚洲你懂的在线视频| 亚洲大胆av| 欧美欧美天天天天操| 亚洲欧美国产不卡| 亚洲激情国产| 美女精品在线观看| 欧美自拍偷拍午夜视频| 99在线精品视频| 亚洲欧美日韩中文视频| 免费看亚洲片| 亚洲免费在线观看|