Added parameter const attributes
This commit is contained in:
parent
a152d07948
commit
5f7133f449
6
Matrix.h
6
Matrix.h
@ -7,7 +7,7 @@
|
||||
template <typename T> class MatrixOf {
|
||||
public:
|
||||
MatrixOf(unsigned int rows, unsigned int cols);
|
||||
MatrixOf(unsigned int rows, unsigned int cols, T *source)
|
||||
MatrixOf(unsigned int rows, unsigned int cols, const T *source)
|
||||
: MatrixOf(rows, cols) {
|
||||
Set(source);
|
||||
}
|
||||
@ -60,7 +60,7 @@ public:
|
||||
static Vector3 Multiply(const MatrixOf<T> *m, Vector3 v);
|
||||
Vector3 operator*(const Vector3 v) const;
|
||||
|
||||
T Get(unsigned int rowIx, unsigned int colIx) {
|
||||
T Get(unsigned int rowIx, unsigned int colIx) const {
|
||||
unsigned int dataIx = rowIx * this->cols + colIx;
|
||||
return this->data[dataIx];
|
||||
}
|
||||
@ -71,7 +71,7 @@ public:
|
||||
}
|
||||
|
||||
// This function does not check on source size!
|
||||
void Set(T *source) {
|
||||
void Set(const T *source) {
|
||||
unsigned int matrixSize = this->cols * this->rows;
|
||||
for (unsigned int dataIx = 0; dataIx < matrixSize; dataIx++)
|
||||
this->data[dataIx] = source[dataIx];
|
||||
|
Loading…
x
Reference in New Issue
Block a user