diff --git a/src/camera_view.cpp b/src/camera_view.cpp index db19d11b..bbbdab0e 100644 --- a/src/camera_view.cpp +++ b/src/camera_view.cpp @@ -274,7 +274,10 @@ void CameraView::fillCameraWidgetGeometry(render::ShaderProgram* nodeProgram, re addPolygon({triangleTop, triangleRight, triangleLeft}); pickFrameProgram->setAttribute("a_vertexPositions", positions); - // pickFrameProgram->setAttribute("a_vertexNormals", normals); // unused + if (pickFrameProgram->hasAttribute("a_vertexNormals")) { + // // this is not actually used, but it only gets optimized out on some platforms, not all + pickFrameProgram->setAttribute("a_vertexNormals", normals); + } pickFrameProgram->setAttribute("a_barycoord", bcoord); size_t nFaces = 7; diff --git a/test/src/camera_view_test.cpp b/test/src/camera_view_test.cpp index 2b81bc10..a1dee683 100644 --- a/test/src/camera_view_test.cpp +++ b/test/src/camera_view_test.cpp @@ -66,6 +66,21 @@ TEST_F(PolyscopeTest, CameraViewUpdate) { polyscope::removeAllStructures(); } +TEST_F(PolyscopeTest, CameraViewPick) { + + polyscope::CameraView* cam1 = polyscope::registerCameraView( + "cam1", polyscope::CameraParameters(polyscope::CameraIntrinsics::fromFoVDegVerticalAndAspect(60, 2.), + polyscope::CameraExtrinsics::fromVectors( + glm::vec3{2., 2., 2.}, glm::vec3{-1., -1., -1.}, glm::vec3{0., 1., 0.}))); + + // This probably doesn't actually click on anything, but it does populate the pick buffers and makes sure that nothing crashes + polyscope::pick::pickAtScreenCoords(glm::vec2{0.3, 0.8}); + + polyscope::show(3); + + polyscope::removeAllStructures(); +} + TEST_F(PolyscopeTest, AddCameraViewColorImage) { polyscope::CameraView* cam1 = polyscope::registerCameraView(