def compute_matrices(self): rotation_matrix = quaternion_to_rotation_matrix(self.orientation) dp = np.linalg.norm(self.position - self.focus) * rotation_matrix[2] self.position = dp + self.focus self.up = rotation_matrix[1] self.view_matrix = get_lookat_matrix(self.position, self.focus, self.up) self.projection_matrix = self.proj_func(self.fov, self.aspect_ratio, self.near_plane, self.far_plane)
def update_orientation(self, start_x, start_y, end_x, end_y): self.orientation = update_orientation(self.orientation, start_x, start_y, end_x, end_y) rotation_matrix = quaternion_to_rotation_matrix(self.orientation) dp = np.linalg.norm(self.position - self.focus) * rotation_matrix[2] self.position = dp + self.focus self.up = rotation_matrix[1] self.view_matrix = get_lookat_matrix(self.position, self.focus, self.up) self.projection_matrix = self.proj_func(self.fov, self.aspect_ratio, self.near_plane, self.far_plane)