- Unity 2018 Shaders and Effects Cookbook
- John P. Doran Alan Zucconi
- 101字
- 2021-06-18 19:04:17
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;
推薦閱讀
- x86匯編語言:從實模式到保護模式(第2版)
- Mastering Swift 2
- INSTANT Django 1.5 Application Development Starter
- 編程數學
- Mastering ROS for Robotics Programming
- C#實踐教程(第2版)
- PHP從入門到精通(第4版)(軟件開發視頻大講堂)
- HTML5從入門到精通(第4版)
- 持續集成與持續交付實戰:用Jenkins、Travis CI和CircleCI構建和發布大規模高質量軟件
- Learning Hadoop 2
- MyBatis 3源碼深度解析
- 深度學習程序設計實戰
- C語言程序設計
- Mastering JavaScript
- 人人都能開發RPA機器人:UiPath從入門到實戰