Пример #1
0
 def make_default_x_block(self):
     pointops = PointList()
     pointops.append([Point3D(0.5, 0.5, -0.5), Point3D(0.5, 0.5,
                                                       0.5), Point3D(-0.5, -0.5, 0.5), Point3D(-0.5, -0.5, -0.5)])
     pointops.append([Point3D(-0.5, 0.5, -0.5), Point3D(-0.5, 0.5,
                                                        0.5), Point3D(0.5, -0.5, 0.5), Point3D(0.5, -0.5, -0.5)])
     return pointops
Пример #2
0
    def makeverticalblock(self, loneneighbors, mat):
        temporigin = []
        tempfaces = []

        for block in loneneighbors[mat]:
            listoffaces = loneneighbors[mat][block]['faces']
            left = block[0]-1, block[1], block[2]
            right = block[0]+1, block[1], block[2]
            front = block[0], block[1]-1, block[2]
            back = block[0], block[1]+1, block[2]

            if mat in self.colormaterials and 'models' in self.colormaterials[mat]:
                pointlist = PointList()
                pointlist.from_tuple_list(self.colormaterials[mat]['models'][0])
                pointops = pointlist
            else:
                pointops = self.defshapes.make_default_flat_blocks()

            if front in loneneighbors[mat] or back in loneneighbors[mat]:
                pointops = self.fromfileordefault(mat, 0, self.defshapes.make_default_vertical_plusblock)
                pointops.rotate_points_z(90)
            elif left in loneneighbors[mat] or right in loneneighbors[mat]:
                pointops = self.fromfileordefault(mat, 0, self.defshapes.make_default_vertical_plusblock)
            elif left in loneneighbors[mat] and right in loneneighbors[mat] and front in loneneighbors[mat] and back in loneneighbors[mat]:
                pointops = self.fromfileordefault(mat, 0, self.defshapes.make_default_vertical_plusblock)
            else:
                pointops = self.fromfileordefault(mat, 0, self.defshapes.make_default_vertical_plusblock)

            self.defshapes.remove_neibors(pointops, listoffaces)
            self.appendto3dlist(pointops, block)
            temporigin.append(pointops.get_avg_point().as_tuple())
            tempfaces += pointops
        return tempfaces, self.getavgorigins(temporigin)
Пример #3
0
    def fromfileordefault(self, mat, index, defaultfunction):

        if mat in self.colormaterials and 'models' in self.colormaterials[mat] and index + 1 <= len(self.colormaterials[mat]['models']):
            pointlist = PointList()
            pointlist.from_tuple_list(self.colormaterials[mat]['models'][index])
            pointops = pointlist
        else:
            pointops = defaultfunction()
        return pointops
Пример #4
0
    def fromfileordefault(self, mat, index, defaultfunction):

        if mat in self.colormaterials and 'models' in self.colormaterials[
                mat] and index + 1 <= len(self.colormaterials[mat]['models']):
            pointlist = PointList()
            pointlist.from_tuple_list(
                self.colormaterials[mat]['models'][index])
            pointops = pointlist
        else:
            pointops = defaultfunction()
        return pointops
Пример #5
0
    def makeverticalblock(self, loneneighbors, mat):
        temporigin = []
        tempfaces = []

        for block in loneneighbors[mat]:
            listoffaces = loneneighbors[mat][block]['faces']
            left = block[0] - 1, block[1], block[2]
            right = block[0] + 1, block[1], block[2]
            front = block[0], block[1] - 1, block[2]
            back = block[0], block[1] + 1, block[2]

            if mat in self.colormaterials and 'models' in self.colormaterials[
                    mat]:
                pointlist = PointList()
                pointlist.from_tuple_list(
                    self.colormaterials[mat]['models'][0])
                pointops = pointlist
            else:
                pointops = self.defshapes.make_default_flat_blocks()

            if front in loneneighbors[mat] or back in loneneighbors[mat]:
                pointops = self.fromfileordefault(
                    mat, 0, self.defshapes.make_default_vertical_plusblock)
                pointops.rotate_points_z(90)
            elif left in loneneighbors[mat] or right in loneneighbors[mat]:
                pointops = self.fromfileordefault(
                    mat, 0, self.defshapes.make_default_vertical_plusblock)
            elif left in loneneighbors[mat] and right in loneneighbors[
                    mat] and front in loneneighbors[
                        mat] and back in loneneighbors[mat]:
                pointops = self.fromfileordefault(
                    mat, 0, self.defshapes.make_default_vertical_plusblock)
            else:
                pointops = self.fromfileordefault(
                    mat, 0, self.defshapes.make_default_vertical_plusblock)

            self.defshapes.remove_neibors(pointops, listoffaces)
            self.appendto3dlist(pointops, block)
            temporigin.append(pointops.get_avg_point().as_tuple())
            tempfaces += pointops
        return tempfaces, self.getavgorigins(temporigin)
