From 41ef6ca63ea954fdd835e95f0307014488915efe Mon Sep 17 00:00:00 2001 From: Christopher Crouzet Date: Mon, 13 Jan 2025 10:02:23 +1300 Subject: [PATCH] Fix duplicate meshes not being rendered --- warp/render/render_opengl.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/warp/render/render_opengl.py b/warp/render/render_opengl.py index 36d7e17dd..9a237a016 100644 --- a/warp/render/render_opengl.py +++ b/warp/render/render_opengl.py @@ -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. @@ -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,