Browse Source

format with black

main
Alex Nichol 2 years ago
parent
commit
5fad78ad78
  1. 8
      shap_e/rendering/mesh.py

8
shap_e/rendering/mesh.py

@ -89,17 +89,13 @@ class TriMesh:
def write_obj(self, raw_f: BinaryIO): def write_obj(self, raw_f: BinaryIO):
if self.has_vertex_colors(): if self.has_vertex_colors():
vertex_colors = np.stack([self.vertex_channels[x] vertex_colors = np.stack([self.vertex_channels[x] for x in "RGB"], axis=1)
for x in "RGB"], axis=1)
vertices = [ vertices = [
"{} {} {} {} {} {}".format(*coord, *color) "{} {} {} {} {} {}".format(*coord, *color)
for coord, color in zip(self.verts.tolist(), vertex_colors.tolist()) for coord, color in zip(self.verts.tolist(), vertex_colors.tolist())
] ]
else: else:
vertices = [ vertices = ["{} {} {}".format(*coord) for coord in self.verts.tolist()]
"{} {} {}".format(*coord)
for coord in self.verts.tolist()
]
faces = [ faces = [
"f {} {} {}".format(str(tri[0] + 1), str(tri[1] + 1), str(tri[2] + 1)) "f {} {} {}".format(str(tri[0] + 1), str(tri[1] + 1), str(tri[2] + 1))

Loading…
Cancel
Save