Ejemplo n.º 1
0
    def create(radius, diffuse = (1,1,1,1)):
        """ Creates a sphere of given radius. Origin at the center of the sphere.
        """

        v = [[c * radius for c in vertex] for vertex in Sphere.vertices]
        mesh = Mesh(v, Sphere.faces, Sphere.normals, diffuse)


        mesh.aabb = ((2*radius, 2*radius, 2*radius), (-2*radius, -2*radius, -2*radius))

        return mesh
Ejemplo n.º 2
0
    def create(radius, diffuse=(1, 1, 1, 1)):
        """ Creates a sphere of given radius. Origin at the center of the sphere.
        """

        v = [[c * radius for c in vertex] for vertex in Sphere.vertices]
        mesh = Mesh(v, Sphere.faces, Sphere.normals, diffuse)

        mesh.aabb = ((2 * radius, 2 * radius, 2 * radius),
                     (-2 * radius, -2 * radius, -2 * radius))

        return mesh
Ejemplo n.º 3
0
    def create(sizex, sizey, sizez, diffuse = (1,1,1,1)):
        """ Creates a box, centered around the origin.

        To create a cube, set sizex=sizey=sizez.
        """

        sizex = float(sizex)/2
        sizey = float(sizey)/2
        sizez = float(sizez)/2

        v = [[vertex[0] * sizex, vertex[1] * sizey, vertex[2] * sizez] for vertex in Box.vertices]
        mesh = Mesh(v, Box.faces, Box.normals, diffuse)


        mesh.aabb = ((sizex, sizey, sizez), (-sizex, -sizey, -sizez))

        return mesh
Ejemplo n.º 4
0
    def create(sizex, sizey, sizez, diffuse=(1, 1, 1, 1)):
        """ Creates a box, centered around the origin.

        To create a cube, set sizex=sizey=sizez.
        """

        sizex = float(sizex) / 2
        sizey = float(sizey) / 2
        sizez = float(sizez) / 2

        v = [[vertex[0] * sizex, vertex[1] * sizey, vertex[2] * sizez]
             for vertex in Box.vertices]
        mesh = Mesh(v, Box.faces, Box.normals, diffuse)

        mesh.aabb = ((sizex, sizey, sizez), (-sizex, -sizey, -sizez))

        return mesh