官术网_书友最值得收藏!

There's more...

Where swizzling really shows its full potential is when it's applied to packed matrices. Cg allows types such as float4x4, which represents a matrix of floats with four rows and four columns. You can access a single element of the matrix using the _mRC notation, where R is the row and C is the column:

float4x4 matrix; 
// ... 
float first = matrix._m00; 
float last = matrix._m33; 

The _mRC notation can also be chained:

float4 diagonal = matrix._m00_m11_m22_m33; 

An entire row can be selected using squared brackets:

float4 firstRow = matrix[0]; 
// Equivalent to 
float4 firstRow = matrix._m00_m01_m02_m03; 
主站蜘蛛池模板: 公安县| 隆化县| 灵武市| 朝阳区| 罗甸县| 岳西县| 元阳县| 五台县| 湖南省| 伊吾县| 宿迁市| 蒙阴县| 白银市| 永年县| 安庆市| 犍为县| 潼关县| 南康市| 文登市| 大英县| 高唐县| 资阳市| 沁水县| 南皮县| 云林县| 合阳县| 宜章县| 鹰潭市| 清河县| 府谷县| 天等县| 大悟县| 九江市| 吉木乃县| 温泉县| 二手房| 大渡口区| 乐陵市| 广安市| 如东县| 当雄县|