src/types/matrix.cpp

changeset 1390
3eace926af7f
parent 1326
69a90bd2dba2
equal deleted inserted replaced
1389:3fb8ad4d27b1 1390:3eace926af7f
236 int Matrix::ConstRowView::row() 236 int Matrix::ConstRowView::row()
237 { 237 {
238 return _row; 238 return _row;
239 } 239 }
240 240
241 Matrix Matrix::fromRotationMatrix(const GLRotationMatrix& rotationMatrix) 241 Matrix Matrix::fromQMatrix(const QMatrix4x4& matrix)
242 { 242 {
243 Matrix result; 243 Matrix result;
244 244
245 for (int i = 0; i < 3; ++i) 245 for (int i = 0; i < 3; ++i)
246 for (int j = 0; j < 3; ++j) 246 for (int j = 0; j < 3; ++j)
247 result(i, j) = rotationMatrix(i, j); 247 result(i, j) = matrix(i, j);
248 248
249 return result; 249 return result;
250 } 250 }
251
252 Matrix Matrix::scaleMatrix(qreal scalar)
253 {
254 return {
255 scalar, 0, 0,
256 0, scalar, 0,
257 0, 0, scalar
258 };
259 }
260
261 Matrix& Matrix::operator*=(const Matrix& other)
262 {
263 *this = *this * other;
264 return *this;
265 }

mercurial