游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1291|回复: 0

请教地形高度图不能全部读取

[复制链接]

40

主题

48

帖子

48

积分

注册会员

Rank: 2

积分
48
发表于 2009-10-16 13:12:00 | 显示全部楼层 |阅读模式
学生最近在做地形,用到了256的高度图,读取RAW文件并显示时发现地图的大小和高度图的信息不一致,好像比高度图少了很多,只读取了高度图中间的一部分,一下是读取RAW文件的函数,请各位高手看看是哪里错了,谢谢了:

void Terrain::ReadRawFile(const char *filename)
{
        m_fHeightMap.resize(m_iSideVerNum * m_iSideVerNum);
        //m_fWater.resize(m_iSideVerNum * m_iSideVerNum);
        m_iMap.resize(m_iSideVerNum * m_iSideVerNum);
        m_fDHMap.resize(m_iSideVerNum * m_iSideVerNum);
        m_AabbMap.resize(m_iSideVerNum * m_iSideVerNum);

    ifstream hFile;
        hFile.open(filename, ios::binary);
        for(int i=0; i<= m_iSideLength; i++)
        {
           for(int j=0; j<=m_iSideLength; j++)
           {
              int index = i*m_iSideLength+j;

                  m_fHeightMap[index] = hFile.get();
           }
        }

       
}
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-8-6 23:04

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表