Пример #6
0
 def make_default_x_block(self):
     pointops = PointList()
     pointops.append([
         Point3D(0.5, 0.5, -0.5),
         Point3D(0.5, 0.5, 0.5),
         Point3D(-0.5, -0.5, 0.5),
         Point3D(-0.5, -0.5, -0.5)
     ])
     pointops.append([
         Point3D(-0.5, 0.5, -0.5),
         Point3D(-0.5, 0.5, 0.5),
         Point3D(0.5, -0.5, 0.5),
         Point3D(0.5, -0.5, -0.5)
     ])
     return pointops
Пример #7
0
 def make_default_fence_shape(self):
     pointops = PointList()
     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)])
     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)])
     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
Пример #8
0
    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)
Пример #9
0
 def make_default_normal_stairs(self):
     pointops = PointList()
     pointops.append([
         Point3D(0.5, -0.5, -0.5),
         Point3D(-0.5, -0.5, -0.5),
         Point3D(-0.5, 0.5, -0.5),
         Point3D(0.5, 0.5, -0.5)
     ])
     pointops.append([
         Point3D(0, -0.5, 0.5),
         Point3D(0.5, -0.5, 0.5),
         Point3D(0.5, 0.5, 0.5),
         Point3D(0, 0.5, 0.5)
     ])
     pointops.append([
         Point3D(0, 0.5, 0),
         Point3D(-0.5, 0.5, 0),
         Point3D(-0.5, -0.5, 0),
         Point3D(0, -0.5, 0)
     ])
     pointops.append([
         Point3D(0, 0.5, 0),
         Point3D(0, -0.5, 0),
         Point3D(0, -0.5, 0.5),
         Point3D(0, 0.5, 0.5)
     ])
     pointops.append([
         Point3D(-0.5, 0.5, -0.5),
         Point3D(-0.5, -0.5, -0.5),
         Point3D(-0.5, -0.5, 0),
         Point3D(-0.5, 0.5, 0)
     ])
     pointops.append([
         Point3D(0.5, 0.5, 0.5),
         Point3D(0.5, -0.5, 0.5),
         Point3D(0.5, -0.5, -0.5),
         Point3D(0.5, 0.5, -0.5)
     ])
     pointops.append([
         Point3D(0, -0.5, 0.5),
         Point3D(0, -0.5, 0),
         Point3D(-0.5, -0.5, 0),
         Point3D(-0.5, -0.5, -0.5),
         Point3D(0.5, -0.5, -0.5),
         Point3D(0.5, -0.5, 0.5)
     ])
     pointops.append([
         Point3D(0.5, 0.5, 0.5),
         Point3D(0.5, 0.5, -0.5),
         Point3D(-0.5, 0.5, -0.5),
         Point3D(-0.5, 0.5, 0),
         Point3D(0, 0.5, 0),
         Point3D(0, 0.5, 0.5)
     ])
     return pointops
Пример #10
0
 def make_default_flat_block_shape(self):
     pointops = PointList()
     pointops.append([
         Point3D(0.4, 0.4, -0.5),
         Point3D(-0.4, 0.4, -0.5),
         Point3D(-0.4, -0.4, -0.5),
         Point3D(0.4, -0.4, -0.5)
     ])
     pointops.append([
         Point3D(0.4, 0.4, -0.4),
         Point3D(-0.4, 0.4, -0.4),
         Point3D(-0.4, -0.4, -0.4),
         Point3D(0.4, -0.4, -0.4)
     ])
     pointops.append([
         Point3D(-0.4, -0.4, -0.5),
         Point3D(-0.4, -0.4, -0.4),
         Point3D(0.4, -0.4, -0.4),
         Point3D(0.4, -0.4, -0.5)
     ])
     pointops.append([
         Point3D(-0.4, 0.4, -0.5),
         Point3D(-0.4, 0.4, -0.4),
         Point3D(0.4, 0.4, -0.4),
         Point3D(0.4, 0.4, -0.5)
     ])
     pointops.append([
         Point3D(-0.4, -0.4, -0.5),
         Point3D(-0.4, 0.4, -0.5),
         Point3D(-0.4, 0.4, -0.4),
         Point3D(-0.4, -0.4, -0.4)
     ])
     pointops.append([
         Point3D(0.4, -0.4, -0.5),
         Point3D(0.4, 0.4, -0.5),
         Point3D(0.4, 0.4, -0.4),
         Point3D(0.4, -0.4, -0.4)
     ])
     return pointops
Пример #11
0
 def make_default_ladder_shapes(self):
     pointops = PointList()
     pointops.append([Point3D(0.5, -0.5, -0.5), Point3D(-0.5, -0.5, -0.5), Point3D(-0.5, -0.4, -0.5), Point3D(0.5, -0.4, -0.5)])
     pointops.append([Point3D(0.5, -0.4, 0.5), Point3D(-0.5, -0.4, 0.5), Point3D(-0.5, -0.5, 0.5), Point3D(0.5, -0.5, 0.5)])
     pointops.append([Point3D(-0.5, -0.4, -0.5), Point3D(-0.5, -0.4, 0.5), Point3D(0.5, -0.4, 0.5), Point3D(0.5, -0.4, -0.5)])
     pointops.append([Point3D(0.5, -0.5, -0.5), Point3D(0.5, -0.5, 0.5), Point3D(-0.5, -0.5, 0.5), Point3D(-0.5, -0.5, -0.5)])
     pointops.append([Point3D(-0.5, -0.5, 0.5), Point3D(-0.5, -0.4, 0.5), Point3D(-0.5, -0.4, -0.5), Point3D(-0.5, -0.5, -0.5)])
     pointops.append([Point3D(0.5, -0.5, -0.5), Point3D(0.5, -0.4, -0.5), Point3D(0.5, -0.4, 0.5), Point3D(0.5, -0.5, 0.5)])
     return pointops
Пример #12
0
    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
Пример #13
0
 def make_default_ladder_shapes(self):
     pointops = PointList()
     pointops.append([
         Point3D(0.5, -0.5, -0.5),
         Point3D(-0.5, -0.5, -0.5),
         Point3D(-0.5, -0.4, -0.5),
         Point3D(0.5, -0.4, -0.5)
     ])
     pointops.append([
         Point3D(0.5, -0.4, 0.5),
         Point3D(-0.5, -0.4, 0.5),
         Point3D(-0.5, -0.5, 0.5),
         Point3D(0.5, -0.5, 0.5)
     ])
     pointops.append([
         Point3D(-0.5, -0.4, -0.5),
         Point3D(-0.5, -0.4, 0.5),
         Point3D(0.5, -0.4, 0.5),
         Point3D(0.5, -0.4, -0.5)
     ])
     pointops.append([
         Point3D(0.5, -0.5, -0.5),
         Point3D(0.5, -0.5, 0.5),
         Point3D(-0.5, -0.5, 0.5),
         Point3D(-0.5, -0.5, -0.5)
     ])
     pointops.append([
         Point3D(-0.5, -0.5, 0.5),
         Point3D(-0.5, -0.4, 0.5),
         Point3D(-0.5, -0.4, -0.5),
         Point3D(-0.5, -0.5, -0.5)
     ])
     pointops.append([
         Point3D(0.5, -0.5, -0.5),
         Point3D(0.5, -0.4, -0.5),
         Point3D(0.5, -0.4, 0.5),
         Point3D(0.5, -0.5, 0.5)
     ])
     return pointops
