Skip to content

Commit

Permalink
Fix vision & trajectory 3D rendering
Browse files Browse the repository at this point in the history
On some platforms (macOS only?), a vertex buffer would fill up and the lines would stop rendering. Seems to be fixed by explicitly requesting that the updated geometry is sent to the GPU.
  • Loading branch information
jwbonner committed Oct 7, 2023
1 parent 854da9d commit 69bcef0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/shared/visualizers/ThreeDimensionVisualizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1181,13 +1181,15 @@ export default class ThreeDimensionVisualizer implements Visualizer {
this.command.poses.visionTarget[i].translation[1],
this.command.poses.visionTarget[i].translation[2]
]);
this.visionTargets[i].geometry.attributes.position.needsUpdate = true;
}
}

// Update trajectories
{
while (this.trajectories.length > this.command.poses.trajectory.length) {
// Remove extra lines
this.trajectories[0].geometry.dispose();
this.trajectories[0].material.dispose();
this.wpilibFieldCoordinateGroup.remove(this.trajectories[0]);
this.trajectories.shift();
Expand All @@ -1213,6 +1215,7 @@ export default class ThreeDimensionVisualizer implements Visualizer {
positions = positions.concat(pose.translation);
});
this.trajectories[i].geometry.setPositions(positions);
this.trajectories[i].geometry.attributes.position.needsUpdate = true;
}
}
}
Expand Down

0 comments on commit 69bcef0

Please sign in to comment.