Swap yaw and pitch in camera computation. Add functions to convert view matrix to camera position, and camera position to camera yaw pitch roll.

This commit is contained in:
yunfeibai
2017-06-01 15:30:37 -07:00
parent 4388a6ea02
commit e6d1a8cf97
74 changed files with 347 additions and 281 deletions

View File

@@ -35,10 +35,10 @@ struct BridgeExample : public CommonRigidBodyBase
void resetCamera()
{
float dist = 41;
float pitch = 52;
float yaw = 35;
float pitch = -35;
float yaw = 52;
float targetPos[3]={0,0.46,0};
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
m_guiHelper->resetCamera(dist,yaw,pitch,targetPos[0],targetPos[1],targetPos[2]);
}
};

View File

@@ -35,10 +35,10 @@ struct ChainExample : public CommonRigidBodyBase
void resetCamera()
{
float dist = 41;
float pitch = 52;
float yaw = 35;
float pitch = -35;
float yaw = 52;
float targetPos[3]={0,0.46,0};
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
m_guiHelper->resetCamera(dist,yaw,pitch,targetPos[0],targetPos[1],targetPos[2]);
}
};

View File

@@ -62,10 +62,10 @@ struct InclinedPlaneExample : public CommonRigidBodyBase
void resetCamera()
{
float dist = 41;
float pitch = 52;
float yaw = 35;
float pitch = -35;
float yaw = 52;
float targetPos[3]={0,0.46,0};
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
m_guiHelper->resetCamera(dist,yaw,pitch,targetPos[0],targetPos[1],targetPos[2]);
}

View File

@@ -58,10 +58,10 @@ struct MultiPendulumExample: public CommonRigidBodyBase {
virtual void applyPendulumForce(btScalar pendulumForce);
void resetCamera() {
float dist = 41;
float pitch = 52;
float yaw = 35;
float pitch = -35;
float yaw = 52;
float targetPos[3] = { 0, 0.46, 0 };
m_guiHelper->resetCamera(dist, pitch, yaw, targetPos[0], targetPos[1],
m_guiHelper->resetCamera(dist, yaw, pitch, targetPos[0], targetPos[1],
targetPos[2]);
}

View File

@@ -35,10 +35,10 @@ struct MultipleBoxesExample : public CommonRigidBodyBase
void resetCamera()
{
float dist = 41;
float pitch = 52;
float yaw = 35;
float pitch = -35;
float yaw = 52;
float targetPos[3]={0,0.46,0};
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
m_guiHelper->resetCamera(dist,yaw,pitch,targetPos[0],targetPos[1],targetPos[2]);
}
};

View File

@@ -58,10 +58,10 @@ struct NewtonsCradleExample: public CommonRigidBodyBase {
virtual void applyPendulumForce(btScalar pendulumForce);
void resetCamera() {
float dist = 41;
float pitch = 52;
float yaw = 35;
float pitch = -35;
float yaw = 52;
float targetPos[3] = { 0, 0.46, 0 };
m_guiHelper->resetCamera(dist, pitch, yaw, targetPos[0], targetPos[1],
m_guiHelper->resetCamera(dist, yaw, pitch, targetPos[0], targetPos[1],
targetPos[2]);
}

View File

@@ -90,10 +90,10 @@ struct NewtonsRopeCradleExample : public CommonRigidBodyBase {
void resetCamera()
{
float dist = 41;
float pitch = 52;
float yaw = 35;
float pitch = -35;
float yaw = 52;
float targetPos[3]={0,0.46,0};
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
m_guiHelper->resetCamera(dist,yaw,pitch,targetPos[0],targetPos[1],targetPos[2]);
}
std::vector<btSliderConstraint*> constraints;

View File

@@ -43,10 +43,10 @@ struct RigidBodyFromObjExample : public CommonRigidBodyBase
void resetCamera()
{
float dist = 11;
float pitch = 52;
float yaw = 35;
float pitch = -35;
float yaw = 52;
float targetPos[3]={0,0.46,0};
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
m_guiHelper->resetCamera(dist,yaw,pitch,targetPos[0],targetPos[1],targetPos[2]);
}
};

View File

@@ -35,10 +35,10 @@ struct SimpleBoxExample : public CommonRigidBodyBase
void resetCamera()
{
float dist = 41;
float pitch = 52;
float yaw = 35;
float pitch = -35;
float yaw = 52;
float targetPos[3]={0,0.46,0};
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
m_guiHelper->resetCamera(dist,yaw,pitch,targetPos[0],targetPos[1],targetPos[2]);
}
};

View File

@@ -61,10 +61,10 @@ struct SimpleClothExample : public CommonRigidBodyBase
void resetCamera()
{
float dist = 41;
float pitch = 52;
float yaw = 35;
float pitch = -35;
float yaw = 52;
float targetPos[3]={0,0.46,0};
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
m_guiHelper->resetCamera(dist,yaw,pitch,targetPos[0],targetPos[1],targetPos[2]);
}
void createSoftBody(const btScalar size, const int num_x, const int num_z, const int fixed=1+2);

View File

@@ -35,10 +35,10 @@ struct SimpleJointExample : public CommonRigidBodyBase
void resetCamera()
{
float dist = 41;
float pitch = 52;
float yaw = 35;
float pitch = -35;
float yaw = 52;
float targetPos[3]={0,0.46,0};
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
m_guiHelper->resetCamera(dist,yaw,pitch,targetPos[0],targetPos[1],targetPos[2]);
}
};