diff --git a/CMakeLists.txt b/CMakeLists.txt index d3fcc57..31b84aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_policy(SET CMP0017 NEW) # need include() with .cmake cmake_policy(SET CMP0072 NEW) # FindOpenGL prefers GLVND by default project(QAD) set(QAD_MAJOR 2) -set(QAD_MINOR 27) +set(QAD_MINOR 28) set(QAD_REVISION 0) set(QAD_SUFFIX ) set(QAD_COMPANY SHS) diff --git a/libs/piqt/piqt.h b/libs/piqt/piqt.h index 0c38544..1079727 100644 --- a/libs/piqt/piqt.h +++ b/libs/piqt/piqt.h @@ -27,8 +27,11 @@ #include #include +#include #include +#include #include +#include #include #if QT_VERSION_MAJOR == 5 # if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) @@ -105,6 +108,60 @@ inline PIMathVectorT3d Q2PIVector3(const QVector3D & v) { return PIMathVectorT3d({double(v.x()), double(v.y()), double(v.z())}); } +template +inline QGenericMatrix PI2QMathMatrixT(const PIMathMatrixT & v) { + QGenericMatrix ret; + for (int r = 0; r < Rows; ++r) + for (int c = 0; c < Cols; ++c) + ret(r, c) = v[r][c]; + return ret; +} + +template +inline PIMathMatrixT Q2PIMathMatrixT(const QGenericMatrix & v) { + PIMathMatrixT ret; + for (int r = 0; r < Rows; ++r) + for (int c = 0; c < Cols; ++c) + ret[r][c] = v(r, c); + return ret; +} +inline PIMathMatrixT<4, 4, float> Q2PIMathMatrixT(const QMatrix4x4 & v) { + PIMathMatrixT<4, 4, float> ret; + for (int r = 0; r < 4; ++r) + for (int c = 0; c < 4; ++c) + ret[r][c] = v(r, c); + return ret; +} + + +inline PIMathVectorT2d Q2PIMathVectorT(const QVector2D & v) { + return PIMathVectorT2d({v[0], v[1]}); +} +inline PIMathVectorT2d Q2PIMathVectorT(const QPointF & v) { + return PIMathVectorT2d({v.x(), v.y()}); +} +inline PIMathVectorT3d Q2PIMathVectorT(const QVector3D & v) { + return PIMathVectorT3d({v[0], v[1], v[2]}); +} +inline PIMathVectorT4d Q2PIMathVectorT(const QVector4D & v) { + return PIMathVectorT4d({v[0], v[1], v[2], v[3]}); +} +template +inline PIMathVectorT Q2PIMathVectorT(const QGenericMatrix<1, Size, Type> & v) { + PIMathVectorT ret; + for (int i = 0; i < Size; ++i) + ret[i] = v(i, 0); + return ret; +} +template +inline PIMathVectorT Q2PIMathVectorT(const QGenericMatrix & v) { + PIMathVectorT ret; + for (int i = 0; i < Size; ++i) + ret[i] = v(0, i); + return ret; +} + + inline QPointF PI2QPoint(const PIPointd & v) { return QPointF(v.x, v.y); }