1
- # pylint: disable=invalid-name, missing-docstring, no-member, too-many-lines, c-extension-no-member, bare-except, not-callable
1
+ # pylint: disable=invalid-name, missing-docstring, no-member, too-many-lines, c-extension-no-member, bare-except, not-callable, no-value-for-parameter, unused-argument
2
2
3
3
from typing import Sequence
4
4
import os
@@ -94,6 +94,8 @@ def simplify_skipped_layers(cg, fragment, fragment_id, fragment_parent_id):
94
94
while layer < parent_layer :
95
95
fragment = simplify (cg , fragment , fragment_id , lod = layer )
96
96
layer += 1
97
+ fragment ["vertices" ] = fragment ["vertices" ].reshape (- 1 , 3 )
98
+ fragment ["faces" ] = fragment ["faces" ].reshape (- 1 , 3 )
97
99
return fragment
98
100
99
101
@@ -257,7 +259,6 @@ def _lower_remaps(ks):
257
259
lower_remaps = {}
258
260
if cg .get_chunk_layer (chunk_id ) > 2 :
259
261
for lower_chunk_id in cg .get_chunk_child_ids (chunk_id ):
260
- # TODO speedup
261
262
lower_remaps .update (
262
263
get_higher_to_lower_remapping (cg , lower_chunk_id , time_stamp = time_stamp )
263
264
)
@@ -749,7 +750,13 @@ def transform_draco_fragment_and_return_encoding_options(
749
750
750
751
751
752
def merge_draco_meshes_across_boundaries (
752
- cg , fragments , chunk_id , mip , high_padding , return_zmesh_object = False
753
+ cg ,
754
+ new_fragment_id ,
755
+ fragments ,
756
+ chunk_id ,
757
+ mip ,
758
+ high_padding ,
759
+ return_zmesh_object = False ,
753
760
):
754
761
"""
755
762
Merge a list of draco mesh fragments, removing duplicate vertices that lie
@@ -758,6 +765,13 @@ def merge_draco_meshes_across_boundaries(
758
765
759
766
# repeat simplify here?
760
767
768
+ for fragment in fragments :
769
+ frag = fragment ["mesh" ]
770
+ fragment_id = fragment ["node_id" ]
771
+ fragment ["mesh" ] = simplify_skipped_layers (
772
+ cg , frag , fragment_id , new_fragment_id
773
+ )
774
+
761
775
vertexct = np .zeros (len (fragments ) + 1 , np .uint32 )
762
776
vertexct [1 :] = np .cumsum ([x ["mesh" ]["num_vertices" ] for x in fragments ])
763
777
vertices = np .concatenate ([x ["mesh" ]["vertices" ] for x in fragments ])
@@ -1091,11 +1105,11 @@ def chunk_initial_mesh_task(
1091
1105
stotal_faces = int (np .sum (og_mesh_faces ))
1092
1106
stotal_vertices = int (np .sum (og_mesh_vertices ))
1093
1107
1094
- # redis = get_redis_connection()
1095
- # redis.sadd(f"{cg.graph_id}/faces/2", total_faces)
1096
- # redis.sadd(f"{cg.graph_id}/vertices/2", total_vertices)
1097
- # redis.sadd(f"{cg.graph_id}/og_faces/2", stotal_faces)
1098
- # redis.sadd(f"{cg.graph_id}/og_vertices/2", stotal_vertices)
1108
+ redis = get_redis_connection ()
1109
+ redis .sadd (f"{ cg .graph_id } /faces/2" , total_faces )
1110
+ redis .sadd (f"{ cg .graph_id } /vertices/2" , total_vertices )
1111
+ redis .sadd (f"{ cg .graph_id } /og_faces/2" , stotal_faces )
1112
+ redis .sadd (f"{ cg .graph_id } /og_vertices/2" , stotal_vertices )
1099
1113
1100
1114
if sharded and WRITING_TO_CLOUD :
1101
1115
shard_binary = sharding_spec .synthesize_shard (merged_meshes )
@@ -1279,7 +1293,7 @@ def chunk_stitch_remeshing_task(
1279
1293
)
1280
1294
1281
1295
new_fragment = merge_draco_meshes_across_boundaries (
1282
- cg , old_fragments , chunk_id , mip , high_padding
1296
+ cg , new_fragment_id , old_fragments , chunk_id , mip , high_padding
1283
1297
)
1284
1298
new_fragment = simplify (cg , new_fragment , new_fragment_id )
1285
1299
@@ -1403,7 +1417,7 @@ def chunk_initial_sharded_stitching_task(
1403
1417
)
1404
1418
1405
1419
new_fragment = merge_draco_meshes_across_boundaries (
1406
- cg , old_fragments , chunk_id , mip , high_padding
1420
+ cg , new_fragment_id , old_fragments , chunk_id , mip , high_padding
1407
1421
)
1408
1422
1409
1423
new_fragment = simplify (cg , new_fragment , new_fragment_id )
@@ -1432,9 +1446,9 @@ def chunk_initial_sharded_stitching_task(
1432
1446
total_faces = int (np .sum (mesh_faces ))
1433
1447
total_vertices = int (np .sum (mesh_vertices ))
1434
1448
1435
- # redis = get_redis_connection()
1436
- # redis.sadd(f"{cg.graph_id}/faces/{layer}", total_faces)
1437
- # redis.sadd(f"{cg.graph_id}/vertices/{layer}", total_vertices)
1449
+ redis = get_redis_connection ()
1450
+ redis .sadd (f"{ cg .graph_id } /faces/{ layer } " , total_faces )
1451
+ redis .sadd (f"{ cg .graph_id } /vertices/{ layer } " , total_vertices )
1438
1452
1439
1453
del mesh_dict
1440
1454
shard_binary = sharding_spec .synthesize_shard (merged_meshes )
0 commit comments