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

天行健 君子當自強而不息

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)  編輯 收藏 引用


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


公告

導航

統計

常用鏈接

隨筆分類(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>
            久久综合九九| 欧美日本韩国| 国产亚洲综合精品| 久久精品视频播放| 欧美一区国产二区| 黄色免费成人| 欧美黄色免费| 你懂的亚洲视频| 亚洲乱码视频| 一区二区福利| 国产欧美综合在线| 蜜桃av噜噜一区二区三区| 免费久久99精品国产自| 亚洲精品国产欧美| 一本大道久久a久久综合婷婷 | 欧美成人性网| 欧美国产丝袜视频| 亚洲摸下面视频| 欧美一区二区三区免费观看| 伊甸园精品99久久久久久| 亚洲国产视频直播| 国产精品一区二区久久久久| 狂野欧美一区| 欧美色图五月天| 久久国产精品黑丝| 欧美成人高清视频| 亚洲欧美国产77777| 久久久精品视频成人| 亚洲三级影片| 香蕉久久夜色精品| 亚洲精品美女在线观看| 亚洲天堂第二页| 在线精品视频一区二区三四| 99精品欧美一区| 狠狠色狠狠色综合日日tαg| 亚洲日本在线观看| 精品成人在线| 亚洲一区二区在线看| 亚洲精品视频在线观看免费| 小黄鸭精品aⅴ导航网站入口| 亚洲精品国产精品乱码不99| 欧美一区二区在线| 一区二区免费看| 久久青草久久| 久久精品国产综合| 欧美体内she精视频| 亚洲国产成人av| 国产中文一区| 亚洲欧美日韩人成在线播放| 亚洲精品少妇网址| 久久精品青青大伊人av| 午夜精品久久久久久久99热浪潮| 免费观看成人| 美女黄网久久| 一区在线视频观看| 午夜亚洲福利| 性娇小13――14欧美| 欧美日韩1区2区3区| 欧美成人黄色小视频| 国产字幕视频一区二区| 亚洲影音一区| 欧美一二三视频| 国产精品海角社区在线观看| 亚洲区一区二| 亚洲一区精彩视频| 一区二区高清| 欧美色视频一区| 99精品国产99久久久久久福利| 亚洲日本无吗高清不卡| 久久一二三国产| 欧美成年人视频| 亚洲激情亚洲| 欧美激情91| 亚洲第一网站免费视频| 欧美一乱一性一交一视频| 久久精品国产99精品国产亚洲性色| 国产精品视频一| 亚洲欧美日韩一区二区三区在线观看 | 欧美在线影院| 久久久之久亚州精品露出| 今天的高清视频免费播放成人 | 亚洲午夜视频| 久久精品国产精品亚洲精品| 国产自产女人91一区在线观看| 欧美一级片在线播放| 久久久综合网| 亚洲精品日产精品乱码不卡| 欧美日韩性视频在线| 亚洲视屏在线播放| 久久久久国产精品麻豆ai换脸| 精品成人国产| 欧美交受高潮1| 中日韩美女免费视频网址在线观看 | 一本色道久久综合亚洲精品不卡| 欧美日韩国产精品| 亚洲在线中文字幕| 久久久一区二区| 日韩视频在线免费| 国产精品久久久久久久久久三级| 亚洲欧美日韩一区二区三区在线观看 | 日韩一级大片在线| 欧美制服丝袜第一页| 亚洲欧洲日韩综合二区| 欧美日韩一区二区三区在线观看免| 亚洲一区影音先锋| 美女尤物久久精品| 在线亚洲精品福利网址导航| 国产精品一区二区久久久久| 老司机午夜精品视频在线观看| 日韩视频一区二区在线观看| 久久久久久有精品国产| 日韩西西人体444www| 国产精品三级久久久久久电影| 久久天天躁狠狠躁夜夜爽蜜月| 99re6这里只有精品| 久久免费视频网| 亚洲视频一区二区免费在线观看| 黄色亚洲网站| 国产精品成人aaaaa网站| 久久人人97超碰国产公开结果| 99国产精品| 欧美成在线观看| 欧美中文字幕精品| 夜色激情一区二区| 亚洲国产精品久久久久婷婷老年| 国产精品视频免费观看www| 欧美风情在线| 久久综合精品一区| 性做久久久久久| 一区二区三区日韩在线观看| 亚洲高清av在线| 久久只精品国产| 欧美一区二粉嫩精品国产一线天| 亚洲毛片av在线| 亚洲国产福利在线| 黄色日韩精品| 黄色日韩在线| 国产在线精品一区二区夜色| 国产精品二区在线| 欧美日韩精品综合| 欧美激情精品久久久久| 麻豆乱码国产一区二区三区| 欧美在线视频一区二区| 亚洲欧美日韩系列| 亚洲欧美一区二区原创| 亚洲午夜视频| 亚洲一二区在线| 亚洲免费视频在线观看| 亚洲视频观看| 亚洲自拍偷拍一区| 亚洲天堂av综合网| 亚洲一区www| 亚洲电影中文字幕| 亚洲欧洲日本在线| 乱码第一页成人| 久久婷婷色综合| 久久亚洲精品一区二区| 久久国产精品黑丝| 久久久精品日韩欧美| 久久亚洲图片| 美女国产精品| 欧美不卡一区| 欧美精品综合| 欧美偷拍一区二区| 国产精品av免费在线观看| 国产精品成人一区二区三区夜夜夜 | 欧美成人一区二区三区| 欧美高清在线视频观看不卡| 欧美日韩国产页| 欧美亚洲成人精品| 国产一区二区在线观看免费播放| 激情亚洲成人| 亚洲美女网站| 欧美亚洲综合网| 另类综合日韩欧美亚洲| 亚洲国产高清视频| 一区二区精品在线| 欧美一区国产在线| 欧美国产一区视频在线观看| 欧美午夜电影一区| 影音先锋亚洲视频| 在线综合欧美| 久久久免费av| 亚洲蜜桃精久久久久久久| 欧美亚洲日本网站| 欧美国产欧美亚洲国产日韩mv天天看完整| 欧美日韩亚洲一区二| 国产亚洲一区二区在线观看 | 国产精品成人观看视频免费| 国产视频一区在线观看| 亚洲区在线播放| 欧美一区二区观看视频| 亚洲第一精品久久忘忧草社区| 亚洲一区精品视频| 久久综合网hezyo| 国产精品久久九九| 亚洲最黄网站| 久久综合伊人77777尤物| 中文在线一区| 欧美国产日韩一区|