游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2197|回复: 3

拾取地形的问题

[复制链接]

23

主题

59

帖子

59

积分

注册会员

Rank: 2

积分
59
发表于 2010-5-6 12:57:00 | 显示全部楼层 |阅读模式
我是用鼠标左键拾取的 每拾取一次都会出现如下的警告
Direct3D9: (WARN) :Static index buffer locked more than once per frame. Could have severe performance penalty.
Direct3D9: (WARN) :Static index buffer locked more than once per frame. Could have severe performance penalty.
Direct3D9: (WARN) :Static index buffer locked more than once per frame. Could have severe performance penalty.
Direct3D9: (WARN) :Static index buffer locked more than once per frame. Could have severe performance penalty.
Direct3D9: (WARN) :Static index buffer locked more than once per frame. Could have severe performance penalty.
Direct3D9: (WARN) :Static index buffer locked more than once per frame. Could have severe performance penalty.
Direct3D9: (WARN) :Static index buffer locked more than once per frame. Could have severe performance penalty.

请问怎么处理。

42

主题

140

帖子

158

积分

注册会员

Rank: 2

积分
158
发表于 2010-5-6 13:15:00 | 显示全部楼层

Re:拾取地形的问题

这只是性能警告,想必你是直接Lock缓冲读取地形的数据吧,这种方式效率实在是太低了。

9

主题

132

帖子

145

积分

注册会员

Rank: 2

积分
145
QQ
发表于 2010-5-6 17:13:00 | 显示全部楼层

Re: 拾取地形的问题

对每个面做射线检测效率太低了。

我建议:
   沿射线方向穷举。

   vec3 start, end;
   vec3 dir;
   vec3 pos;
   
   while (pos < end)
   {
        float y = get_terrain_height(pos.x, pos.z);
        if (pos.y < y)
          break;

        pos += dir;
   }

一般情况都挺快的。

11

主题

1238

帖子

1782

积分

金牌会员

Rank: 6Rank: 6

积分
1782
发表于 2010-5-8 12:15:00 | 显示全部楼层

Re:拾取地形的问题

拾取地形怎么会LOCK index buffer? 没有高度图数据吗?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-6-9 18:28

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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