def make_default_vertical_plusblock(self): pointops = PointList() for fordir in xrange(0, 4): temperlist = PointList() temperlist.append([ Point3D(0.5, 0.1, 0.5), Point3D(0.5, -0.1, 0.5), Point3D(0.5, -0.1, -0.5), Point3D(0.5, 0.1, -0.5) ]) temperlist.append([ Point3D(0.5, -0.1, -0.5), Point3D(0.1, -0.1, -0.5), Point3D(0.1, 0.1, -0.5), Point3D(0.5, 0.1, -0.5) ]) temperlist.append([ Point3D(0.5, 0.1, 0.5), Point3D(0.1, 0.1, 0.5), Point3D(0.1, -0.1, 0.5), Point3D(0.5, -0.1, 0.5) ]) temperlist.append([ Point3D(0.5, -0.1, -0.5), Point3D(0.5, -0.1, 0.5), Point3D(0.1, -0.1, 0.5), Point3D(0.1, -0.1, -0.5) ]) temperlist.append([ Point3D(0.1, 0.1, -0.5), Point3D(0.1, 0.1, 0.5), Point3D(0.5, 0.1, 0.5), Point3D(0.5, 0.1, -0.5) ]) temperlist.rotate_points_z(90 * fordir) pointops.extend(temperlist) pointops.append([ Point3D(-0.1, 0.1, -0.5), Point3D(0.1, 0.1, -0.5), Point3D(0.1, -0.1, -0.5), Point3D(-0.1, -0.1, -0.5) ]) pointops.append([ Point3D(-0.1, -0.1, 0.5), Point3D(0.1, -0.1, 0.5), Point3D(0.1, 0.1, 0.5), Point3D(-0.1, 0.1, 0.5) ]) return pointops
def make_default_vertical_plusblock(self): pointops = PointList() for fordir in xrange(0, 4): temperlist = PointList() temperlist.append([Point3D(0.5, 0.1, 0.5), Point3D(0.5, -0.1, 0.5), Point3D(0.5, -0.1, -0.5), Point3D(0.5, 0.1, -0.5)]) temperlist.append([Point3D(0.5, -0.1, -0.5), Point3D(0.1, -0.1, -0.5), Point3D(0.1, 0.1, -0.5), Point3D(0.5, 0.1, -0.5)]) temperlist.append([Point3D(0.5, 0.1, 0.5), Point3D(0.1, 0.1, 0.5), Point3D(0.1, -0.1, 0.5), Point3D(0.5, -0.1, 0.5)]) temperlist.append([Point3D(0.5, -0.1, -0.5), Point3D(0.5, -0.1, 0.5), Point3D(0.1, -0.1, 0.5), Point3D(0.1, -0.1, -0.5)]) temperlist.append([Point3D(0.1, 0.1, -0.5), Point3D(0.1, 0.1, 0.5), Point3D(0.5, 0.1, 0.5), Point3D(0.5, 0.1, -0.5)]) temperlist.rotate_points_z(90*fordir) pointops.extend(temperlist) pointops.append([Point3D(-0.1, 0.1, -0.5), Point3D(0.1, 0.1, -0.5), Point3D(0.1, -0.1, -0.5), Point3D(-0.1, -0.1, -0.5)]) pointops.append([Point3D(-0.1, -0.1, 0.5), Point3D(0.1, -0.1, 0.5), Point3D(0.1, 0.1, 0.5), Point3D(-0.1, 0.1, 0.5)]) return pointops
def makestairs(self, loneneighbors, mat): temporigin = [] tempfaces = [] if mat in self.colormaterials and 'interneighbor' in self.colormaterials[ mat] and self.colormaterials[mat]['interneighbor']: removeneibors = False else: removeneibors = True neighborstairs = {} for mat_index in [ 53, 67, 108, 109, 114, 128, 134, 135, 136, 156, 165, 164, 180 ]: if (mat_index, 0) in loneneighbors: neighborstairs.update(loneneighbors[(mat_index, 0)]) for block in loneneighbors[mat]: listoffaces = loneneighbors[mat][block]['faces'] somemeta = (loneneighbors[mat][block]['meta'] & 3) pointops = PointList() shapedone = False front = block[0] - 1, block[1], block[2] back = block[0] + 1, block[1], block[2] left = block[0], block[1] - 1, block[2] right = block[0], block[1] + 1, block[2] if not shapedone and front in neighborstairs and ( neighborstairs[front]['meta'] & 3) in [2, 3] and somemeta in [0, 1]: shape = self.isperpendicular( somemeta, (neighborstairs[front]['meta'] & 3)) shapedone = True if shape in [0, 3]: pointops = self.fromfileordefault( mat, 1, self.defshapes.make_default_pos_corner_stairs) else: pointops = self.fromfileordefault( mat, 2, self.defshapes.make_default_neg_corner_stairs) if (neighborstairs[front]['meta'] & 3) == 2: pointops.rotate_points_z(-90) if (neighborstairs[front]['meta'] & 3) == 3: pointops.mirror_points_y() if not shapedone and back in neighborstairs and ( neighborstairs[back]['meta'] & 3) in [2, 3] and somemeta in [0, 1]: shape = self.isperpendicular( somemeta, (neighborstairs[back]['meta'] & 3)) shapedone = True if shape in [0, 3]: pointops = self.fromfileordefault( mat, 2, self.defshapes.make_default_neg_corner_stairs) pointops.rotate_points_z(-90) else: pointops = self.fromfileordefault( mat, 1, self.defshapes.make_default_pos_corner_stairs) if (neighborstairs[back]['meta'] & 3) == 2: pointops.mirror_points_y() if not shapedone and left in neighborstairs and ( neighborstairs[left]['meta'] & 3) in [0, 1] and somemeta in [2, 3]: shape = self.isperpendicular( somemeta, (neighborstairs[left]['meta'] & 3)) shapedone = True if shape in [0, 3]: pointops = self.fromfileordefault( mat, 2, self.defshapes.make_default_neg_corner_stairs) if (neighborstairs[left]['meta'] & 3) == 0: pointops.mirror_points_y() else: pointops = self.fromfileordefault( mat, 1, self.defshapes.make_default_pos_corner_stairs) if (neighborstairs[left]['meta'] & 3) == 1: pointops.mirror_points_y() if not shapedone and right in neighborstairs and ( neighborstairs[right]['meta'] & 3) in [0, 1] and somemeta in [2, 3]: shape = self.isperpendicular( somemeta, (neighborstairs[right]['meta'] & 3)) shapedone = True if shape in [0, 3]: pointops = self.fromfileordefault( mat, 1, self.defshapes.make_default_pos_corner_stairs) if (neighborstairs[right]['meta'] & 3) == 0: pointops.mirror_points_y() else: pointops = self.fromfileordefault( mat, 2, self.defshapes.make_default_neg_corner_stairs) if (neighborstairs[right]['meta'] & 3) == 1: pointops.rotate_points_z(-90) if not shapedone: pointops = self.defshapes.make_default_normal_stairs() direction = loneneighbors[mat][block]['meta'] & 3 upsidedown = (loneneighbors[mat][block]['meta'] >> 2) & 1 if direction == 0: pointops.rotate_points_z(0) elif direction == 1: pointops.rotate_points_z(180) elif direction == 2: pointops.rotate_points_z(270) else: pointops.rotate_points_z(90) if upsidedown: pointops.mirror_points_z() if removeneibors: self.defshapes.remove_neibors(pointops, listoffaces) temporigin.append(pointops.get_avg_point().as_tuple()) self.appendto3dlist(pointops, block) tempfaces += pointops return tempfaces, self.getavgorigins(temporigin)
def makestairs(self, loneneighbors, mat): temporigin = [] tempfaces = [] if mat in self.colormaterials and 'interneighbor' in self.colormaterials[mat] and self.colormaterials[mat]['interneighbor']: removeneibors = False else: removeneibors = True neighborstairs = {} for mat_index in [53, 67, 108, 109, 114, 128, 134, 135, 136, 156, 165, 164, 180]: if (mat_index, 0) in loneneighbors: neighborstairs.update(loneneighbors[(mat_index, 0)]) for block in loneneighbors[mat]: listoffaces = loneneighbors[mat][block]['faces'] somemeta = (loneneighbors[mat][block]['meta'] & 3) pointops = PointList() shapedone = False front = block[0]-1, block[1], block[2] back = block[0]+1, block[1], block[2] left = block[0], block[1]-1, block[2] right = block[0], block[1]+1, block[2] if not shapedone and front in neighborstairs and (neighborstairs[front]['meta'] & 3) in [2, 3] and somemeta in [0, 1]: shape = self.isperpendicular(somemeta, (neighborstairs[front]['meta'] & 3)) shapedone = True if shape in [0, 3]: pointops = self.fromfileordefault(mat, 1, self.defshapes.make_default_pos_corner_stairs) else: pointops = self.fromfileordefault(mat, 2, self.defshapes.make_default_neg_corner_stairs) if (neighborstairs[front]['meta'] & 3) == 2: pointops.rotate_points_z(-90) if (neighborstairs[front]['meta'] & 3) == 3: pointops.mirror_points_y() if not shapedone and back in neighborstairs and (neighborstairs[back]['meta'] & 3) in [2, 3] and somemeta in [0, 1]: shape = self.isperpendicular(somemeta, (neighborstairs[back]['meta'] & 3)) shapedone = True if shape in [0, 3]: pointops = self.fromfileordefault(mat, 2, self.defshapes.make_default_neg_corner_stairs) pointops.rotate_points_z(-90) else: pointops = self.fromfileordefault(mat, 1, self.defshapes.make_default_pos_corner_stairs) if (neighborstairs[back]['meta'] & 3) == 2: pointops.mirror_points_y() if not shapedone and left in neighborstairs and (neighborstairs[left]['meta'] & 3) in [0, 1] and somemeta in [2, 3]: shape = self.isperpendicular(somemeta, (neighborstairs[left]['meta'] & 3)) shapedone = True if shape in [0, 3]: pointops = self.fromfileordefault(mat, 2, self.defshapes.make_default_neg_corner_stairs) if (neighborstairs[left]['meta'] & 3) == 0: pointops.mirror_points_y() else: pointops = self.fromfileordefault(mat, 1, self.defshapes.make_default_pos_corner_stairs) if (neighborstairs[left]['meta'] & 3) == 1: pointops.mirror_points_y() if not shapedone and right in neighborstairs and (neighborstairs[right]['meta'] & 3) in [0, 1] and somemeta in [2, 3]: shape = self.isperpendicular(somemeta, (neighborstairs[right]['meta'] & 3)) shapedone = True if shape in [0, 3]: pointops = self.fromfileordefault(mat, 1, self.defshapes.make_default_pos_corner_stairs) if (neighborstairs[right]['meta'] & 3) == 0: pointops.mirror_points_y() else: pointops = self.fromfileordefault(mat, 2, self.defshapes.make_default_neg_corner_stairs) if (neighborstairs[right]['meta'] & 3) == 1: pointops.rotate_points_z(-90) if not shapedone: pointops = self.defshapes.make_default_normal_stairs() direction = loneneighbors[mat][block]['meta'] & 3 upsidedown = (loneneighbors[mat][block]['meta'] >> 2) & 1 if direction == 0: pointops.rotate_points_z(0) elif direction == 1: pointops.rotate_points_z(180) elif direction == 2: pointops.rotate_points_z(270) else: pointops.rotate_points_z(90) if upsidedown: pointops.mirror_points_z() if removeneibors: self.defshapes.remove_neibors(pointops, listoffaces) temporigin.append(pointops.get_avg_point().as_tuple()) self.appendto3dlist(pointops, block) tempfaces += pointops return tempfaces, self.getavgorigins(temporigin)