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

天行健 君子當自強而不息

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>
            欧美激情亚洲综合一区| 亚洲精品国产精品乱码不99按摩| 欧美在线观看视频| 亚洲欧美文学| 欧美中文字幕在线播放| 久久久久国产精品麻豆ai换脸| 欧美中文在线观看国产| 玖玖玖国产精品| 欧美精品免费观看二区| 国产精品九九| 国产主播一区二区| 亚洲日本欧美| 午夜精品一区二区三区电影天堂 | 在线亚洲激情| 久久成人一区二区| 亚洲电影激情视频网站| 亚洲人成在线影院| 欧美一二三区在线观看| 欧美激情一区二区三区在线视频| 国产精品福利av| 在线视频观看日韩| 香港成人在线视频| 亚洲国产成人porn| 久久大逼视频| 国产精品白丝黑袜喷水久久久| 国产亚洲综合性久久久影院| 亚洲精品社区| 久久亚洲影院| 免费一级欧美片在线播放| 国产精品国产三级国产aⅴ浪潮| 国产精品网站在线播放| 在线色欧美三级视频| 欧美一区二区三区视频在线观看| 亚洲国产清纯| 校园激情久久| 国产精品www网站| 亚洲免费av电影| 美女日韩在线中文字幕| 亚洲女性裸体视频| 国产精品第三页| 中国成人黄色视屏| 亚洲精品国产精品国自产观看浪潮 | 免费久久99精品国产自| 国产精品美女在线| 亚洲美洲欧洲综合国产一区| 嫩草伊人久久精品少妇av杨幂| 亚洲一区二区三区四区视频| 欧美精品一区二区高清在线观看| 伊人婷婷欧美激情| 久久综合给合| 久久精品91久久香蕉加勒比| 国产欧美日韩精品专区| 午夜在线观看欧美| 亚洲天堂免费观看| 国产精品久久久久久久久动漫| 亚洲天堂激情| 亚洲视频在线二区| 国产精品免费aⅴ片在线观看| 亚洲午夜精品17c| 日韩午夜激情| 欧美日韩高清不卡| 一区二区欧美亚洲| 一区二区久久久久| 国产精品视频一区二区三区| 亚洲欧美视频| 欧美一区二区三区在| 狠狠色狠狠色综合日日tαg| 久久婷婷蜜乳一本欲蜜臀| 久久久久久久久岛国免费| 亚洲第一页自拍| 亚洲精品自在在线观看| 欧美视频一区二| 性色一区二区| 久久久久国产成人精品亚洲午夜| 亚洲成色777777在线观看影院| 欧美高清在线精品一区| 欧美日韩午夜精品| 久久精品国产免费观看| 久久中文字幕一区| 在线亚洲欧美视频| 香蕉成人啪国产精品视频综合网| 精品va天堂亚洲国产| 亚洲精品久久久久久下一站 | 国产精品v片在线观看不卡 | 欧美大秀在线观看| 欧美日产国产成人免费图片| 欧美一区二区三区免费观看视频| 欧美亚洲免费电影| 最新亚洲电影| 亚洲欧美一区二区原创| 亚洲电影免费观看高清| 亚洲一级二级在线| 在线免费日韩片| 亚洲视频在线观看三级| 在线欧美亚洲| 亚洲在线黄色| 夜夜嗨av一区二区三区免费区| 先锋影音久久| 一本色道久久综合亚洲二区三区| 欧美专区日韩视频| 欧美激情a∨在线视频播放| 欧美一级视频免费在线观看| 美国三级日本三级久久99| 欧美一区二区播放| 欧美片第1页综合| 老司机精品导航| 国产精品午夜视频| 日韩视频在线观看| 亚洲精品极品| 久久午夜羞羞影院免费观看| 欧美一级片一区| 国产精品swag| 日韩视频在线播放| 日韩视频―中文字幕| 久久久精品一区| 久久成人精品| 国产精品一区二区a| 在线视频精品一区| 亚洲一区二区毛片| 欧美视频手机在线| 亚洲精品一区在线观看| 最近看过的日韩成人| 久久久久久综合| 久久这里有精品视频| 韩国久久久久| 久久婷婷久久| 欧美成在线观看| 亚洲韩国青草视频| 欧美成人a∨高清免费观看| 欧美国产日韩二区| 亚洲欧洲综合另类在线| 男人插女人欧美| 亚洲国产精品一区| 一区二区三区久久精品| 欧美日韩精品久久久| 亚洲靠逼com| 亚洲已满18点击进入久久| 欧美午夜不卡| 香蕉免费一区二区三区在线观看| 性欧美18~19sex高清播放| 国产精品网站在线| 久久国产福利国产秒拍| 免费观看成人| 亚洲精品国产精品国产自| 欧美日本久久| 亚洲综合成人婷婷小说| 久久久久久久一区| 亚洲国产成人av好男人在线观看| 老司机精品视频一区二区三区| 亚洲国产激情| 亚洲永久免费视频| 国产日韩欧美一区| 久久国产高清| 亚洲激情一区二区| 亚洲欧美日韩在线高清直播| 国产一区二区你懂的| 欧美丰满高潮xxxx喷水动漫| 日韩一本二本av| 欧美资源在线观看| 最新高清无码专区| 国产精品一级二级三级| 免播放器亚洲一区| 亚洲一区中文字幕在线观看| 免费h精品视频在线播放| 一本一道久久综合狠狠老精东影业| 国产精品久久激情| 久久天天狠狠| 亚洲一区二区三区乱码aⅴ蜜桃女 亚洲一区二区三区乱码aⅴ | 欧美国产亚洲精品久久久8v| 一区二区三区精品国产| 国产欧美一区二区三区国产幕精品| 久久精品一本| 在线视频欧美日韩精品| 免费成人毛片| 久久av在线看| 国产精品99久久久久久久女警| 国产一区二区毛片| 欧美午夜精品电影| 免费视频一区| 香蕉久久精品日日躁夜夜躁| 亚洲精品专区| 亚洲国产91| 久久女同互慰一区二区三区| 亚洲欧美激情诱惑| 亚洲精品在线视频| 伊人久久男人天堂| 国产精品免费看片| 欧美日韩国产美| 媚黑女一区二区| 久久精品视频免费播放| 亚洲一区在线免费| 一本色道久久综合狠狠躁的推荐| 欧美成人蜜桃| 久久午夜国产精品| 欧美亚洲在线| 香蕉久久夜色精品| 亚洲专区国产精品| 一区二区三区高清视频在线观看| 亚洲缚视频在线观看| 影音先锋中文字幕一区|