mirror of
https://github.com/thunderbrewhq/typhoon.git
synced 2025-12-12 10:32:29 +00:00
feat(matrix): add C44Matrix::Scale for C3Vector
This commit is contained in:
parent
3619492e39
commit
6b14afb6bd
2 changed files with 18 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
#include "tempest/matrix/C44Matrix.hpp"
|
#include "tempest/matrix/C44Matrix.hpp"
|
||||||
|
#include "tempest/Vector.hpp"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
C44Matrix C44Matrix::RotationAroundZ(float angle) {
|
C44Matrix C44Matrix::RotationAroundZ(float angle) {
|
||||||
|
|
@ -64,6 +65,20 @@ void C44Matrix::RotateAroundZ(float angle) {
|
||||||
*this = C44Matrix::RotationAroundZ(angle) * *this;
|
*this = C44Matrix::RotationAroundZ(angle) * *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void C44Matrix::Scale(const C3Vector& scale) {
|
||||||
|
this->a0 *= scale.x;
|
||||||
|
this->a1 *= scale.x;
|
||||||
|
this->a2 *= scale.x;
|
||||||
|
|
||||||
|
this->b0 *= scale.y;
|
||||||
|
this->b1 *= scale.y;
|
||||||
|
this->b2 *= scale.y;
|
||||||
|
|
||||||
|
this->c0 *= scale.z;
|
||||||
|
this->c1 *= scale.z;
|
||||||
|
this->c2 *= scale.z;
|
||||||
|
}
|
||||||
|
|
||||||
C44Matrix operator*(const C44Matrix& l, float a) {
|
C44Matrix operator*(const C44Matrix& l, float a) {
|
||||||
float a0 = l.a0 * a;
|
float a0 = l.a0 * a;
|
||||||
float a1 = l.a1 * a;
|
float a1 = l.a1 * a;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef TEMPEST_MATRIX_C_44MATRIX_HPP
|
#ifndef TEMPEST_MATRIX_C_44MATRIX_HPP
|
||||||
#define TEMPEST_MATRIX_C_44MATRIX_HPP
|
#define TEMPEST_MATRIX_C_44MATRIX_HPP
|
||||||
|
|
||||||
|
class C3Vector;
|
||||||
|
|
||||||
class C44Matrix {
|
class C44Matrix {
|
||||||
public:
|
public:
|
||||||
// Static functions
|
// Static functions
|
||||||
|
|
@ -47,6 +49,7 @@ class C44Matrix {
|
||||||
float Determinant() const;
|
float Determinant() const;
|
||||||
C44Matrix Inverse(float det) const;
|
C44Matrix Inverse(float det) const;
|
||||||
void RotateAroundZ(float angle);
|
void RotateAroundZ(float angle);
|
||||||
|
void Scale(const C3Vector& scale);
|
||||||
};
|
};
|
||||||
|
|
||||||
C44Matrix operator*(const C44Matrix& l, float a);
|
C44Matrix operator*(const C44Matrix& l, float a);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue