Exemplo n.º 1
0
def createPlane(axis, x, y, texture):
    vertices = None

    # Defining the location and colors of each vertex  of the shape
    if axis == "z":
        vertices = [
            #    positions        colors
            0.0, 0.0, 0.0, 0.0, 1.0,
            x, 0.0, 0.0, 1.0, 1.0,
            x, y, 0.0, 1.0, 0.0,
            0.0, y, 0.0, 0.0, 0.0]

    elif axis == "x":
        vertices = [
            #    positions        colors
            0.0, 0.0, 0.0, 0.0, 1.0,
            0.0, 0.0, y, 0.0, 0.0,
            x, 0, y, 1.0, 0.0,
            x, 0, 0, 1.0, 1.0]

    elif axis == "y":
        vertices = [
            #    positions        colors
            0.0, 0.0, 0.0, 0.0, 1.0,
            0.0, x, 0.0, 1.0, 1.0,
            0.0, x, y, 1.0, 0.0,
            0.0, 0.0, y, 0.0, 0.0]

    # Defining connections among vertices
    # We have a triangle every 3 indices specified
    indices = [
        0, 1, 2,
        2, 3, 0]

    return bs.Shape(vertices, indices, texture)
Exemplo n.º 2
0
def createHeartQuad():

    # Defining locations and colors for each vertex of the shape
    vertices = [
    #   positions        colors
        0.0, 0.0, 0.0, 0.0, 1.0,
        1.0, 0.0, 0.0, 1.0, 1.0,
        1.0, 1.0, 0.0, 1.0, 0.0,
        0.0, 1.0, 0.0, 0.0, 0.0]

    # Defining connections among vertices
    # We have a triangle every 3 indices specified
    indices = [
         0, 1, 2,
         2, 3, 0]

    return bs.Shape(vertices, indices, "texture/heart.png")
Exemplo n.º 3
0
    def hitboxShape(self, texture):
        # Defining the location and texture coordinates of each vertex  of the shape
        vertices = [
            # Z+
            0.0,
            0.0,
            self.height,
            0.0,
            1.0,
            self.width,
            0.0,
            self.height,
            1.0,
            1.0,
            self.width,
            self.depth * 0.5,
            self.height,
            1.0,
            0.0,
            0.0,
            self.depth * 0.5,
            self.height,
            0.0,
            0.0,

            # Z-
            0.0,
            0.0,
            0.0,
            0.0,
            1.0,
            self.width,
            0.0,
            0.0,
            1.0,
            1.0,
            self.width,
            self.depth * 0.5,
            0.0,
            1.0,
            0.0,
            0.0,
            self.depth * 0.5,
            0.0,
            0.0,
            0.0,

            # X+
            self.width,
            0.0,
            0.0,
            0.0,
            1.0,
            self.width,
            self.depth * 0.5,
            0.0,
            1.0,
            1.0,
            self.width,
            self.depth * 0.5,
            self.height,
            1.0,
            0.0,
            self.width,
            0.0,
            self.height,
            0.0,
            0.0,

            # X-
            0.0,
            0.0,
            0.0,
            0.0,
            1.0,
            0.0,
            self.depth * 0.5,
            0.0,
            1.0,
            1.0,
            0.0,
            self.depth * 0.5,
            self.height,
            1.0,
            0.0,
            0.0,
            0.0,
            self.height,
            0.0,
            0.0,

            # Y+
            0.0,
            self.depth * 0.5,
            0.0,
            0.0,
            1.0,
            self.width,
            self.depth * 0.5,
            0.0,
            1.0,
            1.0,
            self.width,
            self.depth * 0.5,
            self.height,
            1.0,
            0.0,
            0.0,
            self.depth * 0.5,
            self.height,
            0.0,
            0.0,

            # Y-
            0.0,
            0.0,
            0.0,
            0.0,
            1.0,
            self.width,
            0.0,
            0.0,
            1.0,
            1.0,
            self.width,
            0.0,
            self.height,
            1.0,
            0.0,
            0.0,
            0.0,
            self.height,
            0.0,
            0.0,
            self.width * 0.5,
            self.depth * 1.5,
            self.height * 0.5,
            1.0,
            1.0  # Y+ Bullet point
        ]

        # Defining connections among vertices
        # We have a triangle every 3 indices specified
        indices = [
            0,
            1,
            2,
            2,
            3,
            0,  # Z+
            7,
            6,
            5,
            5,
            4,
            7,  # Z-
            8,
            9,
            10,
            10,
            11,
            8,  # X+
            15,
            14,
            13,
            13,
            12,
            15,  # X-
            19,
            18,
            24,
            18,
            17,
            24,  # Y+ Bullet point
            17,
            16,
            24,
            16,
            19,
            24,  # Y+ Bullet point
            20,
            21,
            22,
            22,
            23,
            20
        ]  # Y-

        return bs.Shape(vertices, indices, texture)