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

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

Working with Maps and Levels(13)

Creating the Auto Map Class

The auto map class I've developed for the book will load a cMesh object and compress
it into a flat version of the map. The flattened map is stored in a series of vertex
buffers. These vertex buffers use only the X-, Y-, and Z-coordinates of each
vertex plus a single diffuse color. This means that auto maps are compact and easy
to render. This also means that you can use alpha blending to overlay the map on
the screen without covering the crucial gaming action going on.

Each map section has an associated flag that defines whether it is visible. The class
allows you to enable or disable those visibility flags, and to make sure that the
player’s hard work is not in vain, save and load those visibility flags.

Enough talk; now check out the class declaration:

//-------------------------------------------------------------------------------------------
// The sVertex structure is a custom vertex structure than contains only the 3D coordinates.
// This is used to retrieve coordinate information from a mesh's vertex buffer.
//-------------------------------------------------------------------------------------------
typedef struct sVertex
{
    float x, y, z;
} *sVertexPtr;

typedef struct sMapVertex
{
    
float x, y, z;      // coordinate
    D3DCOLOR diffuse;   // map color
} *sMapVertexPtr;

#define AUTO_MAP_FVF    (D3DFVF_XYZ | D3DFVF_DIFFUSE)

/********************************************************************************************/

typedef 
class cAutoMap
{
private:
    
long    m_num_sections;
    
bool*   m_visible;                          // visibility of sections
    DIRECT3DVERTEXBUFFER9_PTR*  m_map_vb;       // map vertex buffer array

    IDirect3DVertexBuffer9*     m_arrow_vb;     

    D3DVIEWPORT9                m_viewport;     
// area to draw map
    cCamera                     m_camera;       

    
float                       m_scale;        // scale used to draw map

    
//////////////////////////////////////////////////////////////////////////////

public:
    cAutoMap()
    {
        m_num_sections  = 0;
        m_visible      = NULL;
        m_map_vb       = NULL;
        m_arrow_vb     = NULL;
        
        m_camera.rotate(1.57f, 0.0f, 0.0f); 
// point camera down
        set_viewport(0, 0, 100, 100);

        m_scale = 1.0f;
    }

    ~cAutoMap()
    {
        free();
    }

    
void free()
    {
        
if(m_map_vb)
        {
            
for(long i = 0; i < m_num_sections; i++)
                release_com(m_map_vb[i]);

            delete[] m_map_vb;
            m_map_vb = NULL;           
        }

        m_num_sections = 0;

        delete[] m_visible;
        m_visible = NULL;

        release_com(m_arrow_vb);
    }

    
long get_num_section()
    {
        
return m_num_sections;
    }

    
void set_viewport(long x_pos, long y_pos, long width, long height)
    {
        
// define an area to draw the map

        m_viewport.X      = x_pos;
        m_viewport.Y      = y_pos;
        m_viewport.Width  = width;
        m_viewport.Height = height;
        m_viewport.MinZ   = 0.0f;
        m_viewport.MaxZ   = 1.0f;
    }

    
void visible_section(long section)
    {
        
// enable a map section's visibility flag

        m_visible[section] = 
true;
    }
    
    
void invisible_section(long section)
    {
        
// disable a map section's visibility flag

        m_visible[section] = 
false;
    }

    
//////////////////////////////////////////////////////////////////////////////

public:
    
bool create(pcstr filename, long color);

    
bool load(pcstr filename);
    
bool save(pcstr filename);
    
    
void render(cCamera* old_camera,
                
float map_x_pos, float map_y_pos, float map_z_pos,
                
float num_arrows,
                
float* arrow_x_pos, float* arrow_z_pos, float* angle);
} *cAutoMapPtr;


From the start, you can see that I’ve defined two vertex structures. You use the first,
sVertex, to access the vertex coordinates from the source meshes. You use the
second vertex structure, sMapVertex, to store the map sections.

Following the vertex structures are a collage of variables. Notice the number of map sections in use, an array of vertex
buffers, an array of char variables used to mark sections of the map that are visible,
a viewport structure, a cCamera, a scaling factor variable, and a pointer vertex buffer.

You should be comfortable with everything except the pointer vertex buffer and the
scaling factor. To make things easier on you, a map being loaded is scaled down to a
workable size. When you render the auto map, you need to specify coordinates from
the large map scale, but the auto map class will scale them down to fit the small map.

For example, a map that is 1,024 units in width and depth is scaled down to 256
units in width and depth. In fact, all maps are scaled down to a size of 256 x 256,
regardless of their size in the .X file.

As for the pointer vertex buffer, I’ve added the capability to display an arrow
pointer that represents each character on the map. The arrow pointer points in the
direction each character is facing. This vertex buffer simply contains three points
and is rendered using a red diffuse color.

In addition to the class’s private variables, you must deal with the functions.

