Skip to content

Commit

Permalink
Fix duplicate meshes not being rendered
Browse files Browse the repository at this point in the history
  • Loading branch information
christophercrouzet committed Jan 15, 2025
1 parent 9235c1e commit 41ef6ca
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion warp/render/render_opengl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2989,7 +2989,7 @@ def render_mesh(
indices = np.array(indices, dtype=np.int32).reshape((-1, 3))
idx_count = len(indices)

geo_hash = hash((indices.tobytes(),))
geo_hash = hash((points.tobytes(), indices.tobytes()))

if name in self._instances:
# We've already registered this mesh instance and its associated shape.
Expand All @@ -3011,6 +3011,12 @@ def render_mesh(
if shape is not None:
# Update the shape's point positions.
self.update_shape_vertices(shape, points, scale)

if not is_template and name not in self._instances:
# Create a new instance.
body = self._resolve_body_id(parent_body)
self.add_shape_instance(name, shape, body, pos, rot, color1=colors)

return shape

# No existing shape for the given mesh was found, or its topology may have changed,
Expand Down

0 comments on commit 41ef6ca

Please sign in to comment.