def draw_line(self, bgn, end): x1, x2 = int(bgn.x), int(end.x) y1, y2 = int(bgn.y), int(end.y) dx = int(x2 - x1) dy = int(y2 - y1) stepx = 1 stepy = 1 if dx >= 0: stepx = 1 else: stepx = -1 dx = abs(dx) if dy >= 0: stepy = 1 else: stepy = -1 dy = abs(dy) deltax = 2 * dx deltay = 2 * dy if dx > dy: error = deltay - dx for i in xrange(dx): if x1 >=0 and x1 < self.device.width and y1 >= 0 and y1 < self.device.height: self.device.draw_pixel(x1, y1, Color.black()) if error >= 0: error -= deltax y1 += stepy error += deltay x1 += stepx else: error = deltax - dy for i in xrange(dy): if x1 >= 0 and x1 < self.device.width and y1 >= 0 and y1 < self.device.height: self.device.draw_pixel(x1, y1, Color.black()) if error >= 0: error -= deltay x1 += stepx error += deltax y1 += stepy return
def __init__(self, pos=Vector4(), color=Color.black(), tex=Vector2(), normal=Vector4()): self.pos = pos self.color = color self.tex = tex self.normal = normal return
def __init__(self, pos_world=Vector4(), pos_proj=Vector4(), tex=Vector2(), normal=Vector4(), color=Color.black(), oneDivZ=0): self.pos_world = pos_world self.pos_proj = pos_proj self.tex = tex self.normal = normal self.color = color self.oneDivZ = oneDivZ return
def clear(self): self.setrangecolor(0, cfg.LED_COUNT, Color.black())