示例#1
0
        glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, vIndices)

slots = []

def matToList(m):
	m = m.transposed()
	return [m.a,m.b,m.c,m.d, m.e,m.f,m.g,m.h,
		m.i,m.j,m.k,m.l, m.m,m.n,m.o,m.p]

translation = Vector3()

zstamp = time.time()

invrots = [Matrix4.new_identity(),
                  Matrix4.new_rotatex(pi/2),
                  Matrix4.new_rotatex(-pi/2),
                  Matrix4.new_rotatey(pi/2),
                  Matrix4.new_rotatey(-pi/2),
                  Matrix4.new_rotatez(pi/2),
                  Matrix4.new_rotatex(pi)]

def add_flat_tri(p, vertices, normals, indices):
        n = (p[1]-p[0]).cross(p[2]-p[0]).normalize()
        for i in range(3):
                vertices += array('f',[p[i].x, p[i].y, p[i].z])
                normals += array('f',[n.x, n.y, n.z])
        next = len(indices)
        indices += array('H',[next, next+1, next+2])

def create_invader_element():