def __init__(self): self.context = Context.getInstance() # NOTE must be initialized self.logger = logging.getLogger(__name__) self.windowWidth = 640 self.windowHeight = 480 self.initialize() self.colorShader = Shader(self.context.getResourcePath('shaders', 'ADS.vert'), self.context.getResourcePath('shaders', 'ADS.frag')) self.proj = hm.perspective(hm.identity(), 35, float(self.windowWidth) / self.windowHeight, 1.0, 1000.0) self.view = hm.lookat(hm.identity(), np.array([0.0, 0.0, 0.0, 1.0], dtype = np.float32), np.array([0.0, 0.0, 1.0, 1.0], dtype = np.float32), np.array([0.0, -1.0, 0.0, 1.0], dtype = np.float32)) self.cameraMatrix = np.dot(self.proj, self.view) self.setCameraMatrix(self.cameraMatrix)
def __init__(self): self.context = Context.getInstance() # NOTE must be initialized self.logger = logging.getLogger(__name__) self.windowWidth = 640 self.windowHeight = 480 self.initialize() self.colorShader = Shader( self.context.getResourcePath('shaders', 'ADS.vert'), self.context.getResourcePath('shaders', 'ADS.frag')) self.proj = hm.perspective(hm.identity(), 35, float(self.windowWidth) / self.windowHeight, 1.0, 1000.0) self.view = hm.lookat( hm.identity(), np.array([0.0, 0.0, 0.0, 1.0], dtype=np.float32), np.array([0.0, 0.0, 1.0, 1.0], dtype=np.float32), np.array([0.0, -1.0, 0.0, 1.0], dtype=np.float32)) self.cameraMatrix = np.dot(self.proj, self.view) self.setCameraMatrix(self.cameraMatrix)
1, 1,-1, 1, 1, 1, 1, 0, #5 -1, 1,-1, 1, 0, 1, 1, 0, #6 1, 1, 1, 1, 1, 1, 0, 0, #7 -1, 1, 1, 1, 0, 1, 0, 0, #8 -1,-1, 1, 1, 0, 0, 0, 0, #9 -1, 1,-1, 1, 0, 1, 1, 0, #10 -1,-1,-1, 1, 0, 0, 1, 0, #11 1,-1,-1, 1, 1, 0, 1, 0, #12 -1,-1, 1, 1, 0, 0, 0, 0, #13 1,-1, 1, 1, 1, 0, 0, 0, #14 ], dtype = np.float32) campos = np.array([2.5, 1.5, 2.5, 1], dtype = np.float32) center = np.array([0.0,0.0,0.0,1.0], dtype = np.float32) modelview_mat = hm.lookat(hm.identity(), campos, center) perspective_mat = None mvp = None def resizeWindow(width, height): global mvp, modelview_mat, perspective_mat glViewport(0, 0, width, height) perspective_mat = hm.perspective(hm.identity(), 70, float(width) / height, 0.1, 10.0) mvp = np.dot(perspective_mat, modelview_mat) running = True # A light example for a key callback. def keypress(key, action): if key == GLFW_KEY_ESC: global running
0, #13 1, -1, 1, 1, 1, 0, 0, 0, #14 ], dtype=np.float32) campos = np.array([2.5, 1.5, 2.5, 1], dtype=np.float32) center = np.array([0.0, 0.0, 0.0, 1.0], dtype=np.float32) modelview_mat = hm.lookat(hm.identity(), campos, center) perspective_mat = None mvp = None def resizeWindow(width, height): global mvp, modelview_mat, perspective_mat glViewport(0, 0, width, height) perspective_mat = hm.perspective(hm.identity(), 70, float(width) / height, 0.1, 10.0) mvp = np.dot(perspective_mat, modelview_mat) running = True