def enable(self): if self.gl_light is not None: x, y, z = self.transform.position gl_position = (x, y, -z, int(not self.directional)) OpenGLRenderer.enablelight(self.gl_light, self.ambient, self.diffuse, self.specular, self.spot_direction, gl_position)
def _renderloop(self): OpenGLRenderer.clearscreen() if GameObject._camera: GameObject._camera.push() for light in GameObject._lights: light.enable() map(GameObject.render, GameObject._gameobjects) if GameObject._camera: GameObject._camera.pop() OpenGLRenderer.flip()
def mainloop(self, fps=60): """ Starts the mainloop of the game """ OpenGLRenderer.init(self.screen_size, self.fullscreen) OpenGLRenderer.set_window_title(self.title) OpenGLRenderer.set_window_icon(self.icon) try: self._mainloop(fps) finally: OpenGLRenderer.quit()
def __init__(self, ambient=(0, 0, 0, 1), diffuse=(1, 1, 1, 1), specular=(1, 1, 1, 1), spot_direction=(0, 0, 1)): Component.__init__(self) self.gl_light = OpenGLRenderer.getnextlight() self.ambient = ambient self.diffuse = diffuse self.specular = specular self.spot_direction = spot_direction + (0,) self.directional = False
def __init__(self, ambient=(0, 0, 0, 1), diffuse=(1, 1, 1, 1), specular=(1, 1, 1, 1), spot_direction=(0, 0, 1)): Component.__init__(self) self.gl_light = OpenGLRenderer.getnextlight() self.ambient = ambient self.diffuse = diffuse self.specular = specular self.spot_direction = spot_direction + (0, ) self.directional = False
def render(self): OpenGLRenderer.render(self)
def disable(self): if self.gl_light is not None: OpenGLRenderer.disable(self.gl_light)