《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底层库,因为它的应用程序编程接 ...
随机推荐
- [LeetCode]题解(python):103 Binary Tree Zigzag Level Order Traversal
题目来源 https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/ Given a binary tree, re ...
- [LeetCode]题解(python):092 Reverse Linked List II
题目来源 https://leetcode.com/problems/reverse-linked-list-ii/ Reverse a linked list from position m to ...
- mysql 数据库授权
1: GRANT ALL PRIVILEGES ON share_db.* to 'db_user'@'%' IDENTIFIED BY 'db_user'; 2:FLUSH PRIVILEGES;
- logback详细配置(三)
转自:http://blog.csdn.net/haidage/article/details/6794540 <filter>: 过滤器,执行一个过滤器会有返回个枚举值,即DENY,NE ...
- Apple Developer Program Roles Overview
Apple Developer Program Roles Overview There are three roles that can be assigned to Apple Developer ...
- LeetCode Fraction to Recurring Decimal
原题链接在这里:https://leetcode.com/problems/fraction-to-recurring-decimal/ 题目: Given two integers represen ...
- JavaScript:下拉列表框的事件处理
下拉列表框处理操作主要使用的是一个onchang的事件,此事件描述的是内容改变后行为. 范例:观察下拉列表框的事件处理 代码: <!doctype html> <html lang ...
- 使用pycharm远程调试python代码
使用 pycharm 进行 python 代码远程调试 pycharm 的远程调试是从远程机器连接到本地机器,需要在远程机器的py文件中指定本地机器的IP和端口. 远程机器上,通过easy_insta ...
- java yum安装的环境变量设置
如何(怎样)在CentOS 6.X 或 redhat 上使用安装JDK runtime environment (openjdk) ? CentOS 6.X 和 5.X 自带有OpenJDK runt ...
- IntelliJ IDEA 下的版本控制介绍
不管是个人开发或是团队开发,版本控制都是可以很好地被使用的,目前我找不到任何开发者不使用版本控制的理由.而且对于 IDE 来讲,集成版本控制的本身就是它最大的亮点之一,很多开发者也是为此而使用它. 在 ...