Example #1
0
    def __init__(
        self,
        position=(0.0, 0.0, 1.0),
        focus=(0.0, 0.0, 0.0),
        up=(0.0, 1.0, 0.0),
        fov=45.0,
        near_plane=0.01,
        far_plane=20.0,
        aspect_ratio=8.0 / 6.0,
    ):

        super(TrackballCamera, self).__init__(
            position=position,
            focus=focus,
            up=up,
            fov=fov,
            near_plane=near_plane,
            far_plane=far_plane,
            aspect_ratio=aspect_ratio,
        )

        self.view_matrix = get_lookat_matrix(self.position, self.focus,
                                             self.up)

        rotation_matrix = self.view_matrix[0:3, 0:3]
        self.orientation = rotation_matrix_to_quaternion(rotation_matrix)
Example #2
0
    def _update_matrices(self):

        self.view_matrix = get_lookat_matrix(self.position, self.focus,
                                             self.up)
        self.orientation = rotation_matrix_to_quaternion(self.view_matrix[0:3,
                                                                          0:3])

        self.projection_matrix = self.proj_func(self.fov, self.aspect_ratio,
                                                self.near_plane,
                                                self.far_plane)
Example #3
0
 def _orientation_default(self):
     rotation_matrix = self.view_matrix[0:3, 0:3]
     return rotation_matrix_to_quaternion(rotation_matrix)