posted on 2007-12-10 15:31 lovedday 閱讀(208) 評論(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>
            在线亚洲精品福利网址导航| 免费在线播放第一区高清av| 91久久精品日日躁夜夜躁国产| 亚洲深爱激情| 99精品欧美一区二区三区| 欧美与欧洲交xxxx免费观看| 午夜精品在线看| 国产精品成人在线观看| 亚洲国产你懂的| 亚洲精华国产欧美| 久久亚洲色图| 老牛影视一区二区三区| 国产一区二区三区免费在线观看| 亚洲一级电影| 午夜精品视频| 国产精品美女久久久浪潮软件 | 国产精品专区第二| 亚洲在线观看免费| 小黄鸭视频精品导航| 国产精品xvideos88| 99精品福利视频| 亚洲视频精品在线| 国产精品v欧美精品v日本精品动漫 | 国产精品乱码久久久久久| 99热在这里有精品免费| 亚洲午夜高清视频| 国产精品人人爽人人做我的可爱| 一区二区不卡在线视频 午夜欧美不卡在 | 国产麻豆一精品一av一免费| 亚洲免费综合| 久久色在线观看| 在线高清一区| 欧美大片免费观看| 日韩视频永久免费观看| 亚洲欧美视频一区二区三区| 国产女人精品视频| 久久午夜视频| 亚洲日韩视频| 欧美一区二区播放| 激情久久久久久久| 欧美精品一区二区精品网| 亚洲视频国产视频| 久久综合伊人77777| 99天天综合性| 国产精品一卡二卡| 久久午夜av| av成人毛片| 老牛国产精品一区的观看方式| 亚洲精品你懂的| 国产精品美女一区二区| 久久久久国产一区二区三区| 亚洲国产第一页| 亚洲欧美精品一区| 永久域名在线精品| 欧美日韩在线视频一区| 校园春色综合网| 亚洲狠狠丁香婷婷综合久久久| 亚洲在线播放电影| 亚洲国产精品精华液网站| 欧美午夜精品久久久久久久| 久久久成人精品| 一本久道久久综合中文字幕| 久久久www免费人成黑人精品 | 亚洲欧洲偷拍精品| 国产精品欧美日韩| 欧美承认网站| 欧美在线观看视频在线| 亚洲精品免费看| 久久综合99re88久久爱| 亚洲在线电影| 日韩视频在线观看国产| 国产在线乱码一区二区三区| 欧美日韩免费看| 久久综合中文色婷婷| 亚洲欧美日韩精品久久奇米色影视 | 亚洲欧美日韩国产成人| 91久久久久久久久久久久久| 国产欧美日韩综合一区在线观看 | 一区在线影院| 国产精品一级久久久| 欧美日韩精品| 欧美成年视频| 久久久久88色偷偷免费| 亚洲欧美精品| 一区二区三区国产盗摄| 亚洲黄一区二区| 欧美成人精品三级在线观看| 久久久久久久精| 亚洲欧美一区二区原创| 亚洲夜间福利| 一级成人国产| 99视频有精品| 亚洲免费福利视频| 亚洲三级毛片| 亚洲精品中文字幕有码专区| 136国产福利精品导航| 精品二区视频| 伊人久久av导航| 狠狠久久综合婷婷不卡| 国产一区久久| 黄色在线一区| 在线不卡欧美| 亚洲高清av| 亚洲日本成人网| 日韩一级黄色av| 亚洲网站视频| 亚洲一区欧美一区| 亚洲欧美在线免费| 欧美伊人久久| 久久理论片午夜琪琪电影网| 免费成人高清在线视频| 欧美高清成人| 亚洲三级性片| 亚洲午夜影视影院在线观看| 亚洲一二三区精品| 欧美在线电影| 欧美暴力喷水在线| 欧美精品久久99久久在免费线| 欧美三级中文字幕在线观看| 国产精品久久久久久久久久尿| 国产精品一区二区三区成人| 国产一区二区观看| 在线精品视频一区二区| 日韩视频中午一区| 亚洲视频免费| 久久国产免费| 欧美国产精品v| 9人人澡人人爽人人精品| 亚洲一区二区三区激情| 久久久亚洲午夜电影| 欧美极品在线观看| 国产精品综合久久久| 在线免费观看视频一区| 一区二区三区精品视频| 久久不射中文字幕| 欧美激情中文不卡| 亚洲一区久久| 麻豆9191精品国产| 国产精品美女久久久久久久 | 国内精品福利| 夜夜夜精品看看| 久久久噜噜噜久久中文字免| 亚洲国产精品视频| 亚洲欧美日韩综合aⅴ视频| 久久综合999| 国产精品青草久久| 亚洲精品美女在线| 久久久99国产精品免费| 亚洲精一区二区三区| 久久精品免费电影| 国产精品捆绑调教| 亚洲精品一区在线观看| 久久精品成人一区二区三区蜜臀| 亚洲高清不卡| 欧美专区第一页| 欧美日韩在线精品一区二区三区| 国产一区二区三区在线观看视频| 一卡二卡3卡四卡高清精品视频| 久久人91精品久久久久久不卡| 亚洲精选中文字幕| 免费久久精品视频| 国产一区二区三区免费在线观看 | 在线视频亚洲欧美| 欧美激情视频一区二区三区在线播放| 国产欧美一区二区三区沐欲 | 国产精自产拍久久久久久蜜| 日韩特黄影片| 欧美大尺度在线观看| 亚久久调教视频| 国产精品久久999| 一本综合久久| 亚洲国产精品黑人久久久| 久久精品视频在线播放| 国产欧美日韩91| 午夜伦欧美伦电影理论片| 亚洲免费观看高清在线观看| 你懂的国产精品| 亚洲第一免费播放区| 久久视频一区二区| 欧美一区二区三区免费看| 国产精品区一区二区三区| 亚洲欧美日韩国产另类专区| 亚洲美女在线一区| 欧美日韩国产专区| 亚洲视频二区| 9国产精品视频| 国产精品福利在线观看网址| 亚洲视频每日更新| 一区二区三区视频在线播放| 欧美日韩色综合| 中国女人久久久| 亚洲午夜精品国产| 国产欧美日韩三区| 久久成人免费视频| 久久精品国产成人| 国产一区二区成人| 麻豆精品视频在线观看| 久久婷婷综合激情| 亚洲精品一区二区在线| 日韩网站在线观看|