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

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; 
主站蜘蛛池模板: 金湖县| 乃东县| 泸溪县| 内乡县| 卓尼县| 茶陵县| 元氏县| 南京市| 吴桥县| 金溪县| 凉山| 呼伦贝尔市| 出国| 武威市| 阳谷县| 庄浪县| 黔西县| 桐梓县| 嘉义市| 东辽县| 丽水市| 金沙县| 九龙城区| 武平县| 尼勒克县| 舟曲县| 石嘴山市| 南汇区| 仙居县| 剑河县| 铁力市| 贵港市| 额敏县| 扶沟县| 嘉荫县| 扎赉特旗| 如东县| 富民县| 依安县| 乌兰察布市| 大荔县|