Пример #14
0
 def make_default_fence_shape(self):
     pointops = PointList()
     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)
     ])
     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)
     ])
     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
Пример #15
0
    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
Пример #16
0
    def make_default_neg_corner_stairs(self):
        pointops = PointList()
        pointops.append([Point3D(0.5, -0.5, -0.5), Point3D(-0.5, -0.5, -0.5),
                         Point3D(-0.5, 0.5, -0.5), Point3D(0.5, 0.5, -0.5)])

        pointops.append([Point3D(0, -0.5, 0.5), Point3D(0, -0.5, 0), Point3D(-0.5, -0.5, 0), Point3D(-0.5, -0.5, -0.5), Point3D(0.5, -0.5, -0.5), Point3D(0.5, -0.5, 0.5)])
        pointops.append([Point3D(-0.5, 0.5, 0.5), Point3D(-0.5, 0.5, -0.5), Point3D(-0.5, -0.5, -0.5), Point3D(-0.5, -0.5, 0), Point3D(-0.5, 0, 0), Point3D(-0.5, 0, 0.5)])
        pointops.append([Point3D(0, -0.5, 0.5), Point3D(0.5, -0.5, 0.5), Point3D(0.5, 0.5, 0.5), Point3D(-0.5, 0.5, 0.5), Point3D(-0.5, 0, 0.5), Point3D(0, 0, 0.5)])
        pointops.append([Point3D(0, -0.5, 0.5), Point3D(0, 0, 0.5), Point3D(0, 0, 0), Point3D(0, -0.5, 0)])
        pointops.append([Point3D(-0.5, 0, 0), Point3D(0, 0, 0), Point3D(0, 0, 0.5), Point3D(-0.5, 0, 0.5)])
        pointops.append([Point3D(-0.5, -0.5, 0), Point3D(0, -0.5, 0), Point3D(0, 0, 0), Point3D(-0.5, 0, 0)])
        pointops.append([Point3D(0.5, -0.5, -0.5), Point3D(0.5, 0.5, -0.5), Point3D(0.5, 0.5, 0.5), Point3D(0.5, -0.5, 0.5)])
        pointops.append([Point3D(-0.5, 0.5, 0.5), Point3D(0.5, 0.5, 0.5), Point3D(0.5, 0.5, -0.5), Point3D(-0.5, 0.5, -0.5)])

        return pointops
Пример #17
0
 def make_default_flat_block_shape(self):
     pointops = PointList()
     pointops.append([Point3D(0.4, 0.4, -0.5), Point3D(-0.4, 0.4, -0.5), Point3D(-0.4, -0.4, -0.5), Point3D(0.4, -0.4, -0.5)])
     pointops.append([Point3D(0.4, 0.4, -0.4), Point3D(-0.4, 0.4, -0.4), Point3D(-0.4, -0.4, -0.4), Point3D(0.4, -0.4, -0.4)])
     pointops.append([Point3D(-0.4, -0.4, -0.5), Point3D(-0.4, -0.4, -0.4), Point3D(0.4, -0.4, -0.4), Point3D(0.4, -0.4, -0.5)])
     pointops.append([Point3D(-0.4, 0.4, -0.5), Point3D(-0.4, 0.4, -0.4), Point3D(0.4, 0.4, -0.4), Point3D(0.4, 0.4, -0.5)])
     pointops.append([Point3D(-0.4, -0.4, -0.5), Point3D(-0.4, 0.4, -0.5), Point3D(-0.4, 0.4, -0.4), Point3D(-0.4, -0.4, -0.4)])
     pointops.append([Point3D(0.4, -0.4, -0.5), Point3D(0.4, 0.4, -0.5), Point3D(0.4, 0.4, -0.4), Point3D(0.4, -0.4, -0.4)])
     return pointops
Пример #18
0
    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)