- Hands-On C++ Game Animation Programming
- Gabor Szauer
- 171字
- 2021-06-30 14:45:57
Adding matrices
Two matrices can be added together by component. To add two matrices together, sum their respective components and store the result in a new matrix. Matrix addition can be used with scalar multiplication to interpolate or blend between multiple matrices. Later, you will learn how to use this property to implement animation skinning.
Implement the matrix addition function in mat4.cpp. Don't forget to add the function declaration to mat4.h:
mat4 operator+(const mat4& a, const mat4& b) {
return mat4(
a.xx+b.xx, a.xy+b.xy, a.xz+b.xz, a.xw+b.xw,
a.yx+b.yx, a.yy+b.yy, a.yz+b.yz, a.yw+b.yw,
a.zx+b.zx, a.zy+b.zy, a.zz+b.zz, a.zw+b.zw,
a.tx+b.tx, a.ty+b.ty, a.tz+b.tz, a.tw+b.tw
);
}
Matrix addition is simple but it will play a big role in displaying an animated mesh. In the next section, you will learn how to scale a matrix by a scalar value.
- LaTeX Cookbook
- VMware View Security Essentials
- 國際大學(xué)生程序設(shè)計(jì)競(jìng)賽中山大學(xué)內(nèi)部選拔真題解(二)
- Mastering SVG
- Visual Basic學(xué)習(xí)手冊(cè)
- 你不知道的JavaScript(中卷)
- 用Python實(shí)現(xiàn)深度學(xué)習(xí)框架
- concrete5 Cookbook
- 從零開始學(xué)Linux編程
- 微服務(wù)架構(gòu)深度解析:原理、實(shí)踐與進(jìn)階
- 響應(yīng)式Web設(shè)計(jì):HTML5和CSS3實(shí)戰(zhàn)(第2版)
- TypeScript 2.x By Example
- 零基礎(chǔ)學(xué)HTML+CSS
- Tableau Desktop可視化高級(jí)應(yīng)用
- Python Social Media Analytics