def create_vertices(nb_points, space_between_points, x_base, y_base, _noise, distance): dist = distance / (nb_points - 1) coeff = dist * space_between_points vertices = [] for i in xrange(0, nb_points): x = i * coeff + x_base for j in xrange(0, nb_points): y = j * coeff + y_base add_vertex(vertices, (x, int(_noise.get_vector_from_final_values(int(i), int(j))), y)) return vertices
def render_face_array(faces, vtx_offset): vn = [] ll = [] for f in faces: idx = add_vertex(vn, f.get_normal()) ll.append("f ") for index in f.indices: ll.append(str(index + 1 + vtx_offset)) ll.append("//") ll.append(str(idx + 1 + vtx_offset)) ll.append(" ") ll.append("\n") return "".join(ll), vn