取自《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. LeetCode Lowest Common Ancestor of a Binary Tree

    原题链接在这里:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/ 题目: Given a binary tr ...

  2. python笔记 - day6

    python笔记 - day6 参考: http://www.cnblogs.com/wupeiqi/articles/5501365.html 大纲: 利用递归,实现阶乘: Python反射 pyt ...

  3. eclipse中的Console控制台视图脱离主窗口解决办法

    问题:Console控制台视图由于操作不当,跑出来了,脱离了主窗口 解决:在eclipse主窗口最上面的工具条选项中,找到Window,点击里面的Reset Perspective,即可,这样视图就重 ...

  4. linux安装pip报错

    解决方法:升级pip工具 sudo python -m pip install -U pip

  5. Android中的CharSequence和String

    String 类代表字符串.Java 程序中的所有字符串字面值(如 "abc" )都作为此类的实例来实现. (这个没啥了解的吧,经常用 class)public interface ...

  6. 用java给php写个万能接口

    package helloworld; import java.io.IOException; import javax.servlet.ServletException; import javax. ...

  7. RouterOS 软路由配置固定IP上网+DHCP

    实现要求: 局域网所有PC机自动获取IP地址,能相互访问并且能访问外网 环境要求: 一台PC机安装两张网卡 ( 使用常用的网卡芯片,例如Intel芯片.RTL瑞昱芯片等 ) 配置说明 1.外网IP地址 ...

  8. 最流行的PHP 代码规范

    “PHP是最好的编程语言” ;-) 那么PHPer习惯使用什么样的代码规范呢?sideeffect.kr通过分析GitHub上托管的开源代码,得出了一些有趣的结果,让我们一起来看看吧. 缩进 空格(7 ...

  9. Git撤销操作命令

    使用Git的过程中,失误无法避免,虽然Git很强,但是有些失误,无法挽回.在这里我介绍一些Git的撤销命令. 撤销对文件的修改 如下图所示的情况,你修改了文件,但是不想保存对文件的修改. 根据具体情况 ...

  10. LuaExpat笔记

    xml xml是一种格式化数据交换语言, 适用于在网络上不同应用会话. http://www.xml.com/pub/a/98/10/guide0.html exPat 一种C语言实现的 xml 文档 ...