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

天行健 君子當(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>
            一区二区日韩免费看| 亚洲第一区中文99精品| 亚洲天堂av综合网| 一本大道久久精品懂色aⅴ| 欧美三区不卡| 欧美中文字幕视频在线观看| 午夜国产不卡在线观看视频| 国产亚洲精品aa| 欧美成年人网| 欧美日韩国产成人在线| 午夜一区二区三区不卡视频| 性做久久久久久久免费看| 国产综合在线视频| 亚洲国产精品一区二区www在线| 欧美成人免费一级人片100| 一区二区三区国产在线| 亚洲欧美中文在线视频| 亚洲国产精品精华液网站| 99国内精品| 精品动漫3d一区二区三区| 亚洲国产精品成人va在线观看| 欧美午夜精品久久久久久久| 久久久久国产精品午夜一区| 欧美激情在线有限公司| 午夜伦欧美伦电影理论片| 久久夜色精品国产欧美乱| 亚洲深夜福利在线| 久久久在线视频| 亚洲综合社区| 欧美1级日本1级| 久久成人精品无人区| 奶水喷射视频一区| 欧美中文字幕不卡| 欧美激情一区二区三区在线| 久久精品亚洲精品国产欧美kt∨| 欧美黄色aaaa| 久久综合狠狠综合久久激情| 欧美日韩在线一二三| 欧美成熟视频| 国产综合色产| 亚洲综合电影一区二区三区| 一区二区av在线| 免费看亚洲片| 美女视频黄免费的久久| 国产精品一区二区三区乱码| 亚洲人成在线免费观看| 亚洲第一精品电影| 香蕉久久a毛片| 亚洲一区视频在线| 欧美日韩福利| 亚洲欧洲一区二区三区久久| 一区二区在线看| 欧美一区二区日韩一区二区| 亚洲一区二区三区四区五区黄| 欧美第一黄色网| 亚洲国产99| 亚洲国产成人久久综合一区| 久久久精品性| 麻豆精品一区二区综合av| 国产一级揄自揄精品视频| 亚洲欧美视频在线观看视频| 狂野欧美激情性xxxx| 久久只有精品| 永久域名在线精品| 猛干欧美女孩| 亚洲欧洲综合另类| 日韩视频在线一区二区三区| 欧美激情综合五月色丁香小说| 欧美激情在线观看| 日韩视频久久| 欧美日韩在线三级| 亚洲欧美国产三级| 久久国产一区二区| 精品福利电影| 蜜桃久久精品一区二区| 91久久亚洲| 亚洲欧美www| 国产一区二区| 久久夜色精品亚洲噜噜国产mv| 欧美成人亚洲| 中文一区二区| 国产欧美日韩另类视频免费观看| 欧美一区亚洲一区| 欧美激情视频在线免费观看 欧美视频免费一 | 最新亚洲激情| 欧美日韩国产不卡| 亚洲欧美变态国产另类| 玖玖玖国产精品| 日韩视频欧美视频| 国产精品午夜在线观看| 久久超碰97中文字幕| 亚洲第一中文字幕| 亚洲精品日韩在线观看| 午夜久久久久| 欧美韩日视频| 亚洲专区免费| 亚洲国产精品精华液2区45| 欧美精品在线看| 欧美一区二区在线免费观看 | 尤物在线观看一区| 欧美日本国产一区| 欧美中文在线字幕| 亚洲日本免费| 乱中年女人伦av一区二区| 一区二区三区**美女毛片| 合欧美一区二区三区| 欧美日韩国产综合久久| 久久国产精品一区二区三区四区| 亚洲欧洲精品天堂一级| 久久电影一区| 亚洲一区中文字幕在线观看| 在线日韩精品视频| 国产欧美大片| 欧美日韩一区成人| 欧美96在线丨欧| 久久久久成人精品| 亚洲一区在线播放| 日韩视频一区二区在线观看| 欧美69wwwcom| 久久裸体艺术| 久久成人羞羞网站| 午夜国产精品视频免费体验区| 亚洲欧洲在线观看| 亚洲电影免费观看高清完整版在线| 国产精品视频男人的天堂| 欧美片第一页| 欧美高清视频一区| 噜噜噜噜噜久久久久久91 | 亚洲久久一区二区| 你懂的网址国产 欧美| 久久精品一本| 久久精品一区二区三区中文字幕| 亚洲视频专区在线| 一区二区三区**美女毛片| 亚洲精品欧美一区二区三区| 亚洲黄色在线视频| 亚洲精品乱码久久久久久蜜桃麻豆| 国内成+人亚洲| 精品9999| 亚洲国产一区在线| 亚洲精品乱码久久久久久蜜桃91 | 国产精品素人视频| 国产精品麻豆成人av电影艾秋 | 久久综合伊人77777尤物| 久久久www成人免费毛片麻豆| 欧美在线高清视频| 久久久久久亚洲综合影院红桃| 久久国产精品久久久久久| 久久久久久9| 欧美成人亚洲成人日韩成人| 欧美高清视频一区| 欧美日韩三区| 国产精品视频最多的网站| 国产精品视频xxxx| 国产在线不卡| 亚洲国产精品毛片| 在线亚洲一区二区| 欧美在线视频在线播放完整版免费观看 | 欧美国产在线观看| 亚洲黄色视屏| 亚洲视频网在线直播| 午夜视频一区在线观看| 久久久噜噜噜久久久| 欧美黄免费看| 国产乱子伦一区二区三区国色天香 | 国产精品第十页| 国产伦一区二区三区色一情| 国产午夜亚洲精品理论片色戒| 在线观看日韩一区| 一区二区三区回区在观看免费视频| 亚洲综合社区| 欧美成人午夜77777| 99国产一区二区三精品乱码| 久久av一区二区| 欧美激情在线免费观看| 国产欧美日韩亚洲精品| 亚洲国产精品第一区二区| 亚洲欧美电影院| 美女被久久久| 亚洲午夜免费福利视频| 久久综合九色欧美综合狠狠| 欧美性大战久久久久久久| 亚洲电影免费观看高清完整版在线| 中文网丁香综合网| 免费不卡视频| 亚洲自拍啪啪| 欧美美女bb生活片| 一区二区三区中文在线观看| 亚洲视频在线观看| 欧美成人久久| 香蕉av777xxx色综合一区| 欧美精品xxxxbbbb| 精品成人国产| 久久国产一区| 亚洲中午字幕| 欧美午夜在线视频| 亚洲片区在线| 亚洲大黄网站| 久久亚洲一区| 精品福利av|