3 #include "testing/testing.h"
7 #include <pxr/usd/usd/stage.h>
8 #include <pxr/usd/usdGeom/capsule.h>
9 #include <pxr/usdImaging/usdImaging/capsuleAdapter.h>
30 pxr::UsdStageRefPtr
stage = pxr::UsdStage::CreateInMemory();
33 FAIL() <<
"Couldn't create in-memory stage.";
37 pxr::UsdGeomCapsule capsule = pxr::UsdGeomCapsule::Define(
stage, pxr::SdfPath(
"/Capsule"));
40 FAIL() <<
"Couldn't create UsdGeomCapsule.";
44 pxr::UsdImagingCapsuleAdapter capsule_adapter;
45 pxr::VtValue points_value = pxr::UsdImagingCapsuleAdapter::GetMeshPoints(
46 capsule.GetPrim(), pxr::UsdTimeCode::Default());
47 if (!points_value.IsHolding<pxr::VtArray<pxr::GfVec3f>>()) {
48 FAIL() <<
"Mesh points value holding unexpected type.";
52 pxr::VtArray<pxr::GfVec3f> points = points_value.Get<pxr::VtArray<pxr::GfVec3f>>();
53 EXPECT_FALSE(points.empty());
55 pxr::VtValue topology_value = pxr::UsdImagingCapsuleAdapter::GetMeshTopology();
57 if (!topology_value.IsHolding<pxr::HdMeshTopology>()) {
58 FAIL() <<
"Mesh topology value holding unexpected type.";
62 pxr::HdMeshTopology topology = topology_value.Get<pxr::HdMeshTopology>();
64 pxr::VtArray<int> vertex_counts = topology.GetFaceVertexCounts();
65 EXPECT_FALSE(vertex_counts.empty());
67 pxr::VtArray<int> vertex_indices = topology.GetFaceVertexIndices();
68 EXPECT_FALSE(vertex_indices.empty());
TEST_F(USDImagingTest, CapsuleAdapterTest)
std::string register_usd_plugins_for_tests()