Ejemplo n.º 1
0
void rotateCamera(float yaw, float pitch, float roll) {

	CMatrix matrix;
	float rotate[4][4];
	SVect3d view;

	matrix.LoadIdentity();
	matrix.Rotate(roll*0.0174532925, 0.0, 0.0, 1.0);
	matrix.Rotate(-pitch*0.0174532925, 1.0, 0.0, 0.0);
	matrix.Rotate(yaw*0.0174532925, 0.0, 1.0, 0.0);

	matrix.GetMatrixArray((float *)rotate);

	view.x = rotate[0][0]*0.0 + rotate[0][1]*0.0 + rotate[0][2]*(-1.0);
	view.y = rotate[1][0]*0.0 + rotate[1][1]*0.0 + rotate[1][2]*(-1.0);
	view.z = rotate[2][0]*0.0 + rotate[2][1]*0.0 + rotate[2][2]*(-1.0);

	camUp.x = rotate[0][0]*0.0 + rotate[0][1]*1.0 + rotate[0][2]*0.0;
	camUp.y = rotate[1][0]*0.0 + rotate[1][1]*1.0 + rotate[1][2]*0.0;
	camUp.z = rotate[2][0]*0.0 + rotate[2][1]*1.0 + rotate[2][2]*0.0;

	camLookAt.x = view.x + pos.x;
	camLookAt.y = view.y + pos.y;
	camLookAt.z = view.z + pos.z;

}
Ejemplo n.º 2
0
void prepareDraw() {

	float Model[4][4];
	memset(Model, 0, sizeof(Model));
	cmModelviewMatrix.GetMatrixArray((float *)Model);
	glUniformMatrix4fv      (iModel, 1, false, (const float *)&Model[0][0]);
}