《Focus On 3D Terrain Programming》中一段代码的注释二
- bool CTERRAIN::MakeTerrainFault( int iSize, int iIterations, int iMinDelta, int iMaxDelta, float fFilter )
- {
- ......
- .............
- for( iCurrentIteration=; iCurrentIteration<iIterations; iCurrentIteration++ )
- {
- //calculate the height range (linear interpolation from iMaxDelta to iMinDelta) for this fault-pass
- iHeight= iMaxDelta - ( ( iMaxDelta-iMinDelta )*iCurrentIteration )/iIterations;
- //pick two points at random from the entire height map
- iRandX1= rand( )%m_iSize;
- iRandZ1= rand( )%m_iSize;
- //check to make sure that the points are not the same
- do
- {
- iRandX2= rand( )%m_iSize;
- iRandZ2= rand( )%m_iSize;
- } while ( iRandX2==iRandX1 && iRandZ2==iRandZ1 );
- //iDirX1, iDirZ1 is a vector going the same direction as the line
- iDirX1= iRandX2-iRandX1;
- iDirZ1= iRandZ2-iRandZ1;
- for( z=; z<m_iSize; z++ )
- {
- for( x=; x<m_iSize; x++ )
- {
- //iDirX2, iDirZ2 is a vector from iRandX1, iRandZ1 to the current point (in the loop)
- iDirX2= x-iRandX1;
- iDirZ2= z-iRandZ1;
- //if the result of ( iDirX2*iDirZ1 - iDirX1*iDirZ2 ) is "up" (above 0),
- //then raise this point by iHeight
- if( ( iDirX2*iDirZ1 - iDirX1*iDirZ2 )> )
- fTempBuffer[( z*m_iSize )+x]+= ( float )iHeight;
- }
- }
- //erode terrain
- FilterHeightField( fTempBuffer, fFilter );
- }
- .......
- ..............
- return true;
- }
===================
《Focus On 3D Terrain Programming》中一段代码的注释二的更多相关文章
- 《Focus On 3D Terrain Programming》中一段代码的注释三
取自<Focus On 3D Terrain Programming>中的一段: //--------------------------------------------------- ...
- 《Focus On 3D Terrain Programming》中一段代码的注释一
取自<Focus On 3D Terrain Programming>中的一段: //--------------------------------------------------- ...
- 【鸡渣饲料系列】《Introdution to 3D Game Programming With DirectX11》 代码转移至vs2015
<Introdution to 3D Game Programming With DirectX11>我是从这本书学习的directx,被称为“龙书”dx11版,由于是通过这本书学习的所以 ...
- bootstrap 中这段代码 使bundles 失败
_:-ms-fullscreen, :root input[type="date"], _:-ms-fullscreen, :root input[type="time& ...
- SQL SERVER中如何查找存储过程中一段代码
select b.name ,a.text from syscomments a,sysobjects b where and object_id(b.name)=a.id and b.xtype i ...
- phpstorm 代码注释后,撤销某段代码的注释的,快捷键是什么?
phpstorm 的代码注释有两种风格,一种是双斜杠,另一种是 /* ... */风格,两者的快捷键都是开关式(即按第一次为注释,再按一次为撤销注释),快捷键如下: 1.双斜杠注释 Ctrl + ...
- Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第七章:在Direct3D中绘制(二)
原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第七章:在Direct3D中绘制(二) 代码工程地址: https:/ ...
- Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第六章:在Direct3D中绘制
原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第六章:在Direct3D中绘制 代码工程地址: https://gi ...
- Introduction to 3D Game Programming with DirectX 11 翻译--开篇
Direct3D 11简介 Direct3D 11是一个渲染库,用于在Windows平台上使用现代图形硬件编写高性能3D图形应用程序.Direct3D是一个windows底层库,因为它的应用程序编程接 ...
随机推荐
- ArcSDE for SQL Server安装及在ArcMap中创建ArcSDE连接
原文:ArcSDE for SQL Server安装及在ArcMap中创建ArcSDE连接 安装ArcSDE for SQL Server,最后一步成功后的界面如下: 在ArcMap中创建ArcSDE ...
- WPFFontCache_v0400.exe CPU使用率过高的问题
最近的电脑很慢 CPU超过50%了 任务管理器显示是WPFFontCache_v0400.exe 的问题 每次强制终止后不就又重新启动很是麻烦, 在MSDN中找到了解决办法: 禁用Windows Pr ...
- OO之美3
面向对象和基于对象 基于对象:所以基于对象,就是一种对数据类型的抽象,封装一个结构包含了数据和函数,然后以对象为目标进行操作.构建的基础是对象,但是操作对象并不体现出面向对象的继承性,也就是基于对象局 ...
- Sql Server中通配符
Sql Server中通配符的使用 通配符_ "_"号表示任意单个字符,该符号只能匹配一个字符."_"可以放在查询条件的任意位置,且只能代表一个字符.一个汉字只 ...
- Python-S13作业-day1-之登陆程序
Python-S13-day1 需求: 1.让用户输入账号密码,账号密码正确,登陆程序,打印欢迎信息: 2.如果账号,或密码输入错误,提示用户重新输入,用户有三次机会: 3.如果用户第三次输入的账号或 ...
- centos shell编程6一些工作中实践脚本 nagios监控脚本 自定义zabbix脚本 mysql备份脚本 zabbix错误日志 直接送给bc做计算 gzip innobackupex/Xtrabackup 第四十节课
centos shell编程6一些工作中实践脚本 nagios监控脚本 自定义zabbix脚本 mysql备份脚本 zabbix错误日志 直接送给bc做计算 gzip innobacku ...
- Android 多线程处理之多线程用法
handler.post(r)其实这样并不会新起线程,只是执行的runnable里的run()方法,却没有执行start()方法,所以runnable走的还是UI线程. 1.如果像这样,是可以操作ui ...
- .net平台下深拷贝和浅拷贝
在.net类库中,对象克隆广泛存在于各种类型的实现中,凡是实现了ICloneable接口的类型都具备克隆其对象实例的能力.所以本文讲述的深拷贝和浅拷贝也是在实现ICloneable接口的基础上进行的. ...
- 【转载】:【C++跨平台系列】解决STL的max()与numeric_limits::max()和VC6 min/max 宏冲突问题
http://www.cnblogs.com/cvbnm/articles/1947743.html 多年以前,Microsoft 幹了一件比 #define N 3 還要蠢的蠢事,那就是在 < ...
- MetInfo标签函数及参数
参数标签直接在页面中调用标签代码即可: 函数标签需要在页面PHP嵌入代码中通过参数定义转换方可使用,如$metlang=methtml_lang('-'),点击函数标签代码可查看函数标签详细使用方法: ...