Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -417,7 +417,7 @@ def build_textured_cube(pil_imgs, face_rotations=None):
|
|
| 417 |
# (-x,-y, z), ( x,-y, z), ( x, y, z), (-x, y, z)
|
| 418 |
quads = {
|
| 419 |
# top (+Z) : regarder depuis +Z (au-dessus)
|
| 420 |
-
"
|
| 421 |
(-half_x, -half_y, half_z),
|
| 422 |
( half_x, -half_y, half_z),
|
| 423 |
( half_x, half_y, half_z),
|
|
@@ -431,7 +431,7 @@ def build_textured_cube(pil_imgs, face_rotations=None):
|
|
| 431 |
( half_x, -half_y, half_z),
|
| 432 |
],
|
| 433 |
# bottom (-Z) : regarder depuis -Z (dessous)
|
| 434 |
-
"
|
| 435 |
(-half_x, half_y, -half_z),
|
| 436 |
( half_x, half_y, -half_z),
|
| 437 |
( half_x, -half_y, -half_z),
|
|
@@ -445,14 +445,14 @@ def build_textured_cube(pil_imgs, face_rotations=None):
|
|
| 445 |
(-half_x, -half_y, -half_z),
|
| 446 |
],
|
| 447 |
# front (+Y) : regarder depuis +Y (face avant)
|
| 448 |
-
"
|
| 449 |
(-half_x, half_y, -half_z),
|
| 450 |
(-half_x, half_y, half_z),
|
| 451 |
( half_x, half_y, half_z),
|
| 452 |
( half_x, half_y, -half_z),
|
| 453 |
],
|
| 454 |
# back (-Y) : regarder depuis -Y (face arrière)
|
| 455 |
-
"
|
| 456 |
( half_x, -half_y, -half_z),
|
| 457 |
( half_x, -half_y, half_z),
|
| 458 |
(-half_x, -half_y, half_z),
|
|
@@ -461,8 +461,8 @@ def build_textured_cube(pil_imgs, face_rotations=None):
|
|
| 461 |
}
|
| 462 |
|
| 463 |
# --- écrire l'OBJ (24 vertices, 24 vt, triangulé) selon face_order demandé ---
|
| 464 |
-
|
| 465 |
-
face_order = ["back", "left", "top", "front", "right", "bottom"]
|
| 466 |
obj_path = os.path.join(tmpdir, "parallelep.obj")
|
| 467 |
with open(obj_path, "w", encoding="utf-8") as f:
|
| 468 |
f.write("# Parallelepiped OBJ generated by build_textured_cube\n")
|
|
|
|
| 417 |
# (-x,-y, z), ( x,-y, z), ( x, y, z), (-x, y, z)
|
| 418 |
quads = {
|
| 419 |
# top (+Z) : regarder depuis +Z (au-dessus)
|
| 420 |
+
"front": [
|
| 421 |
(-half_x, -half_y, half_z),
|
| 422 |
( half_x, -half_y, half_z),
|
| 423 |
( half_x, half_y, half_z),
|
|
|
|
| 431 |
( half_x, -half_y, half_z),
|
| 432 |
],
|
| 433 |
# bottom (-Z) : regarder depuis -Z (dessous)
|
| 434 |
+
"back": [
|
| 435 |
(-half_x, half_y, -half_z),
|
| 436 |
( half_x, half_y, -half_z),
|
| 437 |
( half_x, -half_y, -half_z),
|
|
|
|
| 445 |
(-half_x, -half_y, -half_z),
|
| 446 |
],
|
| 447 |
# front (+Y) : regarder depuis +Y (face avant)
|
| 448 |
+
"top": [
|
| 449 |
(-half_x, half_y, -half_z),
|
| 450 |
(-half_x, half_y, half_z),
|
| 451 |
( half_x, half_y, half_z),
|
| 452 |
( half_x, half_y, -half_z),
|
| 453 |
],
|
| 454 |
# back (-Y) : regarder depuis -Y (face arrière)
|
| 455 |
+
"bottom": [
|
| 456 |
( half_x, -half_y, -half_z),
|
| 457 |
( half_x, -half_y, half_z),
|
| 458 |
(-half_x, -half_y, half_z),
|
|
|
|
| 461 |
}
|
| 462 |
|
| 463 |
# --- écrire l'OBJ (24 vertices, 24 vt, triangulé) selon face_order demandé ---
|
| 464 |
+
face_order = ["top", "right", "bottom", "left", "front", "back"]
|
| 465 |
+
# face_order = ["back", "left", "top", "front", "right", "bottom"]
|
| 466 |
obj_path = os.path.join(tmpdir, "parallelep.obj")
|
| 467 |
with open(obj_path, "w", encoding="utf-8") as f:
|
| 468 |
f.write("# Parallelepiped OBJ generated by build_textured_cube\n")
|