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

天行健 君子當自強而不息

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 閱讀(215) 評論(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>
            亚洲大胆人体视频| 国产老肥熟一区二区三区| 欧美大片第1页| 国产精品久久999| 国产在线欧美日韩| 亚洲少妇最新在线视频| 美女在线一区二区| 在线视频你懂得一区二区三区| 久久美女性网| 国产伦精品一区二区三区照片91 | 狠狠爱www人成狠狠爱综合网| 亚洲精品一区中文| 久久久久久午夜| 亚洲视频1区| 国产三级欧美三级| 中国日韩欧美久久久久久久久| 国产精品美女在线| 最新国产成人av网站网址麻豆| 久久成人精品一区二区三区| 欧美成人国产一区二区| 一本一道久久综合狠狠老精东影业 | 一区二区三区精品国产| 美女脱光内衣内裤视频久久网站| 老**午夜毛片一区二区三区| 国产一区日韩二区欧美三区| 久久青草久久| 欧美日韩精品高清| 一区二区三区 在线观看视频| 亚洲午夜精品久久久久久app| 欧美伦理a级免费电影| 亚洲人精品午夜| 亚洲一级网站| 亚洲成人在线| 亚洲一区二区三区四区视频| 欧美日韩一区二区三区在线| 日韩视频一区二区三区在线播放免费观看 | 欧美日韩国产不卡在线看| 性色av一区二区怡红| 国产精品99久久久久久久久 | 欧美日韩亚洲三区| 免费成人黄色片| 国产女人精品视频| 久久精品夜色噜噜亚洲a∨| 亚洲欧美日韩国产成人精品影院| 国产精品高清网站| 欧美激情视频网站| 欧美日韩三级| 欧美激情精品久久久久久黑人| 国产免费成人av| 亚洲免费不卡| 国产精品亚洲产品| 久久综合久久综合这里只有精品| 亚洲婷婷综合久久一本伊一区| 怡红院精品视频在线观看极品| 欧美高清视频一区| 欧美人与性禽动交情品| 欧美成人日韩| 国内精品免费在线观看| 亚洲一区精彩视频| 亚洲在线一区| 久久精品盗摄| 日韩午夜激情| 亚洲欧美日韩中文在线制服| 一区二区三区精品国产| 欧美大片免费观看| 亚洲成人直播| 一个色综合导航| 亚洲六月丁香色婷婷综合久久| 久久夜色精品国产欧美乱| 久久久国产一区二区三区| 国产欧美日韩另类视频免费观看| 亚洲视频久久| 欧美一区二区三区免费在线看 | 亚洲无线观看| 亚洲综合首页| 久久久99精品免费观看不卡| 一本久久精品一区二区| 欧美在线|欧美| 亚洲视频精选| 国产精品久久久久久亚洲毛片| 日韩一级视频免费观看在线| 亚洲午夜精品一区二区三区他趣| 久久www免费人成看片高清| 久久久精彩视频| 永久555www成人免费| 老牛嫩草一区二区三区日本| 亚洲国产一区在线| 亚洲高清在线视频| 亚洲欧美国产高清va在线播| 99国产一区| 欧美三级电影精品| 亚洲乱码国产乱码精品精可以看| 激情欧美日韩一区| 午夜亚洲性色视频| 亚洲欧美日韩国产综合在线 | 欧美在线视频观看免费网站| 美女福利精品视频| 99精品欧美| 国产模特精品视频久久久久| 久久成人羞羞网站| 亚洲人成在线免费观看| 在线播放中文字幕一区| 欧美黑人多人双交| 亚洲国产第一页| 亚洲区在线播放| 欧美先锋影音| 亚洲午夜久久久| 蜜臀久久99精品久久久画质超高清| 亚洲精选在线| 国产精品一区二区男女羞羞无遮挡| 久久久亚洲综合| 蜜臀av性久久久久蜜臀aⅴ| 一本久久综合亚洲鲁鲁五月天| 国产毛片一区二区| 欧美日韩大片| 麻豆91精品| 亚洲日本中文字幕| 久久婷婷国产麻豆91天堂| 一区二区三区四区国产| 伊人久久噜噜噜躁狠狠躁| 欧美性猛交一区二区三区精品| 久久久水蜜桃av免费网站| 亚洲欧美国产日韩中文字幕| 亚洲国产欧美日韩精品| 免费成人高清在线视频| 欧美在线播放| 亚洲天堂av在线免费观看| 亚洲精品麻豆| 国产精品v片在线观看不卡| 蜜桃av一区二区三区| 欧美一区不卡| 亚洲第一在线| 理论片一区二区在线| 欧美一区二区女人| 亚洲男同1069视频| 国产精品99久久久久久久女警| 一区二区视频免费完整版观看| 国产女精品视频网站免费| 国产精品国产三级欧美二区| 欧美日韩视频在线| 欧美日韩国产一区| 欧美日韩精品一区视频| 欧美高清视频免费观看| 久久只精品国产| 久久永久免费| 六月婷婷一区| 久久夜色精品亚洲噜噜国产mv| 久久久久久9| 久久亚洲影音av资源网| 久久蜜桃香蕉精品一区二区三区| 久久大逼视频| 久久久青草青青国产亚洲免观| 久久久亚洲影院你懂的| 久久综合一区二区三区| 鲁大师影院一区二区三区| 欧美~级网站不卡| 欧美一区二区三区日韩视频| 午夜在线观看免费一区| 久久www成人_看片免费不卡| 久久精品视频亚洲| 久久影院午夜论| 欧美国产精品一区| 欧美午夜宅男影院| 国产日产高清欧美一区二区三区| 国产欧美欧洲在线观看| 国内精品久久久久久久果冻传媒| 狠狠色狠狠色综合系列| 亚洲欧洲精品成人久久奇米网 | 亚洲精品系列| 亚洲伊人网站| 久久久欧美精品| 亚洲国产精品久久久久久女王| 亚洲美女福利视频网站| 日韩一区二区福利| 欧美一区二区三区免费观看视频| 久久精品一区二区三区中文字幕| 欧美h视频在线| 国产精品毛片大码女人| 伊人成人在线| 亚洲在线视频网站| 久久综合中文字幕| 日韩亚洲欧美高清| 久久精品国产精品亚洲| 欧美精品日韩一区| 欧美成人午夜免费视在线看片| 欧美精品午夜视频| 国产日韩精品一区二区| 亚洲精品影院在线观看| 欧美一区二区视频在线观看| 亚洲国产成人在线| 亚洲欧美日韩天堂| 欧美精品一区二区三区蜜桃| 国产日韩欧美91| 一区二区三区四区国产| 狂野欧美性猛交xxxx巴西| 一区二区激情小说| 欧美xxx成人| 伊人春色精品| 欧美一级欧美一级在线播放| 亚洲人成人一区二区在线观看|