@@ -235,6 +235,10 @@ TEST_F(PolyscopeTest, VolumeMeshCellVector) {
235235}
236236
237237TEST_F (PolyscopeTest, VolumeMeshInspect) {
238+
239+ // in another test below we repeat the same logic, but with a second mesh present
240+ // to ensure the volume mesh lookup logic in the slice plane works right
241+
238242 std::vector<glm::vec3> verts;
239243 std::vector<std::array<int , 8 >> cells;
240244 std::tie (verts, cells) = getVolumeMeshData ();
@@ -256,7 +260,45 @@ TEST_F(PolyscopeTest, VolumeMeshInspect) {
256260 q1Cat->setEnabled (true );
257261 polyscope::show (3 );
258262
259- polyscope::removeAllStructures ();
263+ // clear it out
264+ p->setVolumeMeshToInspect (" vol" );
265+ polyscope::show (3 );
260266
267+ polyscope::removeAllStructures ();
261268 polyscope::removeLastSceneSlicePlane ();
262269}
270+
271+ TEST_F (PolyscopeTest, VolumeMeshInspectWithExtra) {
272+
273+ // same as above, but with an additional mesh present
274+ // to ensure the volume mesh lookup logic in the slice plane works right
275+
276+ std::vector<glm::vec3> verts;
277+ std::vector<std::array<int , 8 >> cells;
278+ std::tie (verts, cells) = getVolumeMeshData ();
279+ polyscope::VolumeMesh* psVol = polyscope::registerVolumeMesh (" vol" , verts, cells);
280+ polyscope::VolumeMesh* psVolExtra = polyscope::registerVolumeMesh (" vol extra" , verts, cells);
281+
282+ // plain old inspecting
283+ polyscope::SlicePlane* p = polyscope::addSceneSlicePlane ();
284+ p->setVolumeMeshToInspect (" vol" );
285+ polyscope::show (3 );
286+
287+ // with a scalar quantity
288+ std::vector<float > vals (verts.size (), 0.44 );
289+ auto q1 = psVol->addVertexScalarQuantity (" vals" , vals);
290+ q1->setEnabled (true );
291+ polyscope::show (3 );
292+
293+ // with a categorical quantity
294+ auto q1Cat = psVol->addVertexScalarQuantity (" vals" , vals, polyscope::DataType::CATEGORICAL);
295+ q1Cat->setEnabled (true );
296+ polyscope::show (3 );
297+
298+ // clear it out
299+ p->setVolumeMeshToInspect (" vol" );
300+ polyscope::show (3 );
301+
302+ polyscope::removeAllStructures ();
303+ polyscope::removeLastSceneSlicePlane ();
304+ }
0 commit comments