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

天行健 君子當自強而不息

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>
            亚洲高清在线观看一区| 亚洲欧美日韩电影| 亚洲精品国产精品久久清纯直播 | 欧美电影资源| 99re8这里有精品热视频免费| 亚洲美女精品久久| 国产精品免费电影| 久久久久国产成人精品亚洲午夜| 久久精品在线播放| 亚洲国产成人久久| 99国产精品视频免费观看一公开| 国产精品久99| 久热精品在线视频| 欧美激情91| 午夜精品久久久久久久99热浪潮| 久久精品国产99| 亚洲免费播放| 午夜精品三级视频福利| 亚洲国产天堂久久综合网| 99热在这里有精品免费| 国产一区二区三区成人欧美日韩在线观看| 欧美91大片| 欧美午夜片欧美片在线观看| 久久久之久亚州精品露出| 免费成人av在线| 亚洲欧美日韩第一区| 久热精品视频在线观看一区| 亚洲天天影视| 久久免费午夜影院| 亚洲一级片在线观看| 久久精品123| 亚洲视频你懂的| 久久久精品性| 亚洲永久免费| 久热精品视频在线观看| 亚洲欧美资源在线| 男女av一区三区二区色多| 午夜视频精品| 欧美成人亚洲| 久久精品电影| 欧美日韩午夜视频在线观看| 欧美成人精品| 国产人久久人人人人爽| 亚洲国产91| 国产日韩欧美一区二区三区在线观看 | 欧美 日韩 国产精品免费观看| 欧美婷婷久久| 欧美电影免费观看高清完整版| 国产精品久久久久久久久久免费看| 免费观看成人鲁鲁鲁鲁鲁视频| 国产精品久久97| 亚洲电影在线播放| 国产一区二区三区精品欧美日韩一区二区三区 | 亚洲男女毛片无遮挡| 亚洲麻豆一区| 欧美一区视频在线| 亚洲午夜激情| 亚洲精品日日夜夜| 一区二区在线视频播放| 亚洲一级黄色| 一区二区毛片| 免费成人av| 美女日韩在线中文字幕| 国产精品视频大全| 日韩视频第一页| 亚洲精品国产视频| 久久久综合网站| 久久精品99国产精品酒店日本| 欧美特黄视频| 亚洲丰满在线| 在线免费观看日本欧美| 午夜亚洲视频| 午夜伦欧美伦电影理论片| 欧美日韩国产首页在线观看| 欧美激情偷拍| 在线观看一区| 久久精品国产精品亚洲精品| 欧美亚洲免费高清在线观看| 欧美日韩中文字幕日韩欧美| 亚洲国产日韩在线| 亚洲经典在线看| 久久麻豆一区二区| 久久久午夜电影| 国产日韩欧美在线播放| 一区二区三区www| 一区二区三区国产| 欧美精品一区二区久久婷婷| 国产亚洲欧美色| 欧美国产亚洲视频| 在线免费观看视频一区| 久久久久久电影| 看片网站欧美日韩| 狠狠色综合色区| 久久国产成人| 久久久亚洲人| 一色屋精品亚洲香蕉网站| 久久国产天堂福利天堂| 久久性色av| 伊人狠狠色j香婷婷综合| 久久久久久成人| 久久一区视频| 在线观看亚洲| 免费精品视频| 亚洲黄色性网站| 亚洲人精品午夜| 免费欧美在线视频| 亚洲高清资源| 一区二区日韩欧美| 国产精品igao视频网网址不卡日韩| 亚洲最新视频在线| 亚洲欧美综合另类中字| 国产精品一区毛片| 欧美一区二区精品久久911| 久久久久久久久一区二区| 国内成+人亚洲| 久久久久综合一区二区三区| 欧美国产日韩精品免费观看| 亚洲日本中文字幕免费在线不卡| 欧美黑人国产人伦爽爽爽| 日韩视频免费在线观看| 亚洲欧美一级二级三级| 国产婷婷97碰碰久久人人蜜臀| 久久国产精品72免费观看| 免费视频一区| 日韩图片一区| 国产精品久久久久久久久借妻 | 久久av一区二区| 美女精品在线观看| 亚洲欧洲日本专区| 欧美另类99xxxxx| 亚洲色无码播放| 久久久久久综合| 亚洲国产一区二区精品专区| 欧美噜噜久久久xxx| 亚洲调教视频在线观看| 久久精品噜噜噜成人av农村| 亚洲大胆视频| 欧美久久电影| 亚洲女人天堂av| 免费一级欧美在线大片| 一区二区成人精品| 国产精品日本精品| 久久久久青草大香线综合精品| 亚洲国产99| 性欧美超级视频| 在线免费观看视频一区| 欧美日韩在线观看一区二区三区| 亚洲一级黄色| 欧美电影免费观看高清完整版| 美日韩在线观看| 久久美女性网| 99国产麻豆精品| 国产性天天综合网| 欧美国产视频在线| 午夜久久久久| 亚洲国产高清视频| 午夜视频在线观看一区| 激情亚洲网站| 欧美午夜不卡在线观看免费| 欧美在线免费视屏| 亚洲精品美女在线| 久久精品成人| 99re6热只有精品免费观看 | 亚洲欧美中文日韩v在线观看| 黄色资源网久久资源365| 欧美理论电影网| 久久久国产视频91| 99视频超级精品| 欧美成人在线免费观看| 亚洲欧美国产精品桃花| 亚洲国产日韩在线一区模特| 国产精品专区h在线观看| 欧美国产日韩精品免费观看| 性欧美videos另类喷潮| 亚洲日韩中文字幕在线播放| 久久久久久网| 亚洲一区二区三区中文字幕| 亚洲电影下载| 国产乱码精品一区二区三区忘忧草 | 麻豆精品一区二区av白丝在线| 日韩午夜在线视频| 麻豆av福利av久久av| 亚洲一区国产视频| 最新国产の精品合集bt伙计| 国产亚洲在线观看| 欧美午夜精品久久久久久浪潮 | 欧美成人黄色小视频| 欧美一区在线直播| 一区二区三区偷拍| 亚洲国产精品成人综合色在线婷婷| 国产精品综合色区在线观看| 欧美另类变人与禽xxxxx| 久久久久久亚洲精品杨幂换脸| 亚洲图片自拍偷拍| 亚洲已满18点击进入久久| 亚洲国产中文字幕在线观看| 国产一级久久| 国产伦精品一区二区三区高清版| 毛片一区二区| 久久久久久自在自线|