# Path: glitter/contexts/glut.py
# def get_shift_state():
#     """Only available in keyboard, special, and mouse callbacks."""
#     return bool(_gl.glutGetModifiers() & _gl.GLUT_ACTIVE_SHIFT)


import numpy as np
from quaternion import Quaternion
from glitter.contexts.glut import get_shift_state
from math import atan2
        fovy = 45.0 * np.pi / 180.0
        aspect = self.width / float(self.height)
        znear = 0.001
        zfar = 1000.0
        focal = 1.0 / np.tan(fovy / 2.0)
        persp_mat = np.zeros((4, 4))
        persp_mat[0, 0] = focal / aspect
        persp_mat[1, 1] = focal 
        persp_mat[2, 2] = (zfar + znear) / (znear - zfar)
        persp_mat[2, 3] = 2 * zfar * znear / (znear - zfar)
        persp_mat[3, 2] = -1

        rot_mat = np.identity(4)
        rot_mat[0, :3] = s
        rot_mat[1, :3] = u
        rot_mat[2, :3] = -f
        t_mat = np.identity(4)
        t_mat[:3, 3] = -self.position

        return np.dot(np.dot(persp_mat, rot_mat), t_mat)

    def set_window_size(self, w, h):
        self.width = w
        self.height = h

    def mouse(self, button, state, x, y):
        self.old_x = x;
        self.old_y = y;
        
        if button == 0 and state == 0:

# Path: glitter/contexts/glut.py
# def get_shift_state():
#     """Only available in keyboard, special, and mouse callbacks."""
#     return bool(_gl.glutGetModifiers() & _gl.GLUT_ACTIVE_SHIFT)


# Path: contrib/freeflycam.py
import numpy as np
from quaternion import Quaternion
from glitter.contexts.glut import get_shift_state
from math import atan2

        fovy = 45.0 * np.pi / 180.0
        aspect = self.width / float(self.height)
        znear = 0.001
        zfar = 1000.0
        focal = 1.0 / np.tan(fovy / 2.0)
        persp_mat = np.zeros((4, 4))
        persp_mat[0, 0] = focal / aspect
        persp_mat[1, 1] = focal 
        persp_mat[2, 2] = (zfar + znear) / (znear - zfar)
        persp_mat[2, 3] = 2 * zfar * znear / (znear - zfar)
        persp_mat[3, 2] = -1

        rot_mat = np.identity(4)
        rot_mat[0, :3] = s
        rot_mat[1, :3] = u
        rot_mat[2, :3] = -f
        t_mat = np.identity(4)
        t_mat[:3, 3] = -self.position

        return np.dot(np.dot(persp_mat, rot_mat), t_mat)

    def set_window_size(self, w, h):
        self.width = w
        self.height = h

    def mouse(self, button, state, x, y):
        self.old_x = x;
        self.old_y = y;
        
        if button == 0 and state == 0:

            if get_shift_state():