def setup_model_matrix(matrix: QMatrix4x4, rotation: np.ndarray, translation: np.ndarray) -> None: matrix.setToIdentity() # Translate matrix (translation = rotation_center) matrix.translate(*translation) # Rotate matrix matrix.rotate(rotation[0], 1.0, 0.0, 0.0) matrix.rotate(rotation[1], 0.0, 1.0, 0.0) matrix.rotate(rotation[2], 0.0, 0.0, 1.0) # Restore matrix matrix.translate(*-translation)
def setup_view_matrix(matrix: QMatrix4x4, camera: iter) -> None: matrix.setToIdentity() matrix.translate(*-camera)