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

天行健 君子當自強而不息

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 閱讀(266) 評論(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>
            免费亚洲一区| 欧美国产先锋| 亚洲欧美国产精品桃花| 国产精品成人免费| 午夜精品免费视频| 午夜伦欧美伦电影理论片| 国产日韩精品一区| 久久久久免费视频| 亚洲黄色大片| 亚洲日本视频| 欧美调教vk| 久久激情网站| 欧美成ee人免费视频| 日韩午夜av| 午夜精品免费视频| 亚洲电影中文字幕| 日韩网站在线| 红桃视频亚洲| 日韩视频久久| 激情文学综合丁香| 亚洲剧情一区二区| 国产视频一区在线观看| 蜜桃av噜噜一区二区三区| 欧美日韩国产美| 久久精品亚洲乱码伦伦中文 | 99视频精品全部免费在线| 99国内精品| 黄色免费成人| 在线亚洲欧美专区二区| 激情久久中文字幕| 在线亚洲一区二区| 亚洲三级电影在线观看| 午夜激情综合网| 99精品视频网| 久久一区二区三区四区| 亚洲一区二区三区中文字幕在线| 欧美中在线观看| 亚洲欧美综合一区| 欧美chengren| 久久免费国产| 国产精品三上| 亚洲精品社区| 最新中文字幕一区二区三区| 亚洲欧美日韩精品综合在线观看| 亚洲精品国精品久久99热| 羞羞色国产精品| 亚洲综合久久久久| 欧美日韩免费观看一区| 欧美激情日韩| 精品不卡一区二区三区| 亚洲影院免费观看| 亚洲欧美日韩视频二区| 欧美另类69精品久久久久9999| 久久躁狠狠躁夜夜爽| 国产日韩精品视频一区二区三区| 一个色综合av| 亚洲视频www| 欧美日韩一区二区三区免费 | 久久精品一区二区国产| 欧美视频网址| 亚洲素人在线| 亚洲影音一区| 国产精品成人免费视频| 99精品国产一区二区青青牛奶| 亚洲精品少妇| 欧美剧在线免费观看网站| 亚洲国产va精品久久久不卡综合| 一区在线播放视频| 久久亚洲一区二区三区四区| 蜜臀av性久久久久蜜臀aⅴ| 国内精品久久久久影院 日本资源 国内精品久久久久伊人av | 国产日韩欧美中文在线播放| 亚洲一区二区三区视频| 午夜视频在线观看一区二区三区| 国产精品第2页| 亚洲一区二区视频| 欧美一区二区三区在线视频| 国产欧美在线看| 久久aⅴ乱码一区二区三区| 久久久久久一区二区| 激情五月***国产精品| 久久影院午夜片一区| 欧美黄色一区| 亚洲一区免费| 国内精品久久久久影院优| 久久久久久九九九九| 亚洲春色另类小说| 正在播放欧美一区| 国产伦精品一区二区三区视频孕妇 | 欧美另类综合| 亚洲午夜在线视频| 久久久久九九视频| 亚洲精品亚洲人成人网| 欧美日韩一本到| 欧美在线一级va免费观看| 欧美成人高清| 亚洲尤物视频在线| 狠狠综合久久av一区二区小说| 另类亚洲自拍| 亚洲一区二区三区国产| 免费在线观看日韩欧美| 一区二区精品在线观看| 国产亚洲观看| 欧美日韩亚洲在线| 久久一区二区三区四区五区| 亚洲精品少妇网址| 久久综合给合久久狠狠色| 一本大道久久a久久精二百| 国产精品一区二区女厕厕| 另类激情亚洲| 欧美一区午夜视频在线观看| 91久久中文字幕| 久久手机免费观看| 西瓜成人精品人成网站| 91久久精品网| 激情视频一区二区| 国产精品无人区| 欧美激情一区二区三区成人 | 亚洲精品日韩久久| 久久精品视频在线看| 一本到12不卡视频在线dvd| 国产一区二区三区免费不卡| 欧美三级乱码| 欧美成人免费网| 久久久噜噜噜久久| 香蕉久久夜色精品国产使用方法| 亚洲国产精品女人久久久| 久久精品一区二区三区不卡| 亚洲欧美国产精品桃花| av72成人在线| 亚洲日本电影在线| 亚洲福利免费| 亚洲高清资源| **网站欧美大片在线观看| 韩国精品一区二区三区| 国产精品最新自拍| 国产精品影视天天线| 国产精品久久一区二区三区| 欧美日韩国产在线看| 欧美另类高清视频在线| 欧美大色视频| 欧美国产激情| 欧美精品一卡二卡| 欧美三级视频在线播放| 欧美区二区三区| 欧美精品激情blacked18| 欧美成人午夜影院| 欧美激情亚洲综合一区| 欧美人与性禽动交情品| 欧美精品国产| 欧美体内she精视频在线观看| 欧美日韩免费区域视频在线观看| 欧美日本久久| 国产精品免费久久久久久| 国产精品高清在线| 国产日韩一区| 好吊妞这里只有精品| 在线视频成人| 亚洲精品一区二区在线| 99亚洲一区二区| 亚洲欧美视频一区二区三区| 欧美一级理论片| 久久久噜噜噜| 亚洲国产免费看| 一区二区三区鲁丝不卡| 亚洲欧美日韩国产中文| 久久人人精品| 欧美精品在线免费播放| 国产精品日韩专区| 狠狠色狠狠色综合系列| 亚洲国产天堂网精品网站| 亚洲午夜精品国产| 欧美中文字幕不卡| 蜜桃久久精品乱码一区二区| 亚洲黑丝一区二区| 亚洲欧美99| 欧美成人蜜桃| 国产精品成人一区二区三区吃奶| 国产一区二区三区直播精品电影| 亚洲黄色av| 欧美一区二区三区久久精品茉莉花 | 亚洲国产欧美日韩另类综合| av成人免费在线| 久久久精品日韩欧美| 亚洲黑丝在线| 欧美一区二区三区视频免费播放 | 亚洲网站在线| 免费观看日韩av| 国产日韩精品一区二区三区| 亚洲精品久久久久| 久久久国产精品一区二区三区| 亚洲欧洲一级| 久久久www成人免费无遮挡大片| 欧美日韩一区二区精品| 有坂深雪在线一区| 欧美一区二区网站| 日韩一区二区精品在线观看| 老鸭窝毛片一区二区三区| 国产老肥熟一区二区三区| 亚洲另类视频|