Files
Graphics-Rasterizer/Matrix.h
IDunnoDev 3b374c1e17 Week5 [26/10]
Added the Z Access to the Matrix class
Added the Identity Matrix Method to the Matrix Class
Added MD2Loader Class
Added Model Class
Added Polygon Class
Added Clear Viewport Method to Rasterizer
Added Z Axis to the Vertex Class
Updated Transformation Matrices to pass a matrix back so that we can do the multiplication at once
2021-12-11 13:24:09 +00:00

41 lines
948 B
C++

#pragma once
#include "Vertex.h"
#include <initializer_list>
// Size of the matrix
const int COLS = 4;
const int ROWS = 4;
class Matrix
{
public:
Matrix();
Matrix(std::initializer_list<float> inputList);
// Take in an array of floats matching the cols and rows
Matrix(const float arrayIn[ROWS][COLS]);
Matrix(const Matrix& other);
~Matrix();
float GetM(const int row, const int column) const;
float GetMatrixCell(const int row, const int column) const;
void SetM(const int row, const int column, const float value);
void SetMatrixCell(const int row, const int column, const float value);
void FromArray(const float arrayIn[ROWS][COLS]);
Matrix IdentityMatrix();
Matrix& operator= (const Matrix& rhs);
bool operator==(const Matrix& other) const;
const Matrix operator*(const Matrix& other) const;
const Vertex operator*(const Vertex& other) const;
private:
float _matrix[ROWS][COLS];
void Copy(const Matrix& other);
};