finally got the ortho projection and some other stuff working
This commit is contained in:
parent
8eda3df225
commit
9db2490989
6 changed files with 70 additions and 25 deletions
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
//#include <pw/core/matrix.hpp>
|
||||
//#include <pw/core/quaternion.hpp>
|
||||
|
||||
namespace pw {
|
||||
|
||||
|
@ -58,6 +60,12 @@ inline T ping_pong(const T& t,const T& length) {
|
|||
}
|
||||
|
||||
|
||||
//void extractRotation(const matrix &A, Quaterniond &q,const unsigned int maxIter)
|
||||
//{
|
||||
// for (auto iter = 0; iter < maxIter; iter++){
|
||||
// auto R = q.matrix();
|
||||
// Vector3d omega = (R.col(0).cross(A.col(0)) + R.col(1).cross(A.col(1)) + R.col(2).cross(A.col(2)))*(1.0 / fabs(R.col(0).dot(A.col(0)) + R.col(1).dot(A.col(1)) + R.col(2).dot(A.col(2))) +1.0e-9);double w = omega.norm();if (w < 1.0e-9)break;q = Quaterniond(AngleAxisd(w, (1.0 / w)*omega))*q;q.normalize();}}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -97,10 +97,10 @@ struct matrix_transform {
|
|||
}
|
||||
|
||||
inline static
|
||||
matrix_<4,4,T> orthographic_projection(T size,T z_near, T z_far)
|
||||
matrix_<4,4,T> orthographic_projection(T width,T height,T z_near, T z_far)
|
||||
{
|
||||
return orthographic_frustum(-size / 2, size / 2,
|
||||
-size / 2, size / 2,
|
||||
return orthographic_frustum(-width / 2, width / 2,
|
||||
-height / 2, height / 2,
|
||||
z_near,z_far);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue