def __init__(self, width, height): self.glCreateWindow(width, height) self.window_color = Color.black() self.draw_color = Color.white() self.glClear() self.light = self.vector(0, 0, 1) self.active_texture = None self.active_texture2 = None self.active_shader = None self.createViewMatrix() self.createProjectionMatrix()
def glViewPort(self, x, y, width, height): self.viewPort_x, self.viewPort_y = x, y self.viewPort_width = width if width < self.width else self.width self.viewPort_height = height if height < self.height else self.height self.viewPort = [[Color.black() for y in range(self.viewPort_height)] for x in range(self.viewPort_width)] self.glClear() self.viewportMatrix = [[ self.viewPort_width / 2, 0, 0, x + self.viewPort_width / 2 ], [0, self.viewPort_height / 2, 0, y + self.viewPort_height / 2], [0, 0, 0.5, 0.5], [0, 0, 0, 1]]
def __init__(self, width, height): self.window_color = Color.black() self.draw_color = Color.white() self.glCreateWindow(width, height) self.camPosition = self.vector(0, 0, 0) self.fov = 60 self.scene = [] self.pointLights = [] self.dirLight = None self.ambientLight = None self.envmap = None