取自《Focus On 3D Terrain Programming》中的一段:
 //--------------------------------------------------------------
// Name: CIMAGE::LoadUncompressedTGA - private
// Description: Load an uncompressed targa (TGA)
// Arguments: None
// Return Value: A boolean variable: -true: TGA was loaded
// -false: TGA was not loaded
//--------------------------------------------------------------
bool CIMAGE::LoadUncompressedTGA( void )
{
........
....
pTGAinfo.m_uiBytesPerPixel= m_uiBPP/;
pTGAinfo.m_uiImageSize = ( pTGAinfo.m_uiBytesPerPixel*m_uiWidth*m_uiHeight ); //copy the image data
memcpy( m_ucpData, ucpFile, pTGAinfo.m_uiImageSize ); //byte swapping ( optimized by Steve Thomas )
for( uiCSwap=; uiCSwap<( int )pTGAinfo.m_uiImageSize; uiCSwap+=pTGAinfo.m_uiBytesPerPixel )
{
m_ucpData[uiCSwap]^= m_ucpData[uiCSwap+]^=m_ucpData[uiCSwap]^= m_ucpData[uiCSwap+];
} //the uncompressed TGA has been successfully loaded
return true;
}
===============
开开眼界,把BGR转换为RGB的交换代码,过于高大上了,直接操作的硬件,可以提高一定的速度,对大图片有用。

    m_ucpData[uiCSwap]^= m_ucpData[uiCSwap+2]^=m_ucpData[uiCSwap]^= m_ucpData[uiCSwap+2];

《Focus On 3D Terrain Programming》中一段代码的注释三的更多相关文章

  1. 《Focus On 3D Terrain Programming》中一段代码的注释二

    取自<Focus On 3D Terrain Programming>中的一段: bool CTERRAIN::MakeTerrainFault( int iSize, int iIter ...

  2. 《Focus On 3D Terrain Programming》中一段代码的注释一

    取自<Focus On 3D Terrain Programming>中的一段: //--------------------------------------------------- ...

  3. 【鸡渣饲料系列】《Introdution to 3D Game Programming With DirectX11》 代码转移至vs2015

    <Introdution to 3D Game Programming With DirectX11>我是从这本书学习的directx,被称为“龙书”dx11版,由于是通过这本书学习的所以 ...

  4. bootstrap 中这段代码 使bundles 失败

    _:-ms-fullscreen, :root input[type="date"], _:-ms-fullscreen, :root input[type="time& ...

  5. SQL SERVER中如何查找存储过程中一段代码

    select b.name ,a.text from syscomments a,sysobjects b where and object_id(b.name)=a.id and b.xtype i ...

  6. phpstorm 代码注释后,撤销某段代码的注释的,快捷键是什么?

    phpstorm 的代码注释有两种风格,一种是双斜杠,另一种是 /* ...  */风格,两者的快捷键都是开关式(即按第一次为注释,再按一次为撤销注释),快捷键如下: 1.双斜杠注释   Ctrl + ...

  7. Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第七章:在Direct3D中绘制(二)

    原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第七章:在Direct3D中绘制(二) 代码工程地址: https:/ ...

  8. Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第六章:在Direct3D中绘制

    原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第六章:在Direct3D中绘制 代码工程地址: https://gi ...

  9. Introduction to 3D Game Programming with DirectX 11 翻译--开篇

    Direct3D 11简介 Direct3D 11是一个渲染库,用于在Windows平台上使用现代图形硬件编写高性能3D图形应用程序.Direct3D是一个windows底层库,因为它的应用程序编程接 ...

随机推荐

  1. LoadingView 自定义加载图片

    #import <UIKit/UIKit.h> @interface LoadingView : UIView @property (nonatomic,strong) NSMutable ...

  2. LeetCode Longest Palindrome

    原题链接在这里:https://leetcode.com/problems/longest-palindrome/ 题目: Given a string which consists of lower ...

  3. 移动端公共css样式

    @media screen and ( min-width: 319px){html{ font-size: 100px;}}@media screen and ( min-width: 359px) ...

  4. (copy) Linux Commands Cheat Sheet in Black & White

    source: http://linoxide.com/linux-command/linux-commands-cheat-sheet/

  5. I2C实时时钟rx-8025板卡实际应用

    rx-8025是片外I2C实时时钟,其应用于9260板卡方法如下.总体思想是配置内核添加驱动(I2C驱动,内核已提供的很完备),板级文件添加设备,添加设备文件以应用程序操作. 1. 配置内核 1)I2 ...

  6. [NetTopologySuite](1)线面相交

    用DotSpatial.Topology进行的测试,即使有NetTopologySuite类库进行测试: Polygon inputGeometry = null; LineString analys ...

  7. 使用JavaScript闭包,以工厂模式实现定时器对象

    原始对象写法 一般工作中写Javascript代码,主要写全局函数,并组织函数之间的调用,确实比较低级, 于是想利用面向对象的思想应用到JS编码中. 在火狐浏览器开发者网站上,看到一个实例利用对象技术 ...

  8. ios判断点击的坐标点

    -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSSet *allTouches = [event allTouc ...

  9. 利用DescriptionAttribute实现枚举字符串

    我们知道定义枚举时是不允许带空格等符号的,这样就不利于进行字符串对比.当然可以通过给枚举添加DescriptionAttribute,然后通过fieldinfo读取DescriptionAttribu ...

  10. css 字体样式

    [强制] font-family 属性中的字体族名称应使用字体的英文 Family Name,其中如有空格,须放置在引号中. 解释: 所谓英文 Family Name,为字体文件的一个元数据,常见名称 ...