| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#pragma once |
| 6 |
|
| 7 |
JPH_NAMESPACE_BEGIN |
| 8 |
|
| 9 |
|
| 10 |
class [[nodiscard]] DynMatrix |
| 11 |
{ |
| 12 |
public: |
| 13 |
|
| 14 |
DynMatrix(const DynMatrix &) = default; |
| 15 |
DynMatrix(uint inRows, uint inCols) : mRows(inRows), mCols(inCols) { mElements.resize(inRows * inCols); } |
| 16 |
|
| 17 |
|
| 18 |
float operator () (uint inRow, uint inCol) const { JPH_ASSERT(inRow < mRows && inCol < mCols); return mElements[inRow * mCols + inCol]; } |
| 19 |
float & operator () (uint inRow, uint inCol) { JPH_ASSERT(inRow < mRows && inCol < mCols); return mElements[inRow * mCols + inCol]; } |
| 20 |
|
| 21 |
|
| 22 |
uint GetCols() const { return mCols; } |
| 23 |
uint GetRows() const { return mRows; } |
| 24 |
|
| 25 |
private: |
| 26 |
uint mRows; |
| 27 |
uint mCols; |
| 28 |
Array<float> mElements; |
| 29 |
}; |
| 30 |
|
| 31 |
JPH_NAMESPACE_END |