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

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; 
主站蜘蛛池模板: 泾川县| 井陉县| 修水县| 巴林右旗| 岫岩| 穆棱市| 澄迈县| 桓仁| 冕宁县| 敦煌市| 彩票| 迁安市| 曲阳县| 沧源| 邯郸市| 富源县| 射洪县| 大荔县| 玛曲县| 长治县| 天水市| 大厂| 韩城市| 云安县| 尤溪县| 临泉县| 邯郸县| 三门峡市| 阿城市| 搜索| 达拉特旗| 田阳县| 沙雅县| 安丘市| 高阳县| 开封县| 彝良县| 辉南县| 万源市| 张家港市| 嵩明县|